8 #ifdef NEED_HPUX_FINDCONFIG
11 #include <sys/types.h>
13 #include <sys/utsname.h>
21 static char result
[BUFSIZ
];
22 char hostname
[BUFSIZ
], *cp
;
24 struct utsname unamebuf
;
26 /* All keyed by initial target being a directory */
27 (void) strcpy(result
, base
);
28 if (stat(result
, &sbuf
) == 0) {
29 if (S_ISDIR(sbuf
.st_mode
)) {
31 /* First choice is my hostname */
32 if (gethostname(hostname
, BUFSIZ
) >= 0) {
33 (void) sprintf(result
, "%s/%s", base
, hostname
);
34 if (stat(result
, &sbuf
) == 0) {
38 /* Second choice is of form default.835 */
39 (void) uname(&unamebuf
);
40 if (strncmp(unamebuf
.machine
, "9000/", 5) == 0)
41 cp
= unamebuf
.machine
+ 5;
43 cp
= unamebuf
.machine
;
44 (void) sprintf(result
, "%s/default.%s", base
, cp
);
45 if (stat(result
, &sbuf
) == 0) {
49 /* Last choice is just default */
50 (void) sprintf(result
, "%s/default", base
);
51 if (stat(result
, &sbuf
) == 0) {
54 (void) strcpy(result
, "/not/found");
65 #include "ntp_stdlib.h"