Re: /proc file-system

david parsons (o.r.c@p.e.l.l.c.h.i.i.l.u.s)
25 Feb 1997 04:11:45 -0800


In article <linux.kernel.199702220702.CAA00370@netcom.ca>,
Andrew E. Mileski <aem@netcom.ca> wrote:
>> The developers should understand that these fields are read either by
>> humans or by programs that use scanf() and friends. Therefore, we should
>> use white-space for delimiters and stay away from ":,=$&(#@*", etc.
>
>Using whitespace as a delimiter won't work because of strings.

Not if your scheme is

token whitespace value

A good parser can deal with this without much effort; it's just a
case of:

tok = p;
while (!isspace(*p) && *p) p++;
if (*p) {
*p = 0;
while (isspace(*p)) ++p;
val = p;
}
else val = (char*)0;

with the only restriction being that the value has to start with a
something other than whitespace.

____
david parsons \bi/ orc@pell.chi.il.us
\/