setup_regex() {
GError *err=NULL;
- uzbl.comm.get_regex = g_regex_new("^GET\\s+([^ \\n]+)$",
+ uzbl.comm.get_regex = g_regex_new("^[Gg][a-zA-Z]*\\s+([^ \\n]+)$",
G_REGEX_OPTIMIZE, 0, &err);
- uzbl.comm.set_regex = g_regex_new("^SET\\s+([^ ]+)\\s*=\\s*([^\\n].*)$",
+ uzbl.comm.set_regex = g_regex_new("^[Ss][a-zA-Z]*\\s+([^ ]+)\\s*=\\s*([^\\n].*)$",
G_REGEX_OPTIMIZE, 0, &err);
- uzbl.comm.bind_regex = g_regex_new("^BIND\\s+?(.*[^ ])\\s*?=\\s*([a-z][^\\n].+)$",
+ uzbl.comm.bind_regex = g_regex_new("^[Bb][a-zA-Z]*\\s+?(.*[^ ])\\s*?=\\s*([a-z][^\\n].+)$",
G_REGEX_UNGREEDY|G_REGEX_OPTIMIZE, 0, &err);
uzbl.comm.cmd_regex = g_regex_new("^CMD\\s+([^ \\n]+)\\s*([^\\n]*)?$",
G_REGEX_OPTIMIZE, 0, &err);
gchar **tokens;
/* SET command */
- if(ctl_line[0] == 'S') {
+ if(ctl_line[0] == 's' || ctl_line[0] == 'S') {
tokens = g_regex_split(uzbl.comm.set_regex, ctl_line, 0);
if(tokens[0][0] == 0) {
set_var_value(tokens[1], tokens[2]);
printf("Error in command: %s\n", tokens[0]);
}
/* GET command */
- else if(ctl_line[0] == 'G') {
+ else if(ctl_line[0] == 'g' || ctl_line[0] == 'G') {
tokens = g_regex_split(uzbl.comm.get_regex, ctl_line, 0);
if(tokens[0][0] == 0) {
get_var_value(tokens[1]);
printf("Error in command: %s\n", tokens[0]);
}
/* BIND command */
- else if(ctl_line[0] == 'B') {
+ else if(ctl_line[0] == 'b' || ctl_line[0] == 'B') {
tokens = g_regex_split(uzbl.comm.bind_regex, ctl_line, 0);
if(tokens[0][0] == 0) {
add_binding(tokens[1], tokens[2]);
else
printf("Error in command: %s\n", tokens[0]);
}
+ /* Comments */
+ else if( (ctl_line[0] == '#')
+ || (ctl_line[0] == ' ')
+ || (ctl_line[0] == '\n'))
+ ; /* ignore these lines */
else
printf("Command not understood (%s)\n", ctl_line);