4d21cec081
Don't attempt to edit non regular files. Patches supplied by John Refling in PR pkg/10536.
28 lines
791 B
Text
28 lines
791 B
Text
$NetBSD: patch-ad,v 1.2 2000/07/10 18:26:54 tron Exp $
|
|
|
|
--- sys/bsd/fullpath.c.orig Wed May 31 16:36:31 2000
|
|
+++ sys/bsd/fullpath.c Wed May 31 16:36:31 2000
|
|
@@ -0,0 +1,23 @@
|
|
+/* test program by John P. Refling *
|
|
+#include <stdlib.h>
|
|
+#include <sys/param.h>
|
|
+#define begin {
|
|
+#define end }
|
|
+int main(argc, argv)
|
|
+int argc;
|
|
+char **argv;
|
|
+{char resolved_path[MAXPATHLEN];
|
|
+char trial_path[MAXPATHLEN];
|
|
+char path[MAXPATHLEN];
|
|
+char *envpath;
|
|
+if (realpath(argv[0], resolved_path) != NULL ) begin
|
|
+ printf("%s\n", resolved_path);
|
|
+end
|
|
+else if ( (envpath = getenv("PATH")) != NULL ) begin
|
|
+ printf("%s\n", envpath);
|
|
+ while (strchr(envpath, ':') != NULL) begin
|
|
+ printf("%d\n", envpath-strchr(envpath,':'));
|
|
+ envpath = strchr(envpath,':');
|
|
+ end
|
|
+end
|
|
+else printf("bad\n");}
|