summaryrefslogtreecommitdiff
path: root/usr.bin/vi/common/exf.c
diff options
context:
space:
mode:
authormichaels <michaels@cvs.openbsd.org>1996-08-20 22:56:15 +0000
committermichaels <michaels@cvs.openbsd.org>1996-08-20 22:56:15 +0000
commit92d8e1f1481d4b16d9368429e59867c3c3e518d6 (patch)
tree56f624bf23ae5a1a6d1591a038a8d829d93712eb /usr.bin/vi/common/exf.c
parentded455e8761207780ae8037f7fdb7f9d39c3abc7 (diff)
nvi 1.74
Diffstat (limited to 'usr.bin/vi/common/exf.c')
-rw-r--r--usr.bin/vi/common/exf.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/usr.bin/vi/common/exf.c b/usr.bin/vi/common/exf.c
index c0b181bfe41..4a17ae69bc6 100644
--- a/usr.bin/vi/common/exf.c
+++ b/usr.bin/vi/common/exf.c
@@ -10,7 +10,7 @@
#include "config.h"
#ifndef lint
-static const char sccsid[] = "@(#)exf.c 10.46 (Berkeley) 8/11/96";
+static const char sccsid[] = "@(#)exf.c 10.47 (Berkeley) 8/12/96";
#endif /* not lint */
#include <sys/param.h>
@@ -475,22 +475,23 @@ file_spath(sp, frp, sbp, existsp)
}
/* Try the O_PATH option values. */
- for (found = 0, p = t = O_STR(sp, O_PATH);; ++p) {
+ for (found = 0, p = t = O_STR(sp, O_PATH);; ++p)
if (*p == ':' || *p == '\0') {
if (t < p - 1) {
savech = *p;
*p = '\0';
len = snprintf(path,
sizeof(path), "%s/%s", t, name);
- if (!stat(path, sbp))
- found = 1;
*p = savech;
+ if (!stat(path, sbp)) {
+ found = 1;
+ break;
+ }
}
t = p + 1;
+ if (*p == '\0')
+ break;
}
- if (*p == '\0' || found)
- break;
- }
/* If we found it, build a new pathname and discard the old one. */
if (found) {