install approved copyright notice
[unix-history] / usr / src / usr.bin / error / input.c
index 83f6e4c..28d608b 100644 (file)
@@ -1,4 +1,24 @@
-static char *sccsid = "@(#)input.c     1.8 (Berkeley) 83/06/14";
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#ifndef lint
+static char sccsid[] = "@(#)input.c    5.3 (Berkeley) %G%";
+#endif /* not lint */
+
 #include <stdio.h>
 #include <ctype.h>
 #include "error.h"
 #include <stdio.h>
 #include <ctype.h>
 #include "error.h"
@@ -22,6 +42,7 @@ Errorclass    f77();
 Errorclass     pi();
 Errorclass     ri();
 Errorclass     troff();
 Errorclass     pi();
 Errorclass     ri();
 Errorclass     troff();
+Errorclass     mod2();
 /*
  *     Eat all of the lines in the input file, attempting to categorize
  *     them by their various flavors
 /*
  *     Eat all of the lines in the input file, attempting to categorize
  *     them by their various flavors
@@ -44,8 +65,8 @@ eaterrors(r_errorc, r_errorv)
         *      of 0 based.
         */
        wordv -= 1;
         *      of 0 based.
         */
        wordv -= 1;
-       if ( 0
-          || (( errorclass = onelong() ) != C_UNKNOWN)
+       if ( wordc > 0 &&
+          ((( errorclass = onelong() ) != C_UNKNOWN)
           || (( errorclass = cpp() ) != C_UNKNOWN)
           || (( errorclass = pccccom() ) != C_UNKNOWN)
           || (( errorclass = richieccom() ) != C_UNKNOWN)
           || (( errorclass = cpp() ) != C_UNKNOWN)
           || (( errorclass = pccccom() ) != C_UNKNOWN)
           || (( errorclass = richieccom() ) != C_UNKNOWN)
@@ -57,7 +78,8 @@ eaterrors(r_errorc, r_errorv)
           || (( errorclass = f77() ) != C_UNKNOWN)
           || ((errorclass = pi() ) != C_UNKNOWN)
           || (( errorclass = ri() )!= C_UNKNOWN)
           || (( errorclass = f77() ) != C_UNKNOWN)
           || ((errorclass = pi() ) != C_UNKNOWN)
           || (( errorclass = ri() )!= C_UNKNOWN)
-          || (( errorclass = troff() )!= C_UNKNOWN)
+          || (( errorclass = mod2() )!= C_UNKNOWN)
+          || (( errorclass = troff() )!= C_UNKNOWN))
        ) ;
        else
                errorclass = catchall();
        ) ;
        else
                errorclass = catchall();
@@ -130,7 +152,7 @@ Errorclass onelong()
                 *      c)      Random noise
                 */
                wordc = 0;
                 *      c)      Random noise
                 */
                wordc = 0;
-               if (strcmp(wordv[2], "Stop.") == 0){
+               if (strcmp(wordv[1], "Stop.") == 0){
                        language = INMAKE; return(C_SYNC);
                }
                if (strcmp(wordv[1], "Assembler:") == 0){
                        language = INMAKE; return(C_SYNC);
                }
                if (strcmp(wordv[1], "Assembler:") == 0){
@@ -207,6 +229,7 @@ Errorclass pccccom()
                clob_last(wordv[3], '\0');      /* drop : on line number */
                wordv[2] = wordv[1];    /* overwrite "line" */
                wordv++;                /*compensate*/
                clob_last(wordv[3], '\0');      /* drop : on line number */
                wordv[2] = wordv[1];    /* overwrite "line" */
                wordv++;                /*compensate*/
+               wordc--;
                currentfilename = wordv[1];
                language = INCC;
                return(C_TRUE);
                currentfilename = wordv[1];
                language = INCC;
                return(C_TRUE);
@@ -362,6 +385,7 @@ Errorclass lint3()
 char   *F77_fatal[3] = {"Compiler", "error", "line"};
 char   *F77_error[3] = {"Error", "on", "line"};
 char   *F77_warning[3] = {"Warning", "on", "line"};
 char   *F77_fatal[3] = {"Compiler", "error", "line"};
 char   *F77_error[3] = {"Error", "on", "line"};
 char   *F77_warning[3] = {"Warning", "on", "line"};
+char    *F77_no_ass[3] = {"Error.","No","assembly."};
 f77()
 {
        char    **nwordv;
 f77()
 {
        char    **nwordv;
@@ -373,7 +397,12 @@ f77()
         *              Compiler error line %d of %s: %s
         *              Error on line %d of %s: %s
         *              Warning on line %d of %s: %s
         *              Compiler error line %d of %s: %s
         *              Error on line %d of %s: %s
         *              Warning on line %d of %s: %s
+        *              Error.  No assembly.
         */
         */
+       if (wordc == 3 && wordvcmp(wordv+1, 3, F77_no_ass) == 0) {
+               wordc = 0;
+               return(C_SYNC);
+       }
        if (wordc < 6)
                return(C_UNKNOWN);
        if (    (lastchar(wordv[6]) == ':')
        if (wordc < 6)
                return(C_UNKNOWN);
        if (    (lastchar(wordv[6]) == ':')
@@ -476,3 +505,26 @@ Errorclass troff()
        }
        return(C_UNKNOWN);
 }
        }
        return(C_UNKNOWN);
 }
+Errorclass mod2()
+{
+       /*
+        *      for decwrl modula2 compiler (powell)
+        */
+       if (   (  (strcmp(wordv[1], "!!!") == 0)        /* early version */
+               ||(strcmp(wordv[1], "File") == 0))      /* later version */
+           && (lastchar(wordv[2]) == ',')      /* file name */
+           && (strcmp(wordv[3], "line") == 0)
+           && (isdigit(firstchar(wordv[4])))   /* line number */
+           && (lastchar(wordv[4]) == ':')      /* line number */
+       ){
+               clob_last(wordv[2], '\0');      /* drop last , on file name */
+               clob_last(wordv[4], '\0');      /* drop last : on line number */
+               wordv[3] = wordv[2];            /* file name on top of "line" */
+               wordv += 2;
+               wordc -= 2;
+               currentfilename = wordv[1];
+               language = INMOD2;
+               return(C_TRUE);
+       }
+       return(C_UNKNOWN);
+}