[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-inetutils] Something about ifconfig --format=unknown
From: |
dingshaoheng |
Subject: |
[bug-inetutils] Something about ifconfig --format=unknown |
Date: |
Sun, 17 Apr 2011 20:37:09 +0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 |
To anyone who read this email,
I find inetutil package's TODO file said:
ifconfig: when a unknown format option is passed to --format, ifconfig
will output the name of the format twice.
%ifconfig --format=unknown
unknownunknown
I suppose that is a bug. So, I hacked it all the afternoon!
Finally, I find that is not a bug at all. The fact is about the number
of network device.
As on my system, there are 3 devices, lo, wlan0 and eth0, the eth0 is my
wired card, and is shutdown at first. Say, only lo and wlan0 is on. When
I executed ifconfig of inetutil, with option --format=unknown, it
repeated unknown twice.
Then, I turned my eth0 on. At this time, unknown was repeated 3 times.
I have read almost all parts of ifconfig's source code, and find this is
done by function print_interfaceX (in file printf.c, line 960), with a
complex while loop. For each device, print_interfaceX will be called.
And the format parameter is passed to it. If it find that format could
not be recognised, it will print out the format once.
The relative code like this:
-------------------------------------------------------------------------------------
while(!(*p == '$' || *p == '\0' || (form-depth > 1 && *p == '}')))
{
quiet || (put_char (form, *p), 0);
p++;
}
-------------------------------------------------------------------------------------
So, I don't think this is a bug. If it really does some matter, I tend
to believe that is a question of design. Because I find it is somewhat a
little complex to avoid the unknown format to be printed more than once.
I want to know your opinion about it. I would be very appreciate if you
can send me a reply at your convenience.
Thanks for your reading.
Ding Shaoheng
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug-inetutils] Something about ifconfig --format=unknown,
dingshaoheng <=