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 /libexec/comsat/comsat.c | |
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 'libexec/comsat/comsat.c')
-rw-r--r-- | libexec/comsat/comsat.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/libexec/comsat/comsat.c b/libexec/comsat/comsat.c index a966002..1221566 100644 --- a/libexec/comsat/comsat.c +++ b/libexec/comsat/comsat.c @@ -211,7 +211,7 @@ notify(struct utmp *utp, char file[], off_t offset, int folder) syslog(LOG_AUTH | LOG_NOTICE, "'/' in \"%s\"", tty); return; } - if (stat(tty, &stb) || !(stb.st_mode & S_IEXEC)) { + if (stat(tty, &stb) || !(stb.st_mode & (S_IXUSR | S_IXGRP))) { dsyslog(LOG_DEBUG, "%s: wrong mode on %s", utp->ut_name, tty); return; } @@ -228,11 +228,25 @@ notify(struct utmp *utp, char file[], off_t offset, int folder) cr = ((tio.c_oflag & (OPOST|ONLCR)) == (OPOST|ONLCR)) ? "\n" : "\n\r"; (void)strncpy(name, utp->ut_name, sizeof(utp->ut_name)); name[sizeof(name) - 1] = '\0'; - (void)fprintf(tp, "%s\007New mail for %s@%.*s\007 has arrived%s%s%s:%s----%s", - cr, name, (int)sizeof(hostname), hostname, - folder ? cr : "", folder ? "to " : "", folder ? file : "", - cr, cr); - jkfprintf(tp, name, file, offset); + switch (stb.st_mode & (S_IXUSR | S_IXGRP)) { + case S_IXUSR: + case (S_IXUSR | S_IXGRP): + (void)fprintf(tp, + "%s\007New mail for %s@%.*s\007 has arrived%s%s%s:%s----%s", + cr, name, (int)sizeof(hostname), hostname, + folder ? cr : "", folder ? "to " : "", folder ? file : "", + cr, cr); + jkfprintf(tp, name, file, offset); + break; + case S_IXGRP: + (void)fprintf(tp, "\007"); + (void)fflush(tp); + (void)sleep(1); + (void)fprintf(tp, "\007"); + break; + default: + break; + } (void)fclose(tp); _exit(0); } |