X-Git-Url: http://git.maemo.org/git/?p=browser-switch;a=blobdiff_plain;f=configfile.c;fp=configfile.c;h=7f3b905f399d660fdb99c7bbef6f46f1e45b8f3b;hp=5200159357e8a09276c532c2727deac9c4cf56ec;hb=07c9702e8c2b041069e438d9547c85429cd32d76;hpb=63bfe571ee86f00936e30853f4289df6efd2b52d diff --git a/configfile.c b/configfile.c index 5200159..7f3b905 100644 --- a/configfile.c +++ b/configfile.c @@ -28,6 +28,22 @@ #include "configfile.h" +#define MAXLINE 1024 + +/* regex matching blank lines or comments */ +#define REGEX_IGNORE "^[[:space:]]*(#|$)" +#define REGEX_IGNORE_FLAGS REG_EXTENDED|REG_NOSUB + +/* regex matching foo = "bar", with arbitrary whitespace at beginning and end + of line and surrounding the = */ +#define REGEX_CONFIG1 "^[[:space:]]*([^=[:space:]]+)[[:space:]]*=[[:space:]]*\"(.*)\"[[:space:]]*$" +#define REGEX_CONFIG1_FLAGS REG_EXTENDED + +/* regex matching foo = bar, with arbitrary whitespace at beginning of line and + surrounding the = */ +#define REGEX_CONFIG2 "^[[:space:]]*([^=[:space:]]+)[[:space:]]*=[[:space:]]*(.*)$" +#define REGEX_CONFIG2_FLAGS REG_EXTENDED|REG_NEWLINE + static regex_t re_ignore, re_config1, re_config2; static int re_init = 0;