[manpages] switch generation to pure CMake

* Ditch docbook/xmlto, use plain manpage files
* Add CMake functions to concatenate manpate sections
* Modify generate_argument_manpage helper tool to generate manpage
This commit is contained in:
Armin Novak 2024-10-09 17:08:00 +02:00 committed by akallabeth
parent 8fcc59ed27
commit c3a5387187
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
28 changed files with 791 additions and 766 deletions

View File

@ -1,9 +1,16 @@
set(DEPS
../../common/man/sdl-freerdp-channels.1.xml
../../common/man/sdl-freerdp-config.1.xml
../../common/man/sdl-freerdp-examples.1.xml
../../common/man/sdl-freerdp-envvar.1.xml
../../../common/man/freerdp-global-config.1.xml
../../../common/man/freerdp-global-options.1
../../common/man/sdl-freerdp-config.1
../../../common/man/freerdp-global-envvar.1
../../../common/man/freerdp-global-config.1
../../common/man/sdl-freerdp-examples.1
../../../common/man/freerdp-global-links.1
)
generate_and_install_freerdp_man_from_xml(${MODULE_NAME} "1" "${DEPS}")
set(VAR_NAMES
"VENDOR"
"PRODUCT"
"VENDOR_PRODUCT"
"CMAKE_INSTALL_FULL_SYSCONFDIR"
)
generate_and_install_freerdp_man_from_xml(${MODULE_NAME} "1" "${DEPS}" "${VAR_NAMES}")

View File

@ -0,0 +1,15 @@
.TH "@MANPAGE_NAME@" "1" "@MAN_TODAY@" "freerdp" "@MANPAGE_NAME@"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.nh
.ad l
.SH "NAME"
@MANPAGE_NAME@ \- FreeRDP SDL client
.SH "SYNOPSIS"
.PP
\fB@MANPAGE_NAME@\fR
[file] [options] [/v:server[:port]]
.SH "DESCRIPTION"
.PP
\fB@MANPAGE_NAME@\fR
is an SDL 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 ogon, gnome\-remote\-desktop, xrdp and VRDP (VirtualBox)\&.

View File

@ -1,67 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE refentry
PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY syntax SYSTEM "freerdp-argument.1.xml">
<!ENTITY config SYSTEM "sdl-freerdp-config.1.xml">
<!ENTITY envvar SYSTEM "sdl-freerdp-envvar.1.xml">
<!ENTITY configuration SYSTEM "freerdp-global-config.1.xml">
<!ENTITY examples SYSTEM "sdl-freerdp-examples.1.xml">
]
>
<refentry>
<refentryinfo>
<date>@MAN_TODAY@</date>
<author>
<authorblurb><para>The FreeRDP Team</para></authorblurb>
</author>
</refentryinfo>
<refmeta>
<refentrytitle>@MANPAGE_NAME@</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="source">freerdp</refmiscinfo>
<refmiscinfo class="manual">@MANPAGE_NAME@</refmiscinfo>
</refmeta>
<refnamediv>
<refname><application>@MANPAGE_NAME@</application></refname>
<refpurpose>FreeRDP SDL client</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>@MAN_TODAY@</date>
</refsynopsisdivinfo>
<para>
<command>@MANPAGE_NAME@</command> [file] [options] [/v:server[:port]]
</para>
</refsynopsisdiv>
<refsect1>
<refsect1info>
<date>@MAN_TODAY@</date>
</refsect1info>
<title>DESCRIPTION</title>
<para>
<command>@MANPAGE_NAME@</command> is an SDL 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 ogon, gnome-remote-desktop,
xrdp and VRDP (VirtualBox).
</para>
</refsect1>
&syntax;
&config;
&envvar;
&configuration;
&examples;
<refsect1>
<title>LINKS</title>
<para>
<ulink url="http://www.freerdp.com/">http://www.freerdp.com/</ulink>
</para>
</refsect1>
</refentry>

View File

@ -1,9 +1,16 @@
set(DEPS
../../common/man/sdl-freerdp-channels.1.xml
../../common/man/sdl-freerdp-config.1.xml
../../common/man/sdl-freerdp-examples.1.xml
../../common/man/sdl-freerdp-envvar.1.xml
../../../common/man/freerdp-global-config.1.xml
../../../common/man/freerdp-global-options.1
../../common/man/sdl-freerdp-config.1
../../../common/man/freerdp-global-envvar.1
../../../common/man/freerdp-global-config.1
../../common/man/sdl-freerdp-examples.1
../../../common/man/freerdp-global-links.1
)
generate_and_install_freerdp_man_from_xml(${MODULE_NAME} "1" "${DEPS}")
set(VAR_NAMES
"VENDOR"
"PRODUCT"
"VENDOR_PRODUCT"
"CMAKE_INSTALL_FULL_SYSCONFDIR"
)
generate_and_install_freerdp_man_from_xml(${MODULE_NAME} "1" "${DEPS}" "${VAR_NAMES}")

View File

@ -0,0 +1,15 @@
.TH "@MANPAGE_NAME@" "1" "@MAN_TODAY@" "freerdp" "@MANPAGE_NAME@"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.nh
.ad l
.SH "NAME"
@MANPAGE_NAME@ \- FreeRDP SDL client
.SH "SYNOPSIS"
.PP
\fB@MANPAGE_NAME@\fR
[file] [options] [/v:server[:port]]
.SH "DESCRIPTION"
.PP
\fB@MANPAGE_NAME@\fR
is an SDL 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 ogon, gnome\-remote\-desktop, xrdp and VRDP (VirtualBox)\&.

View File

@ -1,67 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE refentry
PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY syntax SYSTEM "freerdp-argument.1.xml">
<!ENTITY config SYSTEM "sdl-freerdp-config.1.xml">
<!ENTITY envvar SYSTEM "sdl-freerdp-envvar.1.xml">
<!ENTITY configuration SYSTEM "freerdp-global-config.1.xml">
<!ENTITY examples SYSTEM "sdl-freerdp-examples.1.xml">
]
>
<refentry>
<refentryinfo>
<date>@MAN_TODAY@</date>
<author>
<authorblurb><para>The FreeRDP Team</para></authorblurb>
</author>
</refentryinfo>
<refmeta>
<refentrytitle>@MANPAGE_NAME@</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="source">freerdp</refmiscinfo>
<refmiscinfo class="manual">@MANPAGE_NAME@</refmiscinfo>
</refmeta>
<refnamediv>
<refname><application>@MANPAGE_NAME@</application></refname>
<refpurpose>FreeRDP SDL client</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>@MAN_TODAY@</date>
</refsynopsisdivinfo>
<para>
<command>@MANPAGE_NAME@</command> [file] [options] [/v:server[:port]]
</para>
</refsynopsisdiv>
<refsect1>
<refsect1info>
<date>@MAN_TODAY@</date>
</refsect1info>
<title>DESCRIPTION</title>
<para>
<command>@MANPAGE_NAME@</command> is an SDL 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 ogon, gnome-remote-desktop,
xrdp and VRDP (VirtualBox).
</para>
</refsect1>
&syntax;
&config;
&envvar;
&configuration;
&examples;
<refsect1>
<title>LINKS</title>
<para>
<ulink url="http://www.freerdp.com/">http://www.freerdp.com/</ulink>
</para>
</refsect1>
</refentry>

