Doxygen Source Code Documentation
        
Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search   
getenv_.c
Go to the documentation of this file.00001 #include "f2c.h"
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 #ifdef KR_headers
00016 VOID getenv_(fname, value, flen, vlen) char *value, *fname; ftnlen vlen, flen;
00017 #else
00018 void getenv_(char *fname, char *value, ftnlen flen, ftnlen vlen)
00019 #endif
00020 {
00021 extern char **environ;
00022 register char *ep, *fp, *flast;
00023 register char **env = environ;
00024 
00025 flast = fname + flen;
00026 for(fp = fname ; fp < flast ; ++fp)
00027         if(*fp == ' ')
00028                 {
00029                 flast = fp;
00030                 break;
00031                 }
00032 
00033 while (ep = *env++)
00034         {
00035         for(fp = fname; fp<flast ; )
00036                 if(*fp++ != *ep++)
00037                         goto endloop;
00038 
00039         if(*ep++ == '=') {      
00040                 while( *ep && --vlen>=0 )
00041                         *value++ = *ep++;
00042 
00043                 goto blank;
00044                 }
00045 endloop: ;
00046         }
00047 
00048 blank:
00049         while( --vlen >= 0 )
00050                 *value++ = ' ';
00051 }