Mercurial > trustbridge
comparison cinst/main.c @ 626:f595fcbe3e76
Replace "normal printfs" with DEBUG / ERROR printf macros
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Fri, 20 Jun 2014 14:29:05 +0200 |
parents | f925ddfe6301 |
children | fb69aef056ea |
comparison
equal
deleted
inserted
replaced
625:2303caf56dbb | 626:f595fcbe3e76 |
---|---|
82 FILE *f = NULL; | 82 FILE *f = NULL; |
83 long file_size; | 83 long file_size; |
84 | 84 |
85 if (*to_install || *to_remove) | 85 if (*to_install || *to_remove) |
86 { | 86 { |
87 printf ("Error invalid parameters.\n"); | 87 ERRORPRINTF ("Error invalid parameters.\n"); |
88 return -1; | 88 return -1; |
89 } | 89 } |
90 | 90 |
91 f = fopen (file_name, "rb"); | 91 f = fopen (file_name, "rb"); |
92 if (f == NULL) | 92 if (f == NULL) |
111 while (fgets (buf, MAX_LINE_LENGTH + 1, f) ) | 111 while (fgets (buf, MAX_LINE_LENGTH + 1, f) ) |
112 { | 112 { |
113 size_t len = strlen (buf); /* fgets ensures buf is terminated */ | 113 size_t len = strlen (buf); /* fgets ensures buf is terminated */ |
114 if (len <= 3) | 114 if (len <= 3) |
115 { | 115 { |
116 printf ("Line too short.\n"); | 116 ERRORPRINTF ("Line too short.\n"); |
117 fclose (f); | 117 fclose (f); |
118 return ERR_INVALID_INPUT; | 118 return ERR_INVALID_INPUT; |
119 } | 119 } |
120 if (lines_read++ > MAX_LINES) | 120 if (lines_read++ > MAX_LINES) |
121 { | 121 { |
122 printf ("Too many lines\n"); | 122 ERRORPRINTF ("Too many lines\n"); |
123 fclose (f); | 123 fclose (f); |
124 return ERR_TOO_MUCH_INPUT; | 124 return ERR_TOO_MUCH_INPUT; |
125 } | 125 } |
126 if (*buf == 'I') | 126 if (*buf == 'I') |
127 { | 127 { |