some bugfixes
authorxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Wed, 11 Jun 2014 23:00:11 +0000 (23:00 +0000)
committerxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Wed, 11 Jun 2014 23:00:11 +0000 (23:00 +0000)
git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@243 251d49ef-1d17-4917-a970-b30cf55b089b

parsehosts.c
prometheus.c

index 18418eddb6b9c587d6ec23925a71c6f8ed011c48..ecb956a3a53edbf2bd1c3d2d7586d4324d9bc246 100644 (file)
@@ -1,4 +1,4 @@
-/* Modified by: xChaos, 20131029 */\r
+/* Modified by: xChaos, 20131220 */\r
 \r
 #include "cll1-0.6.2.h"\r
 #include "ipstruct.h"\r
 \r
 #include "cll1-0.6.2.h"\r
 #include "ipstruct.h"\r
@@ -163,23 +163,30 @@ void parse_hosts(char *hosts)
    /* any line starting with non-number is comment ...*/\r
    continue;\r
   }\r
    /* any line starting with non-number is comment ...*/\r
    continue;\r
   }\r
-  \r
+\r
+  ptr = strchr(str,'\r'); /* fore unix-style end of line */\r
+  if(ptr)\r
+  {\r
+   *ptr = 0;\r
+  }\r
\r
   /* first, expand (rewrite) any predefined macros, if found*/\r
   for_each(macro, macros)\r
   {\r
    substring = strstr(str, macro->rewrite_from);\r
   /* first, expand (rewrite) any predefined macros, if found*/\r
   for_each(macro, macros)\r
   {\r
    substring = strstr(str, macro->rewrite_from);\r
-   if(substring);\r
+   if(substring)\r
    {\r
     int l1, l3;\r
     *substring = 0;\r
     substring += strlen(macro->rewrite_from);\r
     l1 = strlen(str);\r
     l3 = strlen(substring);\r
    {\r
     int l1, l3;\r
     *substring = 0;\r
     substring += strlen(macro->rewrite_from);\r
     l1 = strlen(str);\r
     l3 = strlen(substring);\r
-    string(ptr, l1 + strlen(macro->rewrite_to) + l3);\r
+    string(ptr, l1 + strlen(macro->rewrite_to) + l3 + 1);\r
     strcpy(ptr, str);\r
     strcat(ptr, macro->rewrite_to);\r
     strcat(ptr, substring);\r
     str = ptr;\r
     strcpy(ptr, str);\r
     strcat(ptr, macro->rewrite_to);\r
     strcat(ptr, substring);\r
     str = ptr;\r
+    /*  printf("REWRITE: %s -> %s\n",_,str); */\r
    }\r
   }\r
 \r
    }\r
   }\r
 \r
@@ -329,4 +336,4 @@ void parse_hosts(char *hosts)
 // TheIP("0.0.0.0", TRUE);\r
 // ip->name = "TOTAL";\r
 // ip->mask = 0;\r
 // TheIP("0.0.0.0", TRUE);\r
 // ip->name = "TOTAL";\r
 // ip->mask = 0;\r
-}
\ No newline at end of file
+}\r
index e091d6e095df8ada02c802803c5d84cdf1a67a2d..43238b3ca276161ffa5d04a00e9f125b8df23bbd 100644 (file)
@@ -581,6 +581,23 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
  string(str, STRLEN); \r
  string(limit_pkts, STRLEN);\r
 \r
  string(str, STRLEN); \r
  string(limit_pkts, STRLEN);\r
 \r
+ /*-----------------------------------------------------------------*/\r
+ printf("Parsing macro definition file %s ...\n", macrosfile);\r
+ /*-----------------------------------------------------------------*/\r
+ parse(macrosfile)\r
+ {\r
+  ptr = parse_datafile_line(_);\r
+  if(ptr)\r
+  {\r
+   create(macro, Macro);\r
+   macro->rewrite_from = _;\r
+   macro->rewrite_to = ptr;\r
+   push(macro, macros);\r
+   printf("%s -> %s\n", macro->rewrite_from, macro->rewrite_to);\r
+  }\r
+ }\r
+ done; /* ugly macro end */\r
+\r
  /*-----------------------------------------------------------------*/\r
  printf("Parsing class defintion file %s ...\n", hosts);\r
  /*-----------------------------------------------------------------*/\r
  /*-----------------------------------------------------------------*/\r
  printf("Parsing class defintion file %s ...\n", hosts);\r
  /*-----------------------------------------------------------------*/\r
@@ -631,25 +648,6 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
   done; /* ugly macro end */\r
  }\r
 \r
   done; /* ugly macro end */\r
  }\r
 \r
- if(enable_credit && just_flush<9)\r
- {\r
-  /*-----------------------------------------------------------------*/\r
-  printf("Parsing macro definition file %s ...\n", macrosfile);\r
-  /*-----------------------------------------------------------------*/\r
-  parse(macrosfile)\r
-  {\r
-   ptr = parse_datafile_line(_);\r
-   if(ptr)\r
-   {\r
-    create(macro, Macro);\r
-    macro->rewrite_from = _;\r
-    macro->rewrite_to = ptr;\r
-    push(macro, macros);\r
-    printf("%s -> %s\n", macro->rewrite_from, macro->rewrite_to);\r
-   }\r
-  }\r
-  done; /* ugly macro end */\r
- }\r
 \r
  if(!just_preview)\r
  {\r
 \r
  if(!just_preview)\r
  {\r
This page took 0.178613 seconds and 4 git commands to generate.