From 7620b22623ca72d3efd3c450a28989f2d002c6ed Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Tue, 11 Oct 1988 21:48:36 -0800 Subject: [PATCH] use herror SCCS-vsn: usr.bin/talk/get_addrs.c 5.5 SCCS-vsn: usr.bin/tftp/main.c 5.8 SCCS-vsn: usr.bin/telnet/commands.c 1.11 --- usr/src/usr.bin/talk/get_addrs.c | 16 +++++++--------- usr/src/usr.bin/telnet/commands.c | 4 ++-- usr/src/usr.bin/tftp/main.c | 12 +++++++----- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/usr/src/usr.bin/talk/get_addrs.c b/usr/src/usr.bin/talk/get_addrs.c index b2b06694ef..9baa20b11c 100644 --- a/usr/src/usr.bin/talk/get_addrs.c +++ b/usr/src/usr.bin/talk/get_addrs.c @@ -16,7 +16,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)get_addrs.c 5.4 (Berkeley) %G%"; +static char sccsid[] = "@(#)get_addrs.c 5.5 (Berkeley) %G%"; #endif /* not lint */ #include "talk_ctl.h" @@ -31,10 +31,9 @@ get_addrs(my_machine_name, his_machine_name) msg.pid = htonl(getpid()); /* look up the address of the local host */ hp = gethostbyname(my_machine_name); - if (hp == (struct hostent *) 0) { - fprintf(stderr, - "talk: %s: Can't figure out network address.\n", - my_machine_name); + if (hp == NULL) { + fprintf(stderr, "talk: %s: ", my_machine_name); + herror((char *)NULL); exit(-1); } bcopy(hp->h_addr, (char *)&my_machine_addr, hp->h_length); @@ -44,10 +43,9 @@ get_addrs(my_machine_name, his_machine_name) */ if (strcmp(his_machine_name, my_machine_name)) { hp = gethostbyname(his_machine_name); - if (hp == (struct hostent *) 0 ) { - fprintf(stderr, - "talk: %s: Can't figure out network address.\n", - his_machine_name); + if (hp == NULL) { + fprintf(stderr, "talk: %s: ", his_machine_name); + herror((char *)NULL); exit(-1); } bcopy(hp->h_addr, (char *) &his_machine_addr, hp->h_length); diff --git a/usr/src/usr.bin/telnet/commands.c b/usr/src/usr.bin/telnet/commands.c index 7e85e8e47d..2873c5e729 100644 --- a/usr/src/usr.bin/telnet/commands.c +++ b/usr/src/usr.bin/telnet/commands.c @@ -16,7 +16,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)commands.c 1.10 (Berkeley) %G%"; +static char sccsid[] = "@(#)commands.c 1.11 (Berkeley) %G%"; #endif /* not lint */ #include @@ -984,7 +984,7 @@ tn(argc, argv) #endif /* defined(h_addr) */ hostname = host->h_name; } else { - printf("%s: unknown host\n", argv[1]); + herror(argv[1]); return 0; } } diff --git a/usr/src/usr.bin/tftp/main.c b/usr/src/usr.bin/tftp/main.c index 350a902a44..0154ef086f 100644 --- a/usr/src/usr.bin/tftp/main.c +++ b/usr/src/usr.bin/tftp/main.c @@ -22,7 +22,7 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)main.c 5.7 (Berkeley) %G%"; +static char sccsid[] = "@(#)main.c 5.8 (Berkeley) %G%"; #endif /* not lint */ /* Many bug fixes are from Jim Guyton */ @@ -291,8 +291,9 @@ put(argc, argv) targ = index(cp, ':'); *targ++ = 0; hp = gethostbyname(cp); - if (hp == 0) { - printf("%s: Unknown host.\n", cp); + if (hp == NULL) { + fprintf(stderr, "tftp: %s: ", cp); + herror((char *)NULL); return; } bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, hp->h_length); @@ -383,8 +384,9 @@ get(argc, argv) *src++ = 0; hp = gethostbyname(argv[n]); - if (hp == 0) { - printf("%s: Unknown host.\n", argv[n]); + if (hp == NULL) { + fprintf(stderr, "tftp: %s: ", argv[n]); + herror((char *)NULL); continue; } bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, hp->h_length); -- 2.20.1