blob: ed169f486d79c045832efff2c2189b3506ccd5ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
$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");}
|