1 /* vi: set sw=4 ts=4: */
3 * mesg implementation for busybox
5 * Copyright (c) 2002 Manuel Novoa III <mjn3@codepoet.org>
7 * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
15 #define S_IWGRP_OR_S_IWOTH S_IWGRP
17 #define S_IWGRP_OR_S_IWOTH (S_IWGRP | S_IWOTH)
20 int mesg_main(int argc, char *argv[])
27 || ((argc == 1) && (((c = **++argv) == 'y') || (c == 'n')))) {
28 if ((tty = ttyname(STDERR_FILENO)) == NULL) {
30 } else if (stat(tty, &sb) == 0) {
32 puts(((sb.st_mode & (S_IWGRP | S_IWOTH)) ==
33 0) ? "is n" : "is y");
39 'y') ? sb.st_mode | (S_IWGRP_OR_S_IWOTH) : sb.
40 st_mode & ~(S_IWGRP | S_IWOTH)) == 0) {
44 bb_perror_msg_and_die("%s", tty);