"Fossies" - the Fresh Open Source Software Archive

Member "delegate9.9.13/maker/unsetenv.c" (16 Nov 2009, 422 Bytes) of package /linux/misc/old/delegate9.9.13.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "unsetenv.c" see the Fossies "Dox" file reference documentation.

    1 #ifdef __cplusplus
    2 extern "C" {
    3 #endif
    4 #ifndef RETYPE
    5 #define RETYPE void
    6 #endif
    7 
    8 extern char **environ;
    9 #include <string.h>
   10 RETYPE unsetenv(const char *name){
   11     int ei = 0;
   12     int eo = 0;
   13     int el = 0;
   14     char *e1;
   15 
   16     el = strlen(name);
   17     eo = 0;
   18     for( ei = 0; e1 = environ[ei]; ei++ ){
   19         if( strncmp(e1,name,el) == 0 && e1[el] == '=' ){
   20             continue;
   21         }
   22         environ[eo++] = e1;
   23     }
   24     environ[eo] = 0;
   25 }
   26 
   27 #ifdef __cplusplus
   28 }
   29 #endif