6 #ifdef NEED_HPUX_FINDCONFIG
11 #include <sys/utsname.h>
19 static char result[BUFSIZ];
20 char hostname[BUFSIZ], *cp;
22 struct utsname unamebuf;
24 /* All keyed by initial target being a directory */
25 (void) strcpy(result, base);
26 if (stat(result, &sbuf) == 0) {
27 if (S_ISDIR(sbuf.st_mode)) {
29 /* First choice is my hostname */
30 if (gethostname(hostname, BUFSIZ) >= 0) {
31 (void) sprintf(result, "%s/%s", base, hostname);
32 if (stat(result, &sbuf) == 0) {
36 /* Second choice is of form default.835 */
37 (void) uname(&unamebuf);
38 if (strncmp(unamebuf.machine, "9000/", 5) == 0)
39 cp = unamebuf.machine + 5;
41 cp = unamebuf.machine;
42 (void) sprintf(result, "%s/default.%s", base, cp);
43 if (stat(result, &sbuf) == 0) {
47 /* Last choice is just default */
48 (void) sprintf(result, "%s/default", base);
49 if (stat(result, &sbuf) == 0) {
52 (void) strcpy(result, "/not/found");
63 #include "ntp_stdlib.h"