bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC] {print,}env -0


From: Jim Meyering
Subject: Re: [RFC] {print,}env -0
Date: Tue, 27 Oct 2009 19:07:23 +0100

Eric Blake wrote:
> According to Jim Meyering on 10/27/2009 1:39 AM:
>>>>>> env -0/--null
>>>>>> printenv -0/--null
>>>>>>
>>>>>> as a means of unambiguously representing the current contents of the
>>>>>> environment with NUL terminators instead of newlines?
>> Yes, now I'm in favor of this, too.
>
> This patch implements the option; I'm still working on developing a test
> (comparing binary output takes a bit more effort) before I will commit
> anything, but thought I'd at least get the review started.
...

> diff --git a/tests/misc/printenv b/tests/misc/printenv
...
> +prog="$abs_top_builddir/src/printenv"

I've been switching to the use of "env -- prog_name",
rather than $abs_name_of_prog.

Using $prog is slightly more concise, but I have a slight
preference for the other syntax because it doesn't rely on
any variable like $abs_top_builddir.
No big deal either way.

> * doc/coreutils.texi (Common options): New macro optNull.

Thanks for factoring that out.

...
> diff --git a/src/env.c b/src/env.c
> index 8d7d55e..778129b 100644
> --- a/src/env.c
> +++ b/src/env.c
> @@ -29,6 +29,11 @@
>          Unset variable VARIABLE (remove it from the environment).
>          If VARIABLE was not set, does nothing.
>
> +   -0
> +   --null
> +        When no program is specified, output environment information
> +        separated by nul bytes rather than newlines.

I have mixed feelings about these comments.
I certainly wouldn't add them when writing from scratch --
that sort of info belongs in documentation, not in comments.
If you add the new entry, please mention "terminated", not "separated",
and spell it as "NUL", not "nul".

I've just checked the documentation, and see it provides no examples.
So the five examples in env.c need to move to coreutils.texi.
Fixing that is now on my list of 5-10-minute tasks ;-)
but anyone else is welcome to do it, too.

Thanks!




reply via email to

[Prev in Thread] Current Thread [Next in Thread]