[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Fix DOS line endings; autoconfize checks for strptime and ...



Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv15735/src/or

Modified Files:
	connection.c or.h routerlist.c 
Log Message:
Fix DOS line endings; autoconfize checks for strptime and  inet_aton

Index: connection.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection.c,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -d -r1.177 -r1.178
--- connection.c	9 Mar 2004 22:01:16 -0000	1.177
+++ connection.c	9 Mar 2004 22:09:13 -0000	1.178
@@ -418,7 +418,7 @@
 
   if(options.ORPort) {
     listener_close_if_present(CONN_TYPE_OR_LISTENER);
-    if(connection_create_listener(options.ORBindAddress, 
+    if(connection_create_listener(options.ORBindAddress, 
 		                          (uint16_t) options.ORPort,
                                   CONN_TYPE_OR_LISTENER) < 0)
       return -1;
@@ -426,7 +426,7 @@
 
   if(options.DirPort) {
     listener_close_if_present(CONN_TYPE_DIR_LISTENER);
-    if(connection_create_listener(options.DirBindAddress, 
+    if(connection_create_listener(options.DirBindAddress, 
 		                          (uint16_t) options.DirPort,
                                   CONN_TYPE_DIR_LISTENER) < 0)
       return -1;
@@ -434,7 +434,7 @@
 
   if(options.SocksPort) {
     listener_close_if_present(CONN_TYPE_AP_LISTENER);
-    if(connection_create_listener(options.SocksBindAddress, 
+    if(connection_create_listener(options.SocksBindAddress,
 		                          (uint16_t) options.SocksPort,
                                   CONN_TYPE_AP_LISTENER) < 0)
       return -1;

Index: or.h
===================================================================
RCS file: /home/or/cvsroot/src/or/or.h,v
retrieving revision 1.247
retrieving revision 1.248
diff -u -d -r1.247 -r1.248
--- or.h	9 Mar 2004 22:01:16 -0000	1.247
+++ or.h	9 Mar 2004 22:09:13 -0000	1.248
@@ -84,7 +84,7 @@
 
 #ifdef MS_WINDOWS
 #include <io.h>
-#include <process.h>
+#include <process.h>
 #include <direct.h>
 #define WIN32_LEAN_AND_MEAN
 #include <windows.h>

Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- routerlist.c	9 Mar 2004 22:01:16 -0000	1.34
+++ routerlist.c	9 Mar 2004 22:09:13 -0000	1.35
@@ -539,36 +539,35 @@
 int router_exit_policy_rejects_all(routerinfo_t *router) {
   return router_compare_addr_to_exit_policy(0, 0, router->exit_policy) 
     == ADDR_POLICY_REJECTED;
-}
-
-static time_t parse_time(const char *cp)
-{
-  struct tm st_tm;
-  /* XXXX WWWW should be HAVE_STRPTIME */
-#ifndef MS_WINDOWS
-  if (!strptime(cp, "%Y-%m-%d %H:%M:%S", &st_tm)) {
-    log_fn(LOG_WARN, "Published time was unparseable"); return 0;
-  }
-#else 
-  unsigned int year=0, month=0, day=0, hour=100, minute=100, second=100;
-  if (scanf("%u-%u-%u %u:%u:%u", cp, &year, &month, 
-	        &day, &hour, &minute, &second) < 6) {
-	log_fn(LOG_WARN, "Published time was unparseable"); return 0;
-  }
-  if (year < 2000 || month < 1 || month > 12 || day < 1 || day > 31 ||
-	  hour > 24 || minute > 61 || second > 62) {
-	log_fn(LOG_WARN, "Published time was nonsensical"); return 0;
-  }
-  st_tm.tm_year = year;
-  st_tm.tm_mon = month;
-  st_tm.tm_mday = day;
-  st_tm.tm_hour = hour;
-  st_tm.tm_min = minute;
-  st_tm.tm_sec = second;
-#endif
-  return tor_timegm(&st_tm);
-
-}
+}
+
+static time_t parse_time(const char *cp)
+{
+  struct tm st_tm;
+#ifdef HAVE_STRPTIME
+  if (!strptime(cp, "%Y-%m-%d %H:%M:%S", &st_tm)) {
+    log_fn(LOG_WARN, "Published time was unparseable"); return 0;
+  }
+#else 
+  unsigned int year=0, month=0, day=0, hour=100, minute=100, second=100;
+  if (scanf("%u-%u-%u %u:%u:%u", cp, &year, &month, 
+	        &day, &hour, &minute, &second) < 6) {
+	log_fn(LOG_WARN, "Published time was unparseable"); return 0;
+  }
+  if (year < 2000 || month < 1 || month > 12 || day < 1 || day > 31 ||
+	  hour > 24 || minute > 61 || second > 62) {
+	log_fn(LOG_WARN, "Published time was nonsensical"); return 0;
+  }
+  st_tm.tm_year = year;
+  st_tm.tm_mon = month;
+  st_tm.tm_mday = day;
+  st_tm.tm_hour = hour;
+  st_tm.tm_min = minute;
+  st_tm.tm_sec = second;
+#endif
+  return tor_timegm(&st_tm);
+
+}
 
 
 /* Helper function: parse a directory from 's' and, when done, store the
@@ -632,8 +631,8 @@
     goto err;
   }
   assert(tok->n_args == 1);
-  
-  if (!(published_on = parse_time(tok->args[0]))) {
+  
+  if (!(published_on = parse_time(tok->args[0]))) {
      goto err;
   }
 
@@ -902,8 +901,8 @@
   if (!(tok = find_first_by_keyword(tokens, K_PUBLISHED))) {
     log_fn(LOG_WARN, "Missing published time"); goto err;
   }
-  assert(tok->n_args == 1);
-  if (!(router->published_on = parse_time(tok->args[0]))) 
+  assert(tok->n_args == 1);
+  if (!(router->published_on = parse_time(tok->args[0])))
 	  goto err;
 
   if (!(tok = find_first_by_keyword(tokens, K_ONION_KEY))) {