BSD 4_4 release
[unix-history] / usr / src / old / adb / common_source / main.c
index c8e9ce0..a97c161 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
 #ifndef lint
-static char sccsid[] = "@(#)main.c     5.2 (Berkeley) %G%";
-#endif
+char copyright[] =
+"@(#) Copyright (c) 1991 The Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)main.c     5.6 (Berkeley) 4/4/91";
+#endif /* not lint */
 
 /*
  * adb - main command loop and error/interrupt handling
 
 /*
  * adb - main command loop and error/interrupt handling
@@ -10,6 +25,7 @@ static char sccsid[] = "@(#)main.c    5.2 (Berkeley) %G%";
 #include <setjmp.h>
 #include <sys/file.h>
 #include <sys/uio.h>
 #include <setjmp.h>
 #include <sys/file.h>
 #include <sys/uio.h>
+#include "pathnames.h"
 
 extern char NOEOR[];           /* "newline expected" */
 
 
 extern char NOEOR[];           /* "newline expected" */
 
@@ -19,16 +35,18 @@ extern char NOEOR[];                /* "newline expected" */
 int    executing;
 
 int    infile;                 /* XXX */
 int    executing;
 
 int    infile;                 /* XXX */
-char   *Ipath = "/usr/lib/adb";/* XXX */
+char   *Ipath = _PATH_SCRIPTS; /* XXX */
 
 static int xargc;              /* remembers argc for getfile() */
 
 static int reading;            /* set whenever reading input */
 static jmp_buf mainloop;       /* label for error jumps */
 
 
 static int xargc;              /* remembers argc for getfile() */
 
 static int reading;            /* set whenever reading input */
 static jmp_buf mainloop;       /* label for error jumps */
 
-int    fault();
+void   fault();
 off_t  lseek();
 
 off_t  lseek();
 
+static int readline();
+
 main(argc, argv)
        register int argc;
        register char **argv;
 main(argc, argv)
        register int argc;
        register char **argv;
@@ -81,7 +99,10 @@ main(argc, argv)
         * If the error occurred while the process was running,
         * we need to remove any breakpoints.
         */
         * If the error occurred while the process was running,
         * we need to remove any breakpoints.
         */
-       (void) setjmp(mainloop);
+       if (setjmp(mainloop))
+               waserr = 1;             /* well, presumably */
+       else
+               waserr = 0;
        if (executing) {
                executing = 0;
                delbp();
        if (executing) {
                executing = 0;
                delbp();
@@ -196,7 +217,7 @@ readchar()
  * Alas, cannot read more than one character at a time here (except
  * possibly on tty devices; must think about that later).
  */
  * Alas, cannot read more than one character at a time here (except
  * possibly on tty devices; must think about that later).
  */
-static
+static int
 readline(p, n)
        register char *p;
        register int n;
 readline(p, n)
        register char *p;
        register int n;
@@ -267,10 +288,10 @@ error(which)
  * If we were reading commands, jump back to the main loop.
  */
 /* ARGSUSED */
  * If we were reading commands, jump back to the main loop.
  */
 /* ARGSUSED */
+void
 fault(sig)
        int sig;
 {
 fault(sig)
        int sig;
 {
-
        /* (void) signal(sig, fault); */        /* unnecessary */
        (void) lseek(infile, 0L, 2);
        mkfault++;
        /* (void) signal(sig, fault); */        /* unnecessary */
        (void) lseek(infile, 0L, 2);
        mkfault++;