-/*
- * Set the value of var to be arg in the Unix 4.2 BSD environment env.
- * Var should end with '='.
- * (bindings are of the form "var=value")
- * This procedure assumes the memory for the first level of environ
- * was allocated using malloc.
- */
-setenv(var, value, clobber)
- char *var, *value;
-{
- extern char **environ;
- int index = 0;
- int varlen = strlen(var);
- int vallen = strlen(value);
-
- for (index = 0; environ[index] != NULL; index++) {
- if (strncmp(environ[index], var, varlen) == 0) {
- /* found it */
- if (!clobber)
- return;
- environ[index] = malloc(varlen + vallen + 1);
- strcpy(environ[index], var);
- strcat(environ[index], value);
- return;
- }
- }
- environ = (char **) realloc(environ, sizeof (char *) * (index + 2));
- if (environ == NULL) {
- fprintf(stderr, "login: malloc out of memory\n");
- exit(1);
- }
- environ[index] = malloc(varlen + vallen + 1);
- strcpy(environ[index], var);
- strcat(environ[index], value);
- environ[++index] = NULL;
-}
-
-write_gid()