|
samba unix风格的配置文件配置信息读取C代码.(5) #define get_character_len(x) 0 /* -------------------------------------------------------------------------- ** * Variables... * * DEBUGLEVEL - The ubiquitous DEBUGLEVEL. This determines which //DEBUG() * messages will be prodUCed. * bufr - pointer to a global buffer. This is probably a kludge, * but it was the nicest kludge I could think of (for now). * bSize - The size of the global buffer <bufr>. */ static char *bufr = NULL; static int bSize = 0; /* we can't use FILE* due to the 256 fd limit - use this cheap hack instead */ typedef struct { char *buf; char *p; size_t size; } myFILE; static int mygetc(myFILE *f) { if (f->p >= f->buf+f->size) return EOF; /* be sure to return chars >127 as positive values */ return (int)( *(f->p++) & 0x00FF ); } static void myfile_close(myFILE *f) { if (!f) return; SAFE_FREE(f->buf); SAFE_FREE(f); } /* -------------------------------------------------------------------------- ** * Functions... */ static int EatWhitespace( myFILE *InFile ) /* ------------------------------------------------------------------------ ** * Scan past whitespace (see ctype(3C)) and return the first non-whitespace * character, or newline, or EOF. * * Input: InFile - Input source.
|