Skip to content

Commit

Permalink
add version print out to remaining commands
Browse files Browse the repository at this point in the history
For some reason version print out was not implemented in all commands.  This
fixes that.

Signed-off-by: Sami Kerola <[email protected]>
  • Loading branch information
kerolasa committed Oct 3, 2018
1 parent fb14ff3 commit 1b1559c
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 4 deletions.
5 changes: 5 additions & 0 deletions clockdiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ void usage(void)
" without -o, use ip timestamp only\n"
" -o use ip timestamp and icmp echo\n"
" -o1 use three-term ip timestamp and icmp echo\n"
" -V print version and exit\n"
" <destination> dns name or ip address\n"
"\nFor more details see clockdiff(8).\n"
);
Expand Down Expand Up @@ -593,6 +594,10 @@ main(int argc, char *argv[])
int s_errno = 0;
int n_errno = 0;

if (argc == 2 && !strcmp(argv[1], "-V")) {
printf(IPUTILS_VERSION("clockdiff"));
return 0;
}
if (argc < 2) {
drop_rights();
usage();
Expand Down
7 changes: 7 additions & 0 deletions doc/clockdiff.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<command>clockdiff</command>
<arg choice='opt'>-o </arg>
<arg choice='opt'>-o1 </arg>
<arg choice='opt'>-V </arg>
<arg choice='plain'><replaceable>destination</replaceable></arg>
<sbr/>
</cmdsynopsis>
Expand Down Expand Up @@ -55,6 +56,12 @@ What flavor works better depends on target host. Particularly,
<option>-o</option> is better for Linux.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-V</option></term>
<listitem>
<para>Print version and exit.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

Expand Down
7 changes: 7 additions & 0 deletions doc/ninfod.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<arg choice='opt'>-dhv </arg>
<arg choice='opt'>-p <replaceable>pidfile</replaceable></arg>
<arg choice='opt'>-u <replaceable>user</replaceable></arg>
<arg choice='opt'>-V </arg>
<sbr/>
</cmdsynopsis>
</refsynopsisdiv>
Expand Down Expand Up @@ -69,6 +70,12 @@ Queries can be sent by various implementations of <emphasis remap='B'>ping6</emp
<emphasis remap='I'>user</emphasis> is required to be able to create the file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-V</option></term>
<listitem>
<para>Print version and exit.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

Expand Down
7 changes: 7 additions & 0 deletions doc/rarpd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<command>arping</command>
<arg choice='opt'>-aAvde </arg>
<arg choice='opt'>-b <replaceable>bootdir</replaceable></arg>
<arg choice='opt'>-V </arg>
<arg choice='opt'><replaceable>interface</replaceable></arg>
<sbr/>
</cmdsynopsis>
Expand Down Expand Up @@ -96,6 +97,12 @@ database and DNS.</para>
<para>TFTP boot directory. Default is <filename>/etc/tftpboot</filename></para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-V</option></term>
<listitem>
<para>Print version and exit.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

Expand Down
1 change: 1 addition & 0 deletions doc/tftpd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<refsynopsisdiv id='synopsis'>
<cmdsynopsis>
<command>tftpd</command>
<arg choice='opt'>-V </arg>
<arg choice='plain'><replaceable>directory</replaceable></arg>
<sbr/>
</cmdsynopsis>
Expand Down
7 changes: 7 additions & 0 deletions doc/tracepath.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<arg choice='opt'>-l <replaceable>pktlen</replaceable></arg>
<arg choice='opt'>-m <replaceable>max_hops</replaceable></arg>
<arg choice='opt'>-p <replaceable>port</replaceable></arg>
<arg choice='opt'>-V </arg>
<arg choice='plain'><replaceable>destination</replaceable></arg>
<sbr/>
</cmdsynopsis>
Expand Down Expand Up @@ -97,6 +98,12 @@ instead of 30.</para>
<para>Sets the initial destination port to use.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-V</option></term>
<listitem>
<para>Print version and exit.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

Expand Down
6 changes: 5 additions & 1 deletion ninfod/ninfod.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ static void parse_args(int argc, char **argv)
char *ep;

/* parse options */
while ((c = getopt(argc, argv, "dhvp:u:")) != -1) {
while ((c = getopt(argc, argv, "dhvp:u:V")) != -1) {
switch(c) {
case 'd': /* debug */
opt_d = 1;
Expand All @@ -601,6 +601,9 @@ static void parse_args(int argc, char **argv)
} else
opt_u = val;
break;
case 'V':
printf(IPUTILS_VERSION("ninfod"));
exit(0);
case 'h': /* help */
default:
opt_h = 1;
Expand Down Expand Up @@ -635,6 +638,7 @@ static void print_usage(void) {
" -p <pidfile> file to store process-id\n"
" -u <user> run <user>\n"
" -v verbose mode\n"
" -V print version and exit\n"
"\nFor more details see ninfod(8).\n"
);
}
Expand Down
7 changes: 5 additions & 2 deletions rarpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ void usage(void)
" -d debug mode\n"
" -e /etc/ethers markup alone is fine\n"
" -v verbose mode\n"
" -V print version and exit\n"
"\nFor more details see rarpd(8).\n"
);
exit(1);
Expand Down Expand Up @@ -575,7 +576,7 @@ int main(int argc, char **argv)


opterr = 0;
while ((opt = getopt(argc, argv, "aAb:dvoe")) != EOF) {
while ((opt = getopt(argc, argv, "aAb:dvoeV")) != EOF) {
switch (opt) {
case 'a':
++all_ifaces;
Expand Down Expand Up @@ -604,7 +605,9 @@ int main(int argc, char **argv)
case 'b':
tftp_dir = optarg;
break;

case 'V':
printf(IPUTILS_VERSION("rarpd"));
return 0;
default:
usage();
}
Expand Down
5 changes: 5 additions & 0 deletions tftpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ int main(int ac, char **av)
int n = 0;
int on = 1;

if (ac == 2 && !strcmp(av[1], "-V")) {
printf(IPUTILS_VERSION("tftpd"));
return 0;
}

openlog("tftpd", LOG_PID, LOG_DAEMON);

/* Sanity. If parent forgot to setuid() on us. */
Expand Down
6 changes: 5 additions & 1 deletion tracepath.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ static void usage(void)
" -m <hops> use maximum <hops>\n"
" -n no dns name resolution\n"
" -p <port> use destination <port>\n"
" -V print version and exit\n"
" <destination> dns name or ip address\n"
"\nFor more details see tracepath(8).\n"
);
Expand Down Expand Up @@ -420,7 +421,7 @@ int main(int argc, char **argv)
else if (argv[0][strlen(argv[0])-1] == '6')
hints.ai_family = AF_INET6;

while ((ch = getopt(argc, argv, "46nbh?l:m:p:")) != EOF) {
while ((ch = getopt(argc, argv, "46nbh?l:m:p:V")) != EOF) {
switch(ch) {
case '4':
if (hints.ai_family != AF_UNSPEC) {
Expand Down Expand Up @@ -460,6 +461,9 @@ int main(int argc, char **argv)
case 'p':
base_port = atoi(optarg);
break;
case 'V':
printf(IPUTILS_VERSION("tracepath"));
return 0;
default:
usage();
}
Expand Down

0 comments on commit 1b1559c

Please sign in to comment.