commit-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Inetutils branch, master, updated. inetutils-1_6-139-gd15cdd4


From: Simon Josefsson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_6-139-gd15cdd4
Date: Tue, 08 Dec 2009 14:04:08 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  d15cdd4a10f0dcd4687391414203ddc7ba13ac16 (commit)
      from  76505247ef01ad628369f1d456ed0753bb594fb1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=d15cdd4a10f0dcd4687391414203ddc7ba13ac16


commit d15cdd4a10f0dcd4687391414203ddc7ba13ac16
Author: Simon Josefsson <address@hidden>
Date:   Tue Dec 8 15:04:06 2009 +0100

    Fix tftp man page by argp-ifying it.

diff --git a/ChangeLog b/ChangeLog
index d67164c..4374206 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2009-12-08  Simon Josefsson  <address@hidden>
 
+       * tftp/main.c: Use argp to parse command line parameters.
+       * man/Makefile.am: Also build man pages for tftp and tftpd.
+       * NEWS: Updated.
+
+2009-12-08  Simon Josefsson  <address@hidden>
+
        * man/Makefile.am: Make sure that all man pages are included in
        the 'make dist' target.  Suggested by Alfred M. Szmidt
        <address@hidden>.
diff --git a/NEWS b/NEWS
index 20e9d6b..d0af7fe 100644
--- a/NEWS
+++ b/NEWS
@@ -28,6 +28,10 @@ PID of the `logger' process.
 
 New program.
 
+* tftp
+
+Command line parsing now uses argp.
+
 * Man pages for all tools are generated using help2man.
 
 
diff --git a/man/Makefile.am b/man/Makefile.am
index f7c02b7..4bc7f53 100644
--- a/man/Makefile.am
+++ b/man/Makefile.am
@@ -16,11 +16,12 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see `http://www.gnu.org/licenses/'.
 
-# FIXME: ping6 ifconfig tftp
+# FIXME: ping6 ifconfig
 
 all = hostname.1 ifconfig.1 inetd.1 ftp.1 ftpd.1 logger.1 ping.1 rcp.1 \
       rexec.1 rexecd.1 rlogin.1 rlogind.1 rsh.1 rshd.1 syslogd.1       \
-      talk.1 talkd.1 telnet.1 telnetd.1 traceroute.1 uucpd.1 whois.1
+      talk.1 talkd.1 telnet.1 telnetd.1 tftp.1 tftpd.1 traceroute.1    \
+      uucpd.1 whois.1
 
 dist_man1_MANS =
 
@@ -100,6 +101,14 @@ if ENABLE_telnetd
 dist_man1_MANS += telnetd.1
 endif
 
+if ENABLE_tftp
+dist_man1_MANS += tftp.1
+endif
+
+if ENABLE_tftpd
+dist_man1_MANS += tftpd.1
+endif
+
 if ENABLE_traceroute
 dist_man1_MANS += traceroute.1
 endif
diff --git a/tftp/main.c b/tftp/main.c
index 142d7fe..aaeb1d7 100644
--- a/tftp/main.c
+++ b/tftp/main.c
@@ -74,9 +74,12 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <argp.h>
+#include <libinetutils.h>
 
 #include "xalloc.h"
 #include "extern.h"
+#include "progname.h"
 
 #define TIMEOUT                5       /* secs between rexmt's */
 
@@ -159,14 +162,51 @@ struct cmd cmdtab[] = {
 struct cmd *getcmd ();
 char *tail ();
 
-char *program_name;
+
+const char args_doc[] = "[HOST [PORT]]";
+const char doc[] = "Trivial file transfer protocol client";
+
+static struct argp_option argp_options[] = {
+  {"verbose", 'v', NULL, 0, "verbose output"},
+  {NULL}
+};
+
+char *hostport_argv[3] = { "connect" };
+int hostport_argc = 1;
+
+static error_t
+parse_opt (int key, char *arg, struct argp_state *state)
+{
+  switch (key)
+    {
+    case 'v':          /* Verbose.  */
+      verbose++;
+      break;
+
+    case ARGP_KEY_ARG:
+      if (state->arg_num >= 2 || hostport_argc >= 3)
+       /* Too many arguments. */
+       argp_usage (state);
+      hostport_argv[hostport_argc++] = arg;
+      break;
+
+    default:
+      return ARGP_ERR_UNKNOWN;
+    }
+
+  return 0;
+}
+
+static struct argp argp = {argp_options, parse_opt, args_doc, doc};
 
 int
 main (int argc, char *argv[])
 {
   struct sockaddr_in sin;
 
-  program_name = argv[0];
+  set_program_name (argv[0]);
+  iu_argp_init ("tftp", default_program_authors);
+  argp_parse (&argp, argc, argv, 0, NULL, NULL);
 
   sp = getservbyname ("tftp", "udp");
   if (sp == 0)
@@ -189,11 +229,11 @@ main (int argc, char *argv[])
     }
   strcpy (mode, "netascii");
   signal (SIGINT, intr);
-  if (argc > 1)
+  if (hostport_argc > 1)
     {
       if (setjmp (toplevel) != 0)
        exit (0);
-      setpeer (argc, argv);
+      setpeer (hostport_argc, hostport_argv);
     }
   if (setjmp (toplevel) != 0)
     putchar ('\n');

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog       |    6 ++++++
 NEWS            |    4 ++++
 man/Makefile.am |   13 +++++++++++--
 tftp/main.c     |   48 ++++++++++++++++++++++++++++++++++++++++++++----
 4 files changed, 65 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]