From 20868061ee3c06243e6e4aa990e0a9c4c23b800b Mon Sep 17 00:00:00 2001 From: Philippe 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/ctl.c | 7 ++++--- usr.bin/talk/ctl_transact.c | 4 ++++ usr.bin/talk/display.c | 4 ++++ usr.bin/talk/get_addrs.c | 28 ++++++++++++---------------- usr.bin/talk/get_iface.c | 11 +++++------ usr.bin/talk/get_names.c | 33 +++++++++++++++++++-------------- usr.bin/talk/init_disp.c | 12 ++++++------ usr.bin/talk/invite.c | 17 ++++++++++------- usr.bin/talk/io.c | 7 ++++--- usr.bin/talk/look_up.c | 7 +++++-- usr.bin/talk/msgs.c | 6 ++++-- 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 2f77608a2b7c..52a986fe011a 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 #include -#include -#include #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 2cd4dcea2b41..2f2d8430bbb2 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 diff --git a/usr.bin/talk/display.c b/usr.bin/talk/display.c index 7b43d4690574..8dbd7583d386 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 7ac9267d003e..641f80fa3237 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; } diff --git a/usr.bin/talk/get_iface.c b/usr.bin/talk/get_iface.c index 3aef9b20dc86..ef5c2797d2e0 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 -#include -#include -#include +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ +#include #include "talk.h" /* diff --git a/usr.bin/talk/get_names.c b/usr.bin/talk/get_names.c index 793ce7210b8c..762f4ff83700 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 +#include +#include #include #include -#include #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 7eded28f2183..c5cd612a474d 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 +#include +#include #include -#include -#include - #include -#include -#include #include "talk.h" /* diff --git a/usr.bin/talk/invite.c b/usr.bin/talk/invite.c index 579aed00359a..a788d43bd00d 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 +#include +#include +#include #include #include -#include -#include -#include #include -#include -#include #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 7b8ead8a8090..fc3dc5494681 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 -#include -#include #include #include #include "talk.h" diff --git a/usr.bin/talk/look_up.c b/usr.bin/talk/look_up.c index 62356eac8080..fad2e391d2ae 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 #include #include -#include #include -#include #include "talk_ctl.h" #include "talk.h" diff --git a/usr.bin/talk/msgs.c b/usr.bin/talk/msgs.c index 0b3eeee3619a..ea9560887689 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 #include -#include #include "talk.h" #define MSG_INTERVAL 4 diff --git a/usr.bin/talk/talk.c b/usr.bin/talk/talk.c index 68b9d57b6bda..09b6c753f1ea 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" -- cgit v1.2.3