1 #include <stdlib.h> 2 #include <string.h> 3 #include <stdio.h> 4 #include "btparse.h" 5 6 int main(void)7main (void) 8 { 9 char line[1024]; 10 int line_num; 11 int len, i; 12 13 while (! feof (stdin)) 14 { 15 if (fgets (line, 1024, stdin)) 16 { 17 len = strlen (line); 18 if (line[len-1] == '\n') line[len-1] = '\0'; 19 line_num++; 20 printf ("original string = %s\n", line); 21 bt_purify_string (line, 0); 22 len = strlen (line); 23 24 /* strip trailing spaces so our output looks like BibTeX's */ 25 for (i = len-1; line[i] == ' '; i--) 26 line[i] = (char) 0; 27 28 if (len > 0) 29 printf ("purified string = %s\n", line); 30 else /* more imitating BibTeX's output */ 31 printf ("purified string =\n"); 32 printf ("purified length = %d\n", len); 33 } 34 } 35 return 0; 36 } 37 38