diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-08-18 04:02:27 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-08-18 04:02:27 +0000 |
commit | 0fdee9fc4c513111890cb276e3050734c0e8b8c9 (patch) | |
tree | 5cab468ea847a2637773683e95a786710b7383b8 /usr.bin/talk/get_addrs.c | |
parent | 8a60a215e4534c61e81ad6fe5e0b4833e1664a95 (diff) |
Some changes inspired by FreeBSD...
o Kill annoying spaces at the end of lines
o sigaction, not sigvec
o warn/err where sensible
o hstrerror() not herror()
o defaults for erase, kill, and werase if not set
o kill a needless refresh() after the beeps that was messing up the screen
Diffstat (limited to 'usr.bin/talk/get_addrs.c')
-rw-r--r-- | usr.bin/talk/get_addrs.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/usr.bin/talk/get_addrs.c b/usr.bin/talk/get_addrs.c index e21eedcdc78..d0286ece990 100644 --- a/usr.bin/talk/get_addrs.c +++ b/usr.bin/talk/get_addrs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: get_addrs.c,v 1.3 1998/04/28 22:13:23 pjanzen Exp $ */ +/* $OpenBSD: get_addrs.c,v 1.4 1998/08/18 04:02:11 millert Exp $ */ /* $NetBSD: get_addrs.c,v 1.3 1994/12/09 02:14:14 jtc Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)get_addrs.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: get_addrs.c,v 1.3 1998/04/28 22:13:23 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: get_addrs.c,v 1.4 1998/08/18 04:02:11 millert Exp $"; #endif /* not lint */ #include "talk.h" @@ -53,15 +53,13 @@ get_addrs(my_machine_name, his_machine_name) { struct hostent *hp; struct servent *sp; + extern int h_errno; msg.pid = htonl(getpid()); /* look up the address of the local host */ hp = gethostbyname(my_machine_name); - if (hp == NULL) { - fprintf(stderr, "talk: %s: ", my_machine_name); - herror((char *)NULL); - exit(-1); - } + if (hp == NULL) + errx(1, "%s: %s", my_machine_name, hstrerror(h_errno)); bcopy(hp->h_addr, (char *)&my_machine_addr, hp->h_length); /* * If the callee is on-machine, just copy the @@ -69,20 +67,14 @@ get_addrs(my_machine_name, his_machine_name) */ if (strcmp(his_machine_name, my_machine_name)) { 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); } else his_machine_addr = my_machine_addr; /* 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 == NULL) + errx(1, "ntalk/udp: service is not registered."); daemon_port = sp->s_port; } |