if (sudo_setenv("PS1", buf)) { (void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]); exit(1); }
sudo_setenv("PS1", buf);
add_env(contiguous)    int contiguous;{    char idstr[MAX_UID_T_LEN + 1];    size_t size;    char *buf;    /* Add the SUDO_COMMAND envariable (cmnd + args). */    size = strlen(user_cmnd) + 1;    if (NewArgc > 1) {	char *to, **from;	if (contiguous) {	    size += (size_t) (NewArgv[NewArgc-1] - NewArgv[1]) +		    strlen(NewArgv[NewArgc-1]) + 1;	} else {	    for (from = &NewArgv[1]; *from; from++)		size += strlen(*from) + 1;	}	buf = (char *) emalloc(size);	/*	 * Copy the command and it's arguments info buf.	 */	(void) strcpy(buf, user_cmnd);	to = buf + strlen(user_cmnd);	for (from = &NewArgv[1]; *from; from++) {	    *to++ = ' ';	    (void) strcpy(to, *from);	    to += strlen(*from);	}    } else {	buf = user_cmnd;    }    if (sudo_setenv("SUDO_COMMAND", buf)) {	(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);	exit(1);    }    if (NewArgc > 1)	free(buf);    /* Grab a pointer to the flat arg string from the environment. */    if (NewArgc > 1 && (user_args = getenv("SUDO_COMMAND"))) {	if ((user_args = strchr(user_args, ' ')))	    user_args++;	else	    user_args = NULL;    }    /* Add the SUDO_USER environment variable. */    if (sudo_setenv("SUDO_USER", user_name)) {	(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);	exit(1);    }    /* Add the SUDO_UID environment variable. */    (void) sprintf(idstr, "%ld", (long) user_uid);    if (sudo_setenv("SUDO_UID", idstr)) {	(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);	exit(1);    }    /* Add the SUDO_GID environment variable. */    (void) sprintf(idstr, "%ld", (long) user_gid);    if (sudo_setenv("SUDO_GID", idstr)) {	(void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);	exit(1);    }    /* Set PS1 if SUDO_PS1 is set. */    if ((buf = getenv("SUDO_PS1")))	if (sudo_setenv("PS1", buf)) {	    (void) fprintf(stderr, "%s: cannot allocate memory!\n", Argv[0]);	    exit(1);	}}