Merge commit 'rob/config-refactor' into experimental
authorDuClare <akarinotengoku@gmail.com>
Wed, 13 May 2009 13:26:05 +0000 (16:26 +0300)
committerDuClare <akarinotengoku@gmail.com>
Wed, 13 May 2009 13:26:05 +0000 (16:26 +0300)
Conflicts:
uzbl.c

1  2 
uzbl.c

diff --cc uzbl.c
--- 1/uzbl.c
--- 2/uzbl.c
+++ b/uzbl.c
@@@ -684,16 -670,13 +684,16 @@@ static voi
  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;
@@@ -775,16 -758,11 +775,21 @@@ parse_cmd_line(char *ctl_line) 
          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);