Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!elroy.jpl.nasa.gov!sdd.hp.com!hplabs!hpda!hpcuhc!mck From: mck@hpcuhc.cup.hp.com (Doug McKenzie) Newsgroups: comp.sys.hp Subject: Re: biff Message-ID: <530027@hpcuhc.cup.hp.com> Date: 4 Feb 91 15:03:42 GMT References: Organization: Hewlett Packard, Cupertino Lines: 134 >There is a UNIX BSD utility program called 'biff' which notifies the >user about any incoming mail. Is there any similar program on HP-UX? >If not, has anyone tried to write code with similar functionality. Below is a slightly ancient, unsupported version, with man page. Doug McKenzie HP-UX Support # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by Doug McKenzie on Mon Feb 4 06:59:53 1991 # # This archive contains: # biff.1 biff.c # LANG=""; export LANG PATH=/bin:/usr/bin:$PATH; export PATH echo x - biff.1 cat >biff.1 <<'@EOF' '''\" UNISRC_ID @(#)37.1 87/02/20 .TH BIFF 1 "18 July 1983" .UC 4 .SH NAME biff \- be notified if mail arrives and who it is from .SH SYNOPSIS .B biff [ .B yn ] .SH DESCRIPTION .I Biff informs the system whether you want to be notified when mail arrives during the current terminal session. The command .IP .B "biff y" .LP enables notification; the command .IP .B "biff n" .LP disables it. When mail notification is enabled, the header and first few lines of the message will be printed on your screen whenever mail arrives. A ``biff y'' command is often included in the file .I \&.login or .I \&.profile to be executed at each login. .PP .I Biff operates asynchronously. For synchronous notification use the MAIL variable of .IR sh (1) or the .I mail variable of .IR csh (1). .SH SEE ALSO csh(1), sh(1), mail(1), comsat(8C) @EOF chmod 444 biff.1 echo x - biff.c cat >biff.c <<'@EOF' #ifdef hpux #ifndef lint static char *UNISRC_ID = "@(#)37.1 87/02/20"; #endif /* HPUX_ID: @(#)biff.c 37.1 86/06/16 */ #else #ifndef lint static char *sccsid ="@(#)biff.c 4.2 (Berkeley) 7/2/83"; #endif #endif not hpux /* * biff */ #include #include #include char *ttyname(); main(argc, argv) int argc; char **argv; { char *cp = ttyname(2); struct stat stb; argc--, argv++; if (cp == 0) fprintf(stderr, "Where are you?\n"), exit(1); if (stat(cp, &stb) < 0) perror(cp), exit(1); if (argc == 0) { printf("is %s\n", stb.st_mode&0100 ? "y" : "n"); exit((stb.st_mode&0100) ? 0 : 1); } switch (argv[0][0]) { case 'y': if (chmod(cp, stb.st_mode|0100) < 0) perror(cp); break; case 'n': if (chmod(cp, stb.st_mode&~0100) < 0) perror(cp); break; default: fprintf(stderr, "usage: biff [y] [n]\n"); } exit((stb.st_mode&0100) ? 0 : 1); } @EOF chmod 444 biff.c exit 0