View File

@ -0,0 +1,124 @@
.SH "CONFIGURATION FILE"
.PP
Format and Location:
.RS 4
The configuration file is stored per user\&.
.br
The
\fIXDG_CONFIG_HOME\fR
environment variable can be used to override the base directory\&.
.br
This defaults to
\fI~/\&.config\fR
The location relative to
\fIXDG_CONFIG_HOME\fR
is
\fI$XDG_CONFIG_HOME/@VENDOR_PRODUCT@/sdl\-freerdp\&.json\fR
.br
The configuration is stored in JSON format
.RE
.PP
Supported options:
.RS 4
.PP
\fISDL_KeyModMask\fR
.RS 4
.PP
.RS 4
Defines the key combination required for SDL client shortcuts\&.
.br
Default
\fIKMOD_RSHIFT\fR
.br
An array of
\fISDL_Keymod\fR
strings as defined at
\fI@SDL_WIKI_BASE_URL@/SDL_Keymod\fR
.RE
.RE
.PP
\fISDL_Fullscreen\fR
.RS 4
.PP
.RS 4
Toggles client fullscreen state\&.
.br
Default
\fISDL_SCANCODE_RETURN\fR\&.
.br
A string as defined at
\fI@SDL_WIKI_BASE_URL@/SDLScancodeLookup\fR
.RE
.RE
.PP
\fISDL_Minimize\fR
.RS 4
.PP
.RS 4
Minimizes the client window
.br
Default
\fISDL_SCANCODE_M\fR\&.
.br
A string as defined at
\fI@SDL_WIKI_BASE_URL@/SDLScancodeLookup\fR
.RE
.RE
.PP
\fISDL_Resizeable\fR
.RS 4
.PP
.RS 4
Toggles local window resizeable state\&.
.br
Default
\fISDL_SCANCODE_R\fR\&.
.br
A string as defined at
\fI@SDL_WIKI_BASE_URL@/SDLScancodeLookup\fR
.RE
.RE
.PP
\fISDL_Grab\fR
.RS 4
.PP
.RS 4
Toggles keyboard and mouse grab state\&.
.br
Default
\fISDL_SCANCODE_G\fR\&.
.br
A string as defined at
\fI@SDL_WIKI_BASE_URL@/SDLScancodeLookup\fR
.RE
.RE
.PP
\fISDL_Disconnect\fR
.RS 4
.PP
.RS 4
Disconnects from the RDP session\&.
.br
Default
\fISDL_SCANCODE_D\fR\&.
.br
A string as defined at
\fI@SDL_WIKI_BASE_URL@/SDLScancodeLookup\fR
.RE
.RE
.RE

View File

