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);
}
+
static gboolean
get_var_value(gchar *name) {
void **p = NULL;
else
printf("Error in command: %s\n", tokens[0]);
}
+ /* CMD command */
+ else if(ctl_line[0] == 'C') {
+ tokens = g_regex_split(uzbl.comm.cmd_regex, ctl_line, 0);
+ if(tokens[0][0] == 0) {
+ parse_command(tokens[1], tokens[2]);
+ g_strfreev(tokens);
+ }
+ 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);