+\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
+ 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
+ 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
+ /* printf("REWRITE: %s -> %s\n",_,str); */\r
+ }\r
+ }\r
+\r