BSD 4_3_Tahoe release
[unix-history] / usr / src / ucb / dbx / source.c
index 65f20ea..33df506 100644 (file)
@@ -5,10 +5,10 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)source.c   5.1 (Berkeley) 5/31/85";
+static char sccsid[] = "@(#)source.c   5.2 (Berkeley) 1/12/88";
 #endif not lint
 
 #endif not lint
 
-static char rcsid[] = "$Header: source.c,v 1.4 84/06/07 16:29:38 linton Exp $";
+static char rcsid[] = "$Header: source.c,v 1.3 87/08/19 15:19:40 mike Exp $";
 
 /*
  * Source file management.
 
 /*
  * Source file management.
@@ -22,7 +22,12 @@ static char rcsid[] = "$Header: source.c,v 1.4 84/06/07 16:29:38 linton Exp $";
 #include "keywords.h"
 #include "tree.h"
 #include "eval.h"
 #include "keywords.h"
 #include "tree.h"
 #include "eval.h"
-#include <sys/file.h>
+#ifdef IRIS
+#   define R_OK 04     /* read access */
+#   define L_SET 01    /* absolute offset for seek */
+#else
+#   include <sys/file.h>
+#endif
 
 #ifndef public
 typedef int Lineno;
 
 #ifndef public
 typedef int Lineno;
@@ -38,6 +43,11 @@ Lineno cursrcline;
 List sourcepath;
 #endif
 
 List sourcepath;
 #endif
 
+#ifdef IRIS
+#   define re_comp regcmp
+#   define re_exec(buf) (regex(buf) != NULL)
+#endif
+
 extern char *re_comp();
 
 private Lineno lastlinenum;
 extern char *re_comp();
 
 private Lineno lastlinenum;
@@ -445,6 +455,17 @@ String pattern;
     }
 }
 
     }
 }
 
+public integer srcwindowlen ()
+{
+    Node s;
+
+    s = findvar(identname("$listwindow", true));
+    if (s == nil)
+       return 10;
+    eval(s);
+    return pop(integer);
+}
+
 /*
  * Compute a small window around the given line.
  */
 /*
  * Compute a small window around the given line.
  */
@@ -452,16 +473,9 @@ String pattern;
 public getsrcwindow (line, l1, l2)
 Lineno line, *l1, *l2;
 {
 public getsrcwindow (line, l1, l2)
 Lineno line, *l1, *l2;
 {
-    Node s;
     integer size;
 
     integer size;
 
-    s = findvar(identname("$listwindow", true));
-    if (s == nil) {
-       size = 10;
-    } else {
-       eval(s);
-       size = pop(integer);
-    }
+    size = srcwindowlen();
     *l1 = line - (size div 2);
     if (*l1 < 1) {
        *l1 = 1;
     *l1 = line - (size div 2);
     if (*l1 < 1) {
        *l1 = 1;