Merge pull request #7539 from yuwata/man-options

Add missing parsing and documentation for several options
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2017-12-05 21:40:21 +01:00 committed by GitHub
commit fdaf80672e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 236 additions and 130 deletions

View file

@ -147,6 +147,7 @@
</varlistentry>
<varlistentry>
<term><option>-q</option></term>
<term><option>--quiet</option></term>
<listitem>

View file

@ -144,7 +144,7 @@
<term><option>-q</option></term>
<term><option>--quiet</option></term>
<listitem><para>Suppresses info messages about lack
<listitem><para>Suppresses informational messages about lack
of access to journal files and possible in-flight coredumps.
</para></listitem>
</varlistentry>

View file

@ -5,3 +5,4 @@
<!ENTITY usergeneratordir @USER_GENERATOR_PATH@>
<!ENTITY systemenvgeneratordir @SYSTEM_ENV_GENERATOR_PATH@>
<!ENTITY userenvgeneratordir @USER_ENV_GENERATOR_PATH@>
<!ENTITY CERTIFICATE_ROOT @CERTIFICATE_ROOT@>

View file

@ -439,7 +439,7 @@
<term><option>-q</option></term>
<term><option>--quiet</option></term>
<listitem><para>Suppresses all info messages
<listitem><para>Suppresses all informational messages
(i.e. "-- Logs begin at …", "-- Reboot --"),
any warning messages regarding
inaccessible system journals when run as a normal

View file

@ -112,6 +112,7 @@
</varlistentry>
<xi:include href="user-system-options.xml" xpointer="host" />
<xi:include href="user-system-options.xml" xpointer="machine" />
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />

View file

@ -301,6 +301,13 @@
<literal>,</literal> if another address will be output afterwards. </para></listitem>
</varlistentry>
<varlistentry>
<term><option>-q</option></term>
<term><option>--quiet</option></term>
<listitem><para>Suppresses additional informational output while running.</para></listitem>
</varlistentry>
<xi:include href="user-system-options.xml" xpointer="host" />
<varlistentry>

View file

@ -23,7 +23,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
-->
<refentry id="systemd-hwdb" conditional="ENABLE_HWDB">
<refentry id="systemd-hwdb" conditional="ENABLE_HWDB"
xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>systemd-hwdb</title>
<productname>systemd</productname>
@ -68,13 +70,6 @@
<refsect1><title>Options</title>
<variablelist>
<varlistentry>
<term><option>-h</option></term>
<term><option>--help</option></term>
<listitem>
<para>Print help text.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--usr</option></term>
<listitem>
@ -88,6 +83,8 @@
<para>Alternate root path in the filesystem.</para>
</listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="help" />
</variablelist>
<refsect2><title>systemd-hwdb

View file

@ -102,6 +102,13 @@
with <option>--cert=</option>.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--trust=</option></term>
<listitem><para>Specify the path to a file containing a
CA certificate in PEM format.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-D <replaceable>DIR</replaceable></option></term>
<term><option>--directory=<replaceable>DIR</replaceable></option></term>

View file

@ -1,6 +1,9 @@
<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY % entities SYSTEM "custom-entities.ent" >
%entities;
]>
<!--
SPDX-License-Identifier: LGPL-2.1+
@ -198,6 +201,48 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>--key=</option></term>
<listitem><para>
Takes a path to a SSL key file in PEM format.
Defaults to <filename>&CERTIFICATE_ROOT;/private/journal-remote.pem</filename>.
This option can be used with <option>--listen-https=</option>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--cert=</option></term>
<listitem><para>
Takes a path to a SSL certificate file in PEM format.
Defaults to <filename>&CERTIFICATE_ROOT;/certs/journal-remote.pem</filename>.
This option can be used with <option>--listen-https=</option>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--trust=</option></term>
<listitem><para>
Takes a path to a SSL CA certificate file in PEM format,
or <option>all</option>. If <option>all</option> is set,
then certificate checking will be disabled.
Defaults to <filename>&CERTIFICATE_ROOT;/ca/trusted.pem</filename>.
This option can be used with <option>--listen-https=</option>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--gnutls-log=</option></term>
<listitem><para>
Takes a comma separated list of gnutls logging categories.
This option can be used with <option>--listen-http=</option> or
<option>--listen-https=</option>.
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>

