diff options
author | charnier <charnier@FreeBSD.org> | 1998-01-14 07:21:14 +0000 |
---|---|---|
committer | charnier <charnier@FreeBSD.org> | 1998-01-14 07:21:14 +0000 |
commit | deff56dc01b6743aa95aae415449bf0b2ef21b33 (patch) | |
tree | fc63802d03ce54876720b92fadd121c9edc9e522 /usr.bin/talk/get_addrs.c | |
parent | 936239d2954e2310bbb3821da0cfe46611b9a0b3 (diff) | |
download | FreeBSD-src-deff56dc01b6743aa95aae415449bf0b2ef21b33.zip FreeBSD-src-deff56dc01b6743aa95aae415449bf0b2ef21b33.tar.gz |
Add rcsid. Remove unused #includes (what about RU# ?). Change exit(-1) and
add usage().
Diffstat (limited to 'usr.bin/talk/get_addrs.c')
-rw-r--r-- | usr.bin/talk/get_addrs.c | 28 |
1 files changed, 12 insertions, 16 deletions
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 <string.h> +#include <err.h> #include <netdb.h> -#include <stdio.h> +#include <string.h> #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; } |