Imported Upstream version 20120526
[platform/upstream/byacc.git] / main.c
diff --git a/main.c b/main.c
index 4014595..bcd7d50 100644 (file)
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.36 2011/09/06 22:44:45 tom Exp $ */
+/* $Id: main.c,v 1.39 2012/05/26 00:50:20 tom Exp $ */
 
 #include <signal.h>
 #include <unistd.h>            /* for _exit() */
@@ -38,6 +38,7 @@ char iflag;
 char lflag;
 static char oflag;
 char rflag;
+char sflag;
 char tflag;
 char vflag;
 
@@ -201,6 +202,7 @@ usage(void)
        ,"  -p symbol_prefix      set symbol prefix (default \"yy\")"
        ,"  -P                    create a reentrant parser, e.g., \"%pure-parser\""
        ,"  -r                    produce separate code and table files (y.code.c)"
+       ,"  -s                    suppress #define's for quoted names in %token lines"
        ,"  -t                    add debugging support"
        ,"  -v                    write description (y.output)"
        ,"  -V                    show version information and exit"
@@ -244,6 +246,10 @@ setflag(int ch)
        rflag = 1;
        break;
 
+    case 's':
+       sflag = 1;
+       break;
+
     case 't':
        tflag = 1;
        break;
@@ -361,7 +367,7 @@ allocate(size_t n)
 }
 
 #define CREATE_FILE_NAME(dest, suffix) \
-       dest = MALLOC(len + strlen(suffix) + 1); \
+       dest = TMALLOC(char, len + strlen(suffix) + 1); \
        NO_SPACE(dest); \
        strcpy(dest, file_prefix); \
        strcpy(dest + len, suffix)
@@ -392,7 +398,7 @@ create_file_names(void)
     if (prefix != NULL)
     {
        len = (size_t) (prefix - output_file_name);
-       file_prefix = (char *)MALLOC(len + 1);
+       file_prefix = TMALLOC(char, len + 1);
        NO_SPACE(file_prefix);
        strncpy(file_prefix, output_file_name, len)[len] = 0;
     }