X-Git-Url: http://git.maemo.org/git/?p=browser-switch;a=blobdiff_plain;f=configfile.h;h=b8be9e65e8837219b14237cca54f44bed9d57d52;hp=c7863a7d602a4eb0c46ae738b919043b53a57a45;hb=f2de63c6e0c4bd6dd0bd02b8953b9a4d06a0bcb0;hpb=ca61ab9737a563adac6436de4fe35243b40345ef diff --git a/configfile.h b/configfile.h index c7863a7..b8be9e6 100644 --- a/configfile.h +++ b/configfile.h @@ -24,29 +24,24 @@ #define _CONFIGFILE_H #include -#include -#include #define DEFAULT_HOMEDIR "/home/user" #define CONFIGFILE_LOC "/.config/browser-switchboard" #define CONFIGFILE_LOC_OLD "/.config/browser-proxy" -#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 +struct swb_config_line { + /* Whether or not the line has been parsed */ + int parsed; + /* If parsed, the config key; otherwise, the entire line */ + char *key; + /* If parsed, the config value */ + char *value; +}; FILE *open_config_file(void); +int parse_config_file_begin(void); +void parse_config_file_end(void); +int parse_config_file_line(FILE *fp, struct swb_config_line *line); + #endif /* _CONFIGFILE_H */