#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
-#include <strings.h>
+#ifdef POSIX
+#include <sys/utsname.h>
+#endif
+#include <string.h>
#include <ctype.h>
#include <moira.h>
int n_len;
int has_dot = 0;
char tbuf[BUFSIZ];
+#ifdef POSIX
+ struct utsname name;
+#endif
register char *cp;
if (strlen(host) > 2 && host[0] == '"' && host[strlen(host)-1] == '"') {
return(strsave(tbuf));
}
- if (index(host, '*') || index(host, '?') || index(host, '['))
+ if (strchr(host, '*') || strchr(host, '?') || strchr(host, '['))
return(host);
hp = gethostbyname(host);
static char *domain = NULL;
if (domain == NULL) {
+#ifdef POSIX
+ (void) uname(&name);
+ strncpy(tbuf, name.nodename, sizeof(tbuf));
+#else
gethostname(tbuf, sizeof(tbuf));
+#endif
hp = gethostbyname(tbuf);
- cp = index(hp->h_name, '.');
+ cp = strchr(hp->h_name, '.');
if (cp)
domain = strsave(++cp);
else