lkml.org 
[lkml]   [1997]   [Feb]   [25]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
 
Messages in this thread
/
From(david parsons)
SubjectRe: /proc file-system
Date25 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
                   \/
\
 
 \ /
  Last update: 2005-03-22 13:39    [from the cache]
©2003-2008