From 784b48a6bb9b28dfbe08f290b7497333d1ed9c39 Mon Sep 17 00:00:00 2001 From: johan Date: Tue, 9 Jul 2002 02:16:49 +0000 Subject: Add ability to only beep when mail arrives. comsat: only send two bell charecters if S_IXGRP is set and S_IXUSR is not. biff: add new option 'b' to set S_IXGRP. PR: 10931 Submitted by: Andrew J. Korty Approved by: sheldonh (mentor) MFC after: 1 month --- usr.bin/biff/biff.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'usr.bin/biff/biff.c') diff --git a/usr.bin/biff/biff.c b/usr.bin/biff/biff.c index 67341ba..ccbc32a 100644 --- a/usr.bin/biff/biff.c +++ b/usr.bin/biff/biff.c @@ -81,28 +81,35 @@ main(argc, argv) err(2, "stat"); if (*argv == NULL) { - (void)printf("is %s\n", sb.st_mode & S_IXUSR ? "y" : "n"); - return(sb.st_mode & S_IXUSR ? 0 : 1); + (void)printf("is %s%s\n", + sb.st_mode & S_IXUSR ? "y" : + sb.st_mode & S_IXGRP ? "b" : "n"); + return(sb.st_mode & (S_IXUSR | S_IXGRP) ? 0 : 1); + } switch(argv[0][0]) { case 'n': - if (chmod(name, sb.st_mode & ~S_IXUSR) < 0) + if (chmod(name, sb.st_mode & ~(S_IXUSR | S_IXGRP)) < 0) err(2, "%s", name); break; case 'y': - if (chmod(name, sb.st_mode | S_IXUSR) < 0) + if (chmod(name, (sb.st_mode & ~(S_IXUSR | S_IXGRP)) | S_IXUSR) < 0) + err(2, "%s", name); + break; + case 'b': + if (chmod(name, (sb.st_mode & ~(S_IXUSR | S_IXGRP)) | S_IXGRP) < 0) err(2, "%s", name); break; default: usage(); } - return(sb.st_mode & S_IXUSR ? 0 : 1); + return(sb.st_mode & (S_IXUSR | S_IXGRP) ? 0 : 1); } static void usage() { - (void)fprintf(stderr, "usage: biff [y | n]\n"); + (void)fprintf(stderr, "usage: biff [n | y | b]\n"); exit(2); } -- cgit v1.1