comparison src/conf.c @ 13:49dab67fe461

code beautifying
author meillo@marmaro.de
date Wed, 29 Oct 2008 21:10:18 +0100
parents 26e34ae9a3e3
children a8f3424347dc
comparison
equal deleted inserted replaced
12:9fb7ddbaf129 13:49dab67fe461
14 You should have received a copy of the GNU General Public License 14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 17 */
18 18
19 #include <pwd.h>
20 #include <grp.h>
21
19 #include "masqmail.h" 22 #include "masqmail.h"
20
21 #include "pwd.h"
22 #include "grp.h"
23 23
24 masqmail_conf conf; 24 masqmail_conf conf;
25 25
26 void 26 void
27 init_conf() 27 init_conf()
105 } 105 }
106 106
107 return list; 107 return list;
108 } 108 }
109 109
110 /* given a semicolon separated string, this function 110 /* given a semicolon separated string, this function makes a GList out of it. */
111 makes a GList out of it.
112 */
113 GList* 111 GList*
114 parse_list(gchar * line, gboolean read_file) 112 parse_list(gchar * line, gboolean read_file)
115 { 113 {
116 GList *list = NULL; 114 GList *list = NULL;
117 gchar buf[256]; 115 gchar buf[256];
352 if (!eat_spaces(in)) 350 if (!eat_spaces(in))
353 return FALSE; 351 return FALSE;
354 352
355 c = fgetc(in); 353 c = fgetc(in);
356 if (c != '\"') { 354 if (c != '\"') {
357 while ((isalnum(c) || c == '_' || c == '-' || c == '.' || c == '/' 355 while ((isalnum(c) || c == '_' || c == '-' || c == '.' || c == '/' || c == '@' || c == ';')
358 || c == '@' || c == ';')
359 && (ptr < buf + size - 1) 356 && (ptr < buf + size - 1)
360 && (c != EOF)) { 357 && (c != EOF)) {
361 *ptr = c; 358 *ptr = c;
362 ptr++; 359 ptr++;
363 c = fgetc(in); 360 c = fgetc(in);
366 ungetc(c, in); 363 ungetc(c, in);
367 } else { 364 } else {
368 gboolean escape = FALSE; 365 gboolean escape = FALSE;
369 c = fgetc(in); 366 c = fgetc(in);
370 while (((c != '\"') || escape) && (ptr < buf + size - 1)) { 367 while (((c != '\"') || escape) && (ptr < buf + size - 1)) {
371 if (c != '\n') { /* ignore line breaks */ 368 if (c != '\n') { /* ignore line breaks */
372 if ((c == '\\') && (!escape)) { 369 if ((c == '\\') && (!escape)) {
373 escape = TRUE; 370 escape = TRUE;
374 } else { 371 } else {
375 *ptr = c; 372 *ptr = c;
376 ptr++; 373 ptr++;
408 if (read_rval(in, rval, rsize)) { 405 if (read_rval(in, rval, rsize)) {
409 DEBUG(6) fprintf(stderr, "rval = %s\n", rval); 406 DEBUG(6) fprintf(stderr, "rval = %s\n", rval);
410 return TRUE; 407 return TRUE;
411 } 408 }
412 } else { 409 } else {
413 fprintf(stderr, "'=' expected after %s, char was '%c'\n", lval, 410 fprintf(stderr, "'=' expected after %s, char was '%c'\n", lval, c);
414 c);
415 } 411 }
416 } 412 }
417 return FALSE; 413 return FALSE;
418 } 414 }
419 415