diff options
author | johan <johan@FreeBSD.org> | 2002-07-09 02:16:49 +0000 |
---|---|---|
committer | johan <johan@FreeBSD.org> | 2002-07-09 02:16:49 +0000 |
commit | 784b48a6bb9b28dfbe08f290b7497333d1ed9c39 (patch) | |
tree | c91eef50ab8a64269c76ce38216fd16fdca2d980 /usr.bin/biff | |
parent | f271ae2de506248c8624176eda0e57459d77a71a (diff) | |
download | FreeBSD-src-784b48a6bb9b28dfbe08f290b7497333d1ed9c39.zip FreeBSD-src-784b48a6bb9b28dfbe08f290b7497333d1ed9c39.tar.gz |
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 <ajk@purdue.edu>
Approved by: sheldonh (mentor)
MFC after: 1 month
Diffstat (limited to 'usr.bin/biff')
-rw-r--r-- | usr.bin/biff/biff.1 | 13 | ||||
-rw-r--r-- | usr.bin/biff/biff.c | 19 |
2 files changed, 22 insertions, 10 deletions
diff --git a/usr.bin/biff/biff.1 b/usr.bin/biff/biff.1 index c19a0b1..49d711d 100644 --- a/usr.bin/biff/biff.1 +++ b/usr.bin/biff/biff.1 @@ -40,7 +40,7 @@ .Nd "be notified if mail arrives and who it is from" .Sh SYNOPSIS .Nm -.Op Cm n | y +.Op Cm n | y | b .Sh DESCRIPTION The .Nm @@ -52,11 +52,13 @@ The following options are available: .It Cm n Disable notification. .It Cm y -Enable notification. +Enable header notification. +.It Cm b +Enable bell notification. .El .Pp -When mail notification is enabled, the header and first few lines of -the message will be printed on your screen whenever mail arrives. +When header notification is enabled, the header and first few lines of +the message will be printed on your terminal whenever mail arrives. A .Dq Li biff y command is often included in the file @@ -65,6 +67,9 @@ or .Pa \&.profile to be executed at each login. .Pp +When bell notification is enabled, only two bell characters (ASCII \\007) +will be printed on your terminal whenever mail arrives. +.Pp The .Nm utility operates asynchronously. 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); } |