*** ./main.c.ORIG Thu Aug 25 09:38:09 2011 --- ./main.c Thu Aug 25 09:39:27 2011 *************** *** 3162,3167 **** --- 3162,3207 ---- #define USE_NO_DEV_TTY 0 #endif + + /*************************************************************************** + unsetenv() + ****************************************************************************/ + + #ifdef _AIX51 + int + unsetenv( const char *name ) + { + size_t len; + char **ep; + + if ((name == NULL) || (*name == '\0') || (strchr( name, '=' ) != NULL)) + { + errno = EINVAL; + return( -1 ); + } + + len = strlen( name ); + + ep = environ; + while (*ep != NULL) + if (! strncmp( *ep, name, len ) && (*ep)[len] == '=') + { + /* Found it. Remove this pointer by moving later ones back. */ + char **dp = ep; + + do + dp[0] = dp[1]; + while (*dp++); + /* Continue the loop in case NAME appears again. */ + } + else + ++ep; + + return( 0 ); + } + #endif + + /* * Inits pty and tty and forks a login process. * Does not close fd Xsocket.