www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/06/13/12:42:56

From: "Tim Van Holder" <tim DOT van DOT holder AT pandora DOT be>
To: <djgpp-workers AT delorie DOT com>
Cc: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Subject: Re: (un)setenv()
Date: Wed, 13 Jun 2001 18:43:45 +0200
Message-ID: <CAEGKOHJKAAFPKOCLHDIKEDECEAA.tim.van.holder@pandora.be>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
In-reply-to: <Pine.SUN.3.91.1010613115722.16126Q-100000@is>
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Importance: Normal
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Thanks!  I have a few minor comments, but other than that, it can go
> in.

Which reminds me: DJ can I have write access, so I can check this in
along with the a64l/l64a stuff?

> Please update the docs and the source, but I don't think we need to
> move the file to another directory.  The structure of the directories
> in djlsr does not convey any information about standard compliance, it
> is simply a convenient way of organizing the source tree.  We already
> have non-standard functions in standard directories, e.g. _rename in
> ansi/stdio.

Okelidokeli.

> OTOH, if setenv is now Posix, we need to move its prototype in
> stdlib.h to the Posix section.

Will do.

> >   /* Let putenv() do the work */
> >   name_with_assign = malloc (strlen (name) + 2);
> 
> Perhaps alloca is better here, since environment variables tend to be
> relatively short.
Right.

> You could also avoid this altogether, since `putenv' will remove the
> variable if passed a name without a value.  I think it is okay to rely
> on this feature of our implementation of `putenv', provided that you
> say so in a comment.

Oh ok - I only briefly glanced at putenv, so I didn't know it would accept
values without a '='.
In fact, I'll need to update putenv() as well (POSIX also mentions it); for
one thing, the prototype was changed to a non-const char* in Issue 5 of the
draft standard.

> >   putenv (name_with_assign);
> 
> You cannot use `putenv' in a Posix function without including
> <libc/stubs.h>.

Is this still true now that putenv() is Posix?

> > If @var{name} is @code{NULL}, points to an empty string, or points to
> > a string containing a @samp{=}, this function returns -1 and sets
> > @var{errno} to @code{EINVAL}; otherwise it returns 0.
> 
> `errno' is not a formal argument, therefore it should have the @code
> markup, not @var.

Okidoki.

> Finally, please add something in wc204.txi about these changes.

Will do.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019