]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Miscellaneous bug fixes / activated "make check" for src/or
authorBruce Montrose <montrose@itd.nrl.navy.mil>
Tue, 9 Jul 2002 19:51:41 +0000 (19:51 +0000)
committerBruce Montrose <montrose@itd.nrl.navy.mil>
Tue, 9 Jul 2002 19:51:41 +0000 (19:51 +0000)
svn:r31

src/common/config.c
src/or/Makefile.am
src/or/config.c

index 3efcbe207ad82ce1a5820cb892b63c48aa75630b..3d4162dab1dda2ef46f09b38e596b6c70580bf69 100644 (file)
@@ -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;
 }
 
index d0e78a5525df6dfc262ac18a25e3f431172c61ee..f2967769024e1e9547fe5d5a96ed4bee12301908 100644 (file)
@@ -1,4 +1,8 @@
 
+TESTS = test_config
+
+noinst_PROGRAMS = test_config
+
 bin_PROGRAMS = or
 
 or_LDADD = -L../common -lor
@@ -7,6 +11,10 @@ or_SOURCES = args.c buffers.c cell.c circuit.c command.c connection.c \
              connection_exit.c connection_ap.c connection_op.c connection_or.c config.c \
              main.c onion.c routers.c
 
+test_config_SOURCES = test_config.c
+
+test_config_LDADD = config.o -L../common -lor
+
 noinst_HEADERS = or.h
 
 
index 619f6497a3706dfcff4288bd0292097ec075adb6..e70e1a17b7d8b4009417640087b90f79c29ad66a 100644 (file)
@@ -8,6 +8,9 @@
 /*
  * Changes :
  * $Log$
+ * Revision 1.5  2002/07/09 19:51:41  montrose
+ * Miscellaneous bug fixes / activated "make check" for src/or
+ *
  * Revision 1.4  2002/07/03 19:58:18  montrose
  * minor bug fix in error checking
  *
@@ -117,10 +120,10 @@ RETURN VALUE: 0 on success, non-zero on error
    case -1:
       if ( Verbose )                      /* display options upon user request */
       {
-         printf("\nLogLevel=%s\n",options->LogLevel);
+         printf("LogLevel=%s\n",options->LogLevel);
          printf("RouterFile=%s, PrivateKeyFile=%s\n",options->RouterFile,options->PrivateKeyFile);
          printf("ORPort=%d, OPPort=%d, APPort=%d\n",options->ORPort,options->OPPort,options->APPort);
-         printf("CoinWeight=%6.4f, MaxConn=%d, TrafficShaping=%d\n\n",options->CoinWeight,options->MaxConn,options->TrafficShaping);
+         printf("CoinWeight=%6.4f, MaxConn=%d, TrafficShaping=%d\n",options->CoinWeight,options->MaxConn,options->TrafficShaping);
       }
       code = 0;
       break;