comparison src/conf.c @ 14:a8f3424347dc

replaced number 0 with character \0 where appropriate
author meillo@marmaro.de
date Wed, 29 Oct 2008 21:21:26 +0100
parents 49dab67fe461
children 71605f542ecc
comparison
equal deleted inserted replaced
13:49dab67fe461 14:a8f3424347dc
116 gchar *p, *q; 116 gchar *p, *q;
117 117
118 DEBUG(6) fprintf(stderr, "parsing list %s\n", line); 118 DEBUG(6) fprintf(stderr, "parsing list %s\n", line);
119 119
120 p = line; 120 p = line;
121 while (*p != 0) { 121 while (*p != '\0') {
122 q = buf; 122 q = buf;
123 123
124 while (*p && (*p != ';') && (q < buf + 255)) 124 while (*p && (*p != ';') && (q < buf + 255))
125 *(q++) = *(p++); 125 *(q++) = *(p++);
126 *q = 0; 126 *q = '\0';
127 127
128 if ((buf[0] == '/') && (read_file)) 128 if ((buf[0] == '/') && (read_file))
129 /* item is a filename, include its contents */ 129 /* item is a filename, include its contents */
130 list = g_list_concat(list, parse_list_file(buf)); 130 list = g_list_concat(list, parse_list_file(buf));
131 else 131 else
198 198
199 DEBUG(6) fprintf(stderr, "parse_interface: %s\n", line); 199 DEBUG(6) fprintf(stderr, "parse_interface: %s\n", line);
200 200
201 p = line; 201 p = line;
202 q = buf; 202 q = buf;
203 while ((*p != 0) && (*p != ':') && (q < buf + 255)) 203 while ((*p != '\0') && (*p != ':') && (q < buf + 255))
204 *(q++) = *(p++); 204 *(q++) = *(p++);
205 *q = 0; 205 *q = '\0';
206 206
207 iface = g_malloc(sizeof(interface)); 207 iface = g_malloc(sizeof(interface));
208 iface->address = g_strdup(buf); 208 iface->address = g_strdup(buf);
209 209
210 if (*p) { 210 if (*p) {
227 227
228 DEBUG(6) fprintf(stderr, "parse_network: %s\n", line); 228 DEBUG(6) fprintf(stderr, "parse_network: %s\n", line);
229 229
230 p = line; 230 p = line;
231 q = buf; 231 q = buf;
232 while ((*p != 0) && (*p != '/') && (q < buf + 255)) 232 while ((*p != '\0') && (*p != '/') && (q < buf + 255))
233 *(q++) = *(p++); 233 *(q++) = *(p++);
234 *q = 0; 234 *q = '\0';
235 235
236 if ((addr.s_addr = inet_addr(buf)) != INADDR_NONE) { 236 if ((addr.s_addr = inet_addr(buf)) != INADDR_NONE) {
237 if (*p) { 237 if (*p) {
238 guint i; 238 guint i;
239 p++; 239 p++;
320 && (c != EOF)) { 320 && (c != EOF)) {
321 *ptr = c; 321 *ptr = c;
322 ptr++; 322 ptr++;
323 c = fgetc(in); 323 c = fgetc(in);
324 } 324 }
325 *ptr = 0; 325 *ptr = '\0';
326 ungetc(c, in); 326 ungetc(c, in);
327 327
328 if (c == EOF) { 328 if (c == EOF) {
329 fprintf(stderr, "unexpected EOF after %s\n", buf); 329 fprintf(stderr, "unexpected EOF after %s\n", buf);
330 return FALSE; 330 return FALSE;
334 334
335 eat_spaces(in); 335 eat_spaces(in);
336 336
337 DEBUG(6) fprintf(stderr, "lval = %s\n", buf); 337 DEBUG(6) fprintf(stderr, "lval = %s\n", buf);
338 338
339 return buf[0] != 0; 339 return buf[0] != '\0';
340 } 340 }
341 341
342 static gboolean 342 static gboolean
343 read_rval(FILE * in, gchar * buf, gint size) 343 read_rval(FILE * in, gchar * buf, gint size)
344 { 344 {
357 && (c != EOF)) { 357 && (c != EOF)) {
358 *ptr = c; 358 *ptr = c;
359 ptr++; 359 ptr++;
360 c = fgetc(in); 360 c = fgetc(in);
361 } 361 }
362 *ptr = 0; 362 *ptr = '\0';
363 ungetc(c, in); 363 ungetc(c, in);
364 } else { 364 } else {
365 gboolean escape = FALSE; 365 gboolean escape = FALSE;
366 c = fgetc(in); 366 c = fgetc(in);
367 while (((c != '\"') || escape) && (ptr < buf + size - 1)) { 367 while (((c != '\"') || escape) && (ptr < buf + size - 1)) {
374 escape = FALSE; 374 escape = FALSE;
375 } 375 }
376 } 376 }
377 c = fgetc(in); 377 c = fgetc(in);
378 } 378 }
379 *ptr = 0; 379 *ptr = '\0';
380 } 380 }
381 381
382 eat_line_trailing(in); 382 eat_line_trailing(in);
383 383
384 DEBUG(6) fprintf(stderr, "rval = %s\n", buf); 384 DEBUG(6) fprintf(stderr, "rval = %s\n", buf);