diff --git a/.gitignore b/.gitignore index 048417b7d..ff66464d9 100755 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,9 @@ external/* # Documentation docs/api client/X11/xfreerdp.1 +client/X11/xfreerdp.1.xml +client/X11/xfreerdp-channels.1.xml +client/X11/xfreerdp-examples.1.xml # Mac OS X .DS_Store diff --git a/client/X11/CMakeLists.txt b/client/X11/CMakeLists.txt index baecfe7a4..1ccfaea17 100644 --- a/client/X11/CMakeLists.txt +++ b/client/X11/CMakeLists.txt @@ -19,7 +19,7 @@ set(MODULE_NAME "xfreerdp-client") set(MODULE_PREFIX "FREERDP_CLIENT_X11_CONTROL") -include(FindXmlto) +include(FindDocBookXSL) include_directories(${X11_INCLUDE_DIRS}) set(${MODULE_PREFIX}_SRCS @@ -68,18 +68,43 @@ set(${MODULE_PREFIX}_LIBS ${CMAKE_DL_LIBS}) if(WITH_MANPAGES) - if(XMLTO_FOUND) + find_program( XSLTPROC_EXECUTABLE NAMES xsltproc) + + if(DOCBOOKXSL_FOUND AND XSLTPROC_EXECUTABLE) + + # We need the variable ${MAN_TODAY} to contain the current date in ISO + # format to replace it in the configure_file step. + include(today) + + TODAY(MAN_TODAY) + + configure_file(xfreerdp.1.xml.in xfreerdp.1.xml @ONLY IMMEDIATE) + + add_executable(generate_argument_docbook + generate_argument_docbook.c) + target_link_libraries(generate_argument_docbook winpr-utils freerdp-core freerdp-utils freerdp-client) + add_custom_command(OUTPUT xfreerdp.1 - COMMAND ${XMLTO_EXECUTABLE} man ${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp.1.xml - DEPENDS xfreerdp.1.xml) + COMMAND generate_argument_docbook + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-channels.1.xml ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-examples.1.xml ${CMAKE_CURRENT_BINARY_DIR} + COMMAND ${XSLTPROC_EXECUTABLE} ${DOCBOOKXSL_DIR}/manpages/docbook.xsl xfreerdp.1.xml + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/xfreerdp.1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-examples.1.xml + ${CMAKE_CURRENT_SOURCE_DIR}/xfreerdp-channels.1.xml + generate_argument_docbook) add_custom_target(xfreerdp.manpage ALL DEPENDS xfreerdp.1) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/xfreerdp.1 DESTINATION share/man/man1) - else(XMLTO_FOUND) - message(WARNING "WITH_MANPAGES was set, but xmlto was not found. man-pages will not be installed") - endif(XMLTO_FOUND) + else(DOCBOOKXSL_FOUND AND XSLTPROC_EXECUTABLE) + message(WARNING "WITH_MANPAGES was set, but xsltproc was not found. man-pages will not be installed") + endif(DOCBOOKXSL_FOUND AND XSLTPROC_EXECUTABLE) endif(WITH_MANPAGES) set(XSHM_FEATURE_TYPE "REQUIRED") diff --git a/client/X11/generate_argument_docbook.c b/client/X11/generate_argument_docbook.c new file mode 100644 index 000000000..0c1da21a8 --- /dev/null +++ b/client/X11/generate_argument_docbook.c @@ -0,0 +1,177 @@ + +#include +#include +#include + +#include + +/* We need to include the command line c file to get access to + * the argument struct. */ +#include "../common/cmdline.c" + +LPSTR tmp = NULL; + +LPCSTR tr_esc_str(LPCSTR arg) +{ + size_t cs = 0, x, ds; + size_t s; + + if( NULL == arg ) + return NULL; + + s = strlen(arg); + + /* Find trailing whitespaces */ + while( (s > 0) && isspace(arg[s-1])) + s--; + + /* Prepare a initial buffer with the size of the result string. */ + tmp = malloc(s * sizeof(LPCSTR)); + if( NULL == tmp ) + { + fprintf(stderr, "Could not allocate string buffer."); + exit(-2); + } + + /* Copy character for character and check, if it is necessary to escape. */ + ds = s + 1; + for(x=0; x': + ds += 3; + tmp = realloc(tmp, ds * sizeof(LPCSTR)); + if( NULL == tmp ) + { + fprintf(stderr, "Could not reallocate string buffer."); + exit(-4); + } + tmp[cs++] = '&'; + tmp[cs++] = 'g'; + tmp[cs++] = 't'; + tmp[cs++] = ';'; + break; + case '\'': + ds += 5; + tmp = realloc(tmp, ds * sizeof(LPCSTR)); + if( NULL == tmp ) + { + fprintf(stderr, "Could not reallocate string buffer."); + exit(-5); + } + tmp[cs++] = '&'; + tmp[cs++] = 'a'; + tmp[cs++] = 'p'; + tmp[cs++] = 'o'; + tmp[cs++] = 's'; + tmp[cs++] = ';'; + break; + case '"': + ds += 5; + tmp = realloc(tmp, ds * sizeof(LPCSTR)); + if( NULL == tmp ) + { + fprintf(stderr, "Could not reallocate string buffer."); + exit(-6); + } + tmp[cs++] = '&'; + tmp[cs++] = 'q'; + tmp[cs++] = 'u'; + tmp[cs++] = 'o'; + tmp[cs++] = 't'; + tmp[cs++] = ';'; + break; + case '&': + ds += 4; + tmp = realloc(tmp, ds * sizeof(LPCSTR)); + if( NULL == tmp ) + { + fprintf(stderr, "Could not reallocate string buffer."); + exit(-7); + } + tmp[cs++] = '&'; + tmp[cs++] = 'a'; + tmp[cs++] = 'm'; + tmp[cs++] = 'p'; + tmp[cs++] = ';'; + break; + default: + tmp[cs++] = arg[x]; + break; + } + + /* Assure, the string is '\0' terminated. */ + tmp[ds-1] = '\0'; + } + + return tmp; +} + +int main(int argc, char *argv[]) +{ + size_t elements = sizeof(args)/sizeof(args[0]); + size_t x; + const char *fname = "xfreerdp-argument.1.xml"; + FILE *fp = NULL; + + /* Open output file for writing, truncate if existing. */ + fp = fopen(fname, "w"); + if( NULL == fp ) + { + fprintf(stderr, "Could not open '%s' for writing.", fname); + return -1; + } + + /* The tag used as header in the manpage */ + fprintf(fp, "\n"); + fprintf(fp, "\tOptions\n"); + fprintf(fp, "\t\t\n"); + + /* Iterate over argument struct and write data to docbook 4.5 + * compatible XML */ + if( elements < 2 ) + { + fprintf(stderr, "The argument array 'args' is empty, writing an empty file."); + elements = 1; + } + + for(x=0; x\n"); + if( COMMAND_LINE_VALUE_REQUIRED == arg->Flags ) + fprintf(fp, "\t\t\t\t %s\n", tr_esc_str(arg->Name), tr_esc_str(arg->Format) ); + else + fprintf(fp, "\t\t\t\t\n", tr_esc_str(arg->Name) ); + fprintf(fp, "\t\t\t\t\n"); + fprintf(fp, "\t\t\t\t\t%s\n", tr_esc_str(arg->Text)); + + fprintf(fp, "\t\t\t\t\n"); + fprintf(fp, "\t\t\t\n"); + } + + fprintf(fp, "\t\t\n"); + fprintf(fp, "\t\n"); + fclose(fp); + + if(NULL != tmp) + free(tmp); + + return 0; +} + diff --git a/client/X11/xfreerdp-channels.1.xml b/client/X11/xfreerdp-channels.1.xml new file mode 100644 index 000000000..e69de29bb diff --git a/client/X11/xfreerdp-examples.1.xml b/client/X11/xfreerdp-examples.1.xml new file mode 100644 index 000000000..462649f68 --- /dev/null +++ b/client/X11/xfreerdp-examples.1.xml @@ -0,0 +1,89 @@ + + Examples + + + xfreerdp connection.rdp /p:Pwd123! /f + + Connect in fullscreen mode using a stored configuration connection.rdp and the password Pwd123! + + + + xfreerdp /u:CONTOSO\\JohnDoe /p:Pwd123! /v:rdp.contoso.com + + Connect to host rdp.contoso.com with user CONTOSO\\JohnDoe and password Pwd123! + + + + xfreerdp /u:JohnDoe /p:Pwd123! /w:1366 /h:768 /v:192.168.1.100:4489 + + Connect to host 192.168.1.100 on port 4489 with user JohnDoe, password Pwd123!. The screen width is set to 1366 and the height to 768 + + + + xfreerdp /u:JohnDoe /p:Pwd123! /vmconnect:C824F53E-95D2-46C6-9A18-23A5BB403532 /v:192.168. 1.100 + + Establish a connection to host 192.168.1.100 with user JohnDoe, password Pwd123! and connect to Hyper-V console (use port 2179, disable negotiation) with VMID C824F53E-95D2-46C6-9A18-23A5BB403532 + + + + +clipboard + + Activate clipboard redirection + + + + /drive:home,/home/user + + Activate drive redirection of /home/user as home drive + + + + /smartcard:<device> + + Activate smartcard redirection for device device + + + + /printer:<device>,<driver> + + Activate printer redirection for printer device using driver driver + + + + /serial:<device> + + Activate serial port redirection for port device + + + + /parallel:<device> + + Activate parallel port redirection for port device + + + + /sound:sys:alsa + + Activate audio output redirection using device sys:alsa + + + + /microphone:sys:alsa + + Activate audio input redirection using device sys:alsa + + + + /multimedia:sys:alsa + + Activate multimedia redirection using device sys:alsa + + + + /usb:id,dev:054c:0268 + + Activate USB device redirection for the device identified by 054c:0268 + + + + diff --git a/client/X11/xfreerdp.1.xml b/client/X11/xfreerdp.1.xml deleted file mode 100644 index bf7f774e6..000000000 --- a/client/X11/xfreerdp.1.xml +++ /dev/null @@ -1,571 +0,0 @@ - - - - 2011-08-27 - - The FreeRDP Team - - - - xfreerdp - 1 - freerdp - xfreerdp - - - xfreerdp - FreeRDP X11 client - - - - 2011-08-27 - - - xfreerdp [options] server[:port] [[options] server[:port] …] - - - - - 2011-08-27 - - DESCRIPTION - - xfreerdp is an X11 Remote Desktop Protocol (RDP) - client which is part of the FreeRDP project. An RDP server is built-in - to many editions of Windows. Alternative servers included xrdp and VRDP (VirtualBox). - - - - OPTIONS - - - -0 - - - Attach to the admin console of the server. - - - - - -a bpp - - - Sets the color depth for the connection to bpp bits per pixel. - Valid values are 8, 15, 16, 24 and 32. The default value is the color depth of the FreeRDP-window. - - - - - -c dir - - - Sets the working-dir to dir. - This parameter is only used when an AlternateShell () is requested. - dir should contain the executable file specified in the AlternateShell. - - - - - -D - - - Removes the windows decorations. - - - - - -d - - - Domain used in authentication. - - - - - -f - - - start in full screen mode. This mode can always be en- and disabled using Ctrl-Alt-Enter. - - - - - -T text - - - Sets the window title to text. - - - - - -g geometry - - - Sets the size of the FreeRDP window (and of the remote desktop, when establishing a new connection). - geometry can have one of the following forms: - - - - WxH - - in this case the resulting window will be of - WxH pixels. - - - - - P% - - in this case the resulting window will be P% - of your screen. - - - - - The special keyword workarea - - in this case the resulting window will be of the same size as your workarea. - - - - - - - - -h - - - Print help. - - - - - -k id - - - Sets the keyboard-layout-id to id. - - - - - -K - - - Do not interfere with window manager bindings. Normally, xfreerdp captures all keystrokes while its window is focused. - - - - - -n hostname - - - Set the reported client hostname to hostname. - Default is to automatically detect the hostname. - - - - - -o - - - Play audio on the console instead of redirecting to the client. - - - - - -p password - - - Password used in authentication. - - - - - -s shell - - - Sets the startup-shell to shell. - This parameter should contain a complete path to the alternate shell. - If the alternete shell requires a different working directory use . - - - - - -t port - - - Connect to port, instead of the default 3389. - - - - - -u username - - - Username used in authentication. - - - - - -x flag - - - Set the experience performance flags. - flag can be one of: - - - - m - (modem): Equivalent to 15. - - - - - b - (broadband): Equivalent to 1. - - - - - l - (lan): Equivalent to 0. - - - - - num - A hexadecimal number that - represents a bit-mask, were numbers mean the following - Taken from - MS-RDPBCGR Section 2.2.1.11.1.1.1 - Extended Info Packet: - - - 1: Disable desktop wallpaper. - - - 2: Disable full-window drag (only the window outline is displayed when the window is moved). - - - 4: Disable menu animations. - - - 8: Disable user interface themes. - - - 20: Disable mouse cursor shadows. - - - 40: Disable cursor blinking. - - - 80: Enable font smoothing. - - - 100: Enable Desktop Composition. - - - - - - - - - - -X xid - - embed xfreerdp into window with xid. - - - - -z - - - Enable compression. - - - - - --app - - - initialize a RemoteApp connection. This implies -g workarea. - - - - - --no-auth - - - Skips authentication. This is useful e.g. for the current FreeRDP server that doesn't yet support server-side authentication. - - - - - --authonly - - - Only authenticates. This is useful to test your credentials (username and password). - Returns status code 0 if the client can connect, 1 otherwise. Requires a username, - password and connection host at the command line. - - - - - --bcv3 codec - - Use codec for bitmap cache v3 - - - - - --no-bmp-cache - - - Disable bitmap cache. - - - - - --certificate-name name - - - use name for the logon certificate, instead of the server name - - - - - --composition - - - Enable composition (RDVH only, not to be confused with remote composition). - - - - - --ext extname - - - load extension extname - - - - - --no-fastpath - - - Disables fast-path. Use slow-path packets instead, which have larger headers. - It might be good for debugging certain issues when you suspect it might be - linked to the parsing of one of the two header types. - - - - - --from-stdin - - Prompts for unspecified arguments -u username, -p - password, -d domain and connection host. This is useful to - hide arguments from ps. Also useful for scripts that will - feed these arguments to the client via (what else?) stdin. - - - - - --disable-full-window-drag - - - Disable full window drag. - - - - - --gdi backend - - - GDI (Graphics Device Interface) rendering backend. backend can be either sw (software) or hw (hardware). - - - - - --ignore-certificate - - - ignore verification of logon certificate. - - - - - --kbd-list - - - list all keyboard layout ids used by -k - - - - - --disable-menu-animations - - - Disable menu animations. - - - - - --no-motion - - - Don't send mouse motion events. - - - - - --no-nego - - disable negotiation of security layer and enforce highest enabled security protocol. - - - - - --no-nla - - - Disable network level authentication. - - - - - --nsc - - - Enable NSCodec. - - - - - --no-osb - - - Disable off screen bitmaps. - - - - - --pcb blob - - - Use preconnection blob. - - - - - --pcid id - - - Use preconnection id. - - - - - --plugin pluginname - - - load pluginname - - - - - --no-rdp - - - Disable Standard RDP encryption. - - - - - --rfx - - - Enable RemoteFX. - - - - - --rfx-mode - - - RemoteFX operational flags. flags can be either v[ideo], i[mage]), default is video. - - - - - --no-salted-checksum - - - disable salted checksums with Standard RDP encryption. - - - - - --ntlm - - - force NTLM protocol version. version can be one of 1 or 2. - - - - - --sec proto - - - force protocol security. proto can be one of rdp, tls or nla. - - - - - --disable-theming - - - Disable theming. - - - - - --no-tls - - - Disable TLS encryption. - - - - - --tsg -username -password -hostname - - - Use Terminal Server Gateway with -username -password -hostname. - - - - - --version - - - Print version information. - - - - - --disable-wallpaper - - - Disable wallpaper. - - - - - - - LINKS - - http://www.freerdp.com/ - - - diff --git a/client/X11/xfreerdp.1.xml.in b/client/X11/xfreerdp.1.xml.in new file mode 100644 index 000000000..4dbb42083 --- /dev/null +++ b/client/X11/xfreerdp.1.xml.in @@ -0,0 +1,60 @@ + + + + + ] +> + + + + @MAN_TODAY@ + + The FreeRDP Team + + + + xfreerdp + 1 + freerdp + xfreerdp + + + xfreerdp + FreeRDP X11 client + + + + @MAN_TODAY@ + + + xfreerdp [file] [options] [/v:server[:port]] + + + + + @MAN_TODAY@ + + DESCRIPTION + + xfreerdp is an X11 Remote Desktop Protocol (RDP) + client which is part of the FreeRDP project. An RDP server is built-in + to many editions of Windows. Alternative servers included xrdp and VRDP (VirtualBox). + + + + &syntax; + + &channels; + + &examples; + + + LINKS + + http://www.freerdp.com/ + + + diff --git a/cmake/FindDocBookXSL.cmake b/cmake/FindDocBookXSL.cmake new file mode 100644 index 000000000..9192ef9b3 --- /dev/null +++ b/cmake/FindDocBookXSL.cmake @@ -0,0 +1,52 @@ +# Try to find DocBook XSL stylesheet +# Once done, it will define: +# +# DOCBOOKXSL_FOUND - system has the required DocBook XML DTDs +# DOCBOOKXSL_DIR - the directory containing the stylesheets +# used to process DocBook XML + +# Copyright (c) 2010, Luigi Toscano, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +set (STYLESHEET_PATH_LIST + share/xml/docbook/stylesheet/docbook-xsl + share/xml/docbook/xsl-stylesheets + share/sgml/docbook/xsl-stylesheets + share/xml/docbook/stylesheet/nwalsh/current + share/xml/docbook/stylesheet/nwalsh + share/xsl/docbook + share/xsl/docbook-xsl +) + +find_path (DOCBOOKXSL_DIR lib/lib.xsl + PATHS ${CMAKE_SYSTEM_PREFIX_PATH} + PATH_SUFFIXES ${STYLESHEET_PATH_LIST} +) + +if (NOT DOCBOOKXSL_DIR) + # hacks for systems that put the version in the stylesheet dirs + set (STYLESHEET_PATH_LIST) + foreach (STYLESHEET_PREFIX_ITER ${CMAKE_SYSTEM_PREFIX_PATH}) + file(GLOB STYLESHEET_SUFFIX_ITER RELATIVE ${STYLESHEET_PREFIX_ITER} + ${STYLESHEET_PREFIX_ITER}/share/xml/docbook/xsl-stylesheets-* + ) + if (STYLESHEET_SUFFIX_ITER) + list (APPEND STYLESHEET_PATH_LIST ${STYLESHEET_SUFFIX_ITER}) + endif () + endforeach () + + find_path (DOCBOOKXSL_DIR VERSION + PATHS ${CMAKE_SYSTEM_PREFIX_PATH} + PATH_SUFFIXES ${STYLESHEET_PATH_LIST} + ) +endif (NOT DOCBOOKXSL_DIR) + + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args (DocBookXSL + "Could NOT find DocBook XSL stylesheets" + DOCBOOKXSL_DIR) + +mark_as_advanced (DOCBOOKXSL_DIR) diff --git a/cmake/today.cmake b/cmake/today.cmake new file mode 100644 index 000000000..51d0031a8 --- /dev/null +++ b/cmake/today.cmake @@ -0,0 +1,16 @@ +# This script returns the current date in ISO format +# +# YYYY-MM-DD +# +MACRO (TODAY RESULT) + IF (WIN32) + EXECUTE_PROCESS(COMMAND "cmd" " /C date +%Y-%m-%d" OUTPUT_VARIABLE ${RESULT}) + string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}}) + ELSEIF(UNIX) + EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d" OUTPUT_VARIABLE ${RESULT}) + string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}}) + ELSE (WIN32) + MESSAGE(SEND_ERROR "date not implemented") + SET(${RESULT} 000000) + ENDIF (WIN32) +ENDMACRO (TODAY)