bug-inetutils
[Top][All Lists]
Advanced

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

Re: [bug-inetutils] Argpifying ifconfig.


From: Alfred M. Szmidt
Subject: Re: [bug-inetutils] Argpifying ifconfig.
Date: Tue, 3 Apr 2007 01:44:16 +0200 (CEST)

   Here (http://glug-nith.org/~rishi/download/src/ifconfig-argp.diff) is
   the current state of my patch to argpify ifconfig. Whenever I call
   'argp_parse (&argp, argc, argv, 0, 0, NULL)' instead of 'argp_parse
   (&argp, argc, argv, 0, &index, NULL)' in main (), things like:
   $ ifconfig lo
   $ ifconfig lo 127.0.0.3
   give an error-- 'Too many arguments'. Since I do not need 'index' in
   main (), I want to get rid of it.

   Any idea?

Have you checked the argp manual?  I don't have it at hand, so I'm not
of much help, but it documents 5th option and how it should be used.

   diff -urNp inetutils/ifconfig/options.c inetutils-build/ifconfig/options.c
   --- inetutils/ifconfig/options.c     2006-10-21 20:54:20.000000000 +0530
   +++ inetutils-build/ifconfig/options.c       2007-04-02 23:25:46.000000000 
+0530
[...snip...]
   @@ -44,14 +44,58 @@

    #include <sys/socket.h>
    #include <net/if.h>
   +#include <libinetutils.h>
    #include "ifconfig.h"

Please use "libinetutils.h" for "local" include files, and <foo.h> for
system ones.  We don't do that consitently, but still...  For example,
<argp.h> is correct, even if we have our own in lib/, but we should
write "xmalloc.h" to get xmalloc and friends, since this is not
normally a system header.

[...snip...]

   @@ -141,7 +185,7 @@ static const char *short_options = "+i:a

    static struct option long_options[] = {
    #ifdef SYSTEM_LONG_OPTIONS
   -  SYSTEM_LONG_OPTIONS
   +  //  SYSTEM_LONG_OPTIONS
    #endif
      {"verbose", no_argument, 0, 'v'},
      {"version", no_argument, 0, 'V'},

Is this intentionally left intact?  And why is SYSTEM_LONG_OPTIONS
commented out?

[...snip...]

   diff -urNp inetutils/ifconfig/system/linux.h
   inetutils-build/ifconfig/system/linux.h
   --- inetutils/ifconfig/system/linux.h        2006-10-21 20:54:20.000000000 
+0530
   +++ inetutils-build/ifconfig/system/linux.h  2007-04-02 21:04:43.000000000 
+0530
   @@ -37,8 +37,7 @@ struct system_ifconfig
    };

    # define SYSTEM_LONG_OPTIONS \
   -  {"txqlen",         required_argument,      0,      'T'},
   -
   +  {"txqlen", 'T', "N", 0, "Set transmit queue length to N", GRP+1},

Please do not remove page breaks (the ^L in there).




reply via email to

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