xlbiff-4.1.orig/0040755000765700007640000000000007753323305012454 5ustar martinedvxlbiff-4.1.orig/README0100644000765700007640000002166307753323226013343 0ustar martinedv=========== WHAT IS IT? =========== Is xbiff just not quite enough for you? This is xlbiff, the X Literate Biff. Xlbiff lurks in the background, monitoring your mailbox file (normally /var/spool/mail/). When something shows up there, it invokes the MH scan(1) command and displays the output in a window. If more mail comes in, it scans again and resizes accordingly. Clicking the left mouse button anywhere in the window causes it to vanish. It will also vanish if you inc(1) and the mailbox becomes empty. Xlbiff is modeled after xconsole -- its job is to sit invisibly and pop up only when something demands your attention. ========== ADVANTAGES (or, Why Yet Another Biff?) ========== Xlbiff: + occupies no screen real estate until mail comes in + lets you preview new mail to decide if you want to read it immediately + is easy to make go away ========== INSTALLING ========== Xlbiff is old... it uses the X11 "imake" mechanism: % xmkmf % make You may want to look at the Imakefile to make sure you agree with the default values in it, first. =========================== INSTALLING -- WITHOUT IMAKE =========================== If you don't have imake, copy the file Makefile.std to 'Makefile' and edit it to make sure everything looks good. Type 'make' and cross your fingers. If that all works, su and type `make install' or install by hand -- you should be able to figure it out. And _please_ don't just su because I say so. Take a look at the sources and Makefile before you compromise your system. If the make didn't work out that well, see PORTING below. =========== CUSTOMIZING =========== You may want to tweak some values in the app-defaults file and/or add some resources to your .Xdefaults. You also probably want to tell your window manager not to put borders or titlebars or whatever around the xlbiff window. Finally, don't forget to add an `l' to that xbiff invocation in your .Xlogin! Note that an MH format file, xlbiff.form, is included. This form: - omits message number, which is meaningless in this context - omits message size, since `scan -file' can't figure it out - puts a `*' next to the message if your name is on the To: list (before you say "no duh", think about mailing lists and cc's) - displays the date in a friendly format - packs as much subject & body into one line as possible. Xlbiff.form was stolen & hacked from Jerry Peek's excellent Nutshell book on MH & xmh. There are also two sample scripts, Bcheck and Bscan, intended to be used in conjunction. These are for checking mail in "bulk" maildrops. See README.bulk for more info. ======================= |THINGS TO BE AWARE OF| ======================= Xlbiff invokes `scan -file xxx' by default, and thus requires MH 6.7 or above. If your MH isn't at this level, you can find the latest version on ftp.ics.uci.edu:/pub/mh. If you don't feel like upgrading, there's a really, really ugly kludge you can do with inc: inc -notruncate -silent -file %s -form xlbiff.form \ -width %d -audit /tmp/xlbiff.$$ +.null >/dev/null 2>&1; \ cat /tmp/xlbiff.$$; \ rm /tmp/xlbiff.$$ >/dev/null 2>&1; \ rmf +.null >/dev/null 2>&1 Note that this is truly bletcherous and will give you lots of headaches when new mail comes in and your MH context gets screwed up. If you're a Berkeley mail person, you can set scanCommand to: echo x | mail | grep "^.[NU]" but it sure does look ugly. Perhaps there are .mailrc settings to make it look more decent? If you use Elm you may want to use `frm' as your scanCommand. Some people seem to be very satisfied with the `fromwho' package, posted by jearls@blackbird.csc.calpoly.edu to comp.sources.unix volume 25, available on gatekeeper.dec.com or ftp.uu.net or other places Archie surely knows about. Also be aware that problems have been detected with xlbiff reading a mail file on an NFS-mounted directory. Xlbiff is not guaranteed to work under these conditions. ======================================= PORTING (or, if INSTALLING didn't work) ======================================= Xlbiff should be pretty portable. It was developed in 1991 on a DECstation 5000/200 running Ultrix 4.2 using cc and gcc; it has been known to run on Linux, Solaris, and others. Xlbiff requires X11R5 or beyond and works best with MH 6.7 and up, or nmh 1.1. On systems that don't have strerror(), eg, SunOS, you will need to uncomment the NEED_STRERROR line in Imakefile or Makefile.std. On systems that don't have memcpy, you may want to uncomment the USE_BCOPY line in Imakefile or Makefile.std. I *think* most portability bugs have been ironed out, but of course there are always a few left. If fixes are required, or if you add any whizzy features (see TODO for a partial list), please mail them to me, esm@pobox.com, and I will wrap them up for future releases. ========== BACKGROUND ========== I wrote xlbiff because I don't always want to read my mail. Regular xbiff lets me know when I have mail but not what it is -- this makes me have to inc(1) just so I can decide if I want to bother reading it. Xlbiff gives me a much better indication of whether or not I want to take time to read a new message. If I don't, I just click it away and continue with what I'm doing. Before xlbiff, I wrote a crude hack using perl and xmessage. It worked, but I had always wanted to do it right. ======= HISTORY ======= The following describes changes made to xlbiff throughout its history. Where applicable, changes are attributed to the people who submitted the ideas and, in many cases, patches and source code. * Version 4.1 (8 Nov 2003) + improved Bcheck and Bscan + updated email addresses, URLs + Packaged for Debian release * Version 4.0 (2 June 1994 for X11R6 contrib tape) + expand functionality of "checkCommand" + include "bulk" scripts, taking advantage of checkCommand + general cleanup From Stephen Gildea + don't call XBell() if volume is zero (workaround for bug in certain X terminals). * Version 3.1 (unreleased) From Bjoern Stabell + add *mailerCommand resource and functionality * Version 3.0 (released 26 Oct 92) + miscellaneous bug fixes From Gary Weimer + add "sound" resource -- allows playing any sound on popup. From Neil O'Sullivan + add "fade" resource -- pops window down after certain time. * Version 2.1 BETA From Daren W Latham + add -refresh and -led options. + handle WM_DELETE_WINDOW. From Peter Fischman + Add some comments to Makefile.std to help out SYSV'ers From Stephen Gildea + Lots of cleanup in the default resources. From Yuan Liu + Handle remapping better, don't vanish when WM restarts. From me: + add ErrExit routine, do some more cleanup. + output error message if scan fails, but don't die. + add ledPopdown option. + add checkCommand option (after lots of pestering by Mark!) * Version 2.0 submitted for X11R5 contrib tape Fri 4 Oct 1991 + no change, just up rev level * Version 1.5 submitted for testing Thu 3 Oct 1991 From Jhon Honce + change 'maxWidth/maxHeight' to 'columns/rows'. Bottom option was broken and I hadn't even noticed! From me: + I need to track revisions better... * Version 1.4 submitted for testing Thu 3 Oct 1991 From Arthur Castonguay + ignore stat() errors, treat them as empty file. From Stephen Gildea + use XtPop{up,down} instead of {,un}mapWidget. From several or myself + change .width resource to .maxWidth to fix strange bug. + yet more portability fixes and cleanup. * Version 1.3 submitted for testing Tue 1 Oct 1991 From Stephen Gildea + use allowShellResize and {,un}map instead of {,un}realize so it tracks position changes. + clean up .ad file + raise window to top of stack on new mail. + add 'resetSaver' option. From Mike Schroeder + don't pop up if results of scanCommand are null. This is useful for mail(1)-based users since the mailbox size will normally be >0 but that may not indicate new mail. From several + remove ANSI C dependencies. + use XtAppAddTimeOut() instead of alarm()/sleep()/setjmp(). + clean up a bit. From me + add 'bottom' resource to preserve old functionality if you want to keep xlbiff at the bottom of your screen. * Version 1.0 posted to alt.sources Thu 19 Sep 1991 ====== AUTHOR ====== Ed Santiago The latest version of xlbiff may be found at http://www.edsantiago.com/xlbiff/ xlbiff-4.1.orig/README.bulk0100644000765700007640000000274407753302371014274 0ustar martinedv Do you subscribe to a lot of mailing lists? If so, do you have a mail filter that sorts incoming messages into different bins without bothering you? If so, you may find the included scripts useful. In my bin directory is a symbolic link, "xlbiff-bulk", that points to the xlbiff executable. In my .Xdefaults file are the following resources: xlbiff-bulk*background: purple xlbiff-bulk*foreground: green xlbiff-bulk.checkCommand: Bcheck -f %s -p %d xlbiff-bulk.scanCommand: Bscan xlbiff-bulk.mailerCommand: /bin/true xlbiff-bulk.bottom: true xlbiff-bulk.geometry: -0+70 xlbiff-bulk.led: 0 xlbiff-bulk.refresh: 0 xlbiff-bulk.resetSaver: False xlbiff-bulk.sound: play -v 20 /usr/demo/SOUND/sounds/clink.au xlbiff-bulk.volume: 0 xlbiff-bulk.rows: 35 Running "xlbiff-bulk" gets me a window on the top right of my screen with an output something like: A/lert 1 tools-group 1 C/release 2 software 1 H/ 3 comics 16 M/agenda 3 debian 14 debian/lap 8 ssh 3 zaurus 10 zaurus/oz 34 Z/spam 20 These are various subfolders and sub-subfolders, e.g. ~/Mail/A/lert. My folders are organized by priority, with A/* the highest and Z/* lowest. As more mail comes into each bin, the count for each one gets updated. When I read and delete mail in a given bin, the count drops. xlbiff-4.1.orig/TODO0100644000765700007640000000111505257411064013134 0ustar martinedv* BUG: : Xlbiff window grabs keyboard focus when it pops up. * put binary count of messages in LEDs? Or is that too geeky? * BUG: *bottom doesn't interoperate with tvtwm's 'Sticky' feature. * Do like xbiffR5, popdown window if mailbox file is read? nah. * Think of something to do if there are more than maxRows lines. My guess would be to add scroll bars. * pop up alert window on error * Handle width resizes * Handle signals gracefully (ie, turn off LED if killed by ^C) xlbiff-4.1.orig/Imakefile0100644000765700007640000000156007753276651014277 0ustar martinedvXCOMM XCOMM Choose whatever mail path is appropriate for your system XCOMM #ifdef XlbiffMailPath MAILPATH = XlbiffMailPath #else #if defined(SYSV) || defined(SVR4) MAILPATH = /usr/mail/%s #else MAILPATH = /var/spool/mail/%s #endif #endif XCOMM XCOMM Where you want the xlbiff.form file to go XCOMM #ifdef XmhLibDir MHLIBDIR = XmhLibDir #else MHLIBDIR = /usr/new/lib/mh #endif XCOMM XCOMM Define this if your OS doesn't have strerror (eg, SunOS) XCOMM XCOMM NEED_STRERROR = -DNEED_STRERROR XCOMM XCOMM Define this if your OS prefers bcopy to memcpy XCOMM XCOMM USE_BCOPY = -DUSE_BCOPY XCOMM CDEBUGFLAGS = -g -DDEBUG DEFINES = -DMAILPATH=\"$(MAILPATH)\" $(NEED_STRERROR) $(USE_BCOPY) DEPLIBS = XawClientDepLibs LOCAL_LIBRARIES = XawClientLibs SimpleProgramTarget(xlbiff) InstallAppDefaults(XLbiff) InstallNonExecFile(xlbiff.form,$(MHLIBDIR)) xlbiff-4.1.orig/Makefile.std0100644000765700007640000000361407753320624014707 0ustar martinedv# -*- Makefile -*- # # Makefile for xlbiff # # $Id: Makefile.std,v 1.14 2003/11/09 02:08:20 esm Exp $ # # # Where your mail file is. # # BSD systems should probably define it as /usr/spool/mail/%s # SYSV systems will probably want /usr/mail/%s # I'm sure someone else will have /%s/incoming-mail/temp/../geewhiz/.x # #MAILPATH= /udir/%s/.maildrop #MAILPATH= /usr/mail/%s MAILPATH= /var/spool/mail/%s # # Build with debugging enabled or disabled. Note that you can build # with -O and -DDEBUG together if you like. # DEBUG= -O #DEBUG= -g -DDEBUG # # Where to put the binary, eg, /usr/local/bin # BINDIR= /usr/local/bin # # Where to put the app-defaults file, eg, /usr/lib, /usr/local/lib # LIBDIR= /usr/local/lib XAPPLOADDIR= $(LIBDIR)/X11/app-defaults # # Where to put the man page, eg, /usr/man/man1 # MANDIR= /usr/local/man/man1 MANEXT= 1X # # MH library directory, eg, /usr/new/lib/mh, /usr/local/lib/mh # MHLIBDIR= /usr/new/lib/mh # # SYSV systems might need to link with the stuff below # #EXTRALIBS= -lnsl_s EXTRALIBS= # # Systems that don't have strerror() (eg, SunOS) should uncomment this: # # NEED_STRERROR = -DNEED_STRERROR # # Systems that don't have memcpy() should uncomment this # # USE_BCOPY = -DUSE_BCOPY ############################################################################### # DO NOT MODIFY ANYTHING UNDER HERE ############################################################################### CFLAGS= $(DEBUG) $(NEED_STRERROR) $(USE_BCOPY) \ -DMAILPATH="\"$(MAILPATH)\"" EXE= xlbiff OBJ= xlbiff.o SRC= xlbiff.c HDRS= patchlevel.h MAN= xlbiff.man APPRES= XLbiff LIBS= -lXaw -lXmu -lXt -lX11 -lXext $(EXTRALIBS) $(EXE): $(OBJ) $(CC) $(CFLAGS) -o $@ $? $(LIBS) install: $(EXE) $(APPRES).ad cp $(EXE) $(BINDIR)/$(EXE) cp $(APPRES).ad $(XAPPLOADDIR)/$(APPRES) cp $(MAN) $(MANDIR)/$(EXE).$(MANEXT) cp $(EXE).form $(MHLIBDIR)/$(EXE).form clean: $(RM) -f $(EXE) *~ *.o xlbiff-4.1.orig/patchlevel.h0100644000765700007640000000013407753300412014741 0ustar martinedv/* ** version identifiers */ #define VERSION 4 #define PATCHLEVEL 1 #define TESTLEVEL 0 xlbiff-4.1.orig/xlbiff.c0100644000765700007640000007344007753277342014110 0ustar martinedvstatic char rcsid[]= "$Id: xlbiff.c,v 1.75 2003/11/08 23:40:18 esm Exp $"; /*\ |* xlbiff -- X Literate Biff |* |* DESCRIPTION: |* |* xlbiff is yet another biff utility. It lurks around, polling |* a mail file until its size changes. When this happens, it pops |* up a window containing a `scan' of the contents of the mailbox. |* Xlbiff is modeled after xconsole; it remains invisible at non- |* useful times, eg, when no mail is present. See README for details. |* |* Author: Eduardo Santiago, esm@pobox.com |* Created: 20 August 1991 |* Last Updated: 8 November 2003 |* |* Copyright 1994 Eduardo Santiago |* |* The X Consortium, and any party obtaining a copy of these files from |* the X Consortium, directly or indirectly, is granted, free of charge, a |* full and unrestricted irrevocable, world-wide, paid up, royalty-free, |* nonexclusive right and license to deal in this software and |* documentation files (the "Software"), including without limitation the |* rights to use, copy, modify, merge, publish, distribute, sublicense, |* and/or sell copies of the Software, and to permit persons who receive |* copies from any such party to do so. This license includes without |* limitation a license to do the foregoing actions under any patents of |* the party supplying this software to the X Consortium. |* \*/ #include "patchlevel.h" #include #include #include #include #include #include #include #include #include /* ** This grody gunk stolen outright from mit/lib/Xaw/Mailbox.h */ #ifndef X_NOT_POSIX #ifdef _POSIX_SOURCE # include #else #define _POSIX_SOURCE # include #undef _POSIX_SOURCE #endif # define waitCode(w) WEXITSTATUS(w) # define waitSig(w) WIFSIGNALED(w) typedef int waitType; # define INTWAITTYPE #else /* ! X_NOT_POSIX */ #if defined(SYSV) || defined(SVR4) # define waitCode(w) (((w) >> 8) & 0x7f) # define waitSig(w) ((w) & 0xff) typedef int waitType; # define INTWAITTYPE #else # include # define waitCode(w) ((w).w_T.w_Retcode) # define waitSig(w) ((w).w_T.w_Termsig) typedef union wait waitType; #endif /* SYSV else */ #endif /* ! X_NOT_POSIX else */ #ifdef NEED_STRERROR char *strerror(); #endif /* ** if compiled with -DDEBUG *and* run with debugging on, this does lots ** of useless/useful printfs. */ #ifdef DEBUG #define DP(x) if (lbiff_data.debug) printf x #else #define DP(x) #endif /* ** This defines the file we need to monitor. If not defined explicitly ** on the command line, we pick this default. */ #ifndef MAILPATH #define MAILPATH "/usr/spool/mail/%s" #endif /*****************************************************************************\ ** prototypes ** \*****************************************************************************/ char *doScan(); void Popdown(),Popup(); void Usage(); extern char *getlogin(); #ifdef FUNCPROTO void Shrink(Widget, caddr_t, XEvent*, Boolean*); void handler(XtPointer,XtIntervalId*); void initStaticData(int*,int*,int*); void Exit(Widget, XEvent*, String*, Cardinal*); void Mailer(Widget, XEvent*, String*, Cardinal*); void lbiffUnrealize(), lbiffRealize(char*); void getDimensions(char*,Dimension*,Dimension*); void toggle_key_led(int); void ErrExit(Boolean,char*); Bool CheckEvent(Display*,XEvent*,caddr_t); #else void Shrink(); void handler(); void initStaticData(); void Exit(); void Mailer(); void lbiffUnrealize(), lbiffRealize(); void getDimensions(); void toggle_key_led(); void ErrExit(); Bool CheckEvent(); #endif /*****************************************************************************\ ** globals ** \*****************************************************************************/ extern int errno; Widget topLevel,textBox; /* my widgets */ XtAppContext app_context; /* application context */ Boolean visible; /* is window visible? */ Boolean hasdata; /* Something is to be displayed */ char *default_file; /* default filename */ char *progname; /* my program name */ long acknowledge_time = 0; /* time window was acknowledged */ long popup_time = 0; /* time window was popped up */ static Atom wm_delete_window; /* for handling WM_DELETE */ typedef struct { Boolean debug; /* print out useful stuff */ char *file; /* file to monitor size of */ char *checkCmd; /* command to run for check */ char *cmd; /* command to run for output */ char *mailerCmd; /* command to read mail */ int update; /* update interval, in seconds */ int fade; /* popdown interval, in seconds */ int columns; /* number of columns across */ int rows; /* max# of lines in display */ int volume; /* bell volume, 0-100 percent */ Boolean bottom; /* Put window at window bottom */ Boolean resetSaver; /* reset screensaver on popup */ long refresh; /* seconds before reposting msg */ int led; /* led number to light up */ Boolean ledPopdown; /* turn off LED on popdown? */ char *sound; /* Sound file to use */ } AppData, *AppDataPtr; AppData lbiff_data; #define offset(field) XtOffset(AppDataPtr,field) static XtResource xlbiff_resources[] = { { "debug", "Debug", XtRBoolean, sizeof(Boolean), offset(debug), XtRImmediate, False}, { "file", "File", XtRString, sizeof(String), offset(file), XtRString, NULL}, { "checkCommand", "CheckCommand", XtRString, sizeof(String), offset(checkCmd), XtRString, NULL}, { "scanCommand", "ScanCommand", XtRString, sizeof(String), offset(cmd), XtRString, "scan -file %s -width %d" }, { "mailerCommand", "MailerCommand", XtRString, sizeof(String), offset(mailerCmd), XtRString, NULL }, { "update", "Interval", XtRInt, sizeof(int), offset(update), XtRImmediate, (XtPointer)15}, { "fade", "Fade", XtRInt, sizeof(int), offset(fade), XtRImmediate, (XtPointer)0}, { "columns", "Columns", XtRInt, sizeof(int), offset(columns), XtRImmediate, (XtPointer)80}, { "rows", "Rows", XtRInt, sizeof(int), offset(rows), XtRImmediate, (XtPointer)20}, { "sound", "Sound", XtRString, sizeof(String), offset(sound), XtRString, "" }, { "volume", "Volume", XtRInt, sizeof(int), offset(volume), XtRImmediate, (XtPointer)100}, { "bottom", "Bottom", XtRBoolean, sizeof(Boolean), offset(bottom), XtRImmediate, False}, { "resetSaver", "ResetSaver", XtRBoolean, sizeof(Boolean), offset(resetSaver), XtRImmediate, False}, { "refresh", "Refresh", XtRInt, sizeof(int), offset(refresh), XtRImmediate, (XtPointer)1800}, { "led", "Led", XtRInt, sizeof(int), offset(led), XtRImmediate, (XtPointer)0}, { "ledPopdown", "LedPopdown", XtRBoolean, sizeof(Boolean), offset(ledPopdown), XtRImmediate, False} }; static XrmOptionDescRec optionDescList[] = { { "-bottom", ".bottom", XrmoptionNoArg, (caddr_t) "true"}, { "+bottom", ".bottom", XrmoptionNoArg, (caddr_t) "false"}, { "-debug", ".debug", XrmoptionNoArg, (caddr_t) "true"}, { "-file", ".file", XrmoptionSepArg, (caddr_t) NULL}, { "-rows", ".rows", XrmoptionSepArg, (caddr_t) NULL}, { "-columns", ".columns", XrmoptionSepArg, (caddr_t) NULL}, { "-update", ".update", XrmoptionSepArg, (caddr_t) NULL}, { "-fade", ".fade", XrmoptionSepArg, (caddr_t) NULL}, { "-volume", ".volume", XrmoptionSepArg, (caddr_t) NULL}, { "-resetSaver", ".resetSaver", XrmoptionNoArg, (caddr_t) "true"}, { "+resetSaver", ".resetSaver", XrmoptionNoArg, (caddr_t) "false"}, { "-refresh", ".refresh", XrmoptionSepArg, (caddr_t) NULL}, { "-led", ".led", XrmoptionSepArg, (caddr_t) NULL}, { "-ledPopdown", ".ledPopdown", XrmoptionNoArg, (caddr_t) "true"}, { "+ledPopdown", ".ledPopdown", XrmoptionNoArg, (caddr_t) "false"}, { "-sound", ".sound", XrmoptionSepArg, (caddr_t) NULL}, { "-scanCommand", ".scanCommand", XrmoptionSepArg, (caddr_t) NULL}, { "-mailerCommand",".mailerCommand",XrmoptionSepArg,(caddr_t) NULL}, { "-checkCommand",".checkCommand",XrmoptionSepArg, (caddr_t) NULL} }; static char *fallback_resources[] = { "*Font: -*-clean-bold-r-normal--13-130-75-75-c-80-iso8859-1", "*Geometry: +0-0", NULL }; static XtActionsRec lbiff_actions[] = { {"exit",Exit}, {"mailer",Mailer}, {"popdown",Popdown} }; /*****************************************************************************\ ** code ** \*****************************************************************************/ /**********\ |* main *| \**********/ #ifdef FUNCPROTO main( int argc, char *argv[] ) #else main(argc, argv) int argc; char *argv[]; #endif { progname = argv[0]; topLevel = XtVaAppInitialize(&app_context, "XLbiff", optionDescList, XtNumber(optionDescList), &argc, argv, fallback_resources, XtNallowShellResize, True, NULL); XtGetApplicationResources(topLevel, &lbiff_data, xlbiff_resources, XtNumber(xlbiff_resources), (ArgList)NULL,0); #ifndef DEBUG if (lbiff_data.debug) fprintf(stderr,"%s: DEBUG support not compiled in, sorry\n",progname); #endif /* ** Check command line arguments */ if (argc > 1) { if (!strncmp(argv[1],"-version",strlen(argv[1]))) { fprintf(stderr, #if TESTLEVEL != 0 "%s version %d.%d.%d\n", #else "%s version %d.%d\n", #endif progname, VERSION,PATCHLEVEL,TESTLEVEL); exit(0); } else if (!strncmp(argv[1],"-help",strlen(argv[1]))) { Usage(); } else if (argv[1][0] != '-') { lbiff_data.file = argv[1]; } else { fprintf(stderr, "%s: no such option \"%s\", type '%s -help' for help\n", progname,argv[1],progname); exit(1); } } /* ** If no data file was explicitly given, make our best guess */ if (lbiff_data.file == NULL) { char *username = getlogin(); if (username == NULL || username[0] == '\0') { struct passwd *pwd = getpwuid(getuid()); if (pwd == NULL) { fprintf(stderr, "%s: cannot get username\n", progname); exit(1); } username = pwd->pw_name; } default_file = (char*)malloc(strlen(MAILPATH) + strlen(username)); if (default_file == NULL) ErrExit(True,"default_file malloc()"); sprintf(default_file,MAILPATH,username); lbiff_data.file = default_file; } DP(("file= %s\n",lbiff_data.file)); /* ** Fix DISPLAY environment variable, might be needed by subprocesses */ { char *envstr = (char*)malloc(strlen("DISPLAY=") + 1 + strlen(XDisplayString(XtDisplay(topLevel)))); sprintf(envstr, "DISPLAY=%s", XDisplayString(XtDisplay(topLevel))); putenv(envstr); } textBox = XtVaCreateManagedWidget("text", commandWidgetClass, topLevel, NULL); XtAddCallback(textBox, XtNcallback, Popdown, textBox); XtAppAddActions(app_context, lbiff_actions, XtNumber(lbiff_actions)); XtAddEventHandler(topLevel, StructureNotifyMask, False, (XtEventHandler)Shrink, (caddr_t)NULL); XtOverrideTranslations(topLevel, XtParseTranslationTable ("WM_PROTOCOLS: exit()")); wm_delete_window = XInternAtom (XtDisplay(topLevel), "WM_DELETE_WINDOW", False); toggle_key_led(False); /* ** check to see if there's something to do, pop up window if necessary, ** and set up alarm to wake us up again every so often. */ handler(NULL,NULL); /* ** main program loop -- mostly just loops forever waiting for events ** ** note that we will continually be interrupted by the timeout code */ XtAppMainLoop(app_context); } /***********\ |* Usage *| displays usage message \***********/ void Usage() { static char *help_message[] = { "where options include:", " -version display xlbiff version number", " -display host:dpy X server to contact", " -geometry +x+y x,y coords of window", " -rows height height of window, in lines", " -columns width width of window, in characters", " -file file file to watch", " -update seconds how often to check for mail", " -fade seconds lifetime of unmodified window", " -volume percentage how loud to ring the bell", " -bg color background color", " -fg color foreground color", " -refresh seconds seconds before re-posting window", " -led ledNum keyboard LED to light up", " -ledPopdown turn off LED when popped down", " -scanCommand command command to interpret and display", " -checkCommand command command used to check for change", " -mailerCommand command command used to read mail", NULL}; char **s; printf("usage:\t%s [-options ...] [file to watch]\n", progname); for (s= help_message; *s; s++) printf("%s\n", *s); printf("\n"); exit(1); } /**********\ |* Exit *| called via callback, exits the program \**********/ void #ifdef FUNCPROTO Exit(Widget w, XEvent *event, String *params, Cardinal *num_params) #else Exit(w, event, params, num_params) Widget w; XEvent *event; String *params; Cardinal *num_params; #endif { DP(("++Exit()\n")); if (event->type == ClientMessage) { if (event->xclient.data.l[0] != wm_delete_window) { DP(("received client message that was not delete_window\n")); XBell (XtDisplay(w), 0); return; } else DP(("exiting after receiving a wm_delete_window message\n")); } toggle_key_led(False); XCloseDisplay(XtDisplay(w)); exit(0); } /************\ |* Mailer *| called via callback, starts a mailer \************/ void #ifdef FUNCPROTO Mailer(Widget w, XEvent *event, String *params, Cardinal *num_params) #else Mailer(w, event, params, num_params) Widget w; XEvent *event; String *params; Cardinal *num_params; #endif { DP(("++Mailer()\n")); if (lbiff_data.mailerCmd != NULL && lbiff_data.mailerCmd[0] != '\0') { Popdown(); system(lbiff_data.mailerCmd); Popup(); checksize(); } } /***************\ |* checksize *| checks mail file to see if new mail is present |*************** |* This routine stat's the mail spool file and compares its size |* with the previously obtained result. If the size has become |* zero, it pops down the window. If nonzero, it calls a routine |* to execute the scanCommand. If the result of this is non-null, |* it pops up a window showing it (note that users of Berkeley |* mail may have non-empty mail files with all old mail). \*/ checksize() { static int mailsize = 0; struct stat mailstat; int pop_window = False; struct timeval tp; struct timezone tzp; DP(("++checksize()...")); /* ** If user has specified a command to use to check the file, invoke ** it with lbiff_data.file and "previous" as arguments, where "previous" ** is the output of the script the last time it was run (or zero, ** the first time we call it). This is useful as a way of keeping ** state for the checkCommand; in this manner it knows, if the ** spool file size is nonzero, whether it has grown since the last ** time we called it. */ if (lbiff_data.checkCmd != NULL && lbiff_data.checkCmd[0] != '\0') { FILE *p; waitType status; char outbuf[80]; static char *cmd_buf; static int previous; if (cmd_buf == NULL) { cmd_buf = (char*)malloc(strlen(lbiff_data.checkCmd) + strlen(lbiff_data.file) + 10); if (cmd_buf == NULL) ErrExit(True,"scan command buffer malloc()"); } sprintf(cmd_buf, lbiff_data.checkCmd, lbiff_data.file, previous); DP(("++checkCommand= %s\n",cmd_buf)); if ((p= popen(cmd_buf,"r")) == NULL) ErrExit(True,"popen(checkCommand)"); if (fread(outbuf,1,sizeof outbuf,p) < 0) ErrExit(True,"fread(checkCommand)"); previous = atol(outbuf); DP(("checkCommand returns %d\n",previous)); #ifdef INTWAITTYPE status = pclose(p); #else status.w_status = pclose(p); #endif switch (waitCode(status)) { case 0: /* 0: new data */ mailstat.st_size = mailsize + 1; break; case 2: /* 2: no data (clear) */ mailstat.st_size = 0; break; default: /* 1: same as before */ mailstat.st_size = mailsize; } } else { /* no checkCmd, just stat the mailfile and check size */ /* ** Do the stat to get the mail file size. If it fails for any reason, ** ignore the failure and assume the file is size 0. Failures I can ** think of are that should be ignored are: ** ** + nonexistent file. Some Berkeley-style mailers delete ** the spool file when they're done with it. ** + NFS stale filehandle. Yuk. This one happens if ** your mail spool file is on an NFS-mounted directory ** _and_ your update interval is too low _and_ you use ** a Berkeleyish mailer. Yuk. ** ** Doubtless there are errors we should complain about, but this ** would get too ugly. */ if (stat(lbiff_data.file,&mailstat) != 0) { DP(("stat() failed, errno=%d. Assuming filesize=0!\n",errno)); mailstat.st_size = 0; } } /* ** If it's changed size, take appropriate action. */ if (mailstat.st_size != mailsize) { DP(("changed size: %d -> %d\n",mailsize,mailstat.st_size)); mailsize = mailstat.st_size; pop_window = True; } else if (!visible && lbiff_data.refresh && mailsize != 0) { /* ** If window has been popped down, check if it's time to refresh */ if (gettimeofday(&tp,&tzp) != 0) { ErrExit(True,"gettimeofday() in checksize()"); } else { if ((tp.tv_sec - acknowledge_time) > lbiff_data.refresh) { DP(("reposting window, repost time reached\n")); pop_window = True; } } } else if (visible && (mailstat.st_size = mailsize)) { /* ** window is visible--see if fade time has been reached, and ** if so, popdown window ** if fade is zero, do not pop down */ if (gettimeofday(&tp,&tzp) != 0) { ErrExit(True,"gettimeofday() in checksize()"); } else if (lbiff_data.fade > 0) { if ((tp.tv_sec - popup_time) > lbiff_data.fade) lbiffUnrealize(); } } if (pop_window) { if (mailsize == 0) { hasdata = False; toggle_key_led(False); lbiffUnrealize(); } else { /* something was added? */ char *s = doScan(); if (strlen(s) != 0) { /* is there anything new? */ if (hasdata) /* ESM && isvisible? ESM */ lbiffUnrealize(); /* pop down if it's up */ hasdata = True; toggle_key_led(True); lbiffRealize(s); /* pop back up */ } } } else { DP(("no change\n")); } } /*************\ |* handler *| Checks mail file and reschedules itself to do so again \*************/ void #ifdef FUNCPROTO handler( XtPointer closure, XtIntervalId *id ) #else /* ARGSUSED */ handler( closure, id ) XtPointer closure; XtIntervalId *id; #endif { checksize(); XtAppAddTimeOut(app_context,lbiff_data.update * 1000, handler, NULL); } /************\ |* doScan *| invoke MH ``scan'' command to examine mail messages |************ |* This routine looks at the mail file and parses the contents. It |* does this by invoking scan(1) or some other user-defined function. \*/ char * doScan() { static char *cmd_buf; static char *buf = NULL; static int bufsize; static char scan_fail_msg[] = "\n---->>>> scanCommand failed <<<<<----\n"; FILE *p; size_t size; waitType status; DP(("++doScan()\n")); /* ** Initialise display buffer to #rows * #cols ** Initialise command string */ if (buf == NULL) { /* +1 for the newline */ bufsize = (lbiff_data.columns + 1) * lbiff_data.rows; buf = (char*)malloc(bufsize + sizeof(scan_fail_msg) + 1); if (buf == NULL) ErrExit(True,"text buffer malloc()"); DP(("---size= %dx%d\n", lbiff_data.rows, lbiff_data.columns)); cmd_buf = (char*)malloc(strlen(lbiff_data.cmd) + strlen(lbiff_data.file) + 10); if (cmd_buf == NULL) ErrExit(True,"command buffer malloc()"); sprintf(cmd_buf,lbiff_data.cmd, lbiff_data.file, lbiff_data.columns); DP(("---cmd= %s\n",cmd_buf)); } /* ** Execute the command, read the results, then set the contents of window. ** If there is data remaining in the pipe, read it in (and throw it away) ** so our exit status is correct (eg, not "Broken pipe"). */ if ((p= popen(cmd_buf,"r")) == NULL) ErrExit(True,"popen"); if ((size= fread(buf,1,bufsize,p)) < 0) ErrExit(True,"fread"); if (size == bufsize) { char junkbuf[100]; while (fread(junkbuf, 1, 100, p) > 0) ; /* Keep reading until no more left */ } #ifdef INTWAITTYPE status = pclose(p); #else status.w_status = pclose(p); #endif if (waitCode(status) != 0) { strcpy(buf+size, scan_fail_msg); size += strlen(scan_fail_msg); } buf[size] = '\0'; /* null-terminate it! */ DP(("scanned:\n%s\n",buf)); return buf; } /****************\ |* CheckEvent *| \****************/ Bool #ifdef FUNCPROTO CheckEvent( Display *d, XEvent *e, caddr_t arg ) #else /* ~FUNCPROTO */ CheckEvent( d, e, arg ) Display *d; XEvent *e; caddr_t arg; #endif /* FUNCPROTO */ { if (e->type == MapNotify || e->type == UnmapNotify) if (e->xmap.window == (Window)arg) return True; return False; } static XEvent lastEvent; /* ARGSUSED */ /* ** Handler for map/unmap events. Copied from xconsole. ** When unmap and map events occur consecutively, eg when resetting a ** window manager, this makes sure that only the last such event takes place. */ /************\ |* Shrink *| get StructureNotify events, popdown if iconified \************/ void #ifdef FUNCPROTO Shrink( Widget w, caddr_t data, XEvent *e, Boolean *b ) #else Shrink(w, data, e, b) Widget w; caddr_t data; XEvent *e; Boolean *b; #endif { DP(("++Shrink()\n")); if (e->type == MapNotify || e->type == UnmapNotify) { int event_seen = 0; Window win = e->xmap.window; #ifdef USE_BCOPY bcopy((char*)e,(char*)&lastEvent,sizeof(XEvent)); #else memcpy((char*)&lastEvent,(char*)e,sizeof(XEvent)); #endif XSync(XtDisplay(w),False); while(XCheckIfEvent(XtDisplay(w),&lastEvent,CheckEvent,(caddr_t)win)) event_seen = 1; if (!event_seen) return; if (lastEvent.type == UnmapNotify && visible) Popdown(); else if (lastEvent.type == MapNotify && hasdata) Popup(); } } /* ** These here routines (Popdown/Popup) bring the main window up or down. ** They are pretty simple except for the issue with *bottom... ** If running with *bottom, things are more complicated. You can't ** just map/unmap(), because since the window has already been placed ** at the bottom (when realized) any lines that get added to it when ** more mail comes in will just drop off the edge of the screen. ** Thus when *bottom is true we need to realize() the window anew ** each time something changes in it. */ /*************\ |* Popdown *| kill window \*************/ void Popdown() { struct timeval tp; struct timezone tzp; DP(("++Popdown()\n")); if (visible) { XtPopdown(topLevel); XSync(XtDisplay(topLevel), False); } visible = False; /* ** Remember when we were popped down so we can refresh later */ if (gettimeofday(&tp,&tzp) != 0) ErrExit(True,"gettimeofday() in lbiffUnrealize()"); acknowledge_time = tp.tv_sec; if (lbiff_data.ledPopdown) /* Turn off LED if so requested */ toggle_key_led(False); } void Popup() { struct timeval tp; struct timezone tzp; DP(("++Popup()\n")); /* ** Remember when we were popped up so we can fade later */ if (gettimeofday(&tp,&tzp) != 0) ErrExit(True,"gettimeofday() in Popup()"); popup_time = tp.tv_sec; if (hasdata && !visible) { XtPopup(topLevel, XtGrabNone); XSync(XtDisplay(topLevel), False); } visible = True; } /********************\ |* lbiffUnrealize *| kill window \********************/ void lbiffUnrealize() { DP(("++lbiffUnrealize()\n")); if (lbiff_data.bottom) XtUnrealizeWidget(topLevel); else Popdown(); visible = False; } /******************\ |* lbiffRealize *| reformat window, set the text and bring window up \******************/ void #ifdef FUNCPROTO lbiffRealize( char *s ) #else lbiffRealize( s ) char *s; #endif { Arg args[4]; int n; static int first_time = 1; DP(("++lbiffRealize()\n")); /* ** Set the contents of the window */ n = 0; XtSetArg(args[n],XtNlabel,s); n++; XtSetValues(textBox, args, n); /* ** If running with *bottom, we need to tell the widget what size it ** is before realize()ing it. This is so the WM can position it ** properly at the bottom of the screen. */ if (lbiff_data.bottom) { Dimension width,height; getDimensions(s,&width,&height); n = 0; XtSetArg(args[n], XtNwidth, width); n++; XtSetArg(args[n], XtNheight, height); n++; XtSetArg(args[n], XtNy, -1); n++; XtSetValues(topLevel, args, n); XtRealizeWidget(topLevel); } Popup(); if (first_time) { /* first time through this code */ (void) XSetWMProtocols (XtDisplay(topLevel), XtWindow(topLevel), &wm_delete_window, 1); first_time = 0; } if (lbiff_data.sound[0] == '\0') { /* ** No, the following is not a typo, nor is it redundant code. ** Apparently there is one X terminal that beeps whenever XBell() ** is called, even with volume zero. */ if (lbiff_data.volume > 0) { XBell(XtDisplay(topLevel),lbiff_data.volume - 100); DP(("---sound= %s\n","XBell default")); } } else { static char *sound_buf; /* ** Initialise sound string */ if (sound_buf == NULL) { sound_buf = (char*)malloc(strlen(lbiff_data.sound) + 10); if (sound_buf == NULL) ErrExit(True,"sound_buf malloc()"); sprintf(sound_buf,lbiff_data.sound, lbiff_data.volume); DP(("---sound= %s\n",sound_buf)); } system(sound_buf); } if (lbiff_data.resetSaver) XResetScreenSaver(XtDisplay(topLevel)); visible = True; } /*******************\ |* getDimensions *| get width x height of text string \*******************/ void #ifdef FUNCPROTO getDimensions( char *s, Dimension *width, Dimension *height ) #else getDimensions(s,width,height) char *s; Dimension *width, *height; #endif { Dimension tmp_width; int i, len = strlen(s); static int fontWidth, fontHeight; static int borderWidth = -1; tmp_width = *width = *height = 1; if (borderWidth == -1) initStaticData(&borderWidth,&fontHeight,&fontWidth); /* ** count rows and columns */ for (i=0; i < len-1; i++) { if (s[i] == '\n') { /* new line: clear width */ ++*height; tmp_width = 0; } else { ++tmp_width; if (tmp_width > *width) /* monitor highest width */ *width = tmp_width; } } if (*height > lbiff_data.rows) /* cut to fit max wid/hgt */ *height = lbiff_data.rows; if (*width > lbiff_data.columns) *width = lbiff_data.columns; DP(("geom= %dx%d chars (%dx%d pixels)\n",*width,*height, *width*fontWidth, *height*fontHeight)); *width *= fontWidth; *width += 6; /* convert to pixels */ *height *= fontHeight; *height += 4; /* and add a little fudge */ } /********************\ |* initStaticData *| initializes font size & borderWidth \********************/ void #ifdef FUNCPROTO initStaticData( int *bw, int *fontH, int *fontW ) #else initStaticData(bw, fontH, fontW) int *bw, *fontH, *fontW; #endif { Arg args[2]; XFontStruct *fs; int tmp; DP(("++initStaticData...")); XtSetArg(args[0],XtNfont,&fs); XtSetArg(args[1],XtNborderWidth,&tmp); XtGetValues(textBox, args, 2); if (fs == NULL) ErrExit(False,"unknown font"); *bw = tmp; *fontW = fs->max_bounds.width; *fontH = fs->max_bounds.ascent + fs->max_bounds.descent; DP(("font= %dx%d, borderWidth= %d\n",*fontH,*fontW,*bw)); } /********************\ |* toggle_key_led *| toggle a keyboard LED on and off \********************/ void #ifdef FUNCPROTO toggle_key_led(int flag) #else toggle_key_led(flag) int flag; #endif { XKeyboardControl keyboard; if (lbiff_data.led == 0) /* return if no led action desired */ return; DP(("++toggle_key_led(%d,%s)\n", lbiff_data.led, flag ? "True" : "False")); if (flag) keyboard.led_mode = LedModeOn; else keyboard.led_mode = LedModeOff; keyboard.led = lbiff_data.led; XChangeKeyboardControl(XtDisplay(topLevel), KBLed | KBLedMode, &keyboard); } /*************\ |* ErrExit *| print out error message, clean up and exit |************* |* ErrExit prints out a given error message to stderr. If |* is True, it calls strerror(errno) to get the descriptive text for the |* indicated error. It then clears the LEDs and exits. |* |* It is the intention that someday this will bring up a popup window. \*/ void #ifdef FUNCPROTO ErrExit(Boolean errno_valid, char *s) #else ErrExit(errno_valid, s) Boolean errno_valid; char *s; #endif { if (errno_valid) fprintf(stderr,"%s: %s: %s\n", progname, s, strerror(errno)); else fprintf(stderr,"%s: %s\n", progname, s); toggle_key_led(False); XCloseDisplay(XtDisplay(topLevel)); exit(1); } #ifdef NEED_STRERROR /**************\ |* strerror *| return descriptive message text for given errno \**************/ char * #ifdef FUNCPROTO strerror(int err) #else /* ~FUNCPROTO */ strerror(err) int err; #endif /* FUNCPROTO */ { static char unknown[30]; extern int sys_nerr; extern char *sys_errlist[]; if (err >= 0 && err < sys_nerr) return sys_errlist[err]; sprintf(unknown,"Unknown error %d", err); return unknown; } #endif /* NEED_STRERROR */ xlbiff-4.1.orig/xlbiff.man0100644000765700007640000002204107753277324014430 0ustar martinedv.TH XLBIFF 1 "2 June 1994" .SH NAME xlbiff \- mailbox message previewer for X .SH SYNOPSIS .B xlbiff [ \fI\-option\fP ... ] .SH DESCRIPTION The .I xlbiff program lurks in the background, watching your mailbox file, waiting for new mail. When mail arrives, it invokes the MH \fIscan\fP(1) command and pops up a window with the results. Clicking the left mouse button anywhere in this window makes it go away. The window will also disappear if iconified or if the mailbox size drops to zero. .PP .SH OPTIONS .I Xlbiff accepts all of the standard X Toolkit command line options along with the additional options listed below: .TP 8 .B \-help This option indicates that a brief summary of the allowed options should be printed on standard output. .TP 8 .B \-bottom This option tells .I xlbiff to realize/unrealize() the output window instead of using XtPopup/down(). This has the effect of causing the window manager to reposition the window each time it pops up, and is useful for when you specify negative Y coordinates, ie, at the bottom of the screen. Running .I xlbiff in this situation without \-bottom would cause new lines to run off the bottom edge of the screen. .TP 8 .B \+bottom Opposite of \-bottom. .TP 8 .B \-file \fIfilename\fP This option specifies the name of the file which should be monitored. By default, it watches /usr/spool/mail/\fIusername\fP, where \fIusername\fP is your login name. .TP 8 .B \-rows \fIheight\fP This option specifies the maximum height, in lines of text, of the .I xlbiff window. The default is 20. .TP 8 .B \-columns \fIwidth\fP This option specifies the maximum width, in characters, of the .I xlbiff window. The default is 80. .TP 8 .B \-resetSaver If this option is set, .I xlbiff will reset the screen saver when new mail comes in. This is useful if you're doing something near your workstation but not on it. .TP 8 .B \+resetSaver Opposite of \-resetSaver. .TP 8 .B \-update \fIseconds\fP This option specifies the frequency in seconds at which .I xlbiff should update its display. The default is 15 seconds. .TP 8 .B \-fade \fIseconds\fP Number of seconds to wait before popping window back down. This option can be used to monitor events of non-lasting importance, such as syslog or UUCP queues. The default value of 0 disables the .B fade option. .TP 8 .B \-led \fIledNum\fP This option specifies a keyboard LED to light up when there is mail waiting in the \fIfile.\fP The default is zero (do not light a LED). .TP 8 .B \-ledPopdown This option indicates that the LED should be turned off when xlbiff is popped down. Ordinarily the LED stays lit to remind one of awaiting mail. This option has no effect if the \-led option is disabled. .TP 8 .B \+ledPopdown Opposite of \-ledPopdown. .TP 8 .B \-refresh \fIseconds\fP This option specifies the number of seconds to wait before re-posting the mail window after you acknowledge it, and it still contains the same mail. The default is 0 (no refresh). A useful value for this is 1800 (30 minutes). .TP 8 .B \-mailerCommand \fIcommand\fP Specifies the command to invoke when the the mailer() action is activated, eg, "xterm -e elm" or "inc". By default this is bound to the second mouse button. Invoking this action will pop down the main window. When the command exits, it will pop up again. Due to mailbox consistency considerations, the mailerCommand should not exit before it is finished with the mailbox, i.e. it should not be run in the background. .sp There is no default .BR mailerCommand . .TP 8 .B \-scanCommand \fIcommand\fP Specifies a shell command to be executed to list the contents of mailbox \fBfile\fP. The specified string value is used as the argument to a \fIsystem\fP(3) call and may therefore contain i/o redirection. The command's stdout is used to generate the window. Internally, the command is generated as .sp .nf sprintf(buf, scanCommand, file, columns) .fi .sp so a %s and %d respectively in \fBscanCommand\fP will generate the values of \fBfile\fP and \fBcolumns\fP. The default .B scanCommand is .sp .nf scan \-file %s \-width %d .fi .sp .TP 8 .B \-checkCommand \fIcommand\fP Specifies a shell command to be executed to check for new mail (or some other condition) rather than simply examining the size of the mail file. The specified string value is used as the argument to a \fIpopen\fP(3) call, and the output generated is important. Like .I xbiff, an exit status of 0 indicates that a change in condition demands a new evaluation of scanCommand and subsequent popup, 1 indicates no change in status, and 2 indicates that the condition has been cleared and the .I xlbiff window should pop down. By default, no shell command is provided. .sp This option may be useful to monitor logins (by checking update times of /etc/utmp), when using POP or other custom maildrop mechanisms, and so forth. .sp Similarly to scanCommand, the checkCommand is generated internally as .sp .nf sprintf(buf, checkCommand, file, previous) .fi .sp .B previous is the numeric value output by the last time checkCommand was run, or zero the first time. This is useful for allowing the checkCommand to maintain state in a primitive fashion. For instance, a checkCommand such as .sp .nf compare_size %s %d .fi .sp would "do the right thing" if .B compare_size were a script such as: .sp .nf #!/bin/sh NEWSIZE=`wc -c <$1` echo $NEWSIZE if [ $NEWSIZE -ne $2 ]; then if [ $NEWSIZE -eq 0 ]; then exit 2 else exit 0 fi fi exit 1 .fi .sp The author of .I xlbiff uses this facility to keep track of several maildrops with one command. See the .I Bcheck and .I Bscan scripts, included. .TP 8 .B \-volume \fIpercentage\fP This option specifies how loud the bell should be rung when new mail comes in. .PP The following standard X Toolkit command line arguments are commonly used with .I xlbiff: .TP 8 .B \-display \fIdisplay\fP This option specifies the X server to contact. .TP 8 .B \-geometry \fI+x+y\fP This option specifies the preferred position of the scan window. .TP 8 .B \-bg \fIcolor\fP This option specifies the color to use for the background of the window. .TP 8 .B \-fg \fIcolor\fP This option specifies the color to use for the foreground of the window. .TP 8 .B \-xrm \fIresourcestring\fP This option specifies a resource string to be used. This is especially useful for setting resources that do not have separate command line options. .SH RESOURCES The application class name is XLbiff. It understands all of the core resource names and classes as well as: .TP 8 .B bottom (\fPclass\fB Bottom) Same as the \fB\-bottom\fP option. .TP 8 .B file (\fPclass\fB File) Same as the \fB\-file\fP option. .TP 8 .B mailerCommand (\fPclass\fB MailerCommand) Same as the \fB\-mailerCommand\fP option. .TP 8 .B scanCommand (\fPclass\fB ScanCommand) Same as the \fB\-scanCommand\fP option. .TP 8 .B checkCommand (\fPclass\fB CheckCommand) Same as the \fB\-checkCommand\fP option. .TP 8 .B resetSaver (\fPclass\fB ResetSaver) Same as the \fB\-resetSaver\fP option. .TP 8 .B update (\fPclass\fB Interval) Same as the \fB\-update\fP option. .TP 8 .B fade (\fPclass\fB Fade) Same as the \fB\-fade\fP option. .TP 8 .B columns (\fPclass\fB Columns) Same as the \fB\-columns\fP option. .TP 8 .B rows (\fPclass\fB Rows) Specifies the maximum height, in lines, of the .I xlbiff window. The default is 20. .TP 8 .B led (\fPclass\fB Led) Same as the \fB\-led\fP option. .TP 8 .B ledPopdown (\fPclass\fB LedPopdown) Same as the \fB\-ledPopdown\fP option. .TP 8 .B refresh (\fPclass\fB Refresh) Same as the \fB\-refresh\fP option. .TP 8 .B sound (\fPclass\fB Sound) Specify a command to be run in place of a bell when new mail arrives. For example, on a Sun Sparc you might use: .sp .nf *sound: /usr/demo/SOUND/play \-v %d /usr/demo/SOUND/sounds/doorbell.au .fi .sp The command is generated internally with .B sprintf, so the characters ``%d'' will be replaced with the numeric value of the .B volume resource. .TP 8 .B volume (\fPclass\fB Volume) Same as the \fB\-volume\fP option. .SH ACTIONS .I Xlbiff provides the following actions for use in event translations: .TP 8 .B popdown() This action causes the window to vanish. .TP 8 .B exit() This action causes .I xlbiff to exit. .PP The default translations are .sp .nf : popdown() : exit() .fi .sp .SH ENVIRONMENT .PP .TP 8 .B DISPLAY is used to get the default host and display number. .SH FILES .TP 8 /usr/spool/mail/\fIusername\fP default mail file to check. .SH "SEE ALSO" .IR X (1), .IR scan (1) .SH BUGS specifying dimensions in \-geometry causes badness. .PP The \fBled\fP option does not work on Suns before SunOS 4.1/X11R5. .SH AUTHOR Ed Santiago, esm@pobox.com .SH ACKNOWLEDGEMENTS .I Xlbiff took shape around the \fBxgoodbye\fP sample program in the O'Reilly \fIX Toolkit Intrinsics Programming Manual\fP. A lot of code was stolen from \fBxbiff\fP, including this man page. Thanks also to Stephen Gildea (gildea@expo.lcs.mit.edu) for the many, many contributions that made .I xlbiff grow from a midnight hack to a more mature product. xlbiff-4.1.orig/xlbiff.form0100644000765700007640000000050005054327730014601 0ustar martinedv%<(mymbox{to})*%| %>\ %(void(rclock{date}))\ %<(gt 15768000)%03(month{date})%02(year{date})%|\ %<(gt 604800)%02(mday{date})%03(month{date})%|\ %<(gt 86400) %(day{date}) %|\ %02(hour{date}):%02(min{date})%>%>%>\ %<{date} %|*%>\ %<(mymbox{from})To:%14(friendly{to})%|%17(friendly{from})%> \ %{subject}%<{body}<<%{body}%> xlbiff-4.1.orig/XLbiff.ad0100644000765700007640000000206107753276660014143 0ustar martinedv! ! XLbiff -- Literate Biff, displays incoming mail, etc ! *font: -*-clean-bold-r-normal--13-130-75-75-c-80-iso8859-1 ! ! set these if you have a colour monitor, or put in your .Xdefaults ! !*foreground: purple !*background: green ! ! command to use for reading new mail info ! *scanCommand: /usr/bin/mh/scan -file %s -width %d 2>&1 !*scanCommand: scan -file %s -width %d -form xlbiff.form 2>&1 !*scanCommand: echo 'x' | mail | grep '^.[UN]' !*scanCommand: frm ! ! Command to use for invoking mailreader (default is none) ! !*mailerCommand: xterm -e elm !*mailerCommand: xterm -e plum !*mailerCommand: xterm -e mailx !*mailerCommand: xmh ! ! Dimensions of the display window ! *columns: 80 *rows: 20 ! ! miscellaneous ! *bottom: False *led: 0 *ledPopdown: False *refresh: 0 *resetSaver: False *update: 15 *volume: 100 ! ! actions ! *translations: #override\n\ :space: popdown()\n\ :Return: popdown()\n\ :,: popdown()\n\ :,: mailer()\n\ :,: exit()\n\ :q: exit()\n xlbiff-4.1.orig/Bcheck0100755000765700007640000000347007753304117013562 0ustar martinedv#!/usr/bin/perl -w # # Bcheck -- check for new mail in "bulk" maildrops # # Called by xlbiff(1). Not intended for general consumption. # # $Id: Bcheck,v 1.3 2003/11/09 00:17:51 esm Exp $ # (our $ME = $0) =~ s,.*/,,; our $State = ".$ME.results"; use strict; use Digest::MD5; my $context = Digest::MD5->new; # All operations take place under our Mail dir. Theoretically we should # read this (Mail) from the Path: component of ~/.mh_profile. But I'm lazy. chdir "$ENV{HOME}/Mail" or die "$ME: cd: $!\n"; my $seen = 0; # Number of unseen messages # Exmh keeps this nice cache for us. If you don't use exmh, you could # instead run 'folders -fast -recurse'. open FOLDERS, ".folders" or die "$ME: open(.folders): $!\n"; while (defined (my $f = )) { chomp $f; open SEQ, "$f/.mh_sequences" or next; while () { if (/^unseen:\s+(.*)/) { # printf STDERR "$f: $1\n"; $seen++; $context->add($f, $1); } } close SEQ; } close FOLDERS; print "0\n"; # xlbiff expects this # If no new messages exist, pop down the window if ($seen == 0) { exit 2; # 0 = change, 1 = no change, 2 = zero'ed } # Read results from the last time we ran. my $last_results = ""; open LAST, $State and do { chop ($last_results = ); close LAST; }; # Compare our results now against those from last time. If no change, exit now my $new = $context->hexdigest; #printf STDERR "old: %s\nnew: %s\n", $last_results, $new; if ($new eq $last_results) { exit 1; # 1 = no change, 0 = change, 2 = zero'ed } # Something changed. Write out our new results, and exit with status 0 (change) my $tmp = "$State.tmp.$$"; open OUT, ">", $tmp or die "$ME: Error creating $tmp: $!\n"; print OUT $new,"\n"; close OUT; chmod 0600, $tmp; rename $tmp => $State or die "$ME: rename ($tmp => $State): $!\n"; exit 0; xlbiff-4.1.orig/Bscan0100755000765700007640000000306507753316532013435 0ustar martinedv#!/bin/sh # # Bscan -- display count of messages in "bulk" folders # # Normally invoked by xlbiff. Not intended for general use. # # $Id: Bscan,v 1.4 2003/11/09 01:50:18 esm Exp $ # # Width of the FOLDER (left hand) side of the box WIDTH_L=12 # Width of the COUNT (right hand) side. 3 digits is plenty for me. WIDTH_R=3 # Don't clobber existing context... that makes it impossible for us to # read messages from the command line. MHCONTEXT=$HOME/Mail/context.tmp.$$; export MHCONTEXT # Last top-level dir last_dir='' # Find all folders with unseen messages for i in `flist -all -recurse -sequence unseen -noshowzero -fast`; do # For a given folder, e.g. M/zaurus/oz... dir=`expr $i : "\([^/]\+\)"` # Parent directory (M) folder=`expr $i : "[^/]\+/\(.*\)"` # rest of it (zaurus/oz) # Extract the number of unseen messages in this folder count=`flist +$i | sed -e 's/^.* \([0-9]\+\) in seq.*$/\1/'` # Same parent directory as last time? Omit dir, but indent by same amount # # Otherwise, display the if [ "$last_dir" = "$dir" ]; then # Same parent as last time printf "%*s " ${#dir} " " else if [ "$folder" = "" ]; then # Diff, but top-level folder printf "%s " $dir else # Diff, 2-or-more-level folder printf "%s/" $dir fi fi # Show the rest of the folder name, right-padding for alignment. Show # the unseen message count. fmt=$(expr $WIDTH_L - ${#dir} - 1) printf "%-*s%*d\n" "$fmt" "$folder" $WIDTH_R "$count" # Remember this dir for next time last_dir=$dir done rm -f $MHCONTEXT