fixed problem with opening absolute pathnames
authorMark Linton <linton@ucbvax.Berkeley.EDU>
Sat, 21 May 1983 01:58:40 +0000 (17:58 -0800)
committerMark Linton <linton@ucbvax.Berkeley.EDU>
Sat, 21 May 1983 01:58:40 +0000 (17:58 -0800)
SCCS-vsn: old/dbx/source.c 1.8

usr/src/old/dbx/source.c

index bd1376b..5566360 100644 (file)
@@ -1,6 +1,6 @@
 /* Copyright (c) 1982 Regents of the University of California */
 
 /* Copyright (c) 1982 Regents of the University of California */
 
-static char sccsid[] = "@(#)source.c 1.7 %G%";
+static char sccsid[] = "@(#)source.c 1.8 %G%";
 
 /*
  * Source file management.
 
 /*
  * Source file management.
@@ -127,13 +127,17 @@ String filename;
     File f;
 
     f = nil;
     File f;
 
     f = nil;
-    foreach (String, dir, sourcepath)
-       sprintf(buf, "%s/%s", dir, filename);
-       f = fopen(buf, "r");
-       if (f != nil) {
-           break;
+    if (filename[0] == '/') {
+       f = fopen(filename, "r");
+    } else {
+       foreach (String, dir, sourcepath)
+           sprintf(buf, "%s/%s", dir, filename);
+           f = fopen(buf, "r");
+           if (f != nil) {
+               break;
        }
        }
-    endfor
+       endfor
+    }
     return f;
 }
 
     return f;
 }