[dovecot-cvs] dovecot/src/lib-settings settings.c,1.6,1.7
cras at procontrol.fi
cras at procontrol.fi
Wed Aug 27 18:35:56 EEST 2003
Update of /home/cvs/dovecot/src/lib-settings
In directory danu:/tmp/cvs-serv5539/lib-settings
Modified Files:
settings.c
Log Message:
Support # comments also at the end of setting lines
Index: settings.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-settings/settings.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- settings.c 26 Jul 2003 19:42:17 -0000 1.6
+++ settings.c 27 Aug 2003 14:35:54 -0000 1.7
@@ -66,7 +66,7 @@
{
struct istream *input;
const char *errormsg, *next_section;
- char *line, *key, *name;
+ char *line, *key, *name, *p, quote;
size_t len;
int fd, linenum, skip, sections, root_section;
@@ -100,6 +100,22 @@
/* ignore comments or empty lines */
if (*line == '#' || *line == '\0')
continue;
+
+ /* strip away comments. pretty kludgy way really.. */
+ for (p = line; *p != '\0'; p++) {
+ if (*p == '\'' || *p == '"') {
+ quote = *p;
+ for (p++; *p != quote && *p != '\0'; p++) {
+ if (*p == '\\' && p[1] != '\0')
+ p++;
+ }
+ if (*p == '\0')
+ break;
+ } else if (*p == '#') {
+ *p = '\0';
+ break;
+ }
+ }
/* remove whitespace from end of line */
len = strlen(line);
More information about the dovecot-cvs
mailing list