1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-01 08:27:59 +00:00

Add rcsid. Remove unused #includes (what about RU# ?). Change exit(-1) and

add usage().
This commit is contained in:
Philippe Charnier 1998-01-14 07:21:14 +00:00
parent 69036300b2
commit 20868061ee
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=32503
12 changed files with 84 additions and 62 deletions

View File

@ -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 };

View File

@ -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>

View File

@ -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 */
/*

View File

@ -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;
}

View File

@ -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"
/*

View File

@ -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));

View File

@ -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 <sys/stat.h>
#include <sys/termios.h>
#include <sys/ttydefaults.h>
#include <unistd.h>
#include <signal.h>
#include <err.h>
#include <signal.h>
#include <sys/stat.h>
#include <unistd.h>
#include "talk.h"
/*

View File

@ -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 <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <signal.h>
#include <netinet/in.h>
#include <protocols/talkd.h>
#include <err.h>
#include <errno.h>
#include <setjmp.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <protocols/talkd.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)");
}

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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"