View file

@ -1,6 +1,9 @@
<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
<!ENTITY % entities SYSTEM "custom-entities.ent" >
%entities;
]>
<!--
SPDX-License-Identifier: LGPL-2.1+
@ -171,6 +174,43 @@
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--follow</option><optional>=<replaceable>BOOL</replaceable></optional></term>
<listitem><para>
If set to yes, then <command>systemd-journal-upload</command> waits for input.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--key=</option></term>
<listitem><para>
Takes a path to a SSL key file in PEM format.
Defaults to <filename>&CERTIFICATE_ROOT;/private/journal-upload.pem</filename>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--cert=</option></term>
<listitem><para>
Takes a path to a SSL certificate file in PEM format.
Defaults to <filename>&CERTIFICATE_ROOT;/certs/journal-upload.pem</filename>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--trust=</option></term>
<listitem><para>
Takes a path to a SSL CA certificate file in PEM format,
or <option>all</option>. If <option>all</option> is set,
then certificate checking will be disabled.
Defaults to <filename>&CERTIFICATE_ROOT;/ca/trusted.pem</filename>.
</para></listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
</variablelist>

View file

@ -89,6 +89,7 @@
<refsect1><title>Options</title>
<variablelist>
<varlistentry>
<term><option>-d</option></term>
<term><option>--daemon</option></term>
<listitem>
<para>Detach and run in the background.</para>
@ -96,6 +97,7 @@
</varlistentry>
<varlistentry>
<term><option>-D</option></term>
<term><option>--debug</option></term>
<listitem>
<para>Print debug messages to standard error.</para>
@ -103,6 +105,7 @@
</varlistentry>
<varlistentry>
<term><option>-c=</option></term>
<term><option>--children-max=</option></term>
<listitem>
<para>Limit the number of events executed in parallel.</para>
@ -110,6 +113,7 @@
</varlistentry>
<varlistentry>
<term><option>-e=</option></term>
<term><option>--exec-delay=</option></term>
<listitem>
<para>Delay the execution of <varname>RUN</varname>
@ -121,6 +125,7 @@
</varlistentry>
<varlistentry>
<term><option>-t=</option></term>
<term><option>--event-timeout=</option></term>
<listitem>
<para>Set the number of seconds to wait for events to finish. After
@ -129,6 +134,7 @@
</varlistentry>
<varlistentry>
<term><option>-N=</option></term>
<term><option>--resolve-names=</option></term>
<listitem>
<para>Specify when systemd-udevd should resolve names of users and groups.
@ -140,11 +146,7 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>--help</option></term>
<xi:include href="standard-options.xml" xpointer="help-text" />
</varlistentry>
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
</variablelist>
</refsect1>

View file

@ -1053,7 +1053,7 @@ CapabilityBoundingSet=~CAP_B CAP_C</programlisting>
<listitem><para>Takes a boolean argument. If true, explicit module loading will be denied. This allows to turn
off module load and unload operations on modular kernels. It is recommended to turn this on for most services
that do not need special file systems or extra kernel modules to work. Default to off. Enabling this option
that do not need special file systems or extra kernel modules to work. Defaults to off. Enabling this option
removes <constant>CAP_SYS_MODULE</constant> from the capability bounding set for the unit, and installs a
system call filter to block module system calls, also <filename>/usr/lib/modules</filename> is made
inaccessible. For this setting the same restrictions regarding mount propagation and privileges apply as for

View file

@ -1656,7 +1656,7 @@
<term><varname>VLANId=</varname></term>
<listitem>
<para>The VLAN ID for the new static MAC table entry. If
omitted, no VLAN ID info is appended to the new static MAC
omitted, no VLAN ID information is appended to the new static MAC
table entry.</para>
</listitem>
</varlistentry>

