From b2428767b2a1192d05dbc6ac398591f0585d35cc Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Fri, 16 Feb 2018 13:42:10 +0100 Subject: [PATCH] manpage helper tool generation fixes The generator tool is called by CMake and is incompatible with certain options. Therefore this commit * removes WinPR dependency * removes -fsanitize=* from CFLAGS --- client/X11/CMakeLists.txt | 8 +++++--- client/X11/generate_argument_docbook.c | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/client/X11/CMakeLists.txt b/client/X11/CMakeLists.txt index caeb853..2bb75d9 100644 --- a/client/X11/CMakeLists.txt +++ b/client/X11/CMakeLists.txt @@ -90,10 +90,12 @@ if(WITH_MANPAGES) configure_file(xfreerdp.1.xml.in xfreerdp.1.xml @ONLY IMMEDIATE) + # the manpage generator helper tool is called by cmake. + # this does not work if we compile with any of the sanitizer options, + # therefore remove these from the CFLAGS for this specific target. + string(REGEX REPLACE "-fsanitize=[a-z]* " "" CUSTOM_C_FLAGS ${CMAKE_C_FLAGS}) add_executable(generate_argument_docbook generate_argument_docbook.c) - - target_link_libraries(generate_argument_docbook winpr) - + set_property(TARGET generate_argument_docbook PROPERTY CMAKE_C_FLAGS ${CUSTOM_C_FLAGS}) add_custom_command(OUTPUT xfreerdp.1 COMMAND generate_argument_docbook COMMAND ${CMAKE_COMMAND} -E copy diff --git a/client/X11/generate_argument_docbook.c b/client/X11/generate_argument_docbook.c index 5430b96..0dea546 100644 --- a/client/X11/generate_argument_docbook.c +++ b/client/X11/generate_argument_docbook.c @@ -1,9 +1,9 @@ #include #include #include +#include #include "../common/cmdline.h" -#include #define TAG FREERDP_TAG("generate_argument_docbook") LPSTR tr_esc_str(LPCSTR arg, bool format) @@ -23,7 +23,7 @@ LPSTR tr_esc_str(LPCSTR arg, bool format) tmp = (LPSTR)realloc(tmp, ds * sizeof(CHAR)); if(NULL == tmp) { - WLog_ERR(TAG, "Could not allocate string buffer."); + fprintf(stderr, "Could not allocate string buffer.\n"); exit(-2); } /* Copy character for character and check, if it is necessary to escape. */ @@ -38,7 +38,7 @@ LPSTR tr_esc_str(LPCSTR arg, bool format) tmp = (LPSTR)realloc(tmp, ds * sizeof(CHAR)); if(NULL == tmp) { - WLog_ERR(TAG, "Could not reallocate string buffer."); + fprintf(stderr, "Could not reallocate string buffer.\n"); exit(-3); } if (format) @@ -53,7 +53,7 @@ LPSTR tr_esc_str(LPCSTR arg, bool format) tmp = (LPSTR)realloc(tmp, ds * sizeof(CHAR)); if(NULL == tmp) { - WLog_ERR(TAG, "Could not reallocate string buffer."); + fprintf(stderr, "Could not reallocate string buffer.\n"); exit(-4); } if (format) @@ -67,7 +67,7 @@ LPSTR tr_esc_str(LPCSTR arg, bool format) tmp = (LPSTR)realloc(tmp, ds * sizeof(CHAR)); if(NULL == tmp) { - WLog_ERR(TAG, "Could not reallocate string buffer."); + fprintf(stderr, "Could not reallocate string buffer.\n"); exit(-5); } tmp[cs++] = '&'; @@ -82,7 +82,7 @@ LPSTR tr_esc_str(LPCSTR arg, bool format) tmp = (LPSTR)realloc(tmp, ds * sizeof(CHAR)); if(NULL == tmp) { - WLog_ERR(TAG, "Could not reallocate string buffer."); + fprintf(stderr, "Could not reallocate string buffer.\n"); exit(-6); } tmp[cs++] = '&'; @@ -97,7 +97,7 @@ LPSTR tr_esc_str(LPCSTR arg, bool format) tmp = (LPSTR)realloc(tmp, ds * sizeof(CHAR)); if(NULL == tmp) { - WLog_ERR(TAG, "Could not reallocate string buffer."); + fprintf(stderr, "Could not reallocate string buffer.\n"); exit(-7); } tmp[cs++] = '&'; @@ -126,8 +126,8 @@ int main(int argc, char *argv[]) fp = fopen(fname, "w"); if(NULL == fp) { - WLog_ERR(TAG, "Could not open '%s' for writing.", fname); - return winpr_exit(-1); + fprintf(stderr, "Could not open '%s' for writing.\n", fname); + return -1; } /* The tag used as header in the manpage */ fprintf(fp, "\n"); @@ -137,7 +137,7 @@ int main(int argc, char *argv[]) * compatible XML */ if(elements < 2) { - WLog_ERR(TAG, "The argument array 'args' is empty, writing an empty file."); + fprintf(stderr, "The argument array 'args' is empty, writing an empty file.\n"); elements = 1; } for(x=0; x\n"); fprintf(fp, "\t\n"); fclose(fp); - return winpr_exit(0); + return 0; } -- 2.7.4