port to tahoe by Nir peleg of CCI
[unix-history] / usr / src / usr.bin / pascal / pdx / process / pstatus.c
index 32a1572..05f19a5 100644 (file)
@@ -1,7 +1,12 @@
-/* Copyright (c) 1982 Regents of the University of California */
-
-static char sccsid[] = "@(#)pstatus.c 1.2 %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[] = "@(#)pstatus.c  5.2 (Berkeley) %G%";
+#endif not lint
 /*
  * process status routines
  */
 /*
  * process status routines
  */
@@ -22,38 +27,51 @@ static char sccsid[] = "@(#)pstatus.c 1.2 %G%";
 
 printstatus()
 {
 
 printstatus()
 {
-       if (process->signo == SIGINT) {
-               isstopped = TRUE;
-               printerror();
+    if (process->signo == SIGINT) {
+       isstopped = TRUE;
+       printerror();
+    }
+    if (isbperr() && isstopped) {
+       skimsource(srcfilename(pc));
+       printf("stopped at ");
+       printwhere(curline, cursource);
+       putchar('\n');
+       if (curline > 0) {
+           printlines(curline, curline);
+       } else {
+           printinst(pc, pc);
        }
        }
-       if (isbperr() && isstopped) {
-               printf("stopped at ");
-               if (curline > 0) {
-                       printf("line %d", curline);
-                       if (nlhdr.nfiles > 1) {
-                               printf(" in file %s", cursource);
-                       }
-                       putchar('\n');
-                       printlines(curline, curline);
-               } else {
-#                      if (isvaxpx)
-                               printf("location %d\n", pc);
-#                      else
-                               printf("location 0x%x\n", pc);
-#                      endif
-                       printinst(pc, pc);
-               }
-               erecover();
+       erecover();
+    } else {
+       isstopped = FALSE;
+       fixbps();
+       fixintr();
+       if (process->status == FINISHED) {
+           quit(0);
        } else {
        } else {
-               isstopped = FALSE;
-               fixbps();
-               fixintr();
-               if (process->status == FINISHED) {
-                       quit(0);
-               } else {
-                       printerror();
-               }
+           printerror();
+       }
+    }
+}
+
+
+/*
+ * Print out the "line N [in file F]" information that accompanies
+ * messages in various places.
+ */
+
+printwhere(lineno, filename)
+LINENO lineno;
+char *filename;
+{
+    if (lineno > 0) {
+       printf("line %d", lineno);
+       if (nlhdr.nfiles > 1) {
+           printf(" in file %s", filename);
        }
        }
+    } else {
+           printf("location %d\n", pc);
+    }
 }
 
 /*
 }
 
 /*
@@ -63,5 +81,5 @@ printstatus()
 BOOLEAN isfinished(p)
 PROCESS *p;
 {
 BOOLEAN isfinished(p)
 PROCESS *p;
 {
-       return(p->status == FINISHED);
+    return(p->status == FINISHED);
 }
 }