BSD 4_4 release
[unix-history] / usr / src / old / awk / main.c
index 9718081..ea4fdb3 100644 (file)
@@ -1,6 +1,21 @@
+/*-
+ * Copyright (c) 1991 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * This module is believed to contain source code proprietary to AT&T.
+ * Use and redistribution is subject to the Berkeley Software License
+ * Agreement and your Software Agreement with AT&T (Western Electric).
+ */
+
+#ifndef lint
+char copyright[] =
+"@(#) Copyright (c) 1991 The Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif /* not lint */
+
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)main.c     4.3 %G%";
-#endif
+static char sccsid[] = "@(#)main.c     4.6 (Berkeley) 4/17/91";
+#endif /* not lint */
 
 #include "stdio.h"
 #include "ctype.h"
 
 #include "stdio.h"
 #include "ctype.h"
@@ -9,6 +24,7 @@ static char sccsid[] = "@(#)main.c     4.3 %G%";
 #define TOLOWER(c)     (isupper(c) ? tolower(c) : c) /* ugh!!! */
 
 int    dbg     = 0;
 #define TOLOWER(c)     (isupper(c) ? tolower(c) : c) /* ugh!!! */
 
 int    dbg     = 0;
+int    ldbg    = 0;
 int    svflg   = 0;
 int    rstflg  = 0;
 int    svargc;
 int    svflg   = 0;
 int    rstflg  = 0;
 int    svargc;
@@ -32,9 +48,13 @@ main(argc, argv) int argc; char *argv[]; {
                /* character after f to see if it's -f file or -Fx.
                */
                if (argv[0][0] == '-' && TOLOWER(argv[0][1]) == 'f' && argv[0][2] == '\0') {
                /* character after f to see if it's -f file or -Fx.
                */
                if (argv[0][0] == '-' && TOLOWER(argv[0][1]) == 'f' && argv[0][2] == '\0') {
-                       yyin = fopen(argv[1], "r");
-                       if (yyin == NULL)
-                               error(FATAL, "can't open %s", argv[1]);
+                       if (argv[1][0] == '-' && argv[1][1] == '\0')
+                               yyin = stdin;
+                       else {
+                               yyin = fopen(argv[1], "r");
+                               if (yyin == NULL)
+                                       error(FATAL, "can't open %s", argv[1]);
+                       }
                        argc--;
                        argv++;
                        break;
                        argc--;
                        argv++;
                        break;
@@ -53,6 +73,9 @@ main(argc, argv) int argc; char *argv[]; {
                } else if (strcmp("-d", argv[0])==0) {
                        dbg = 1;
                }
                } else if (strcmp("-d", argv[0])==0) {
                        dbg = 1;
                }
+               else if (strcmp("-l", argv[0])==0) {
+                       ldbg = 1;
+               }
                else if(strcmp("-S", argv[0]) == 0) {
                        svflg = 1;
                }
                else if(strcmp("-S", argv[0]) == 0) {
                        svflg = 1;
                }