m4-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to m4/src/main.c,v


From: Eric Blake
Subject: Changes to m4/src/main.c,v
Date: Wed, 28 Feb 2007 21:31:16 +0000

CVSROOT:        /sources/m4
Module name:    m4
Changes by:     Eric Blake <ericb>      07/02/28 21:31:13

Index: src/main.c
===================================================================
RCS file: /sources/m4/m4/src/main.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -b -r1.108 -r1.109
--- src/main.c  5 Feb 2007 17:31:10 -0000       1.108
+++ src/main.c  28 Feb 2007 21:31:13 -0000      1.109
@@ -33,12 +33,12 @@
 
 #define AUTHORS _("Rene' Seindal"), "Gary V. Vaughan", "Eric Blake"
 
-typedef struct macro_definition
+typedef struct deferred
 {
-  struct macro_definition *next;
+  struct deferred *next;
   int code;                    /* deferred optchar */
-  const char *macro;
-} macro_definition;
+  const char *value;
+} deferred;
 
 
 /* Error handling functions.  */
@@ -92,7 +92,7 @@
   -i, --interactive            unbuffer output, ignore interrupts\n\
   -P, --prefix-builtins        force a `m4_' prefix to all builtins\n\
   -Q, --quiet, --silent        suppress some warnings for builtins\n\
-  -r, --regexp-syntax[=SPEC]   set default regexp syntax to SPEC [EMACS]\n\
+  -r, --regexp-syntax[=SPEC]   set default regexp syntax to SPEC [GNU_M4]\n\
       --safer                  disable potentially unsafe builtins\n\
   -W, --warnings               enable all warnings\n\
 "), stdout);
@@ -325,13 +325,12 @@
 int
 main (int argc, char *const *argv, char *const *envp)
 {
-  macro_definition *head = NULL;       /* head of deferred argument list */
-  macro_definition *tail = NULL;
-  macro_definition *defn;
+  deferred *head = NULL;       /* head of deferred argument list */
+  deferred *tail = NULL;
+  deferred *defn;
   int optchar;                 /* option character */
   size_t size;                 /* for parsing numeric option arguments */
 
-  macro_definition *defines;
   bool read_stdin = false;     /* true iff we have read from stdin */
   bool import_environment = false; /* true to import environment */
   bool seen_file = false;
@@ -428,7 +427,7 @@
 
        defn = xmalloc (sizeof *defn);
        defn->code = optchar;
-       defn->macro = optarg;
+       defn->value = optarg;
        defn->next = NULL;
 
        if (head == NULL)
@@ -641,7 +640,7 @@
        {
          defn = xmalloc (sizeof *defn);
          defn->code = 'D';
-         defn->macro = *env;
+         defn->value = *env;
          defn->next = head;
          head = defn;
        }
@@ -649,22 +648,20 @@
 
   /* Handle deferred command line macro definitions.  Must come after
      initialization of the symbol table.  */
+  defn = head;
+  while (defn != NULL)
   {
-    defines = head;
+      deferred *next;
+      const char *arg = defn->value;
 
-    while (defines != NULL)
-      {
-       macro_definition *next;
-       const char *arg = defines->macro;
-
-       switch (defines->code)
+      switch (defn->code)
          {
          case 'D':
          case 'p':
            {
              m4_symbol_value *value = m4_symbol_value_create ();
 
-             /* defines->arg is read-only, so we need a copy.  */
+           /* defn->value is read-only, so we need a copy.  */
              char *macro_name = xstrdup (arg);
              char *macro_value = strchr (macro_name, '=');
 
@@ -673,7 +670,7 @@
              m4_set_symbol_value_text (value, xstrdup (macro_value
                                                        ? macro_value : ""));
 
-             if (defines->code == 'D')
+           if (defn->code == 'D')
                m4_symbol_define (M4SYMTAB, macro_name, value);
              else
                m4_symbol_pushdef (M4SYMTAB, macro_name, value);
@@ -691,13 +688,10 @@
            break;
 
          case 'r':
-           m4_set_regexp_syntax_opt (context,
-                                     m4_regexp_syntax_encode (arg));
+         m4_set_regexp_syntax_opt (context, m4_regexp_syntax_encode (arg));
            if (m4_get_regexp_syntax_opt (context) < 0)
-             {
                m4_error (context, EXIT_FAILURE, 0,
                          _("bad regexp syntax option: `%s'"), arg);
-             }
            break;
 
          case 't':
@@ -737,10 +731,9 @@
            abort ();
          }
 
-       next = defines->next;
-       free (defines);
-       defines = next;
-      }
+      next = defn->next;
+      free (defn);
+      defn = next;
   }
 
   /* Handle remaining input files.  Each file is pushed on the input,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]