diff options
Diffstat (limited to 'clients')
-rw-r--r-- | clients/zstat/zstat.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/clients/zstat/zstat.c b/clients/zstat/zstat.c index 2a31f69..8ea0c04 100644 --- a/clients/zstat/zstat.c +++ b/clients/zstat/zstat.c @@ -178,13 +178,17 @@ hm_stat(host,server) sin.sin_family = AF_INET; - if ((hp = gethostbyname(host)) == NULL) { + if ((sin.sin_addr.s_addr = inet_addr(host)) == (unsigned)(-1)) { + if ((hp = gethostbyname(host)) == NULL) { fprintf(stderr,"Unknown host: %s\n",host); exit(-1); - } - (void) memcpy((char *) &sin.sin_addr, hp->h_addr, hp->h_length); + } + (void) memcpy((char *) &sin.sin_addr, hp->h_addr, hp->h_length); - printf("Hostmanager stats: %s\n",hp->h_name); + printf("Hostmanager stats: %s\n", hp->h_name); + } else { + printf("Hostmanager stats: %s\n", host); + } (void) memset((char *)¬ice, 0, sizeof(notice)); notice.z_kind = STAT; @@ -283,13 +287,17 @@ srv_stat(host) sin.sin_family = AF_INET; - if ((hp = gethostbyname(host)) == NULL) { + if ((sin.sin_addr.s_addr = inet_addr(host)) == (unsigned)(-1)) { + if ((hp = gethostbyname(host)) == NULL) { fprintf(stderr,"Unknown host: %s\n",host); exit(-1); - } - (void) memcpy((char *) &sin.sin_addr, hp->h_addr, hp->h_length); + } + (void) memcpy((char *) &sin.sin_addr, hp->h_addr, hp->h_length); - printf("Server stats: %s\n",hp->h_name); + printf("Server stats: %s\n", hp->h_name); + } else { + printf("Server stats: %s\n", host); + } (void) memset((char *)¬ice, 0, sizeof(notice)); notice.z_kind = UNSAFE; |