Re: debugging eth driver

From: Cameron Simpson (cs@zip.com.au)
Date: Fri Mar 22 2002 - 02:40:37 EST


On 12:36 17 Mar 2002, Keith Owens <kaos@ocs.com.au> wrote:
| printf "%-25s%s\n", $head[$i], $f[$i];

Just a remark on a piece of code I see done a lot,
when formatting things for printf in columns, do this:

        print "%-25s %s\n", ...
          note! ----^

This _guarentees_ a space between one field ond the next. Ps and ls are
examples of commands whose output is regularly mangled in this way by
wide column values. Enforcing a single space between fields in the format
string avoids this. If the extra width bugs you, notch the %-25s down one.

There's plenty of formatting out there subject to this problem; let's
not help it with examples.

Cheers,

-- 
Cameron Simpson, DoD#743        cs@zip.com.au    http://www.zip.com.au/~cs/

Disclaimer: Opinions expressed here are CORRECT, mine, and not PSLs or NMSUs.. - Larry Cunningham <larry@psl.nmsu.edu> - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Mar 23 2002 - 22:00:27 EST