$OpenBSD: patch-src_config_parser_c,v 1.8 2015/12/18 15:53:09 dcoppa Exp $

Allow the commands parser to use "number" arguments by making the stack typed.

--- src/config_parser.c.orig	Wed Sep 30 08:55:10 2015
+++ src/config_parser.c	Fri Dec 18 13:58:58 2015
@@ -122,7 +122,7 @@ static void push_string(const char *identifier, const 
     /* When we arrive here, the stack is full. This should not happen and
      * means there’s either a bug in this parser or the specification
      * contains a command with more than 10 identified tokens. */
-    fprintf(stderr, "BUG: commands_parser stack full. This means either a bug "
+    fprintf(stderr, "BUG: config_parser stack full. This means either a bug "
                     "in the code, or a new command which contains more than "
                     "10 identified tokens.\n");
     exit(1);
@@ -142,7 +142,7 @@ static void push_long(const char *identifier, long num
     /* When we arrive here, the stack is full. This should not happen and
      * means there’s either a bug in this parser or the specification
      * contains a command with more than 10 identified tokens. */
-    fprintf(stderr, "BUG: commands_parser stack full. This means either a bug "
+    fprintf(stderr, "BUG: config_parser stack full. This means either a bug "
                     "in the code, or a new command which contains more than "
                     "10 identified tokens.\n");
     exit(1);
@@ -178,54 +178,7 @@ static void clear_stack(void) {
     }
 }
 
-// TODO: remove this if it turns out we don’t need it for testing.
-#if 0
 /*******************************************************************************
- * A dynamically growing linked list which holds the criteria for the current
- * command.
- ******************************************************************************/
-
-typedef struct criterion {
-    char *type;
-    char *value;
-
-    TAILQ_ENTRY(criterion) criteria;
-} criterion;
-
-static TAILQ_HEAD(criteria_head, criterion) criteria =
-  TAILQ_HEAD_INITIALIZER(criteria);
-
-/*
- * Stores the given type/value in the list of criteria.
- * Accepts a pointer as first argument, since it is 'call'ed by the parser.
- *
- */
-static void push_criterion(void *unused_criteria, const char *type,
-                           const char *value) {
-    struct criterion *criterion = smalloc(sizeof(struct criterion));
-    criterion->type = sstrdup(type);
-    criterion->value = sstrdup(value);
-    TAILQ_INSERT_TAIL(&criteria, criterion, criteria);
-}
-
-/*
- * Clears the criteria linked list.
- * Accepts a pointer as first argument, since it is 'call'ed by the parser.
- *
- */
-static void clear_criteria(void *unused_criteria) {
-    struct criterion *criterion;
-    while (!TAILQ_EMPTY(&criteria)) {
-        criterion = TAILQ_FIRST(&criteria);
-        free(criterion->type);
-        free(criterion->value);
-        TAILQ_REMOVE(&criteria, criterion, criteria);
-        free(criterion);
-    }
-}
-#endif
-
-/*******************************************************************************
  * The parser itself.
  ******************************************************************************/
 
@@ -1007,8 +960,8 @@ bool parse_file(const char *f, bool use_nagbar) {
 
         char *editaction,
             *pageraction;
-        sasprintf(&editaction, "i3-sensible-editor \"%s\" && i3-msg reload\n", f);
-        sasprintf(&pageraction, "i3-sensible-pager \"%s\"\n", errorfilename);
+        sasprintf(&editaction, "/usr/bin/vi \"%s\" && i3-msg reload\n", f);
+        sasprintf(&pageraction, "/usr/bin/less \"%s\"\n", errorfilename);
         char *argv[] = {
             NULL, /* will be replaced by the executable path */
             "-f",
