diff options
author | Bruce Montrose <montrose@itd.nrl.navy.mil> | 2002-07-09 19:51:41 +0000 |
---|---|---|
committer | Bruce Montrose <montrose@itd.nrl.navy.mil> | 2002-07-09 19:51:41 +0000 |
commit | 62ead018a16d6a1a1e12f9c6183fbd2e4a11ec3d (patch) | |
tree | 767d1c73a6a2139ff2d5ade039c58fed24970d05 /src/common | |
parent | 0a3da3ae37dc048f6079d0e4cffd057d07e13216 (diff) | |
download | tor-62ead018a16d6a1a1e12f9c6183fbd2e4a11ec3d.tar tor-62ead018a16d6a1a1e12f9c6183fbd2e4a11ec3d.tar.gz |
Miscellaneous bug fixes / activated "make check" for src/or
svn:r31
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/config.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/common/config.c b/src/common/config.c index 3efcbe207..3d4162dab 100644 --- a/src/common/config.c +++ b/src/common/config.c @@ -8,6 +8,9 @@ /* * Changes : * $Log$ + * Revision 1.4 2002/07/09 19:51:41 montrose + * Miscellaneous bug fixes / activated "make check" for src/or + * * Revision 1.3 2002/07/03 16:31:22 montrose * Added getoptions() and made minor adjustment to poptReadDefaultOptions() * @@ -361,19 +364,17 @@ RETURN VALUE: INT_MIN = problem opening config file, else standard poptGetNextOp **/ { FILE *fp; - int argc, c; + int argc, c, n; char **argv; char line[1024]; line[0] = line[1] = '-'; /* prepend expected long name option flag */ - fp = open_config(fname); + fp = fopen(fname,"r"); if ( fp == NULL ) return INT_MIN; c = 0; - /** - this loop skips over all leading whitespace and blank lines then returns all text - from that point to the next newline. - **/ - while ( c >= -1 && fscanf(fp,"%*[ \n]%[^\n]",&line[2]) == 1 ) + while ( c >= -1 ) { + if ( fscanf(fp,"%*[ \n]%n",&n) == EOF ) break; /* eat leading whitespace */ + if ( fscanf(fp, "%[^\n]",&line[2]) == EOF ) break; /* read a line */ switch ( line[2] ) { case '#': /* comments begin with this */ @@ -386,7 +387,7 @@ RETURN VALUE: INT_MIN = problem opening config file, else standard poptGetNextOp c = poptGetNextOpt(optCon); /* interpret option read from config file */ } } - close_config(fp); + fclose(fp); return c; } |