Re: Patch for 2.1.20 to try: "kernel environment"

David Hinds (dhinds@hyper.stanford.edu)
10 Jan 1997 00:49:42 GMT


Matthias Urlichs (smurf@work.smurf.noris.de) wrote:
: In linux.dev.kernel, article <5aoroq$1al@nntp.Stanford.EDU>,
: dhinds@hyper.stanford.edu (David Hinds) writes:
: > --- linux/fs/proc/array.c.orig Wed Jan 1 22:08:20 1997
: > +++ linux/fs/proc/array.c Fri Jan 3 23:54:36 1997
: > ...
: > + len += sprintf(buffer+len, "%s\n", *p);
: > ...

: I would use \0 instead of \n here. /proc/*/environ does the same thing.

I did notice that /proc/*/environ (and cmdline) use null terminated
strings. I have one question: why?? It seems to me that this only
makes /proc harder to use, because the resulting files have to be
tweaked before they can be processed by the usual text utilities like
grep, sed, etc.

Was this done for compatibility reasons with /proc on some other Unix
variant? Is there some other reason that I'm overlooking?

-- Dave Hinds