* configure.in: removed target_dependent line.
[deliverable/binutils-gdb.git] / gdb / putenv.c
index f7318f08084f0601e6099f8dedbe2ba4813347f7..d111e85d251d1f38da9d244bd013a56c14f8990f 100644 (file)
@@ -9,21 +9,16 @@
 /****************************************************************/
 
 /*
-From pacbell!ames!ll-xn!mit-eddie!uw-beaver!ssc-vax!uvicctr!tholm Wed May  4 23:40:52 1988
 Path: hoptoad!pacbell!ames!ll-xn!mit-eddie!uw-beaver!ssc-vax!uvicctr!tholm
 From: tholm@uvicctr.UUCP (Terrence W. Holm)
 Newsgroups: comp.os.minix
 Subject: putenv(3)
 Message-ID: <395@uvicctr.UUCP>
 Date: 5 May 88 06:40:52 GMT
-Reply-To: tholm@uvicctr.UUCP (Terrence W. Holm)
 Organization: University of Victoria, Victoria B.C. Canada
-Lines: 296
-
 
 EFTH Minix report #2  - May 1988 -  putenv(3)
 
-
 This is an implementation of putenv(3) that we
 wrote for Minix. Please consider this a public
 domain program.
@@ -31,19 +26,16 @@ domain program.
 
 #include <stdio.h>
 
-
 #define  PSIZE  sizeof(char *)
 
-
 extern  char  **environ;
 
-
 char  *index();
 char  *malloc();
 
-
 /****************************************************************/
 /*                                                             */
+/*      int                                                    */
 /*     putenv( entry )                                         */
 /*                                                             */
 /*             The "entry" should follow the form              */
@@ -70,21 +62,23 @@ char  *malloc();
 /****************************************************************/
 
 
+int
 putenv( entry )
   char *entry;
-
-  {
+{
   unsigned length;
   unsigned size;
+  char     *temp;
   char     **p;
   char     **new_environ;
 
   /*  Find the length of the "NAME="  */
 
-  if ( (length=(unsigned) index(entry,'=')) == NULL )
+  temp = index(entry,'=');
+  if ( temp == 0 )
     return( -1 );
 
-  length = length - (unsigned) entry + 1;
+  length = (unsigned) (temp - entry + 1);
 
 
   /*  Scan through the environment looking for "NAME="  */
@@ -93,7 +87,7 @@ putenv( entry )
     if ( strncmp( entry, *p, length ) == 0 )
       {
       *p = entry;
-      return( NULL );
+      return( 0 );
       }
 
 
@@ -103,15 +97,15 @@ putenv( entry )
 
   new_environ = (char **) malloc( (size+2)*PSIZE );
 
-  if ( new_environ == NULL )
+  if ( new_environ == (char **) NULL )
     return( -1 );
 
-  bcopy( (char *) environ, (char *) new_environ, size*PSIZE );
+  memcpy ((char *) new_environ, (char *) environ, size*PSIZE );
 
   new_environ[size]   = entry;
   new_environ[size+1] = NULL;
 
   environ = new_environ;
 
-  return(NULL);
-  }
+  return(0);
+}
This page took 0.025385 seconds and 4 git commands to generate.