View file

@ -23,7 +23,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
-->
<refentry id="udevadm">
<refentry id="udevadm"
xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>udevadm</title>
<productname>systemd</productname>
@ -54,16 +56,16 @@
<arg><option>--help</option></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>udevadm info <replaceable>options</replaceable></command>
<command>udevadm info <optional>options</optional> <optional>devpath</optional></command>
</cmdsynopsis>
<cmdsynopsis>
<command>udevadm trigger <optional>options</optional></command>
<command>udevadm trigger <optional>options</optional> <optional>devpath</optional></command>
</cmdsynopsis>
<cmdsynopsis>
<command>udevadm settle <optional>options</optional></command>
</cmdsynopsis>
<cmdsynopsis>
<command>udevadm control <replaceable>command</replaceable></command>
<command>udevadm control <replaceable>option</replaceable></command>
</cmdsynopsis>
<cmdsynopsis>
<command>udevadm monitor <optional>options</optional></command>
@ -86,24 +88,15 @@
<refsect1><title>Options</title>
<variablelist>
<varlistentry>
<term><option>-d</option></term>
<term><option>--debug</option></term>
<listitem>
<para>Print debug messages to standard error.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--version</option></term>
<listitem>
<para>Print version number.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option></term>
<term><option>--help</option></term>
<listitem>
<para>Print help text.</para>
</listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="version" />
<xi:include href="standard-options.xml" xpointer="help" />
</variablelist>
<refsect2><title>udevadm info
@ -208,19 +201,9 @@
<para>Cleanup the udev database.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--version</option></term>
<listitem>
<para>Print version.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option></term>
<term><option>--help</option></term>
<listitem>
<para>Print help text.</para>
</listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="version" />
<xi:include href="standard-options.xml" xpointer="help" />
</variablelist>
<para>In addition, an optional positional argument can be used
@ -352,13 +335,9 @@
device.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option></term>
<term><option>--help</option></term>
<listitem>
<para>Print help text.</para>
</listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="version" />
<xi:include href="standard-options.xml" xpointer="help" />
</variablelist>
<para>In addition, optional positional arguments can be used
@ -389,17 +368,13 @@
<para>Stop waiting if file exists.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option></term>
<term><option>--help</option></term>
<listitem>
<para>Print help text.</para>
</listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="version" />
<xi:include href="standard-options.xml" xpointer="help" />
</variablelist>
</refsect2>
<refsect2><title>udevadm control <replaceable>command</replaceable></title>
<refsect2><title>udevadm control <replaceable>option</replaceable></title>
<para>Modify the internal state of the running udev daemon.</para>
<variablelist>
<varlistentry>
@ -463,18 +438,15 @@
</listitem>
</varlistentry>
<varlistentry>
<term><option>-t</option></term>
<term><option>--timeout=</option><replaceable>seconds</replaceable></term>
<listitem>
<para>The maximum number of seconds to wait for a reply from systemd-udevd.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option></term>
<term><option>--help</option></term>
<listitem>
<para>Print help text.</para>
</listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="version" />
<xi:include href="standard-options.xml" xpointer="help" />
</variablelist>
</refsect2>
@ -521,13 +493,9 @@
<para>Filter udev events by tag. Only udev events with a given tag attached will pass.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option></term>
<term><option>--help</option></term>
<listitem>
<para>Print help text.</para>
</listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="version" />
<xi:include href="standard-options.xml" xpointer="help" />
</variablelist>
</refsect2>
@ -557,13 +525,9 @@
and all devices will be owned by root.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option></term>
<term><option>--help</option></term>
<listitem>
<para>Print help text.</para>
</listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="version" />
<xi:include href="standard-options.xml" xpointer="help" />
</variablelist>
</refsect2>
@ -576,13 +540,8 @@
for device <replaceable>DEVPATH</replaceable>, and print debug
output.</para>
<variablelist>
<varlistentry>
<term><option>-h</option></term>
<term><option>--help</option></term>
<listitem>
<para>Print help text.</para>
</listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="version" />
<xi:include href="standard-options.xml" xpointer="help" />
</variablelist>
</refsect2>
</refsect1>

View file

@ -57,9 +57,10 @@ static int parse_argv(int argc, char *argv[]) {
};
static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
{ "bus-path", required_argument, NULL, 'p' },
{ NULL, 0, NULL, 0 }
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, ARG_VERSION },
{ "bus-path", required_argument, NULL, 'p' },
{},
};
int c;

View file

@ -24,12 +24,13 @@
#include "time-util.h"
#include "udev-util.h"
#include "udev.h"
#include "udevadm-util.h"
static void print_help(void) {
printf("%s control COMMAND\n\n"
printf("%s control OPTION\n\n"
"Control the udev daemon.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
" -V --version Show package version\n"
" -e --exit Instruct the daemon to cleanup and exit\n"
" -l --log-priority=LEVEL Set the udev log level for the daemon\n"
" -s --stop-exec-queue Do not execute events, queue only\n"
@ -57,6 +58,7 @@ static int adm_control(struct udev *udev, int argc, char *argv[]) {
{ "env", required_argument, NULL, 'p' }, /* alias for -p */
{ "children-max", required_argument, NULL, 'm' },
{ "timeout", required_argument, NULL, 't' },
{ "version", no_argument, NULL, 'V' },
{ "help", no_argument, NULL, 'h' },
{}
};
@ -70,7 +72,7 @@ static int adm_control(struct udev *udev, int argc, char *argv[]) {
if (uctrl == NULL)
return 2;
while ((c = getopt_long(argc, argv, "el:sSRp:m:h", options, NULL)) >= 0)
while ((c = getopt_long(argc, argv, "el:sSRp:m:t:Vh", options, NULL)) >= 0)
switch (c) {
case 'e':
if (udev_ctrl_send_exit(uctrl, timeout) < 0)
@ -153,6 +155,10 @@ static int adm_control(struct udev *udev, int argc, char *argv[]) {
}
break;
}
case 'V':
print_version();
rc = 0;
break;
case 'h':
print_help();
rc = 0;

View file

@ -34,6 +34,7 @@
#include "strbuf.h"
#include "string-util.h"
#include "udev.h"
#include "udevadm-util.h"
#include "util.h"
/*
@ -546,12 +547,17 @@ static int import_file(struct udev *udev, struct trie *trie, const char *filenam
}
static void help(void) {
printf("Usage: udevadm hwdb OPTIONS\n"
" -u,--update update the hardware database\n"
" --usr generate in " UDEVLIBEXECDIR " instead of /etc/udev\n"
" -t,--test=MODALIAS query database and print result\n"
" -r,--root=PATH alternative root path in the filesystem\n"
" -h,--help\n\n");
printf("%s hwdb [OPTIONS]\n\n"
" -h --help Print this message\n"
" -V --version Print version of the program\n"
" -u --update Update the hardware database\n"
" --usr Generate in " UDEVLIBEXECDIR " instead of /etc/udev\n"
" -t --test=MODALIAS Query database and print result\n"
" -r --root=PATH Alternative root path in the filesystem\n\n"
"NOTE:\n"
"The sub-command 'hwdb' is deprecated, and is left for backwards compatibility.\n"
"Please use systemd-hwdb instead.\n"
, program_invocation_short_name);
}
static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
@ -560,11 +566,12 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
};
static const struct option options[] = {
{ "update", no_argument, NULL, 'u' },
{ "usr", no_argument, NULL, ARG_USR },
{ "test", required_argument, NULL, 't' },
{ "root", required_argument, NULL, 'r' },
{ "help", no_argument, NULL, 'h' },
{ "update", no_argument, NULL, 'u' },
{ "usr", no_argument, NULL, ARG_USR },
{ "test", required_argument, NULL, 't' },
{ "root", required_argument, NULL, 'r' },
{ "version", no_argument, NULL, 'V' },
{ "help", no_argument, NULL, 'h' },
{}
};
const char *test = NULL;
@ -575,7 +582,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
int err, c;
int rc = EXIT_SUCCESS;
while ((c = getopt_long(argc, argv, "ut:r:h", options, NULL)) >= 0)
while ((c = getopt_long(argc, argv, "ut:r:Vh", options, NULL)) >= 0)
switch(c) {
case 'u':
update = true;
@ -589,6 +596,9 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) {
case 'r':
root = optarg;
break;
case 'V':
print_version();
return EXIT_SUCCESS;
case 'h':
help();
return EXIT_SUCCESS;

View file

@ -377,7 +377,7 @@ static int uinfo(struct udev *udev, int argc, char *argv[]) {
export_prefix = optarg;
break;
case 'V':
printf("%s\n", PACKAGE_VERSION);
print_version();
return 0;
case 'h':
help();

View file

@ -30,6 +30,7 @@
#include "format-util.h"
#include "udev-util.h"
#include "udev.h"
#include "udevadm-util.h"
static bool udev_exit;
@ -60,10 +61,10 @@ static void print_device(struct udev_device *device, const char *source, int pro
}
static void help(void) {
printf("%s monitor [--property] [--kernel] [--udev] [--help]\n\n"
printf("%s monitor [OPTIONS]\n\n"
"Listen to kernel and udev events.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
" -V --version Show package version\n"
" -p --property Print the event properties\n"
" -k --kernel Print kernel uevents\n"
" -u --udev Print udev events\n"
@ -94,6 +95,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) {
{ "udev", no_argument, NULL, 'u' },
{ "subsystem-match", required_argument, NULL, 's' },
{ "tag-match", required_argument, NULL, 't' },
{ "version", no_argument, NULL, 'V' },
{ "help", no_argument, NULL, 'h' },
{}
};
@ -101,7 +103,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) {
udev_list_init(udev, &subsystem_match_list, true);
udev_list_init(udev, &tag_match_list, true);
while ((c = getopt_long(argc, argv, "pekus:t:h", options, NULL)) >= 0)
while ((c = getopt_long(argc, argv, "pekus:t:Vh", options, NULL)) >= 0)
switch (c) {
case 'p':
case 'e':
@ -130,6 +132,9 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) {
case 't':
udev_list_entry_add(&tag_match_list, optarg, NULL);
break;
case 'V':
print_version();
return 0;
case 'h':
help();
return 0;

View file

@ -29,13 +29,14 @@
#include "parse-util.h"
#include "udev.h"
#include "udevadm-util.h"
#include "util.h"
static void help(void) {
printf("%s settle OPTIONS\n\n"
printf("%s settle [OPTIONS]\n\n"
"Wait for pending udev events.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
" -V --version Show package version\n"
" -t --timeout=SECONDS Maximum time to wait for events\n"
" -E --exit-if-exists=FILE Stop waiting if file exists\n"
, program_invocation_short_name);
@ -45,6 +46,7 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) {
static const struct option options[] = {
{ "timeout", required_argument, NULL, 't' },
{ "exit-if-exists", required_argument, NULL, 'E' },
{ "version", no_argument, NULL, 'V' },
{ "help", no_argument, NULL, 'h' },
{ "seq-start", required_argument, NULL, 's' }, /* removed */
{ "seq-end", required_argument, NULL, 'e' }, /* removed */
@ -59,7 +61,7 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) {
struct udev_queue *queue;
int rc = EXIT_FAILURE;
while ((c = getopt_long(argc, argv, "t:E:hs:e:q", options, NULL)) >= 0) {
while ((c = getopt_long(argc, argv, "t:E:Vhs:e:q", options, NULL)) >= 0) {
switch (c) {
case 't': {
@ -77,6 +79,10 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) {
exists = optarg;
break;
case 'V':
print_version();
return EXIT_SUCCESS;
case 'h':
help();
return EXIT_SUCCESS;

View file

@ -25,12 +25,13 @@
#include "path-util.h"
#include "string-util.h"
#include "udev.h"
#include "udevadm-util.h"
static void help(struct udev *udev) {
printf("%s builtin [--help] COMMAND SYSPATH\n\n"
printf("%s test-builtin [OPTIONS] COMMAND DEVPATH\n\n"
"Test a built-in command.\n\n"
" -h --help Print this message\n"
" --version Print version of the program\n\n"
" -V --version Print version of the program\n\n"
"Commands:\n"
, program_invocation_short_name);
@ -39,7 +40,8 @@ static void help(struct udev *udev) {
static int adm_builtin(struct udev *udev, int argc, char *argv[]) {
static const struct option options[] = {
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ "help", no_argument, NULL, 'h' },
{}
};
char *command = NULL;
@ -49,8 +51,11 @@ static int adm_builtin(struct udev *udev, int argc, char *argv[]) {
enum udev_builtin_cmd cmd;
int rc = EXIT_SUCCESS, c;
while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0)
while ((c = getopt_long(argc, argv, "Vh", options, NULL)) >= 0)
switch (c) {
case 'V':
print_version();
goto out;
case 'h':
help(udev);
goto out;

View file

@ -29,13 +29,14 @@
#include "string-util.h"
#include "udev-util.h"
#include "udev.h"
#include "udevadm-util.h"
static void help(void) {
printf("%s test OPTIONS <syspath>\n\n"
"Test an event run.\n"
printf("%s test [OPTIONS] DEVPATH\n\n"
"Test an event run.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
" -V --version Show package version\n"
" -a --action=ACTION Set action string\n"
" -N --resolve-names=early|late|never When to resolve names\n"
, program_invocation_short_name);
@ -54,15 +55,16 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) {
int rc = 0, c;
static const struct option options[] = {
{ "action", required_argument, NULL, 'a' },
{ "action", required_argument, NULL, 'a' },
{ "resolve-names", required_argument, NULL, 'N' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ "help", no_argument, NULL, 'h' },
{}
};
log_debug("version %s", PACKAGE_VERSION);
while ((c = getopt_long(argc, argv, "a:N:h", options, NULL)) >= 0)
while ((c = getopt_long(argc, argv, "a:N:Vh", options, NULL)) >= 0)
switch (c) {
case 'a':
action = optarg;
@ -80,6 +82,9 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) {
exit(EXIT_FAILURE);
}
break;
case 'V':
print_version();
exit(EXIT_SUCCESS);
case 'h':
help();
exit(EXIT_SUCCESS);

View file

@ -68,10 +68,10 @@ static const char *keyval(const char *str, const char **val, char *buf, size_t s
}
static void help(void) {
printf("%s trigger OPTIONS\n\n"
printf("%s trigger [OPTIONS] DEVPATH\n\n"
"Request events from the kernel.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
" -V --version Show package version\n"
" -v --verbose Print the list of devices while running\n"
" -n --dry-run Do not actually trigger the events\n"
" -t --type= Type of events to trigger\n"
@ -109,6 +109,7 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[]) {
{ "sysname-match", required_argument, NULL, 'y' },
{ "name-match", required_argument, NULL, ARG_NAME },
{ "parent-match", required_argument, NULL, 'b' },
{ "version", no_argument, NULL, 'V' },
{ "help", no_argument, NULL, 'h' },
{}
};
@ -124,7 +125,7 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[]) {
if (udev_enumerate == NULL)
return 1;
while ((c = getopt_long(argc, argv, "vno:t:c:s:S:a:A:p:g:y:b:h", options, NULL)) >= 0) {
while ((c = getopt_long(argc, argv, "vnt:c:s:S:a:A:p:g:y:b:Vh", options, NULL)) >= 0) {
const char *key;
const char *val;
char buf[UTIL_PATH_SIZE];
@ -240,6 +241,9 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[]) {
break;
}
case 'V':
print_version();
return 0;
case 'h':
help();
return 0;

View file

@ -23,3 +23,7 @@
struct udev_device *find_device(struct udev *udev,
const char *id,
const char *prefix);
static inline void print_version(void) {
printf("%s\n", PACKAGE_VERSION);
}