@ -1,93 +0,0 @@
<refsect1>
<title>Configuration file</title>
<variablelist>
<varlistentry>
<term>Format and Location:</term>
<listitem>
<para>The configuration file is stored per user.<sbr/>
The <replaceable>XDG_CONFIG_HOME</replaceable> environment variable can be used to override the base directory.<sbr/>
This defaults to <replaceable>~/.config</replaceable>
The location relative to <replaceable>XDG_CONFIG_HOME</replaceable> is <replaceable>$XDG_CONFIG_HOME/@VENDOR_PRODUCT@/sdl-freerdp.json</replaceable><sbr/>
The configuration is stored in JSON format</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Supported options:</term>
<listitem>
<varlistentry>
<term><replaceable>SDL_KeyModMask</replaceable></term>
<listitem>
<varlistentry>
<listitem>
<para>Defines the key combination required for SDL client shortcuts.<sbr/>
Default <replaceable>KMOD_RSHIFT</replaceable><sbr/>
An array of <replaceable>SDL_Keymod</replaceable> strings as defined at <replaceable>https://wiki.libsdl.org/SDL2/SDL_Keymod</replaceable></para>
</listitem>
</varlistentry>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>SDL_Fullscreen</replaceable></term>
<listitem>
<varlistentry>
<listitem>
<para>Toggles client fullscreen state.<sbr/>
Default <replaceable>SDL_SCANCODE_RETURN</replaceable>.<sbr/>
A string as defined at <replaceable>https://wiki.libsdl.org/SDL2/SDLScancodeLookup</replaceable></para>
</listitem>
</varlistentry>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>SDL_Minimize</replaceable></term>
<listitem>
<varlistentry>
<listitem>
<para>Minimizes the client window<sbr/>
Default <replaceable>SDL_SCANCODE_M</replaceable>.<sbr/>
A string as defined at <replaceable>https://wiki.libsdl.org/SDL2/SDLScancodeLookup</replaceable></para>
</listitem>
</varlistentry>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>SDL_Resizeable</replaceable></term>
<listitem>
<varlistentry>
<listitem>
<para>Toggles local window resizeable state.<sbr/>
Default <replaceable>SDL_SCANCODE_R</replaceable>.<sbr/>
A string as defined at <replaceable>https://wiki.libsdl.org/SDL2/SDLScancodeLookup</replaceable></para>
</listitem>
</varlistentry>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>SDL_Grab</replaceable></term>
<listitem>
<varlistentry>
<listitem>
<para>Toggles keyboard and mouse grab state.<sbr/>
Default <replaceable>SDL_SCANCODE_G</replaceable>.<sbr/>
A string as defined at <replaceable>https://wiki.libsdl.org/SDL2/SDLScancodeLookup</replaceable></para>
</listitem>
</varlistentry>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>SDL_Disconnect</replaceable></term>
<listitem>
<varlistentry>
<listitem>
<para>Disconnects from the RDP session.<sbr/>
Default <replaceable>SDL_SCANCODE_D</replaceable>.<sbr/>
A string as defined at <replaceable>https://wiki.libsdl.org/SDL2/SDLScancodeLookup</replaceable></para>
</listitem>
</varlistentry>
</listitem>
</varlistentry>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -1,15 +0,0 @@
<refsect1>
<title>Environment variables</title>
<variablelist>
<varlistentry>
<term>wlog environment variable</term>
<listitem>
<para>sdl-freerdp uses wLog as its log facility, you can refer to the
corresponding man page (wlog(7)) for more informations. Arguments passed
via the <replaceable>/log-level</replaceable> or <replaceable>/log-filters</replaceable>
have precedence over the environment variables.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -0,0 +1,116 @@
.SH "EXAMPLES"
.PP
\fB@MANPAGE_NAME@ connection\&.rdp /p:Pwd123! /f\fR
.RS 4
Connect in fullscreen mode using a stored configuration
\fIconnection\&.rdp\fR
and the password
\fIPwd123!\fR
.RE
.PP
\fB@MANPAGE_NAME@ /u:USER /size:50%h /v:rdp\&.contoso\&.com\fR
.RS 4
Connect to host
\fIrdp\&.contoso\&.com\fR
with user
\fIUSER\fR
and a size of
\fI50 percent of the height\fR\&. If width (w) is set instead of height (h) like /size:50%w\&. 50 percent of the width is used\&.
.RE
.PP
\fB@MANPAGE_NAME@ /u:CONTOSO\e\eJohnDoe /p:Pwd123! /v:rdp\&.contoso\&.com\fR
.RS 4
Connect to host
\fIrdp\&.contoso\&.com\fR
with user
\fICONTOSO\e\eJohnDoe\fR
and password
\fIPwd123!\fR
.RE
.PP
\fB@MANPAGE_NAME@ /u:JohnDoe /p:Pwd123! /w:1366 /h:768 /v:192\&.168\&.1\&.100:4489\fR
.RS 4
Connect to host
\fI192\&.168\&.1\&.100\fR
on port
\fI4489\fR
with user
\fIJohnDoe\fR, password
\fIPwd123!\fR\&. The screen width is set to
\fI1366\fR
and the height to
\fI768\fR
.RE
.PP
\fB@MANPAGE_NAME@ /u:JohnDoe /p:Pwd123! /vmconnect:C824F53E\-95D2\-46C6\-9A18\-23A5BB403532 /v:192\&.168\&.1\&.100\fR
.RS 4
Establish a connection to host
\fI192\&.168\&.1\&.100\fR
with user
\fIJohnDoe\fR, password
\fIPwd123!\fR
and connect to Hyper\-V console (use port 2179, disable negotiation) with VMID
\fIC824F53E\-95D2\-46C6\-9A18\-23A5BB403532\fR
.RE
.PP
\fB+clipboard\fR
.RS 4
Activate clipboard redirection
.RE
.PP
\fB/drive:home,/home/user\fR
.RS 4
Activate drive redirection of
\fI/home/user\fR
as home drive
.RE
.PP
\fB/smartcard:<device>\fR
.RS 4
Activate smartcard redirection for device
\fIdevice\fR
.RE
.PP
\fB/printer:<device>,<driver>\fR
.RS 4
Activate printer redirection for printer
\fIdevice\fR
using driver
\fIdriver\fR
.RE
.PP
\fB/serial:<device>\fR
.RS 4
Activate serial port redirection for port
\fIdevice\fR
.RE
.PP
\fB/parallel:<device>\fR
.RS 4
Activate parallel port redirection for port
\fIdevice\fR
.RE
.PP
\fB/sound:sys:alsa\fR
.RS 4
Activate audio output redirection using device
\fIsys:alsa\fR
.RE
.PP
\fB/microphone:sys:alsa\fR
.RS 4
Activate audio input redirection using device
\fIsys:alsa\fR
.RE
.PP
\fB/multimedia:sys:alsa\fR
.RS 4
Activate multimedia redirection using device
\fIsys:alsa\fR
.RE
.PP
\fB/usb:id,dev:054c:0268\fR
.RS 4
Activate USB device redirection for the device identified by
\fI054c:0268\fR
.RE

View File

@ -1,95 +0,0 @@
<refsect1>
<title>Examples</title>
<variablelist>
<varlistentry>
<term><command>sdl-freerdp connection.rdp /p:Pwd123! /f</command></term>
<listitem>
<para>Connect in fullscreen mode using a stored configuration <replaceable>connection.rdp</replaceable> and the password <replaceable>Pwd123!</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>sdl-freerdp /u:USER /size:50%h /v:rdp.contoso.com</command></term>
<listitem>
<para>Connect to host <replaceable>rdp.contoso.com</replaceable> with user <replaceable>USER</replaceable> and a size of <replaceable>50 percent of the height</replaceable>. If width (w) is set instead of height (h) like /size:50%w. 50 percent of the width is used.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>sdl-freerdp /u:CONTOSO\\JohnDoe /p:Pwd123! /v:rdp.contoso.com</command></term>
<listitem>
<para>Connect to host <replaceable>rdp.contoso.com</replaceable> with user <replaceable>CONTOSO\\JohnDoe</replaceable> and password <replaceable>Pwd123!</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>sdl-freerdp /u:JohnDoe /p:Pwd123! /w:1366 /h:768 /v:192.168.1.100:4489</command></term>
<listitem>
<para>Connect to host <replaceable>192.168.1.100</replaceable> on port <replaceable>4489</replaceable> with user <replaceable>JohnDoe</replaceable>, password <replaceable>Pwd123!</replaceable>. The screen width is set to <replaceable>1366</replaceable> and the height to <replaceable>768</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>sdl-freerdp /u:JohnDoe /p:Pwd123! /vmconnect:C824F53E-95D2-46C6-9A18-23A5BB403532 /v:192.168.1.100</command></term>
<listitem>
<para>Establish a connection to host <replaceable>192.168.1.100</replaceable> with user <replaceable>JohnDoe</replaceable>, password <replaceable>Pwd123!</replaceable> and connect to Hyper-V console (use port 2179, disable negotiation) with VMID <replaceable>C824F53E-95D2-46C6-9A18-23A5BB403532</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>+clipboard</command></term>
<listitem>
<para>Activate clipboard redirection</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/drive:home,/home/user</command></term>
<listitem>
<para>Activate drive redirection of <replaceable>/home/user</replaceable> as home drive</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/smartcard:&lt;device&gt;</command></term>
<listitem>
<para>Activate smartcard redirection for device <replaceable>device</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/printer:&lt;device&gt;,&lt;driver&gt;</command></term>
<listitem>
<para>Activate printer redirection for printer <replaceable>device</replaceable> using driver <replaceable>driver</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/serial:&lt;device&gt;</command></term>
<listitem>
<para>Activate serial port redirection for port <replaceable>device</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/parallel:&lt;device&gt;</command></term>
<listitem>
<para>Activate parallel port redirection for port <replaceable>device</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/sound:sys:alsa</command></term>
<listitem>
<para>Activate audio output redirection using device <replaceable>sys:alsa</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/microphone:sys:alsa</command></term>
<listitem>
<para>Activate audio input redirection using device <replaceable>sys:alsa</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/multimedia:sys:alsa</command></term>
<listitem>
<para>Activate multimedia redirection using device <replaceable>sys:alsa</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/usb:id,dev:054c:0268</command></term>
<listitem>
<para>Activate USB device redirection for the device identified by <replaceable>054c:0268</replaceable></para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -1,9 +1,18 @@
set(DEPS
xfreerdp-channels.1.xml
xfreerdp-examples.1.xml
xfreerdp-shortcuts.1.xml
xfreerdp-envvar.1.xml
../../common/man/freerdp-global-config.1.xml
../../common/man/freerdp-global-options.1
xfreerdp-shortcuts.1
../../common/man/freerdp-global-envvar.1
../../common/man/freerdp-global-config.1
xfreerdp-examples.1
../../common/man/freerdp-global-links.1
)
generate_and_install_freerdp_man_from_xml(${MODULE_NAME} "1" "${DEPS}")
set(SDL_WIKI_BASE_URL "https://wiki.libsdl.org/SDL2")
set(VAR_NAMES
"VENDOR"
"PRODUCT"
"VENDOR_PRODUCT"
"CMAKE_INSTALL_FULL_SYSCONFDIR"
"SDL_WIKI_BASE_URL"
)
generate_and_install_freerdp_man_from_xml(${MODULE_NAME} "1" "${DEPS}" "${VAR_NAMES}")

