<x-flowed>
Here's a better way to do setenv in Solaris:

lib.h:
   int setenv(char *name, char *value, int clobber);

lib.c:
   int     setenv(char *name, char *value, int clobber)
   {
       char   *malloc();
       char   *getenv();
       char   *cp;

       if (clobber == 0 && getenv(name) != 0)
           return (0);
       if ((cp = malloc(strlen(name) + strlen(value) + 2)) == 0)
           return (1);
       sprintf(cp, "%s=%s", name, value);
       return (putenv(cp));
   }

Should the type for malloc() actually be an int?
It looks that way to me and gives a warning, although it works.

-Jon

_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


</x-flowed>

Reply via email to