add Berkeley specific header; written by K. McKusick and P. Kessler
[unix-history] / usr / src / bin / csh / err.c
index b52d85a..d0e549a 100644 (file)
@@ -1,4 +1,12 @@
-static char *sccsid = "@(#)err.c 4.1 %G%";
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.  The Berkeley Software License Agreement
+ * specifies the terms and conditions for redistribution.
+ */
+
+#ifndef lint
+static char *sccsid = "@(#)err.c       5.3 (Berkeley) %G%";
+#endif
 
 #include "sh.h"
 #include <sys/ioctl.h>
 
 #include "sh.h"
 #include <sys/ioctl.h>
@@ -20,6 +28,7 @@ char  *onev[2] = { one, NOSTR };
  * be closed in the routine process in sh.c which is the only
  * place error unwinds are ever caught.
  */
  * be closed in the routine process in sh.c which is the only
  * place error unwinds are ever caught.
  */
+/*VARARGS1*/
 error(s, arg)
        char *s;
 {
 error(s, arg)
        char *s;
 {
@@ -55,6 +64,12 @@ error(s, arg)
        }
        errspl = 0;
 
        }
        errspl = 0;
 
+       /*
+        * Go away if -e or we are a child shell
+        */
+       if (exiterr || child)
+               exit(1);
+
        /*
         * Reset the state of the input.
         * This buffered seek to end of file will also
        /*
         * Reset the state of the input.
         * This buffered seek to end of file will also
@@ -62,15 +77,9 @@ error(s, arg)
         */
        btoeof();
 
         */
        btoeof();
 
-       /*
-        * Go away if -e or we are a child shell
-        */
-       if (exiterr || child)
-               exit(1);
-
        setq("status", onev, &shvhed);
        if (tpgrp > 0)
        setq("status", onev, &shvhed);
        if (tpgrp > 0)
-               ioctl(FSHTTY, TIOCSPGRP, &tpgrp);
+               (void) ioctl(FSHTTY, TIOCSPGRP, (char *)&tpgrp);
        reset();                /* Unwind */
 }
 
        reset();                /* Unwind */
 }
 
@@ -89,7 +98,7 @@ Perror(s)
        if (!didfds) {
                register int oerrno = errno;
 
        if (!didfds) {
                register int oerrno = errno;
 
-               dcopy(SHDIAG, 2);
+               (void) dcopy(SHDIAG, 2);
                errno = oerrno;
        }
        perror(s);
                errno = oerrno;
        }
        perror(s);