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 | |
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')
-rw-r--r-- | usr.bin/talk/ctl.c | 7 | ||||
-rw-r--r-- | usr.bin/talk/ctl_transact.c | 4 | ||||
-rw-r--r-- | usr.bin/talk/display.c | 4 | ||||
-rw-r--r-- | usr.bin/talk/get_addrs.c | 28 | ||||
-rw-r--r-- | usr.bin/talk/get_iface.c | 11 | ||||
-rw-r--r-- | usr.bin/talk/get_names.c | 33 | ||||
-rw-r--r-- | usr.bin/talk/init_disp.c | 12 | ||||
-rw-r--r-- | usr.bin/talk/invite.c | 17 | ||||
-rw-r--r-- | usr.bin/talk/io.c | 7 | ||||
-rw-r--r-- | usr.bin/talk/look_up.c | 7 | ||||
-rw-r--r-- | usr.bin/talk/msgs.c | 6 | ||||
-rw-r--r-- | usr.bin/talk/talk.c | 6 |
12 files changed, 82 insertions, 60 deletions
diff --git a/usr.bin/talk/ctl.c b/usr.bin/talk/ctl.c index 2f77608..52a986f 100644 --- a/usr.bin/talk/ctl.c +++ b/usr.bin/talk/ctl.c @@ -32,7 +32,11 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)ctl.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ /* @@ -43,10 +47,7 @@ static char sccsid[] = "@(#)ctl.c 8.1 (Berkeley) 6/6/93"; #include <sys/types.h> #include <sys/socket.h> -#include <protocols/talkd.h> -#include <netinet/in.h> #include "talk.h" -#include "talk_ctl.h" struct sockaddr_in daemon_addr = { sizeof(daemon_addr), AF_INET }; struct sockaddr_in ctl_addr = { sizeof(ctl_addr), AF_INET }; diff --git a/usr.bin/talk/ctl_transact.c b/usr.bin/talk/ctl_transact.c index 2cd4dce..2f2d843 100644 --- a/usr.bin/talk/ctl_transact.c +++ b/usr.bin/talk/ctl_transact.c @@ -32,7 +32,11 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)ctl_transact.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include <errno.h> diff --git a/usr.bin/talk/display.c b/usr.bin/talk/display.c index 7b43d46..8dbd758 100644 --- a/usr.bin/talk/display.c +++ b/usr.bin/talk/display.c @@ -32,7 +32,11 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)display.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ /* 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; } diff --git a/usr.bin/talk/get_iface.c b/usr.bin/talk/get_iface.c index 3aef9b2..ef5c279 100644 --- a/usr.bin/talk/get_iface.c +++ b/usr.bin/talk/get_iface.c @@ -28,15 +28,14 @@ * * From: * Id: find_interface.c,v 1.1 1995/08/14 16:08:39 wollman Exp - * - * $Id$ */ -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ +#include <errno.h> #include "talk.h" /* diff --git a/usr.bin/talk/get_names.c b/usr.bin/talk/get_names.c index 793ce72..762f4ff 100644 --- a/usr.bin/talk/get_names.c +++ b/usr.bin/talk/get_names.c @@ -32,17 +32,28 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)get_names.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ -#include <unistd.h> +#include <err.h> +#include <pwd.h> #include <string.h> #include <sys/param.h> -#include <pwd.h> #include "talk.h" extern CTL_MSG msg; +static void +usage(void) +{ + fprintf(stderr, "usage: talk person [ttyname]\n"); + exit(1); +} + /* * Determine the local and remote user, tty, and machines */ @@ -57,21 +68,15 @@ get_names(argc, argv) char *my_tty, *his_tty; register char *cp; - if (argc < 2 ) { - printf("Usage: talk user [ttyname]\n"); - exit(-1); - } - if (!isatty(0)) { - printf("Standard input must be a tty, not a pipe or a file\n"); - exit(-1); - } + if (argc < 2 ) + usage(); + if (!isatty(0)) + errx(1, "standard input must be a tty, not a pipe or a file"); if ((my_name = getlogin()) == NULL) { struct passwd *pw; - if ((pw = getpwuid(getuid())) == NULL) { - printf("You don't exist. Go away.\n"); - exit(-1); - } + if ((pw = getpwuid(getuid())) == NULL) + errx(1, "you don't exist. Go away"); my_name = pw->pw_name; } gethostname(hostname, sizeof (hostname)); diff --git a/usr.bin/talk/init_disp.c b/usr.bin/talk/init_disp.c index 7eded28..c5cd612 100644 --- a/usr.bin/talk/init_disp.c +++ b/usr.bin/talk/init_disp.c @@ -32,7 +32,11 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)init_disp.c 8.2 (Berkeley) 2/16/94"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ /* @@ -40,14 +44,10 @@ static char sccsid[] = "@(#)init_disp.c 8.2 (Berkeley) 2/16/94"; * as well as the signal handling routines. */ -#include <sys/types.h> +#include <err.h> +#include <signal.h> #include <sys/stat.h> -#include <sys/termios.h> -#include <sys/ttydefaults.h> - #include <unistd.h> -#include <signal.h> -#include <err.h> #include "talk.h" /* diff --git a/usr.bin/talk/invite.c b/usr.bin/talk/invite.c index 579aed0..a788d43 100644 --- a/usr.bin/talk/invite.c +++ b/usr.bin/talk/invite.c @@ -32,17 +32,20 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)invite.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ +#include <err.h> +#include <errno.h> +#include <setjmp.h> +#include <signal.h> #include <sys/types.h> #include <sys/socket.h> -#include <sys/time.h> -#include <signal.h> -#include <netinet/in.h> #include <protocols/talkd.h> -#include <errno.h> -#include <setjmp.h> #include "talk_ctl.h" #include "talk.h" @@ -184,11 +187,11 @@ send_delete() if (sendto(ctl_sockt, &msg, sizeof (msg), 0, (struct sockaddr *)&daemon_addr, sizeof (daemon_addr)) != sizeof(msg)) - perror("send_delete (remote)"); + warn("send_delete (remote)"); msg.id_num = htonl(local_id); daemon_addr.sin_addr = my_machine_addr; if (sendto(ctl_sockt, &msg, sizeof (msg), 0, (struct sockaddr *)&daemon_addr, sizeof (daemon_addr)) != sizeof (msg)) - perror("send_delete (local)"); + warn("send_delete (local)"); } diff --git a/usr.bin/talk/io.c b/usr.bin/talk/io.c index 7b8ead8..fc3dc54 100644 --- a/usr.bin/talk/io.c +++ b/usr.bin/talk/io.c @@ -32,7 +32,11 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ /* @@ -41,9 +45,6 @@ static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93"; * ctl.c */ -#include <sys/ioctl.h> -#include <sys/time.h> -#include <stdio.h> #include <errno.h> #include <string.h> #include "talk.h" diff --git a/usr.bin/talk/look_up.c b/usr.bin/talk/look_up.c index 62356ea..fad2e39 100644 --- a/usr.bin/talk/look_up.c +++ b/usr.bin/talk/look_up.c @@ -32,14 +32,17 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)look_up.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ +#include <errno.h> #include <sys/types.h> #include <sys/socket.h> -#include <netinet/in.h> #include <protocols/talkd.h> -#include <errno.h> #include "talk_ctl.h" #include "talk.h" diff --git a/usr.bin/talk/msgs.c b/usr.bin/talk/msgs.c index 0b3eeee..ea95608 100644 --- a/usr.bin/talk/msgs.c +++ b/usr.bin/talk/msgs.c @@ -32,7 +32,11 @@ */ #ifndef lint +#if 0 static char sccsid[] = "@(#)msgs.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ /* @@ -40,9 +44,7 @@ static char sccsid[] = "@(#)msgs.c 8.1 (Berkeley) 6/6/93"; * if we are slow connecting. */ -#include <sys/time.h> #include <signal.h> -#include <stdio.h> #include "talk.h" #define MSG_INTERVAL 4 diff --git a/usr.bin/talk/talk.c b/usr.bin/talk/talk.c index 68b9d57..09b6c75 100644 --- a/usr.bin/talk/talk.c +++ b/usr.bin/talk/talk.c @@ -32,13 +32,17 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1983, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint +#if 0 static char sccsid[] = "@(#)talk.c 8.1 (Berkeley) 6/6/93"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include "talk.h" |