Re: [PATCH:twm] Remove unused fallback implementation of putenv()

2011-05-10 Thread Matthieu Herrb
On Mon, May 09, 2011 at 10:51:36PM -0700, Alan Coopersmith wrote:
 NOPUTENV was never defined in a modular build, probably because putenv()
 is a standard function in Unix98 / SUSv2.
 
 Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com

Reviewed-by: Matthieu Herrb matthieu.he...@laas.fr
 ---
  src/util.c |   66 
 
  1 files changed, 0 insertions(+), 66 deletions(-)
 
 diff --git a/src/util.c b/src/util.c
 index 812886d..83f3257 100644
 --- a/src/util.c
 +++ b/src/util.c
 @@ -771,72 +771,6 @@ SetFocus (TwmWindow *tmp_win, Time time)
  XSetInputFocus (dpy, w, RevertToPointerRoot, time);
  }
  
 -
 -#ifdef NOPUTENV
 -/**
 - * define our own putenv() if the system doesn't have one.
 - * putenv(s): place s (a string of the form NAME=value) in
 - * the environment; replacing any existing NAME.  s is placed in
 - * environment, so if you change s, the environment changes (like
 - * putenv on a sun).  Binding removed if you putenv something else
 - * called NAME.
 - */
 -int
 -putenv(char *s)
 -{
 -char *v;
 -int varlen, idx;
 -extern char **environ;
 -char **newenv;
 -static int virgin = 1; /* true while environ is a virgin */
 -
 -v = index(s, '=');
 -if(v == 0)
 - return 0; /* punt if it's not of the right form */
 -varlen = (v + 1) - s;
 -
 -for (idx = 0; environ[idx] != 0; idx++) {
 - if (strncmp(environ[idx], s, varlen) == 0) {
 - if(v[1] != 0) { /* true if there's a value */
 - environ[idx] = s;
 - return 0;
 - } else {
 - do {
 - environ[idx] = environ[idx+1];
 - } while(environ[++idx] != 0);
 - return 0;
 - }
 - }
 -}
 -
 -/* add to environment (unless no value; then just return) */
 -if(v[1] == 0)
 - return 0;
 -if(virgin) {
 - register i;
 -
 - newenv = (char **) malloc((unsigned) ((idx + 2) * sizeof(char*)));
 - if(newenv == 0)
 - return -1;
 - for(i = idx-1; i = 0; --i)
 - newenv[i] = environ[i];
 - virgin = 0; /* you're not a virgin anymore, sweety */
 -} else {
 - newenv = (char **) realloc((char *) environ,
 -(unsigned) ((idx + 2) * sizeof(char*)));
 - if (newenv == 0)
 - return -1;
 -}
 -
 -environ = newenv;
 -environ[idx] = s;
 -environ[idx+1] = 0;
 -
 -return 0;
 -}
 -#endif /* NOPUTENV */
 -
 -
  static Pixmap 
  CreateXLogoPixmap (unsigned *widthp, unsigned *heightp)
  {
 -- 
 1.7.3.2
 
 ___
 xorg-devel@lists.x.org: X.Org development
 Archives: http://lists.x.org/archives/xorg-devel
 Info: http://lists.x.org/mailman/listinfo/xorg-devel

-- 
Matthieu Herrb
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH:twm] Remove unused fallback implementation of putenv()

2011-05-10 Thread Mark Kettenis
 From: Alan Coopersmith alan.coopersm...@oracle.com
 Date: Mon,  9 May 2011 22:51:36 -0700
 
 NOPUTENV was never defined in a modular build, probably because putenv()
 is a standard function in Unix98 / SUSv2.

Much older than that.  Looks like it first appeared in SVR2 and
4.3BSD-Reno.  That should mean that everything that's even remotely
UNIX these days should have it.

Reviewed-by: Mark Kettenis kette...@openbsd.org

 Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com
 ---
  src/util.c |   66 
 
  1 files changed, 0 insertions(+), 66 deletions(-)
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH:twm] Remove unused fallback implementation of putenv()

2011-05-10 Thread Alan Coopersmith
On 05/10/11 01:04 AM, Mark Kettenis wrote:
 From: Alan Coopersmith alan.coopersm...@oracle.com
 Date: Mon,  9 May 2011 22:51:36 -0700

 NOPUTENV was never defined in a modular build, probably because putenv()
 is a standard function in Unix98 / SUSv2.
 
 Much older than that.  Looks like it first appeared in SVR2 and
 4.3BSD-Reno.  That should mean that everything that's even remotely
 UNIX these days should have it.

Thanks - SUSv2 was the earliest standard I could find online quickly, though
I did find man pages referencing it appearing in older BSD versions  SVID,
they weren't specific about versions.

-- 
-Alan Coopersmith-alan.coopersm...@oracle.com
 Oracle Solaris Platform Engineering: X Window System

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH:twm] Remove unused fallback implementation of putenv()

2011-05-09 Thread Alan Coopersmith
NOPUTENV was never defined in a modular build, probably because putenv()
is a standard function in Unix98 / SUSv2.

Signed-off-by: Alan Coopersmith alan.coopersm...@oracle.com
---
 src/util.c |   66 
 1 files changed, 0 insertions(+), 66 deletions(-)

diff --git a/src/util.c b/src/util.c
index 812886d..83f3257 100644
--- a/src/util.c
+++ b/src/util.c
@@ -771,72 +771,6 @@ SetFocus (TwmWindow *tmp_win, Time time)
 XSetInputFocus (dpy, w, RevertToPointerRoot, time);
 }
 
-
-#ifdef NOPUTENV
-/**
- * define our own putenv() if the system doesn't have one.
- * putenv(s): place s (a string of the form NAME=value) in
- * the environment; replacing any existing NAME.  s is placed in
- * environment, so if you change s, the environment changes (like
- * putenv on a sun).  Binding removed if you putenv something else
- * called NAME.
- */
-int
-putenv(char *s)
-{
-char *v;
-int varlen, idx;
-extern char **environ;
-char **newenv;
-static int virgin = 1; /* true while environ is a virgin */
-
-v = index(s, '=');
-if(v == 0)
-   return 0; /* punt if it's not of the right form */
-varlen = (v + 1) - s;
-
-for (idx = 0; environ[idx] != 0; idx++) {
-   if (strncmp(environ[idx], s, varlen) == 0) {
-   if(v[1] != 0) { /* true if there's a value */
-   environ[idx] = s;
-   return 0;
-   } else {
-   do {
-   environ[idx] = environ[idx+1];
-   } while(environ[++idx] != 0);
-   return 0;
-   }
-   }
-}
-
-/* add to environment (unless no value; then just return) */
-if(v[1] == 0)
-   return 0;
-if(virgin) {
-   register i;
-
-   newenv = (char **) malloc((unsigned) ((idx + 2) * sizeof(char*)));
-   if(newenv == 0)
-   return -1;
-   for(i = idx-1; i = 0; --i)
-   newenv[i] = environ[i];
-   virgin = 0; /* you're not a virgin anymore, sweety */
-} else {
-   newenv = (char **) realloc((char *) environ,
-  (unsigned) ((idx + 2) * sizeof(char*)));
-   if (newenv == 0)
-   return -1;
-}
-
-environ = newenv;
-environ[idx] = s;
-environ[idx+1] = 0;
-
-return 0;
-}
-#endif /* NOPUTENV */
-
-
 static Pixmap 
 CreateXLogoPixmap (unsigned *widthp, unsigned *heightp)
 {
-- 
1.7.3.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel