Date: Sun, 13 Dec 1998 14:09:35 -0500 From: "Andrew J. Korty" <ajk@purdue.edu> To: freebsd-current@FreeBSD.ORG Subject: biff b Message-ID: <199812131909.OAA11246@poynting.physics.purdue.edu>
index | next in thread | raw e-mail
[-- Attachment #1 --] The stock versions of biff(1) and comsat(8) cause the header and first few lines of an arriving mail message to be displayed. My (trivial) modifications to these programs add the "biff b" feature found in some other UNIX variants. In this mode, only a couple of BEL characters are sent to the user's terminal, signifying new mail without disturbing the display. I can't commit this feature because I don't have the privs, but my diffs are attached ... Andrew J. Korty, Director http://www.physics.purdue.edu/~ajk/ Physics Computer Network 85 73 1F 04 63 D9 9D 65 Purdue University 65 2E 7A A8 81 8C 45 75 [-- Attachment #2 --] Index: src/usr.bin/biff/biff.1 =================================================================== RCS file: /usr/cvs/freebsd/src/usr.bin/biff/biff.1,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -c -r1.1.1.1 -r1.2 *** biff.1 1998/12/03 15:41:40 1.1.1.1 --- biff.1 1998/12/07 14:52:39 1.2 *************** *** 40,46 **** .Nd "be notified if mail arrives and who it is from" .Sh SYNOPSIS .Nm biff ! .Op Cm n | y .Sh DESCRIPTION .Nm Biff informs the system whether you want to be notified when mail arrives --- 40,46 ---- .Nd "be notified if mail arrives and who it is from" .Sh SYNOPSIS .Nm biff ! .Op Cm n | y | b .Sh DESCRIPTION .Nm Biff informs the system whether you want to be notified when mail arrives *************** *** 53,58 **** --- 53,60 ---- Disables notification. .It Cm y Enables notification. + .It Cm b + Beeps twice. (Prints no header information.) .El .Pp When mail notification is enabled, the header and first few lines of Index: src/usr.bin/biff/biff.c =================================================================== RCS file: /usr/cvs/freebsd/src/usr.bin/biff/biff.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -c -r1.1.1.1 -r1.2 *** biff.c 1998/12/03 15:41:40 1.1.1.1 --- biff.c 1998/12/07 14:52:39 1.2 *************** *** 80,107 **** err(2, "stat"); if (*argv == NULL) { ! (void)printf("is %s\n", sb.st_mode&0100 ? "y" : "n"); return(sb.st_mode & 0100 ? 0 : 1); } switch(argv[0][0]) { case 'n': ! if (chmod(name, sb.st_mode & ~0100) < 0) err(2, name); break; case 'y': ! if (chmod(name, sb.st_mode | 0100) < 0) err(2, name); break; default: usage(); } ! return(sb.st_mode & 0100 ? 0 : 1); } static void usage() { ! (void)fprintf(stderr, "usage: biff [y | n]\n"); exit(2); } --- 80,121 ---- err(2, "stat"); if (*argv == NULL) { ! switch (sb.st_mode & (S_IXUSR | S_IXGRP)) { ! case S_IXUSR: ! (void)printf("is y\n"); ! break; ! case S_IXGRP: ! (void)printf("is b\n"); ! break; ! default: ! (void)printf("is n\n"); ! break; ! } return(sb.st_mode & 0100 ? 0 : 1); } switch(argv[0][0]) { case 'n': ! if (chmod(name, sb.st_mode & ~(S_IXUSR | S_IXGRP)) < 0) err(2, name); break; case 'y': ! if (chmod(name, sb.st_mode & ~S_IXGRP | S_IXUSR) < 0) ! err(2, name); ! break; ! case 'b': ! if (chmod(name, sb.st_mode & ~S_IXUSR | S_IXGRP) < 0) err(2, name); break; default: usage(); } ! return(sb.st_mode & (S_IXUSR | S_IXGRP) ? 0 : 1); } static void usage() { ! (void)fprintf(stderr, "usage: biff [y | n | b]\n"); exit(2); } Index: src/libexec/comsat/comsat.c =================================================================== RCS file: /usr/cvs/freebsd/src/libexec/comsat/comsat.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -c -r1.1.1.1 -r1.2 *** comsat.c 1998/12/03 15:38:10 1.1.1.1 --- comsat.c 1998/12/07 14:54:17 1.2 *************** *** 220,226 **** syslog(LOG_AUTH | LOG_NOTICE, "'/' in \"%s\"", tty); return; } ! if (stat(tty, &stb) || !(stb.st_mode & S_IEXEC)) { dsyslog(LOG_DEBUG, "%s: wrong mode on %s", utp->ut_name, tty); return; } --- 220,226 ---- syslog(LOG_AUTH | LOG_NOTICE, "'/' in \"%s\"", tty); return; } ! if (stat(tty, &stb) || !(stb.st_mode & (S_IXUSR | S_IXGRP))) { dsyslog(LOG_DEBUG, "%s: wrong mode on %s", utp->ut_name, tty); return; } *************** *** 237,247 **** 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); (void)fclose(tp); _exit(0); } --- 237,257 ---- 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'; ! switch (stb.st_mode & (S_IXUSR | S_IXGRP)) { ! case S_IXUSR: ! (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; ! } (void)fclose(tp); _exit(0); }help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812131909.OAA11246>