View File

@ -1,15 +0,0 @@
<refsect1>
<title>Environment variables</title>
<variablelist>
<varlistentry>
<term>wlog environment variable</term>
<listitem>
<para>xfreerdp uses wLog as its log facility, you can refer to the
corresponding man page (wlog(7)) for more informations. Arguments passed
via the <replaceable>/log-level</replaceable> or <replaceable>/log-filters</replaceable>
have precedence over the environment variables.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -0,0 +1,172 @@
.SH "EXAMPLES"
.PP
.RS 4
.sp
.if n \{\
.RS 4
.\}
.nf
#!/bin/bash
# we got a key combination
if [ "$1" = "key" ];
then
# we only got one argument \*(Aqkey\*(Aq
# list all supported combinations with echo
if [ $# \-eq 1 ];
then
echo "ctrl+alt+f1"
echo "ctrl+alt+f2"
else
# We want the action for a single combination
# use \*(Aqkey\-local\*(Aq to not forward to RDP session
if [ "$2" = "ctrl+alt+f1" ];
then
echo "key\-local"
fi
if [ "$2" = "ctrl+alt+f2" ];
then
echo "/usr/local/bin/somescript\&.sh"
fi
fi
fi
if [ "$1" = "xevent" ];
then
if [ $# \-eq 1 ];
then
echo "FocusIn"
echo "SelectionClear"
else
if [ "$2" = "SelectionNotify" ];
then
echo "/usr/local/bin/someprogram"
fi
fi
fi
.fi
.if n \{\
.RE
.\}
Example action script for key events, listing
\fIctrl+alt+f1\fR
to be handled by local window manager and
\fIctrl+alt+f2\fR
executing a script
.sp
The return value of the program determines if the key is handled locally or remotely (0 for local, > 0 for remote, < 0 for errors)
.RE
.PP
\fB@MANPAGE_NAME@ connection\&.rdp /p:Pwd123! /f\fR
.RS 4
Connect in fullscreen mode using a stored configuration
\fIconnection\&.rdp\fR
and the password
\fIPwd123!\fR
.RE
.PP
\fB@MANPAGE_NAME@ /u:USER /size:50%h /v:rdp\&.contoso\&.com\fR
.RS 4
Connect to host
\fIrdp\&.contoso\&.com\fR
with user
\fIUSER\fR
and a size of
\fI50 percent of the height\fR\&. If width (w) is set instead of height (h) like /size:50%w\&. 50 percent of the width is used\&.
.RE
.PP
\fB@MANPAGE_NAME@ /u:CONTOSO\e\eJohnDoe /p:Pwd123! /v:rdp\&.contoso\&.com\fR
.RS 4
Connect to host
\fIrdp\&.contoso\&.com\fR
with user
\fICONTOSO\e\eJohnDoe\fR
and password
\fIPwd123!\fR
.RE
.PP
\fB@MANPAGE_NAME@ /u:JohnDoe /p:Pwd123! /w:1366 /h:768 /v:192\&.168\&.1\&.100:4489\fR
.RS 4
Connect to host
\fI192\&.168\&.1\&.100\fR
on port
\fI4489\fR
with user
\fIJohnDoe\fR, password
\fIPwd123!\fR\&. The screen width is set to
\fI1366\fR
and the height to
\fI768\fR
.RE
.PP
\fB@MANPAGE_NAME@ /u:JohnDoe /p:Pwd123! /vmconnect:C824F53E\-95D2\-46C6\-9A18\-23A5BB403532 /v:192\&.168\&.1\&.100\fR
.RS 4
Establish a connection to host
\fI192\&.168\&.1\&.100\fR
with user
\fIJohnDoe\fR, password
\fIPwd123!\fR
and connect to Hyper\-V console (use port 2179, disable negotiation) with VMID
\fIC824F53E\-95D2\-46C6\-9A18\-23A5BB403532\fR
.RE
.PP
\fB+clipboard\fR
.RS 4
Activate clipboard redirection
.RE
.PP
\fB/drive:home,/home/user\fR
.RS 4
Activate drive redirection of
\fI/home/user\fR
as home drive
.RE
.PP
\fB/smartcard:<device>\fR
.RS 4
Activate smartcard redirection for device
\fIdevice\fR
.RE
.PP
\fB/printer:<device>,<driver>\fR
.RS 4
Activate printer redirection for printer
\fIdevice\fR
using driver
\fIdriver\fR
.RE
.PP
\fB/serial:<device>\fR
.RS 4
Activate serial port redirection for port
\fIdevice\fR
.RE
.PP
\fB/parallel:<device>\fR
.RS 4
Activate parallel port redirection for port
\fIdevice\fR
.RE
.PP
\fB/sound:sys:alsa\fR
.RS 4
Activate audio output redirection using device
\fIsys:alsa\fR
.RE
.PP
\fB/microphone:sys:alsa\fR
.RS 4
Activate audio input redirection using device
\fIsys:alsa\fR
.RE
.PP
\fB/multimedia:sys:alsa\fR
.RS 4
Activate multimedia redirection using device
\fIsys:alsa\fR
.RE
.PP
\fB/usb:id,dev:054c:0268\fR
.RS 4
Activate USB device redirection for the device identified by
\fI054c:0268\fR
.RE

View File

@ -1,141 +0,0 @@
<refsect1>
<title>Examples</title>
<variablelist>
<varlistentry>
<programlisting><![CDATA[
#!/bin/bash
# we got a key combination
if [ "$1" = "key" ];
then
# we only got one argument 'key'
# list all supported combinations with echo
if [ $# -eq 1 ];
then
echo "ctrl+alt+f1"
echo "ctrl+alt+f2"
else
# We want the action for a single combination
# use 'key-local' to not forward to RDP session
if [ "$2" = "ctrl+alt+f1" ];
then
echo "key-local"
fi
if [ "$2" = "ctrl+alt+f2" ];
then
echo "/usr/local/bin/somescript.sh"
fi
fi
fi
if [ "$1" = "xevent" ];
then
if [ $# -eq 1 ];
then
echo "FocusIn"
echo "SelectionClear"
else
if [ "$2" = "SelectionNotify" ];
then
echo "/usr/local/bin/someprogram"
fi
fi
fi
]]></programlisting>
<listitem>
<para>Example action script for key events, listing <replaceable>ctrl+alt+f1</replaceable> to be handled by local window manager and <replaceable>ctrl+alt+f2</replaceable> executing a script</para>
<para>The return value of the program determines if the key is handled locally or remotely (0 for local, &gt; 0 for remote, &lt; 0 for errors)</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>xfreerdp connection.rdp /p:Pwd123! /f</command></term>
<listitem>
<para>Connect in fullscreen mode using a stored configuration <replaceable>connection.rdp</replaceable> and the password <replaceable>Pwd123!</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>xfreerdp /u:USER /size:50%h /v:rdp.contoso.com</command></term>
<listitem>
<para>Connect to host <replaceable>rdp.contoso.com</replaceable> with user <replaceable>USER</replaceable> and a size of <replaceable>50 percent of the height</replaceable>. If width (w) is set instead of height (h) like /size:50%w. 50 percent of the width is used.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>xfreerdp /u:CONTOSO\\JohnDoe /p:Pwd123! /v:rdp.contoso.com</command></term>
<listitem>
<para>Connect to host <replaceable>rdp.contoso.com</replaceable> with user <replaceable>CONTOSO\\JohnDoe</replaceable> and password <replaceable>Pwd123!</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>xfreerdp /u:JohnDoe /p:Pwd123! /w:1366 /h:768 /v:192.168.1.100:4489</command></term>
<listitem>
<para>Connect to host <replaceable>192.168.1.100</replaceable> on port <replaceable>4489</replaceable> with user <replaceable>JohnDoe</replaceable>, password <replaceable>Pwd123!</replaceable>. The screen width is set to <replaceable>1366</replaceable> and the height to <replaceable>768</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>xfreerdp /u:JohnDoe /p:Pwd123! /vmconnect:C824F53E-95D2-46C6-9A18-23A5BB403532 /v:192.168.1.100</command></term>
<listitem>
<para>Establish a connection to host <replaceable>192.168.1.100</replaceable> with user <replaceable>JohnDoe</replaceable>, password <replaceable>Pwd123!</replaceable> and connect to Hyper-V console (use port 2179, disable negotiation) with VMID <replaceable>C824F53E-95D2-46C6-9A18-23A5BB403532</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>+clipboard</command></term>
<listitem>
<para>Activate clipboard redirection</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/drive:home,/home/user</command></term>
<listitem>
<para>Activate drive redirection of <replaceable>/home/user</replaceable> as home drive</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/smartcard:&lt;device&gt;</command></term>
<listitem>
<para>Activate smartcard redirection for device <replaceable>device</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/printer:&lt;device&gt;,&lt;driver&gt;</command></term>
<listitem>
<para>Activate printer redirection for printer <replaceable>device</replaceable> using driver <replaceable>driver</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/serial:&lt;device&gt;</command></term>
<listitem>
<para>Activate serial port redirection for port <replaceable>device</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/parallel:&lt;device&gt;</command></term>
<listitem>
<para>Activate parallel port redirection for port <replaceable>device</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/sound:sys:alsa</command></term>
<listitem>
<para>Activate audio output redirection using device <replaceable>sys:alsa</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/microphone:sys:alsa</command></term>
<listitem>
<para>Activate audio input redirection using device <replaceable>sys:alsa</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/multimedia:sys:alsa</command></term>
<listitem>
<para>Activate multimedia redirection using device <replaceable>sys:alsa</replaceable></para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>/usb:id,dev:054c:0268</command></term>
<listitem>
<para>Activate USB device redirection for the device identified by <replaceable>054c:0268</replaceable></para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -0,0 +1,35 @@
.SH "KEYBOARD SHORTCUTS"
.PP
<Right CTRL>
.RS 4
releases keyboard and mouse grab
.RE
.PP
<CTRL>+<ALT>+<Return>
.RS 4
toggles fullscreen state of the application
.RE
.PP
<CTRL>+<ALT>+<m>
.RS 4
Minimizes the application
.RE
.PP
<CTRL>+<ALT>+c
.RS 4
toggles remote control in a remote assistance session
.RE
.PP
Action Script
.RS 4
executes a predefined script on key press\&.
Should the script not exist it is ignored\&.
Scripts can be provided at the default location
\fI$XDG_CONFIG_HOME/freerdp/action\&.sh\fR
or as command line argument
\fI/action:script:<path>\fR\&.
The script will receive the current key combination as argument\&.
The output of the script is parsed for
\fIkey\-local\fR
which tells that the script used the key combination, otherwise the combination is forwarded to the remote\&.
.RE

View File

@ -1,29 +0,0 @@
<refsect1>
<title>Keyboard Shortcuts</title>
<variablelist>
<varlistentry>
<term>&lt;Right CTRL&gt;</term>
<listitem><para>releases keyboard and mouse grab</para></listitem>
</varlistentry>
<varlistentry>
<term>&lt;CTRL&gt;+&lt;ALT&gt;+&lt;Return&gt;</term>
<listitem><para>toggles fullscreen state of the application</para></listitem>
</varlistentry>
<varlistentry>
<term>&lt;CTRL&gt;+&lt;ALT&gt;+&lt;m&gt;</term>
<listitem><para>Minimizes the application</para></listitem>
</varlistentry>
<varlistentry>
<term>&lt;CTRL&gt;+&lt;ALT&gt;+c</term>
<listitem><para>toggles remote control in a remote assistance session</para></listitem>
</varlistentry>
<varlistentry>
<term>Action Script</term>
<listitem><para>executes a predefined script on key press.</para></listitem>
<listitem><para>Should the script not exist it is ignored.</para></listitem>
<listitem><para>Scripts can be provided at the default location <replaceable>$XDG_CONFIG_HOME/@VENDOR_PRODUCT@/action.sh</replaceable> or as command line argument <replaceable>/action:script:&lt;path&gt;</replaceable>.</para></listitem>
<listitem><para>The script will receive the current key combination as argument.</para></listitem>
<listitem><para>The output of the script is parsed for <replaceable>key-local</replaceable> which tells that the script used the key combination, otherwise the combination is forwarded to the remote.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -0,0 +1,15 @@
.TH "@MANPAGE_NAME@" "1" "@MAN_TODAY@" "freerdp" "@MANPAGE_NAME@"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.nh
.ad l
.SH "NAME"
@MANPAGE_NAME@ \- FreeRDP X11 client
.SH "SYNOPSIS"
.PP
\fB@MANPAGE_NAME@\fR
[file] [options] [/v:server[:port]]
.SH "DESCRIPTION"
.PP
\fB@MANPAGE_NAME@\fR
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 ogon, gnome\-remote\-desktop, xrdp and VRDP (VirtualBox)\&.

View File

@ -1,70 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE refentry
PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY syntax SYSTEM "freerdp-argument.1.xml">
<!ENTITY shortcuts SYSTEM "xfreerdp-shortcuts.1.xml">
<!ENTITY channels SYSTEM "xfreerdp-channels.1.xml">
<!ENTITY envvar SYSTEM "xfreerdp-envvar.1.xml">
<!ENTITY configuration SYSTEM "freerdp-global-config.1.xml">
<!ENTITY examples SYSTEM "xfreerdp-examples.1.xml">
]
>
<refentry>
<refentryinfo>
<date>@MAN_TODAY@</date>
<author>
<authorblurb><para>The FreeRDP Team</para></authorblurb>
</author>
</refentryinfo>
<refmeta>
<refentrytitle>@MANPAGE_NAME@</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="source">freerdp</refmiscinfo>
<refmiscinfo class="manual">@MANPAGE_NAME@</refmiscinfo>
</refmeta>
<refnamediv>
<refname><application>@MANPAGE_NAME@</application></refname>
<refpurpose>FreeRDP X11 client</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>@MAN_TODAY@</date>
</refsynopsisdivinfo>
<para>
<command>@MANPAGE_NAME@</command> [file] [options] [/v:server[:port]]
</para>
</refsynopsisdiv>
<refsect1>
<refsect1info>
<date>@MAN_TODAY@</date>
</refsect1info>
<title>DESCRIPTION</title>
<para>
<command>@MANPAGE_NAME@</command> 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 ogon, gnome-remote-desktop,
xrdp and VRDP (VirtualBox).
</para>
</refsect1>
&syntax;
&shortcuts;
&channels;
&envvar;
&configuration;
&examples;
<refsect1>
<title>LINKS</title>
<para>
<ulink url="http://www.freerdp.com/">http://www.freerdp.com/</ulink>
</para>
</refsect1>
</refentry>

View File

@ -1,9 +1,30 @@
if(CMAKE_CROSSCOMPILING)
find_package(GenerateArgumentDocbook)
find_package(GenerateArgumentManpage)
else()
add_executable(generate_argument_docbook
generate_argument_docbook.c
include_directories(${CMAKE_BINARY_DIR}/include/)
add_executable(generate_argument_manpage
generate_argument_manpage.c
../cmdline.h
)
export(TARGETS generate_argument_docbook FILE
"${CMAKE_BINARY_DIR}/GenerateArgumentDocbookConfig.cmake")
export(TARGETS generate_argument_manpage FILE
"${CMAKE_BINARY_DIR}/GenerateArgumentManpageConfig.cmake")
endif()
set(MAN_OPTIONS_FILE "${CMAKE_CURRENT_BINARY_DIR}/freerdp-global-options.1")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${MAN_OPTIONS_FILE})
add_custom_command(
OUTPUT ${MAN_OPTIONS_FILE}
COMMAND ${CMAKE_BINARY_DIR}/client/common/man/generate_argument_manpage "${MAN_OPTIONS_FILE}"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS
generate_argument_manpage
)
add_custom_target(generate_argument_manpage.target
DEPENDS
${MAN_OPTIONS_FILE}
${CMAKE_BINARY_DIR}/include/freerdp/config.h
generate_argument_manpage
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

View File

@ -0,0 +1,82 @@
.SH "GLOBAL CONFIGURATION"
.PP
Format and Location:
.RS 4
The configuration file is stored in global system configuration\&.
.br
The location is
\fI@CMAKE_INSTALL_FULL_SYSCONFDIR@/@VENDOR@/@PRODUCT@/certificates\&.json\fR
.br
File format is JSON
.RE
.PP
Supported options:
.RS 4
.PP
\fIdeny\fR
.RS 4
.PP
.RS 4
\fIJSON boolean\fR
.br
Deny the certificate if the check against system SSL store was not successful
.RE
.RE
.PP
\fIignore\fR
.RS 4
.PP
.RS 4
\fIJSON boolean\fR
.br
Ignore certificate failures, just ignore the certificate
.RE
.RE
.PP
\fIdeny\-userconfig\fR
.RS 4
.PP
.RS 4
\fIJSON boolean\fR
.br
If the checks in the global configuration do not accept the certificate do not ask the user
.RE
.RE
.PP
\fIcertificate\-db\fR
.RS 4
.PP
\fIJSON array\fR
.RS 4
An array of
\fIJSON objects\fR
with:
.PP
\fItype\fR
.RS 4
\fIJSON string\fR
.br
a string identifying the hash algorithm used, e\&.g\&.
\fIsha256\fR
.br
.RE
.PP
\fIhash\fR
.RS 4
\fIJSON string\fR
.br
a string of hex integer values representing the certificate hash, e\&.g\&.
\fI0123456789abcdef\fR
.RE
.RE
.RE
.RE

View File

@ -1,76 +0,0 @@
<refsect1>
<title>Global Configuration</title>
<variablelist>
<varlistentry>
<term>Format and Location:</term>
<listitem>
<para>The configuration file is stored in global system configuration.<sbr/>
The location is <replaceable>@CMAKE_INSTALL_FULL_SYSCONFDIR@/@VENDOR@/@PRODUCT@/certificates.json</replaceable><sbr/>
File format is JSON</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Supported options:</term>
<listitem>
<varlistentry>
<term><replaceable>deny</replaceable></term>
<listitem>
<varlistentry>
<listitem>
<para><replaceable>JSON boolean</replaceable><sbr/>
Deny the certificate if the check against system SSL store was not successful</para>
</listitem>
</varlistentry>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>ignore</replaceable></term>
<listitem>
<varlistentry>
<listitem>
<para><replaceable>JSON boolean</replaceable><sbr/>
Ignore certificate failures, just ignore the certificate</para>
</listitem>
</varlistentry>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>deny-userconfig</replaceable></term>
<listitem>
<varlistentry>
<listitem>
<para><replaceable>JSON boolean</replaceable><sbr/>
If the checks in the global configuration do not accept the certificate do not ask the user</para>
</listitem>
</varlistentry>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>certificate-db</replaceable></term>
<listitem>
<varlistentry>
<term><replaceable>JSON array</replaceable></term>
<listitem><para>An array of <replaceable>JSON objects</replaceable> with:</para>
<varlistentry>
<term><replaceable>type</replaceable></term>
<listitem>
<para><replaceable>JSON string</replaceable><sbr/>
a string identifying the hash algorithm used, e.g. <replaceable>sha256</replaceable> <sbr/></para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable>hash</replaceable></term>
<listitem>
<para><replaceable>JSON string</replaceable><sbr/>
a string of hex integer values representing the certificate hash, e.g. <replaceable>0123456789abcdef</replaceable></para>
</listitem>
</varlistentry>
</listitem>
</varlistentry>
</listitem>
</varlistentry>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -0,0 +1,10 @@
.SH "ENVIRONMENT VARIABLES"
.PP
wlog environment variable
.RS 4
@MANPAGE_NAME@ uses wLog as its log facility, you can refer to the corresponding man page (wlog(7)) for more informations\&. Arguments passed via the
\fI/log\-level\fR
or
\fI/log\-filters\fR
have precedence over the environment variables\&.
.RE

View File

@ -0,0 +1,8 @@
.SH "LINKS"
.PP
\m[blue]\fBhttp://www\&.freerdp\&.com/\fR\m[]
.SH "AUTHOR"
.br
.PP
The FreeRDP Team

View File

@ -57,11 +57,17 @@ static LPSTR tr_esc_str(LPCSTR arg, bool format)
char data[2] = { 0 };
switch (arg[x])
{
case '-':
str = "\\-";
if (!append(&tmp, &ds, str))
exit(-3);
break;
case '<':
if (format)
str = "<replaceable>";
str = "\\fI";
else
str = "&lt;";
str = "<";
if (!append(&tmp, &ds, str))
exit(-3);
@ -69,32 +75,28 @@ static LPSTR tr_esc_str(LPCSTR arg, bool format)
case '>':
if (format)
str = "</replaceable>";
str = "\\fR";
else
str = "&gt;";
str = ">";
if (!append(&tmp, &ds, str))
exit(-4);
break;
case '\'':
if (!append(&tmp, &ds, "&apos;"))
exit(-5);
str = "\\*(Aq";
if (!append(&tmp, &ds, str))
exit(-4);
break;
case '"':
if (!append(&tmp, &ds, "&quot;"))
exit(-6);
break;
case '&':
if (!append(&tmp, &ds, "&amp;"))
case '.':
if (!append(&tmp, &ds, "\\&."))
exit(-6);
break;
case '\r':
case '\n':
if (!append(&tmp, &ds, "<sbr/>"))
if (!append(&tmp, &ds, "\n.br\n"))
exit(-7);
break;
@ -112,9 +114,16 @@ static LPSTR tr_esc_str(LPCSTR arg, bool format)
int main(int argc, char* argv[])
{
size_t elements = sizeof(global_cmd_args) / sizeof(global_cmd_args[0]);
const char* fname = "freerdp-argument.1.xml";
(void)fprintf(stdout, "Generating docbook file '%s'\n", fname);
if (argc != 2)
{
(void)fprintf(stderr, "Usage: %s <output file name>\n", argv[0]);
return -1;
}
const char* fname = argv[1];
(void)fprintf(stdout, "Generating manpage file '%s'\n", fname);
FILE* fp = fopen(fname, "w");
if (NULL == fp)
{
@ -123,12 +132,8 @@ int main(int argc, char* argv[])
}
/* The tag used as header in the manpage */
(void)fprintf(fp, "<refsect1>\n");
(void)fprintf(fp, "\t<title>Options</title>\n");
(void)fprintf(fp, "\t\t<variablelist>\n");
(void)fprintf(fp, ".SH \"OPTIONS\"\n");
/* Iterate over argument struct and write data to docbook 4.5
* compatible XML */
if (elements < 2)
{
(void)fprintf(stderr, "The argument array 'args' is empty, writing an empty file.\n");
@ -142,18 +147,19 @@ int main(int argc, char* argv[])
char* alias = tr_esc_str(arg->Alias, FALSE);
char* format = tr_esc_str(arg->Format, TRUE);
char* text = tr_esc_str(arg->Text, FALSE);
(void)fprintf(fp, "\t\t\t<varlistentry>\n");
(void)fprintf(fp, ".PP\n");
bool first = true;
do
{
(void)fprintf(fp, "\t\t\t\t<term><option>");
(void)fprintf(fp, "%s\\fB", first ? "" : ", ");
first = false;
if (arg->Flags == COMMAND_LINE_VALUE_BOOL)
(void)fprintf(fp, "%s", arg->Default ? "-" : "+");
(void)fprintf(fp, "%s", arg->Default ? "\\-" : "+");
else
(void)fprintf(fp, "/");
(void)fprintf(fp, "%s</option>", name);
(void)fprintf(fp, "%s\\fR", name);
if (format)
{
@ -166,45 +172,41 @@ int main(int argc, char* argv[])
(void)fprintf(fp, "]");
}
(void)fprintf(fp, "</term>\n");
if (alias == name)
break;
free(name);
name = alias;
} while (alias);
(void)fprintf(fp, "\n");
if (text)
{
(void)fprintf(fp, "\t\t\t\t<listitem>\n");
(void)fprintf(fp, "\t\t\t\t\t<para>");
if (text)
(void)fprintf(fp, ".RS 4\n");
const int hasText = text && (strnlen(text, 2) > 0);
if (hasText)
(void)fprintf(fp, "%s", text);
if (arg->Flags & COMMAND_LINE_VALUE_BOOL &&
(!arg->Default || arg->Default == BoolValueTrue))
(void)fprintf(fp, " (default:%s)", arg->Default ? "on" : "off");
(void)fprintf(fp, " (default:%s)\n", arg->Default ? "on" : "off");
else if (arg->Default)
{
char* value = tr_esc_str(arg->Default, FALSE);
(void)fprintf(fp, " (default:%s)", value);
(void)fprintf(fp, " (default:%s)\n", value);
free(value);
}
(void)fprintf(fp, "</para>\n");
(void)fprintf(fp, "\t\t\t\t</listitem>\n");
else if (hasText)
(void)fprintf(fp, "\n");
}
(void)fprintf(fp, "\t\t\t</varlistentry>\n");
(void)fprintf(fp, ".RE\n");
free(name);
free(format);
free(text);
}
(void)fprintf(fp, "\t\t</variablelist>\n");
(void)fprintf(fp, "\t</refsect1>\n");
(void)fclose(fp);
(void)fprintf(stdout, "successfully generated '%s'\n", fname);

View File

@ -0,0 +1,48 @@
get_filename_component(GENERATE_MANPAGES_SCRIPT_DIR "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE)
list(APPEND CMAKE_MODULE_PATH ${GENERATE_MANPAGES_SCRIPT_DIR})
include(CleaningConfigureFile)
set(SRC "${CURRENT_SOURCE_DIR}/${target}.${section}.in")
cleaning_configure_file(${SRC} ${manpage}.tmp @ONLY IMMEDIATE)
# write header (aka name of the manpage), truncate existing
file(READ ${CURRENT_BINARY_DIR}/${manpage}.tmp CONTENTS)
file(WRITE ${CURRENT_BINARY_DIR}/${manpage} "${CONTENTS}")
string(REPLACE " " ";" DEPS ${dependencies})
foreach(DEP IN LISTS DEPS)
get_filename_component(DNAME "${DEP}" NAME)
set(SRC_IN ${CURRENT_SOURCE_DIR}/${DEP}.in)
set(DST_IN ${CURRENT_BINARY_DIR}/${DEP}.in)
set(SRC ${CURRENT_SOURCE_DIR}/${DEP})
set(BIN ${CURRENT_BINARY_DIR}/${DEP})
set(DST ${CURRENT_BINARY_DIR}/${DNAME})
if (EXISTS ${SRC_IN})
message("using generated ${DST} from ${SRC_IN}")
cleaning_configure_file(${SRC_IN} ${DST} @ONLY IMMEDIATE)
elseif (EXISTS ${DST_IN})
message("using generated ${DST} from ${DST_IN}")
cleaning_configure_file(${DST_IN} ${DST} @ONLY IMMEDIATE)
elseif (EXISTS ${SRC})
set(DST ${SRC})
message("using ${DST}")
elseif (EXISTS ${BIN})
set(DST ${BIN})
message("using ${DST}")
elseif (EXISTS ${DST})
message("using ${DST}")
else()
message(WARNING "Missing manpage section, considered:")
message(WARNING " ${SRC_IN}")
message(WARNING " ${DST_IN}")
message(WARNING " ${SRC}")
message(WARNING " ${BIN}")
message(WARNING " ${DST}")
message(FATAL_ERROR "Can not continue, terminating")
endif()
file(READ ${DST} CONTENTS)
file(APPEND ${CURRENT_BINARY_DIR}/${manpage} "${CONTENTS}")
endforeach()

View File

@ -1,7 +1,9 @@
include(today)
include(GNUInstallDirs)
include(FindDocBookXSL)
include(CleaningConfigureFile)
get_filename_component(INSTALL_FREERDP_MAN_SCRIPT_DIR "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE)
function(install_freerdp_man manpage section)
if(WITH_MANPAGES)
install(FILES ${manpage} DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section})
@ -20,55 +22,60 @@ function(generate_and_install_freerdp_man_from_template name_base section api)
endif()
endfunction()
function(generate_and_install_freerdp_man_from_xml target section dependencies)
# Generate an install target for a manpage.
#
# This is not as simple as it looks like:
#
# 1. extract the raw file names (files that require configure_file end with .in, ready to use files
# with .1 or some other manpage related number)
# 2. do the same for every dependency
# 3. create a command to run during build. Add a few defined symbols by default
# 4. add variable names passed to the function to the command
# 5. run CMake -P as custom_target during build.
# * run configure_file for all .in files
# * concatenate all manpage sections to the target manpage
# 6. create the actual install target
function(generate_and_install_freerdp_man_from_xml target section dependencies variable_names)
if(WITH_MANPAGES)
get_target_property(name_base ${target} OUTPUT_NAME)
get_target_property(name_base "${target}" OUTPUT_NAME)
set(template "${target}.${section}")
set(MANPAGE_NAME "${name_base}")
set(manpage "${name_base}.${section}")
# We need the variable ${MAN_TODAY} to contain the current date in ISO
# format to replace it in the cleaning_configure_file step.
# format to replace it in the cleaning_configure_file step.
include(today)
TODAY(MAN_TODAY)
cleaning_configure_file(${template}.xml.in ${manpage}.xml @ONLY IMMEDIATE)
set(GENERATE_COMMAND
-Dtemplate=\"${template}\"
-DMANPAGE_NAME=\"${MANPAGE_NAME}\"
-Dmanpage=\"${manpage}\"
-DMAN_TODAY=\"${MAN_TODAY}\"
-DCURRENT_SOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"
-DCURRENT_BINARY_DIR=\"${CMAKE_CURRENT_BINARY_DIR}\"
-Dtarget="${target}"
-Dsection="${section}"
-Ddependencies="${dependencies}"
)
foreach(DEP IN LISTS dependencies)
get_filename_component(DNAME "${DEP}" NAME)
set(SRC ${CMAKE_CURRENT_SOURCE_DIR}/${DEP}.in)
set(DST ${CMAKE_CURRENT_BINARY_DIR}/${DNAME})
if (EXISTS ${SRC})
message("generating ${DST} from ${SRC}")
cleaning_configure_file(${SRC} ${DST} @ONLY IMMEDIATE)
else()
message("using ${DST} from ${SRC}")
endif()
foreach(var IN ITEMS ${variable_names})
list(APPEND GENERATE_COMMAND
-D${var}=${${var}}
)
endforeach()
find_program(XSLTPROC_EXECUTABLE NAMES xsltproc REQUIRED)
if (NOT DOCBOOKXSL_FOUND)
message(FATAL_ERROR "docbook xsl not found but required for manpage generation")
endif()
list(APPEND GENERATE_COMMAND
-P \"${INSTALL_FREERDP_MAN_SCRIPT_DIR}/GenerateManpages.cmake\"
)
add_custom_command(
OUTPUT "${manpage}"
COMMAND ${CMAKE_BINARY_DIR}/client/common/man/generate_argument_docbook
COMMAND ${XSLTPROC_EXECUTABLE} --path "${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}" ${DOCBOOKXSL_DIR}/manpages/docbook.xsl ${manpage}.xml
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/${manpage}.xml
generate_argument_docbook
${template}.xml.in
)
add_custom_target(${manpage}.target ALL
COMMAND ${CMAKE_COMMAND} ${GENERATE_COMMAND}
DEPENDS generate_argument_manpage.target
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_target(
${manpage}.manpage ALL
DEPENDS
${manpage}
)
install_freerdp_man(${CMAKE_CURRENT_BINARY_DIR}/${manpage} ${section})
endif()
endfunction()