diff options
| author | mrg <mrg@NetBSD.org> | 1997-10-19 14:35:28 +0000 |
|---|---|---|
| committer | mrg <mrg@NetBSD.org> | 1997-10-19 14:35:28 +0000 |
| commit | 658077dbfb04f9eac63c0a527b05901540451ecd (patch) | |
| tree | b6faf1a4a35956f77e29910746565410202ae125 /usr.bin/write | |
| parent | 568259857e1931ecee6dd5eab37ec078cc1f6fb0 (diff) | |
WARNSify; clean up .Nm
Diffstat (limited to 'usr.bin/write')
| -rw-r--r-- | usr.bin/write/write.1 | 15 | ||||
| -rw-r--r-- | usr.bin/write/write.c | 28 |
2 files changed, 24 insertions, 19 deletions
diff --git a/usr.bin/write/write.1 b/usr.bin/write/write.1 index aa7c026e3e6..4c71664e50e 100644 --- a/usr.bin/write/write.1 +++ b/usr.bin/write/write.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: write.1,v 1.4 1997/01/09 20:23:27 tls Exp $ +.\" $NetBSD: write.1,v 1.5 1997/10/19 14:35:28 mrg Exp $ .\" .\" Copyright (c) 1989, 1993 .\" The Regents of the University of California. All rights reserved. @@ -35,7 +35,6 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)write.1 8.1 (Berkeley) 6/6/93 -.\" $NetBSD: write.1,v 1.4 1997/01/09 20:23:27 tls Exp $ .\" .Dd June 6, 1993 .Dt WRITE 1 @@ -44,16 +43,16 @@ .Nm write .Nd send a message to another user .Sh SYNOPSIS -.Nm write +.Nm .Ar user .Op Ar ttyname .Sh DESCRIPTION -.Nm Write +.Nm allows you to communicate with other users, by copying lines from your terminal to theirs. .Pp When you run the -.Nm write +.Nm command, the user you are writing to gets a message of the form: .Pp .Dl Message from yourname@yourhost on yourtty at hh:mm ... @@ -61,7 +60,7 @@ command, the user you are writing to gets a message of the form: Any further lines you enter will be copied to the specified user's terminal. If the other user wants to reply, they must run -.Nm write +.Nm as well. .Pp When you are done, type an end-of-file or interrupt character. @@ -83,10 +82,10 @@ disallow writing automatically, so that your output isn't overwritten. If the user you want to write to is logged in on more than one terminal, you can specify which terminal to write to by specifying the terminal name as the second operand to the -.Nm write +.Nm command. Alternatively, you can let -.Nm write +.Nm select one of the terminals \- it will pick the one with the shortest idle time. This is so that if the user is logged in at work and also dialed up from diff --git a/usr.bin/write/write.c b/usr.bin/write/write.c index d5901edcb40..a11c2359531 100644 --- a/usr.bin/write/write.c +++ b/usr.bin/write/write.c @@ -1,4 +1,4 @@ -/* $NetBSD: write.c,v 1.8 1997/02/11 08:21:03 mrg Exp $ */ +/* $NetBSD: write.c,v 1.9 1997/10/19 14:35:31 mrg Exp $ */ /* * Copyright (c) 1989, 1993 @@ -36,17 +36,18 @@ * SUCH DAMAGE. */ +#include <sys/cdefs.h> #ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1989, 1993\n\ - The Regents of the University of California. All rights reserved.\n"; +__COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\ + The Regents of the University of California. All rights reserved.\n"); #endif /* not lint */ #ifndef lint #if 0 static char sccsid[] = "@(#)write.c 8.2 (Berkeley) 4/27/95"; +#else +__RCSID("$NetBSD: write.c,v 1.9 1997/10/19 14:35:31 mrg Exp $"); #endif -static char *rcsid = "$NetBSD: write.c,v 1.8 1997/02/11 08:21:03 mrg Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -63,12 +64,13 @@ static char *rcsid = "$NetBSD: write.c,v 1.8 1997/02/11 08:21:03 mrg Exp $"; #include <utmp.h> #include <err.h> -void done(); +void done __P((int)); void do_write __P((char *, char *, uid_t)); void wr_fputs __P((char *)); void search_utmp __P((char *, char *, char *, uid_t, int)); int term_chk __P((char *, int *, time_t *, int)); int utmp_chk __P((char *, char *)); +int main __P((int, char **)); int main(argc, argv) @@ -92,7 +94,7 @@ main(argc, argv) errx(1, "can't find your tty"); if (!(mytty = ttyname(myttyfd))) errx(1, "can't find your tty's name"); - if (cp = strrchr(mytty, '/')) + if ((cp = strrchr(mytty, '/')) != NULL) mytty = cp + 1; if (term_chk(mytty, &msgsok, &atime, 1)) exit(1); @@ -127,8 +129,11 @@ main(argc, argv) (void)fprintf(stderr, "usage: write user [tty]\n"); exit(1); } - done(); + done(0); /* NOTREACHED */ +#ifdef __GNUC__ + return (0); +#endif } /* @@ -257,7 +262,7 @@ do_write(tty, mytty, myuid) /* Determine our login name before the we reopen() stdout */ if ((login = getlogin()) == NULL) - if (pwd = getpwuid(myuid)) + if ((pwd = getpwuid(myuid)) != NULL) login = pwd->pw_name; else login = "???"; @@ -286,7 +291,8 @@ do_write(tty, mytty, myuid) * done - cleanup and exit */ void -done() +done(dummy) + int dummy; { (void)printf("EOF\r\n"); exit(0); @@ -317,6 +323,6 @@ wr_fputs(s) } return; -err: err(1, NULL); +err: err(1, "%s", ""); #undef PUTC } |
