*** ./util.c.ORIG Thu Nov 19 14:32:59 2009 --- ./util.c Thu Nov 19 14:33:17 2009 *************** *** 153,158 **** --- 153,196 ---- return atoi(buff); } + /*************************************************************************** + unsetenv() + ****************************************************************************/ + + #ifdef _AIX + 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 + static time_t mktime_utc(struct tm * tm, const char* tzbuf) { char * old_tz = getenv("TZ");