* Copyright (c) 1987 Regents of the University of California.
* %sccs.include.redist.c%
"@(#) Copyright (c) 1987 Regents of the University of California.\n\
static char sccsid
[] = "@(#)mesg.c 5.1 (Berkeley) %G%";
static void err
__P((const char *fmt
, ...));
static void usage
__P((void));
while ((ch
= getopt(argc
, argv
, "")) != EOF
)
err("ttyname: %s", strerror(errno
));
if (stat(tty
, &sbuf
) < 0)
err("%s: %s", strerror(errno
));
if (sbuf
.st_mode
& 020) {
(void)fprintf(stderr
, "is y\n");
(void)fprintf(stderr
, "is n\n");
if (chmod(tty
, sbuf
.st_mode
| OTHER_WRITE
) < 0)
err("%s: %s", strerror(errno
));
if (chmod(tty
, sbuf
.st_mode
&~ OTHER_WRITE
) < 0)
err("%s: %s", strerror(errno
));
(void)fprintf(stderr
, "usage: mesg [y | n]\n");
err(const char *fmt
, ...)
(void)fprintf(stderr
, "mesg: ");
(void)vfprintf(stderr
, fmt
, ap
);
(void)fprintf(stderr
, "\n");