bug-inetutils
[Top][All Lists]
Advanced

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

Re: news about ifconfig


From: Alain Magloire
Subject: Re: news about ifconfig
Date: Fri, 12 Jan 2001 10:17:43 -0500 (EST)

Bonjour

  Cool, this sounds very promising, indeed. Poking around interface
is very plaform dependent, did you modularize the code enough so if
I want to do a port say to solaris I will not be entangled in a maze
of #ifdef's.
  This is my only (useless) comments for now.  I'm busy working on
GNU mailutils.  Feel free to create a new directory under inetutils/ifconfig
Although it does not mean it will be part of any release until you feel
confident about your code.

--
alain

> I am sometimes working on ifconfig. Currently, I have some basic support for
> interface configuration (addr, brdaddr, dstaddr, netmask, etc), and a
> flexible output format setup, which I want to show you now:
> 
> This is the standard format:
> 
> address@hidden:~/gnu/cvs/i/xx/ifconfig$ ./ifconfig -i lo -i dummy0
> lo (1):
>   inet address  127.0.0.1
>   netmask       255.0.0.0
>   flags         UP LOOPBACK RUNNING
>   mtu           3904
> 
> dummy0 (2):
>   inet address  127.0.0.2
>   netmask       255.0.0.0
>   flags         UP BROADCAST RUNNING NOARP
>   mtu           1500
> 
> This is the netkit format:
> 
> address@hidden:~/gnu/cvs/i/xx/ifconfig$ ./ifconfig --format netkit -i lo -i 
> dummy0
> lo         Link encap:(not available)
>           inet addr:127.0.0.1  Mask:255.0.0.0
>           UP LOOPBACK RUNNING  MTU:3904  Metric:0
> 
> dummy0     Link encap:(not available)
>           inet addr:127.0.0.2  Bcast:127.255.255.255  Mask:255.0.0.0
>           UP BROADCAST RUNNING NOARP  MTU:1500  Metric:0
> 
> 
> You can specify your own format strings. This is like if_nameindex:
> 
> echo ./ifconfig --format '${first?}{}{\n}${name}${\n}${index}' -i lo -i 
> dummy0'
> lo
> 1
> dummy0
> 2
> 
> There are basic if constructs ${cond?}{true}{false}, and variable
> substitution like ${name}. Currently, it's quite basic, but I plan to
> improve it a bit more, together with the rest of the program. The code is
> nto bad, but also not very clever currently. This will improve.
> 
> Hope you like it. With sufficient flexibility, this should make it more user
> friendly, and also usable in scripts (where parsing the output of a program
> can be problematic, if you don't have control). I will try to provide some
> input flexibility, too. For GNU style I want to use options as with every
> GNU program, but for compatibility, stuff like "dummy0 127.0.0.1 up" could
> also be supported (to some extent).
> 
> To finish, here are the default format strings as seen above:
> 
> struct format
> {
>   char *name;
>   char *templ;
> } formats[] =
> {
>   { "gnu",
>     "${first?}{}{${\n}}${name}${index?}{ (${index})}:${\n}" \
>     "${addr?}{  inet address  ${addr}${\n}}" \
>     "${netmask?}{  netmask       ${netmask}${\n}}" \
>     "${flags?}{  flags         ${flags}${\n}}" \
>     "${mtu?}{  mtu           ${mtu}${\n}}"
>   },
>   { "netkit",
>     "${name}       Link encap:(not available)${\n}" \
>     "     inet addr:${addr}" \
>     "${brdaddr?}{  Bcast:${brdaddr}}" \
>     "${netmask?}{  Mask:${netmask}}" \
>     "${newline}" \
>     "     ${flags}" \
>     "${mtu?}{  MTU:${mtu}}" \
>     "${metric?}{  Metric:${metric}}" \
>     "${newline}" \
>     "${newline}"
>   },
>   /* Of the last entry, name is always 0, but templ is the current
>      user specified format string.  */
>   { 0, 0 }
> };
> 
> 
> -- 
> `Rhubarb is no Egyptian god.' Debian http://www.debian.org address@hidden
> Marcus Brinkmann              GNU    http://www.gnu.org    address@hidden
> address@hidden
> http://www.marcus-brinkmann.de




reply via email to

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