#include "globals.h"
#include <sys/types.h>
+
+#ifdef HAVE_UNAME
#include <sys/utsname.h>
+#endif
+#ifndef _WIN32
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
+#endif /* _WIN32 */
#include <ctype.h>
#include <stdio.h>
else
{
aliasbuf[0] = 0;
- Loop(QueueTop(elem), (void *) PrintAliases);
+ Loop(QueueTop(elem), (void (*)(char **)) PrintAliases);
FreeQueue(elem);
Put_message(aliasbuf);
}
return NULL;
if (GetAddressFromUser("Network mask", &info[SN_MASK]) == SUB_ERROR)
return NULL;
- if (atoi(info[SN_LOW]) == ntohl(inet_addr(S_DEFAULT_LOW)))
+ if (atoi(info[SN_LOW]) == (int)ntohl(inet_addr(S_DEFAULT_LOW)))
{
struct in_addr low;
unsigned long mask, addr;
if (GetAddressFromUser("Lowest assignable address", &info[SN_LOW]) ==
SUB_ERROR)
return NULL;
- if (atoi(info[SN_HIGH]) == ntohl(inet_addr(S_DEFAULT_HIGH)))
+ if (atoi(info[SN_HIGH]) == (int)ntohl(inet_addr(S_DEFAULT_HIGH)))
{
struct in_addr high;
unsigned long mask, addr;
tmpname = canonicalize_hostname(strdup(argv[1]));
top = GetMCInfo(MACHINE, tmpname, NULL);
- Loop(top, ((void *) PrintMachInfo));
+ Loop(top, ((void (*)(char **)) PrintMachInfo));
FreeQueue(top);
return DM_NORMAL;
}
return DM_NORMAL;
}
top = QueueTop(elem);
- Loop(top, ((void *) PrintMachInfo));
+ Loop(top, ((void (*)(char **)) PrintMachInfo));
FreeQueue(top);
return DM_NORMAL;
}
{
sprintf(temp_buf, "%s is assigned to the following clusters.", name);
Put_message(temp_buf);
- Loop(top, (void *) PrintMCMap);
+ Loop(top, (void (*)(char **)) PrintMCMap);
ptr = "Remove this machine from ** ALL ** these clusters?";
if (YesNoQuestion(ptr, FALSE) == TRUE) /* may return -1. */
delete_it = TRUE;
{
char buf[256], *cp;
static char *def_domain = NULL;
- struct hostent *hp;
- struct utsname name;
if (!def_domain)
{
- uname(&name);
- hp = gethostbyname(name.nodename);
- cp = strchr(hp->h_name, '.');
- if (cp)
- def_domain = strdup(++cp);
+ if (mr_host(buf, sizeof(buf)) == MR_SUCCESS)
+ {
+ cp = strchr(buf, '.');
+ if (cp)
+ def_domain = strdup(++cp);
+ }
else
+ {
+ struct hostent *hp;
+#ifdef HAVE_UNAME
+ struct utsname name;
+ uname(&name);
+ hp = gethostbyname(name.nodename);
+#else
+ char name[256];
+ gethostname(name, sizeof(name));
+ name[sizeof(name)-1] = 0;
+ hp = gethostbyname(name);
+#endif /* HAVE_UNAME */
+ cp = strchr(hp->h_name, '.');
+ if (cp)
+ def_domain = strdup(++cp);
+ }
+ if (!def_domain)
def_domain = "";
}
tmpname = canonicalize_hostname(strdup(argv[2]));
top = GetMCInfo(CNAME, tmpalias, tmpname);
Put_message(""); /* blank line on screen */
- Loop(top, ((void *) PrintCname));
+ Loop(top, ((void (*)(char **)) PrintCname));
FreeQueue(top);
return DM_NORMAL;
}
struct mqelem *top;
top = GetMCInfo(SUBNET, argv[1], (char *) NULL);
- Loop(top, (void *) PrintSubnetInfo);
+ Loop(top, (void (*)(char **)) PrintSubnetInfo);
FreeQueue(top);
return DM_NORMAL;
}
struct mqelem *top;
top = GetMCInfo(CLUSTER, argv[1], NULL);
- Loop(top, (void *) PrintClusterInfo);
+ Loop(top, (void (*)(char **)) PrintClusterInfo);
FreeQueue(top);
return DM_NORMAL;
}