From deff56dc01b6743aa95aae415449bf0b2ef21b33 Mon Sep 17 00:00:00 2001 From: charnier Date: Wed, 14 Jan 1998 07:21:14 +0000 Subject: Add rcsid. Remove unused #includes (what about RU# ?). Change exit(-1) and add usage(). --- usr.bin/talk/get_addrs.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'usr.bin/talk/get_addrs.c') diff --git a/usr.bin/talk/get_addrs.c b/usr.bin/talk/get_addrs.c index 7ac9267..641f80f 100644 --- a/usr.bin/talk/get_addrs.c +++ b/usr.bin/talk/get_addrs.c @@ -32,12 +32,16 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)get_addrs.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ -#include +#include #include -#include +#include #include "talk.h" #include "talk_ctl.h" @@ -51,22 +55,14 @@ get_addrs(my_machine_name, his_machine_name) msg.pid = htonl(getpid()); hp = gethostbyname(his_machine_name); - if (hp == NULL) { - fprintf(stderr, "talk: %s: ", his_machine_name); - herror((char *)NULL); - exit(-1); - } + if (hp == NULL) + errx(1, "%s: %s", his_machine_name, hstrerror(h_errno)); bcopy(hp->h_addr, (char *) &his_machine_addr, hp->h_length); - if (get_iface(&his_machine_addr, &my_machine_addr) == -1) { - perror("failed to find my interface address"); - exit(-1); - } + if (get_iface(&his_machine_addr, &my_machine_addr) == -1) + err(1, "failed to find my interface address"); /* find the server's port */ sp = getservbyname("ntalk", "udp"); - if (sp == 0) { - fprintf(stderr, "talk: %s/%s: service is not registered.\n", - "ntalk", "udp"); - exit(-1); - } + if (sp == 0) + errx(1, "ntalk/udp: service is not registered"); daemon_port = sp->s_port; } -- cgit v1.1