richb@sunaus.oz (Rich Burridge) (10/15/90)
This is official patch #9 for faces v1.4. Note that it comes in two parts. CONTENTS: 1. What is faces? 2/ Changes made in this patch. 3/ How to install this patch. 4/ How to get previous patches. --------------- 1/ What is faces? Faces is a program for monitoring a list visually. Typically this is a list of incoming mail messages, jobs in the print queue or users on a system. Faces has the ability to read compressed faces images embedded in your mail headers, uncompressing them and displaying them on-the-fly. There are graphical interfaces for X11, XView, SunView and NeWS. ---------------- 2/ Changes made in this patch. * From Robert Adams <adams@littlei.intel.com> Speedups in directory searching in main.c: 1) all of the lists are now terminated by a NULL (saves a 'strlen' call); 2) the removal of the leading "." is done earlier and a check is made for removing a last trailing dot (this saves an extra bunch of stat's for the dir "misc."); 3) if the 'stat' for the old style file name fails, that means that the directory containing the files also can't be there. The loop is terminated if the 'stat' fails. This reduces the number of 'stat's done when searching for a face by an order of magnitude. * From Robert Adams <adams@littlei.intel.com> The time delay for the SysV kludge 'select' replacement was reduced from 5 to 3. * From Johan Vromans <jv@mh.nl> With GNU gcc, you cannot say "#ifdef XXX || YYY". It must be either "#if XXX || YYY" or "#if defined(XXX) || defined(YYY)". * From Johan Vromans <jv@mh.nl> Defined CC and $(CC) in the compface/Makefile, which can easily be altered for other C compilers. * From Bruno Pillard <bp@chorus.fr> The installation of the machine.tab and the people.tab has been removed from the standard "make install" rules in the Makefile. Typically sites will have customised these files in their faces directory, and do want them overwritten when you do a new installation of the faces program. Instead, an extra definition has been added to the Makefile. If you now do a "make tables", then the default machine and people tables will be installed. The README has been updated to reflect this change. * From John Mackin <john@cs.su.oz.au> Some systems (that don't use Berkeley Mail) have a ~/.mailrc format that is not compatible with the format of the commands that faces wants to find there. So, look for .facesrc first, and if that is found use it; otherwise examine .mailrc. This has been implemented, and the manual pages have been updated to reflect these changes. * From John Mackin <john@cs.su.oz.au> The manual page did not actually document the format of the commands faces looks for in .mailrc/.facesrc (that is, "set bell = <number>" and "set flash = <number>"). These have been documented, and two new options have also been added: "set raise" causes the window to be raised when new mail arrives, and "set button1clear" causes button 1 to clear the window, like it did in the previous version of faces, and like hitting Delete does now, and moves button 1's "toggling" function to button 2. This functionality is present in the X11, XView and SunView drivers. The TODO file has been updated to show that the NeWS driver still needs to be modified. * From John Mackin <john@cs.su.oz.au> Several functions (getenv, malloc, index and rindex) are all standard V7 and are all always char *. There is no reason they should be declared inside the SYSV32 conditional. * From John Mackin <john@cs.su.oz.au> The code has been made more robust for the case where uncompface never gets called. It will core-dump otherwise if an X-Face: line is the last thing in the mail file. In any case, the return value of index should always be checked. * From John Mackin <john@cs.su.oz.au> Various #include file adjustments for a MIPS machine: netdb.h ==> bsd/netdb.h sys/types.h ==> bsd/sys/types.h sys/time.h ==> bsd/sys/time.h In general, you should not assume that sys/time.h will automatically include sys/types.h for you. * From John Mackin <john@cs.su.oz.au> X-Face: lines are ignored if we've already seen one in this mail item. (This is similar to the way From: lines are already treated.) This will work correctly in all cases except when someone who puts their X-Face: in their signature includes (and doesn't indent) mail with an X-Face: in it. The TODO file entry has been modified to reflect this change. * From John Mackin <john@cs.su.oz.au> An extra definition has been added to the Makefile. This is NO_SELECT, and should be uncommented if your machine doesn't have the select() system call. Before this patch, this option was determined by the SYSV32 #ifdef. In these days of hybrid Unix systems this is no longer appropriate. * From John Mackin <john@cs.su.oz.au> The X11 driver now sets the WM_CLIENT_MACHINE property. * From John Mackin <john@cs.su.oz.au> Fixed a bad, core-dump-causing bug in the compface/compress routine. BigRead calls BigMul which assumes B is initialised. That's fine for the compface and uncompface _programs_ -- in that case it is initialised to zero, being statically allocated -- but a disaster for programs that call the library routines repeatedly, as faces does. * From John Mackin <john@cs.su.oz.au> Fixed a naming conflict between BACKGROUND in faces.h, and the Makefile definition BACKGROUND (if uncommented). * From John Mackin <john@cs.su.oz.au> The following points have been added to the TODO file: - If the mailbox is empty, or contains just one mail item, faces -a starts out 10 icon-widths long (with the right-hand part being white instead of background grey), then shrinks to one icon-width as soon as a mail item arrives or you delete the mail. I don't care about this since I don't use -a, but what I _would_ like to see (here comes the wishlist item) is an option that you can use with monitor-new that keeps the window always 10 (or -c if specified) icon-widths wide, but adds extra rows of icons as needed if more than 10/-c new mail items arrive between clearings of the window, and shrinks the window back to one row/-c widths when it is cleared. - The usage message claims you can use "-bg background_color". This isn't in the manual page, and it also doesn't work at all (under X11). The argument appears to be completely ignored - The "-b icon_file" option doesn't work. It still comes up with the default background. - The manual entry makes no mention of X-Face: lines. - It should be made more explicit in the manual page that in the previous version of faces, a -f option _added_ the directory to the face search path, so that if you did -f you got those faces in addition to the system default faces, whereas now -f _supersedes_ the system faces and you must include a trailing colon to have them searched. - A comment on the domain lookup algorithm. According to the manual page: $DIR/machine.dom.ain/uid/iconname $DIR/dom.ain/uid/iconname $DIR/ain/uid/iconname $DIR/misc./uid/iconname $DIR/machine.dom.ain/unknown/iconname $DIR/dom.ain/unknown/iconname $DIR/ain/unknown/iconname $DIR/misc./unknown/iconname This leads to a top-level directory with a _lot_ of subdirectories. I think this is responsible for much of faces' CPU time; it's well known that large directories are a UNIX performance no-no. What I would like to see instead (or in addition, or as an option, perhaps compile-time) is the following. $DIR/ain/dom/uid/iconname $DIR/ain/uid/iconname $DIR/misc./uid/iconname $DIR/ain/dom/machine/unknown/iconname $DIR/ain/dom/unknown/iconname $DIR/ain/unknown/iconname $DIR/misc./unknown/iconname The idea is that at each level, if the next component exists and is a directory, you descend into it and look there. - The code in mon.c recognises From: lines in the body of the mail. This is an error. From: lines should only be recognised before the first blank line. - You test if the beginning of the line is identically equal to "X-Face:" or "From:". This is contrary to RFC822, which specifies (1) that headers should be recognised in either case (so "X-Face:" and "X-FACE:" and "x-FaCe:" are all equivalent). (2) that there may be linear white space (spaces or tabs) between the field-name and the colon (so "FRoM : Foo Bar <foo@bar>" should work). - The RFC822 address parsing in parsefrom.c appears, on quick inspection, to be grossly inadequate. (It certainly doesn't handle comments in addresses, for one thing.) ---------------- 3/ How to install this patch. Patch #9 comes in two parts. You need to save both of these parts, then apply the patches to the faces source. You should use the -p0 option to Larry Wall's patch program, to allow the patches for the filters and compface directory files to be correctly applied. For example: # First part saved in patch.9.part1 # Second part saved in patch.9.part2 cd faces_src patch -p0 <patch.9.part1 patch -p0 <patch.9.part2 Then recompile, and reinstall. For example: make xview # Or Sunview, X11 or NeWS. make install # You might have to be super-user. If you are installing for the first time, see the README file for more details. ---------------- 4/ How to get previous patches. If you need to get patches 5-8, then they can be obtained from the automatic mail archive server, by sending a message to rb-archive-server@Aus.Sun.COM containing the line: send faces patchn where n is the patch number you require. If the mail is likely to go back through any sites that impose a size limit, then I suggest you divide the above request up into two separate mail messages. You can also include a path line in these requests to indicate the mail path that the archive server should use to send the files to you. Such a path line could be: path uunet.uu.net!hostname!user Note that this is uunet.uu.net and not just uunet. Sun.COM doesn't recognise just uunet. [NOTE: When unpacking the shars generated by the automatic mail service, it is possible you will get error messages for incorrect length. Please ignore; hopefully the files should still unpack correctly]. Rich Burridge, DOMAIN: richb@Aus.Sun.COM Sun Microsystems. ACSNET: richb@sunaus.sun.oz PHONE: +61 2 413 2666 UUCP: {uunet,mcvax,ukc}!munnari!sunaus.oz!richb ------CUT HERE------patch.9------CUT HERE------ ------- patchlevel.h ------- Prereq: 8 *** /tmp/da20246 Thu Oct 11 15:42:33 1990 --- patchlevel.h Wed Oct 10 17:49:37 1990 *************** *** 14,17 **** * reported to me then an attempt will be made to fix them. */ ! #define PATCHLEVEL 8 --- 14,17 ---- * reported to me then an attempt will be made to fix them. */ ! #define PATCHLEVEL 9 ------- get.c ------- *** /tmp/da20225 Thu Oct 11 15:42:26 1990 --- get.c Thu Oct 11 10:55:07 1990 *************** *** 15,21 **** */ #include <stdio.h> ! #ifdef SYSV32 || hpux #include <string.h> #else #include <strings.h> --- 15,21 ---- */ #include <stdio.h> ! #if SYSV32 || hpux #include <string.h> #else #include <strings.h> *************** *** 411,417 **** while (*ptr == ' ' || *ptr == '\t' || *ptr == '\n') ptr++ ; SSCANF(ptr, "0x%X", &temp) ; obuf[i*4 + j] = (short) temp ; ! ptr = index(ptr, ',') ; ptr++ ; } obuf[i*4 + 3] = 0 ; --- 411,417 ---- while (*ptr == ' ' || *ptr == '\t' || *ptr == '\n') ptr++ ; SSCANF(ptr, "0x%X", &temp) ; obuf[i*4 + j] = (short) temp ; ! if ((ptr = index(ptr, ',')) == NULL) return ; ptr++ ; } obuf[i*4 + 3] = 0 ; ------- main.c ------- *** /tmp/da20228 Thu Oct 11 15:42:27 1990 --- main.c Thu Oct 11 13:20:34 1990 *************** *** 17,23 **** */ #include <stdio.h> ! #ifdef SYSV32 || hpux #include <string.h> #else #include <strings.h> --- 17,23 ---- */ #include <stdio.h> ! #if SYSV32 || hpux #include <string.h> #else #include <strings.h> *************** *** 24,30 **** --- 24,34 ---- #endif /* SYSV32 || hpux */ #include <sys/types.h> #include <sys/stat.h> + #ifndef mips #include <netdb.h> + #else + #include <bsd/netdb.h> + #endif #include <ctype.h> #ifdef DNSLOOKUP *************** *** 114,119 **** --- 118,124 ---- #endif /*NISLOOKUP*/ int beeps ; /* Number of beeps for arrival of new mail. */ + int button1clear = 0 ; /* Set if button 1 should clear the window. */ int column ; /* Column number for next icon. */ int doing_xface = 0 ; /* Set if we've started to process an X-Face: */ int dontshowno = 0 ; /* Set if number of messages shouldn't be displayed. */ *************** *** 146,151 **** --- 151,157 ---- int old_style = 0 ; /* Set when "old" style face ikon is found. */ int period = 60 ; /* Period in seconds for new mail check. */ int posspec = 0 ; /* Set if -Wp or -g option is present (for X11) */ + int raise = 0 ; /* Set if we are to raise window on update */ int row ; /* Row number for next icon. */ int toclear = 0 ; /* Set if faces memory area needs clearing. */ int update = 0 ; /* If set, send mail to update faces database. */ *************** *** 314,320 **** int i ; facepath[0] = FACEDIR ; /* Default path is single built-in directory. */ ! for (i = 1; i <= MAXPATHS; i++) facepath[i] = "" ; STRCPY(display, "") ; /* X11 display type. */ STRCPY(geometry, "") ; /* X11 geometry information. */ --- 320,326 ---- int i ; facepath[0] = FACEDIR ; /* Default path is single built-in directory. */ ! for (i = 1; i <= MAXPATHS; i++) facepath[i] = NULL ; STRCPY(display, "") ; /* X11 display type. */ STRCPY(geometry, "") ; /* X11 geometry information. */ *************** *** 495,526 **** icomm[0] = community ; icomm[1] = "misc." ; ! icomm[2] = "" ; iuser[0] = user ; iuser[1] = "unknown" ; ! iuser[2] = "" ; old_style = 0 ; /* Reset before checking this face. */ IF_DEBUG( FPRINTF(stderr, "make_iconname: %s[%s] ", community, user) ; ) ! for (id = 0; facepath[id] && (strlen(facepath[id]) != 0); id++) ! for (iu = 0; strlen(iuser[iu]) != 0; iu++) ! for (ic = 0; strlen(icomm[ic]) != 0; ic++) for (cptr = icomm[ic]; cptr != NULL; cptr = index(cptr, '.')) { SPRINTF(iconname, "%s/%s/%s", facepath[id], cptr, iuser[iu]) ; ! if (stat(iconname, &buf) != -1) ! if ((buf.st_mode & S_IFMT) == S_IFREG) ! { ! old_style = 1 ; ! IF_DEBUG( FPRINTF(stderr, "found as %s\n", iconname) ; ) ! return 1 ; ! } for (i = 0; i < maxtypes; i++) { - if (*cptr == '.') cptr++ ; SPRINTF(iconname, "%s/%s/%s/%s", facepath[id], cptr, iuser[iu], fname[i]) ; if (stat(iconname, &buf) != -1) --- 501,543 ---- icomm[0] = community ; icomm[1] = "misc." ; ! icomm[2] = NULL ; iuser[0] = user ; iuser[1] = "unknown" ; ! iuser[2] = NULL ; old_style = 0 ; /* Reset before checking this face. */ IF_DEBUG( FPRINTF(stderr, "make_iconname: %s[%s] ", community, user) ; ) ! for (id = 0; facepath[id] != NULL; id++) ! for (iu = 0; iuser[iu] != NULL; iu++) ! for (ic = 0; icomm[ic] != NULL; ic++) for (cptr = icomm[ic]; cptr != NULL; cptr = index(cptr, '.')) { + + /* Check if we are down to a trailing dot ("misc."). */ + + if (*cptr == '.') + { + cptr++ ; + if (*cptr == '\0') continue ; + } SPRINTF(iconname, "%s/%s/%s", facepath[id], cptr, iuser[iu]) ; ! ! /* If this file or directory isn't here, don't try any further for this one. */ ! ! if (stat(iconname, &buf) == -1) continue ; ! ! if ((buf.st_mode & S_IFMT) == S_IFREG) ! { ! old_style = 1 ; ! IF_DEBUG( FPRINTF(stderr, "found as %s\n", iconname) ; ) ! return 1 ; ! } for (i = 0; i < maxtypes; i++) { SPRINTF(iconname, "%s/%s/%s/%s", facepath[id], cptr, iuser[iu], fname[i]) ; if (stat(iconname, &buf) != -1) *************** *** 550,571 **** flashes = 0 ; if (getenv("HOME")) { ! SPRINTF(mrcname, "%s/.mailrc", getenv("HOME")) ; ! if ((fd = fopen(mrcname, "r")) == NULL) return ; while (fgets(nextline, MAXLINE, fd) != NULL) if (EQUAL(nextline, "set")) { ! ptr = index(nextline, ' ') ; if (EQUAL(ptr+1, "flash")) { ! ptr = index(nextline, '=') ; SSCANF(ptr+1, "%d", &flashes) ; } else if (EQUAL(ptr+1, "bell")) { ! ptr = index(nextline, '=') ; SSCANF(ptr+1, "%d", &beeps) ; } } } FCLOSE(fd) ; --- 567,594 ---- flashes = 0 ; if (getenv("HOME")) { ! SPRINTF(mrcname, "%s/.facesrc", getenv("HOME")) ; ! if ((fd = fopen(mrcname, "r")) == NULL) ! { ! SPRINTF(mrcname, "%s/.mailrc", getenv("HOME")) ; ! if ((fd = fopen(mrcname, "r")) == NULL) return ; ! } while (fgets(nextline, MAXLINE, fd) != NULL) if (EQUAL(nextline, "set")) { ! if ((ptr = index(nextline, ' ')) == NULL) continue ; if (EQUAL(ptr+1, "flash")) { ! if ((ptr = index(nextline, '=')) == NULL) continue ; SSCANF(ptr+1, "%d", &flashes) ; } else if (EQUAL(ptr+1, "bell")) { ! if ((ptr = index(nextline, '=')) == NULL) continue ; SSCANF(ptr+1, "%d", &beeps) ; } + else if (EQUAL(ptr+1, "raise")) raise = 1 ; + else if (EQUAL(ptr+1, "button1clear")) button1clear = 1 ; } } FCLOSE(fd) ; ------- mon.c ------- *** /tmp/da20231 Thu Oct 11 15:42:28 1990 --- mon.c Thu Oct 11 11:22:00 1990 *************** *** 15,21 **** */ #include <stdio.h> ! #ifdef SYSV32 || hpux #include <string.h> #else #include <strings.h> --- 15,21 ---- */ #include <stdio.h> ! #if SYSV32 || hpux #include <string.h> #else #include <strings.h> *************** *** 22,28 **** --- 22,32 ---- #endif /* SYSV32 || hpux */ #include <sys/types.h> #include <sys/stat.h> + #ifndef mips #include <sys/time.h> + #else + #include <bsd/sys/time.h> + #endif #include <sys/file.h> #include "faces.h" #include "extern.h" *************** *** 556,561 **** --- 560,572 ---- */ char *ptr ; + + /* Only take the first occurrence of X-Face: in any given mail item. + * This solves several of the possible problems in this area, and + * prevents core dumps when an X-Face: line terminates the mail file. + */ + + if (x_face) return ; if (!doing_xface) { ------- news.c ------- *** /tmp/da20234 Thu Oct 11 15:42:29 1990 --- news.c Thu Oct 11 14:11:13 1990 *************** *** 145,155 **** { for (j = 0; j < (width / imagewidth); j++) { ! ps_moveimage (inames[BACKGROUND], imagewidth, imageheight, j, i, dnames[(int) F_WINDOW]) ; ! ps_moveimage (inames[BACKGROUND], imagewidth, imageheight, j, i, dnames[(int) F_ICON]) ; --- 145,155 ---- { for (j = 0; j < (width / imagewidth); j++) { ! ps_moveimage (inames[BACKIMAGE], imagewidth, imageheight, j, i, dnames[(int) F_WINDOW]) ; ! ps_moveimage (inames[BACKIMAGE], imagewidth, imageheight, j, i, dnames[(int) F_ICON]) ; *************** *** 209,215 **** } if (strlen(bgicon)) GET_SUN_ICON(bgicon, buf) ; ! load_icon(BACKGROUND, buf) ; if (invert) pprintf(PostScript, "%p ", 3, "/Invert false def") ; else pprintf(PostScript, "%p ", 3, "/Invert true def") ; --- 209,215 ---- } if (strlen(bgicon)) GET_SUN_ICON(bgicon, buf) ; ! load_icon(BACKIMAGE, buf) ; if (invert) pprintf(PostScript, "%p ", 3, "/Invert false def") ; else pprintf(PostScript, "%p ", 3, "/Invert true def") ; *************** *** 284,290 **** { for (j = 0; j < (width / imagewidth); j++) { ! ps_moveimage (inames[BACKGROUND], imagewidth, imageheight, j, i, dnames[(int) dtype]) ; } } --- 284,290 ---- { for (j = 0; j < (width / imagewidth); j++) { ! ps_moveimage (inames[BACKIMAGE], imagewidth, imageheight, j, i, dnames[(int) dtype]) ; } } ------- sunview.c ------- *** /tmp/da20237 Thu Oct 11 15:42:30 1990 --- sunview.c Thu Oct 11 14:16:31 1990 *************** *** 16,21 **** --- 16,22 ---- */ #include <stdio.h> + #include <sys/file.h> #include "faces.h" #include "extern.h" #include <suntool/sunview.h> *************** *** 40,45 **** --- 41,47 ---- #define WINDOW_SET (void) window_set #define ITIMER_NULL ((struct itimerval *) 0) + #define ROOT_NAME "/dev/win0" int repaint_proc() ; *************** *** 57,62 **** --- 59,65 ---- Pixwin *fpw, *pw ; int ffd ; /* File descriptor of faces frame. */ + int rootfd ; adjust_image(dtype, itype, row, column) /* Put new face in memory pixrect. */ *************** *** 107,116 **** int nextc ; nextc = event_id(event) ; ! if (event_is_down(event) && nextc == MS_LEFT) { ! wdtype = (wdtype == DISP_NAME) ? DISP_OTHER : DISP_NAME ; ! draw_screen(wdtype) ; } if (event_is_ascii(event)) do_key(nextc) ; else window_default_event_proc(canvas, event, arg) ; --- 110,124 ---- int nextc ; nextc = event_id(event) ; ! if (event_is_down(event)) { ! if (button1clear && nextc == MS_LEFT) do_key(KEY_CLEAR) ; ! else if ((button1clear && nextc == MS_MIDDLE) || ! (!button1clear && nextc == MS_LEFT)) ! { ! wdtype = (wdtype == DISP_NAME) ? DISP_OTHER : DISP_NAME ; ! draw_screen(wdtype) ; ! } } if (event_is_ascii(event)) do_key(nextc) ; else window_default_event_proc(canvas, event, arg) ; *************** *** 197,203 **** } if (strlen(bgicon)) GET_SUN_ICON(bgicon, buf) ; ! load_icon(BACKGROUND, buf) ; STRCPY(fname[0], "sun.icon") ; STRCPY(fname[1], "48x48x1") ; --- 205,211 ---- } if (strlen(bgicon)) GET_SUN_ICON(bgicon, buf) ; ! load_icon(BACKIMAGE, buf) ; STRCPY(fname[0], "sun.icon") ; STRCPY(fname[1], "48x48x1") ; *************** *** 206,211 **** --- 214,220 ---- gtype = SVIEW ; pr[(int) DISP_NAME] = pr[(int) DISP_OTHER] = NULL ; old_pr[(int) DISP_NAME] = old_pr[(int) DISP_OTHER] = NULL ; + rootfd = open(ROOT_NAME, O_RDONLY, 0) ; return 0 ; } *************** *** 301,313 **** { if (pr[(int) dtype]) PR_REPLROP(pr[(int) dtype], 0, 0, width, height, PIX_SRC, ! images[(int) BACKGROUND], 0, 0) ; } else { if (old_pr[(int) dtype]) PR_REPLROP(old_pr[(int) dtype], 0, 0, width, height, PIX_SRC, ! images[(int) BACKGROUND], 0, 0) ; } } --- 310,322 ---- { if (pr[(int) dtype]) PR_REPLROP(pr[(int) dtype], 0, 0, width, height, PIX_SRC, ! images[(int) BACKIMAGE], 0, 0) ; } else { if (old_pr[(int) dtype]) PR_REPLROP(old_pr[(int) dtype], 0, 0, width, height, PIX_SRC, ! images[(int) BACKIMAGE], 0, 0) ; } } *************** *** 315,320 **** --- 324,332 ---- show_display() /* Show the latest set of mail icon faces. */ { Rect *temprect ; + + if (raise != 0 && newmail) + wmgr_top((int) window_get(frame, WIN_FD), rootfd) ; if (invert) /* Invert the memory pixrects before displaying. */ { ------- extern.h ------- *** /tmp/da20240 Thu Oct 11 15:42:31 1990 --- extern.h Thu Oct 11 10:41:02 1990 *************** *** 64,69 **** --- 64,70 ---- extern char userprog[] ; /* User supplied program to run. */ extern int beeps ; /* Number of beeps for arrival of new mail. */ + extern int button1clear ; /* Set if button 1 should clear the window. */ extern int column ; /* Column number for next icon. */ extern int doing_xface ; /* Set if we've started to process an X-Face: */ extern int dontshowno ; /* Set if no. of messages shouldn't be shown. */ *************** *** 93,98 **** --- 94,100 ---- extern int old_style ; /* Set when "old" style face ikon is found. */ extern int period ; /* Period in seconds for checking new mail. */ extern int posspec ; /* Set if -Wp or -g option is present (for X11) */ + extern int raise ; /* Set if we are to raise window on update */ extern int row ; /* Row number for next icon. */ extern int toclear ; /* Set if faces memory area needs clearing. */ extern int update ; /* If set, send mail to update faces database. */ ------- faces.h ------- *** /tmp/da20243 Thu Oct 11 15:42:32 1990 --- faces.h Thu Oct 11 14:10:18 1990 *************** *** 69,75 **** } ; /* Different types of possible face images. */ ! enum icon_type { BACKGROUND, NOFACE, NOMAIL, NOPAPER, NOPRINT, NOUSERS, ORDINARY, XFACE } ; enum image_type { ONSCREEN, OLDOFF, CUROFF } ; /* Image types. */ --- 69,75 ---- } ; /* Different types of possible face images. */ ! enum icon_type { BACKIMAGE, NOFACE, NOMAIL, NOPAPER, NOPRINT, NOUSERS, ORDINARY, XFACE } ; enum image_type { ONSCREEN, OLDOFF, CUROFF } ; /* Image types. */ *************** *** 131,138 **** #define rindex strrchr #endif /*NOINDEX*/ #ifndef SYSV32 - char *getenv(), *malloc() ; #ifdef hpux int sprintf() ; #else --- 131,139 ---- #define rindex strrchr #endif /*NOINDEX*/ + char *getenv(), *malloc(), *index(), *rindex() ; + #ifndef SYSV32 #ifdef hpux int sprintf() ; #else ------- README ------- *** /tmp/da20249 Thu Oct 11 15:42:34 1990 --- README Thu Oct 11 14:25:38 1990 *************** *** 85,97 **** 3/ make x11 - to make the X11 version. 4/ make xview - to make the XView version. ! This should then be followed by a make install. You might need super-user ! permission to do this successfully. Create your face directory, hostname ! and username sub-directories and appropriate ikons/icons, machine and ! people tables, and you're set. The manual pages describe this in more ! detail. A small sample face directory and alias files have been included ! with this distribution. The Makefile compilation details are setup to default to compiling the SunView version of faces on a Sun4 running SunOS v4.1. Note that there are various compilation definitions that might need uncommenting if you are --- 85,102 ---- 3/ make x11 - to make the X11 version. 4/ make xview - to make the XView version. ! You might need to be super user to do some of the next steps. + The very first time you are installing faces, you will need to do a "make + tables". This will create your face directory and copy default machine and + people tables into this directory. You should then create hostname and + username sub-directories under this face directory, and setup with the + appropriate ikons/icons. You can also customise your machine.tab and + people.tab files. The manual pages describe this in more detail. A small + sample face directory has been included with this distribution. + + This should then be followed by a "make install". + The Makefile compilation details are setup to default to compiling the SunView version of faces on a Sun4 running SunOS v4.1. Note that there are various compilation definitions that might need uncommenting if you are *************** *** 100,111 **** These are: ! BACKGROUND - alternate background icon pattern. DNSLOOKUP - use DNS (Domain Name Service) to try to convert hostnames. DONTSHOWNO - don't show number of message on face image. DONTSHOWTIME - don't show timestamp on face image. DONTSHOWUSER - don't show username on face image. FACEDIR - alternate face database directory. FMONTYPE - default monitoring type. INVERT - inverse video. NAMEUNKNOWN - clump all unknown users together per community. --- 105,119 ---- These are: ! BACKNAME - alternate background icon pattern file name. ! BACKGROUND - alternate background icon pattern definition. DNSLOOKUP - use DNS (Domain Name Service) to try to convert hostnames. + DNSLIB - name of the library to use to resolve DNS calls. DONTSHOWNO - don't show number of message on face image. DONTSHOWTIME - don't show timestamp on face image. DONTSHOWUSER - don't show username on face image. FACEDIR - alternate face database directory. + CFACEDIR - alternate face database directory definition. FMONTYPE - default monitoring type. INVERT - inverse video. NAMEUNKNOWN - clump all unknown users together per community. *************** *** 114,119 **** --- 122,128 ---- NISLOOKUP - uncomment to use Sun NIS (formerly YP) to look for hosts. NODOMAINS - uncomment if you don't want full host domain names. NOINDEX - uncomment if you don't have the index() function. + NOSELECT - uncomment if your machine doesn't have the select() call. PERIOD - alternate period in seconds before recheck. PLP - uncomment if you are running PLP and monitoring printers. REVORDER - byte reversal for little-endian machines. *************** *** 296,308 **** Greg Dudek for an alternative version of "on-the-fly" X-Face imaging which hasn't been used. ! Also thanks to Jeremy Cook, John Machin, Neil Crellin, Mark Andrews, Sjoerd Mullender, Cameron Humphries, Rick Gunderson, Rich McAllister, Hakon Lie, John Fong, Chris Maltby, Darryl K. Ramm, Steve Piette, Tony Landells, Pat Lashley, Dave Glowacki, Chris Steinbroner, Steven M. Miller, Bob Posert, Hugues Leroy, Graham Dumpleton, Michael Schmidt, Robert Adams, Rod Whitby, ! Greg Rose, Mike Khaw, Ian Darwin, Ken Wood and Lindsay F. Marshall for ! various bug reports, fixes and suggestions for improvement. ---------------------------------------------------------------------------- --- 305,318 ---- Greg Dudek for an alternative version of "on-the-fly" X-Face imaging which hasn't been used. ! Also thanks to Jeremy Cook, John Mackin, Neil Crellin, Mark Andrews, Sjoerd Mullender, Cameron Humphries, Rick Gunderson, Rich McAllister, Hakon Lie, John Fong, Chris Maltby, Darryl K. Ramm, Steve Piette, Tony Landells, Pat Lashley, Dave Glowacki, Chris Steinbroner, Steven M. Miller, Bob Posert, Hugues Leroy, Graham Dumpleton, Michael Schmidt, Robert Adams, Rod Whitby, ! Greg Rose, Mike Khaw, Ian Darwin, Ken Wood, Lindsay F. Marshall, Bruno ! Pillard and Johan Vromans for various bug reports, fixes and suggestions ! for improvement. ---------------------------------------------------------------------------- ------- faces.1 ------- *** /tmp/da20252 Thu Oct 11 15:42:35 1990 --- faces.1 Thu Oct 11 14:29:50 1990 *************** *** 96,125 **** .I x y ] .SH DESCRIPTION ! .B faces is a window based tool for visual monitoring lists. Typically it is used to ! monitor mail, print queues or users on a system.. It contains graphical interfaces for NeWS, SunView, XView and X11. It has five different modes of operation: .PP The default (no ! .BR -a , ! .BR -H , ! .BR -P or ! .B -e arguments) will monitor for new mail. By default, only the last ten messages are displayed. Using the left mouse button it is possible to toggle the text in the faces window. This will either be the username or the time the mail message arrived. You can clear this area to the ! background pattern by hitting the Delete key. The icon shows the image of the last message to arrive. .PP The second choice ! .RB ( -a ) is to monitor the whole of a mail file. The open window will ! automatically adjust it's size to correctly show the face icons. The open window options are the username or the timestamp and number of message from that user. The icon will display the image of the last message, and a count of the total number of messages in the spool --- 96,129 ---- .I x y ] .SH DESCRIPTION ! .I faces ! .\" be consistent, it's italic everywhere else is a window based tool for visual monitoring lists. Typically it is used to ! monitor mail, print queues or users on a system. It contains graphical interfaces for NeWS, SunView, XView and X11. It has five different modes of operation: .PP The default (no ! .BR \-a , ! .BR \-H , ! .BR \-P or ! .B \-e arguments) will monitor for new mail. By default, only the last ten messages are displayed. Using the left mouse button it is possible to toggle the text in the faces window. This will either be the username or the time the mail message arrived. You can clear this area to the ! background pattern by hitting the Delete key ! (but see below, under ! .BR "set button1clear" ). ! The icon shows the image of the last message to arrive. .PP The second choice ! .RB ( \-a ) is to monitor the whole of a mail file. The open window will ! automatically adjust its size to correctly show the face icons. The open window options are the username or the timestamp and number of message from that user. The icon will display the image of the last message, and a count of the total number of messages in the spool *************** *** 126,141 **** file or mail folder. .PP The third option ! .RB ( -P ) allows this program to monitor a given print queue. This will generate a single face icon showing the job at the top of the print queue, and the text message will display the printer name plus the number of jobs to be printed. Opening the window will show images of all the jobs in the queue. The text on each image can be toggled, choices ! being the owners' name and the size of the job in bytes. .PP With the fourth mode ! .RB ( -H ), you can monitor who is logged in a machine. For each user, a face image is displayed. Text can be either the username or the time they logged on. The iconic form displays the total number of users. --- 130,145 ---- file or mail folder. .PP The third option ! .RB ( \-P ) allows this program to monitor a given print queue. This will generate a single face icon showing the job at the top of the print queue, and the text message will display the printer name plus the number of jobs to be printed. Opening the window will show images of all the jobs in the queue. The text on each image can be toggled, choices ! being the owner's name and the size of the job in bytes. .PP With the fourth mode ! .RB ( \-H ), you can monitor who is logged in a machine. For each user, a face image is displayed. Text can be either the username or the time they logged on. The iconic form displays the total number of users. *************** *** 142,148 **** .PP Finally you can specify a program or shell script to run ! .RB ( -e ). The standard output from this program will be read by the faces program, and the appropriate faces displayed using the information provided. The format of this face information --- 146,152 ---- .PP Finally you can specify a program or shell script to run ! .RB ( \-e ). The standard output from this program will be read by the faces program, and the appropriate faces displayed using the information provided. The format of this face information *************** *** 163,171 **** adjusts accordingly. .TP .BI \-P " printer" ! Printer name to monitor. If this and a mail spool file are given with the -s option, ! .B faces will monitor the print queue. .TP .BI \-S " spooldir" --- 167,177 ---- adjusts accordingly. .TP .BI \-P " printer" ! Printer name to monitor. If this and a mail spool file are given with the ! .B \-s option, ! .I faces ! .\" be consistent, it's italic everywhere else will monitor the print queue. .TP .BI \-S " spooldir" *************** *** 179,185 **** .B \-U Automatically send mail to a special mail alias, to update the .I faces ! database when a new X-Face: record is read. By default this special alias is .I facemaker. This should be aliased (see --- 185,191 ---- .B \-U Automatically send mail to a special mail alias, to update the .I faces ! database when a new X\-Face: record is read. By default this special alias is .I facemaker. This should be aliased (see *************** *** 191,197 **** By default the .I face_update shell script will not overwriting existing ikons in the faces database. ! Overwriting will take place if the -w option is specified. You should also note that the installation of this mail alias is not done automatically, as this might be considered a security risk on some systems. .TP --- 197,205 ---- By default the .I face_update shell script will not overwriting existing ikons in the faces database. ! Overwriting will take place if the ! .B \-w ! option is specified. You should also note that the installation of this mail alias is not done automatically, as this might be considered a security risk on some systems. .TP *************** *** 208,219 **** Number of columns of face images in each row. By default this is 10. .TP .BI \-d " display" ! Used with the X11 variant of faces to give a display type. .TP .BI \-e " program" Name of the user program to run. This program or shell script will generate lines which the faces program will read, and then display the appropriate ! face images. The format of these input records is described in a previous section. .TP .BI \-f " facepath" --- 216,227 ---- Number of columns of face images in each row. By default this is 10. .TP .BI \-d " display" ! Used with the X11 variant of faces to give the display name. .TP .BI \-e " program" Name of the user program to run. This program or shell script will generate lines which the faces program will read, and then display the appropriate ! face images. The format of these input records is described in a later section. .TP .BI \-f " facepath" *************** *** 235,241 **** .TP .B \-iconic Start the ! .B faces program up in iconic form. .TP .B \-i --- 243,250 ---- .TP .B \-iconic Start the ! .I faces ! .\" be consistent, it's italic everywhere else program up in iconic form. .TP .B \-i *************** *** 272,278 **** .TP .B \-v Print the version number of this release of the ! .B faces program. .TP .BI \-w " width" --- 281,288 ---- .TP .B \-v Print the version number of this release of the ! .I faces ! .\" be consistent, it's italic everywhere else program. .TP .BI \-w " width" *************** *** 282,288 **** .TP .B \-Wi Start the ! .B faces program up in iconic form. SunView automatically uses this flag, but the NeWS version will also. .TP --- 292,299 ---- .TP .B \-Wi Start the ! .I faces ! .\" be consistent, it's italic everywhere else program up in iconic form. SunView automatically uses this flag, but the NeWS version will also. .TP *************** *** 336,350 **** $DIR/misc./unknown/iconname .RE If the ! .B -f argument is specified the given directory is searched instead of .IR /usr/local/faces . The iconname above, consists of the following choices, in the given order: .TS r1 c1 l1 l1 l1 l1 . ! NeWS - face.ps, sun.icon, 48x48x1, face.xbm ! SunView - sun.icon, 48x48x1, face.xbm ! X11 - face.xbm, sun.icon, 48x48x1 .TE Domain names are now fully supported. For example, if mail arrives from .I foo@a.b.c --- 347,361 ---- $DIR/misc./unknown/iconname .RE If the ! .B \-f argument is specified the given directory is searched instead of .IR /usr/local/faces . The iconname above, consists of the following choices, in the given order: .TS r1 c1 l1 l1 l1 l1 . ! NeWS \- face.ps, sun.icon, 48x48x1, face.xbm ! SunView \- sun.icon, 48x48x1, face.xbm ! X11 \- face.xbm, sun.icon, 48x48x1 .TE Domain names are now fully supported. For example, if mail arrives from .I foo@a.b.c *************** *** 355,361 **** .I b.c and .I c ! .RE for the machine name: The directory .I misc. hold faces for generic users such as --- 366,372 ---- .I b.c and .I c ! for the machine name. The directory .I misc. hold faces for generic users such as *************** *** 404,414 **** simply displays who the mail is from. .PP When new mail arrives, ! .B faces will beep and flash appropriately, depending upon the set parameters in ! the users ! .I .mailrc file. .PP If you are using the NeWS version and creating face images of the .I face.ps --- 415,453 ---- simply displays who the mail is from. .PP When new mail arrives, ! .I faces ! .\" be consistent, it's italic everywhere else will beep and flash appropriately, depending upon the set parameters in ! the user's ! faces startup file. + This is looked for in the user's home directory; first the file + .I .facesrc + is tried, and if that file is not found, + .I .mailrc + is looked for. The file, if found, will be examined for lines in the + following form: + .TP + .BI "set bell = " number + Give the number of times + .I faces + will ring the bell when new mail arrives. + .TP + .BI "set flash = " number + Give the number of times + .I faces + will flash the window when new mail arrives. + .TP + .B "set raise" + .I faces + will raise the window when new mail arrives. + .TP + .B "set button1clear" + For those who liked the behaviour of previous versions of + .IR faces , + this causes button 1 to clear the window (like typing Delete). + The ``toggling'' function of button 1 is moved to button 2 + if this option is set. .PP If you are using the NeWS version and creating face images of the .I face.ps *************** *** 457,468 **** .TP 30 .B /var/spool/mail directory for system mailboxes .TP ! .B /.face ! the users compressed face image .TP ! .B /.mailrc ! mail startup file .TP .B /usr/local/faces main directory containing the face icons. --- 496,512 ---- .TP 30 .B /var/spool/mail directory for system mailboxes + .\" this shouldn't be mentioned here, as faces doesn't use it + .\".TP + .\".B /.face + .\"the users compressed face image .TP ! .B $HOME/.facesrc ! faces startup file .TP ! .B $HOME/.mailrc ! mail startup file (examined if .facesrc ! doesn't exist) .TP .B /usr/local/faces main directory containing the face icons. *************** *** 483,489 **** face icons. .TP .B HOME ! The home directory of the current user. Used to locate the .mailrc file. .TP .B MAIL The complete pathname of the mail spool file to monitor. --- 527,534 ---- face icons. .TP .B HOME ! The home directory of the current user. Used to locate the .facesrc or .mailrc ! file. .TP .B MAIL The complete pathname of the mail spool file to monitor.
richb@sunaus.oz (Rich Burridge) (10/15/90)
This is the second part of patch #9 for faces v1.4. See the installation details at the beginning of part1. ------CUT HERE------patch.9.part2------CUT HERE----- ------- Makefile ------- *** /tmp/da20255 Thu Oct 11 15:42:36 1990 --- Makefile Thu Oct 11 15:31:25 1990 *************** *** 25,33 **** # Faces displays a background pattern in its' window. When the window # is not completely full, this gives the appearance of trying to blend # in with the background. By default, this is a root gray color, but you ! # can specify an alternate pattern to use here. # ! #BACKGROUND = -DBACKGROUND=\"\" #------------------------------------------------------------------------ # Uncomment the following two lines to use the Domain Name Service to # attempt to convert unqualified hostnames, or hostnames with partial --- 25,35 ---- # Faces displays a background pattern in its' window. When the window # is not completely full, this gives the appearance of trying to blend # in with the background. By default, this is a root gray color, but you ! # can specify the name of a file containing an alternate pattern to use. ! # Uncomment the next two lines and set appropriately. # ! #BACKNAME = /usr/local/sample-background ! #BACKGROUND = -DBACKGROUND=\"$(BACKNAME)\" #------------------------------------------------------------------------ # Uncomment the following two lines to use the Domain Name Service to # attempt to convert unqualified hostnames, or hostnames with partial *************** *** 120,125 **** --- 122,132 ---- # #NOINDEX = -DNOINDEX #-------------------------------------------------------------------------- + # Not every version of Unix (in particular System V derivitives) has the + # select() system call. If your machine doesn't have this call, then you + # need to uncomment the following definition. + #NOSELECT = -DNOSELECT + #-------------------------------------------------------------------------- # By default, faces rechecks for new mail or print jobs every sixty # seconds. If you would like to specify an alternate period, then uncomment # the following line and set appropriately. *************** *** 216,224 **** CDEFS = $(BACKGROUND) $(DNSLOOKUP) $(DONTSHOWNO) $(DONTSHOWTIME) \ $(DONTSHOWUSER) $(CFACEDIR) $(FMONTYPE) $(INVERT) \ $(NAMEUNKNOWN) $(NEWSINCDIR) $(NISLOOKUP) $(NODOMAINS) \ ! $(NOINDEX) $(PERIOD) $(PLP) $(REVORDER) $(SELTYPE) \ ! $(SPOOLDIR) $(SPOOLFILE) $(SYSV) $(TTEXT) $(UPDATE) \ ! $(X11INCDIR) $(XVIEWINCDIR) $(DEBUG) CCOMP = -g CFLAGS = $(CCOMP) $(CDEFS) # --- 223,231 ---- CDEFS = $(BACKGROUND) $(DNSLOOKUP) $(DONTSHOWNO) $(DONTSHOWTIME) \ $(DONTSHOWUSER) $(CFACEDIR) $(FMONTYPE) $(INVERT) \ $(NAMEUNKNOWN) $(NEWSINCDIR) $(NISLOOKUP) $(NODOMAINS) \ ! $(NOINDEX) $(NOSELECT) $(PERIOD) $(PLP) $(REVORDER) \ ! $(SELTYPE) $(SPOOLDIR) $(SPOOLFILE) $(SYSV) $(TTEXT) \ ! $(UPDATE) $(X11INCDIR) $(XVIEWINCDIR) $(DEBUG) CCOMP = -g CFLAGS = $(CCOMP) $(CDEFS) # *************** *** 309,321 **** $(STDLIBS) $(XVIEWLIBS) -cp xvfaces faces install: (cd compface; $(MAKE) $(MAKEOPTS) install) (cd filters; $(MAKE) $(MAKEOPTS) install) install -s -m 751 faces $(BINDIR) install -c -m 755 face_update $(BINDIR) - install -c -m 644 machine.tab $(FACEDIR) - install -c -m 644 people.tab $(FACEDIR) install -c -m 644 faces.1 \ $(MANDIR)/man$(MANSECT)/faces.$(MANSECT) install -c -m 644 face_update.1 \ --- 316,331 ---- $(STDLIBS) $(XVIEWLIBS) -cp xvfaces faces + tables: + -mkdir $(FACEDIR) + -install -c -m 644 machine.tab $(FACEDIR) + -install -c -m 644 people.tab $(FACEDIR) + install: (cd compface; $(MAKE) $(MAKEOPTS) install) (cd filters; $(MAKE) $(MAKEOPTS) install) install -s -m 751 faces $(BINDIR) install -c -m 755 face_update $(BINDIR) install -c -m 644 faces.1 \ $(MANDIR)/man$(MANSECT)/faces.$(MANSECT) install -c -m 644 face_update.1 \ ------- x11.c ------- *** /tmp/da20258 Thu Oct 11 15:42:37 1990 --- x11.c Thu Oct 11 14:17:00 1990 *************** *** 17,23 **** --- 17,29 ---- */ #include <stdio.h> + #ifndef mips + #include <sys/types.h> #include <sys/time.h> + #else + #include <bsd/sys/types.h> + #include <bsd/sys/time.h> + #endif #include "faces.h" #include "extern.h" #include <X11/Xlib.h> *************** *** 96,106 **** while (beeps > 0) { XBell(dpy, 56) ; ! #ifndef SYSV32 ! SELECT(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, &btime) ; ! #else sleep(1) ; ! #endif /*SYSV32*/ beeps-- ; } while (flashes > 0) --- 102,116 ---- while (beeps > 0) { XBell(dpy, 56) ; ! #ifdef NOSELECT sleep(1) ; ! #else ! #ifdef NO_43SELECT ! SELECT(0, 0, 0, 0, &btime) ; ! #else ! SELECT(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, &btime) ; ! #endif /*NO_43SELECT*/ ! #endif /*NOSELECT*/ beeps-- ; } while (flashes > 0) *************** *** 252,258 **** } if (strlen(bgicon)) GET_SUN_ICON(bgicon, buf) ; ! load_icon(BACKGROUND, buf) ; STRCPY(fname[0], "face.xbm") ; STRCPY(fname[1], "sun.icon") ; --- 262,268 ---- } if (strlen(bgicon)) GET_SUN_ICON(bgicon, buf) ; ! load_icon(BACKIMAGE, buf) ; STRCPY(fname[0], "face.xbm") ; STRCPY(fname[1], "sun.icon") ; *************** *** 308,313 **** --- 318,325 ---- int flags ; int x, y ; /* Window position. */ XSetWindowAttributes winattrs ; + XTextProperty textprop ; + char hostname[MAXLINE] ; w = width = maxcols * imagewidth ; h = height = imageheight ; *************** *** 387,392 **** --- 399,411 ---- XSetClassHint(dpy, frame[F_WINDOW], &class_hint) ; + GETHOSTNAME(hostname, MAXLINE) ; + textprop.value = (unsigned char *) hostname ; + textprop.encoding = XA_STRING ; + textprop.format = 8 ; + textprop.nitems = strlen(hostname) ; + XSetWMClientMachine(dpy, frame[F_WINDOW], &textprop) ; + /* Equivalent of make_icon. */ if (mtype == MONPRINTER) adjust_image(DISP_ICON, NOPRINT, 0, 0) ; *************** *** 428,435 **** if (dest == CUROFF) dpm = pr[(int) dtype] ; else dpm = old_pr[(int) dtype] ; ! if (depth == 1) XSetStipple(dpy, tilegc, images[(int) BACKGROUND]) ; ! else XSetTile(dpy, tilegc, images[(int) BACKGROUND]) ; XFillRectangle(dpy, dpm, tilegc, 0, 0, width, height) ; } --- 447,454 ---- if (dest == CUROFF) dpm = pr[(int) dtype] ; else dpm = old_pr[(int) dtype] ; ! if (depth == 1) XSetStipple(dpy, tilegc, images[(int) BACKIMAGE]) ; ! else XSetTile(dpy, tilegc, images[(int) BACKIMAGE]) ; XFillRectangle(dpy, dpm, tilegc, 0, 0, width, height) ; } *************** *** 439,444 **** --- 458,469 ---- XEvent ev ; static int first_time = 1 ; + if (raise != 0 && newmail) + { + XRaiseWindow(dpy, frame[F_WINDOW]) ; + XRaiseWindow(dpy, frame[F_ICON]) ; + } + if (invert) /* Invert the memory pixrects before displaying. */ { XSetFunction(dpy, gc, GXcopyInverted) ; *************** *** 481,487 **** for (;;) { readmask = fullmask ; ! #ifndef SYSV32 #ifdef NO_43SELECT SELECT(32, &readmask, 0, 0, &tval) ; if (readmask && (1 << xfd)) --- 506,512 ---- for (;;) { readmask = fullmask ; ! #ifndef NOSELECT #ifdef NO_43SELECT SELECT(32, &readmask, 0, 0, &tval) ; if (readmask && (1 << xfd)) *************** *** 496,507 **** sleep(1) ; while ((XPending(dpy) == 0) && (contr < period)) { ! sleep(5) ; ! contr += 5 ; } } if (XPending(dpy)) ! #endif /*SYSV32*/ do { if (!XCheckMaskEvent(dpy, ExposureMask, &event)) --- 521,532 ---- sleep(1) ; while ((XPending(dpy) == 0) && (contr < period)) { ! sleep(3) ; ! contr += 3 ; } } if (XPending(dpy)) ! #endif /*NOSELECT*/ do { if (!XCheckMaskEvent(dpy, ExposureMask, &event)) *************** *** 523,533 **** /* ButtonPress. */ ! else if (event.type == ButtonPress && ! event.xbutton.button == Button1) { ! wdtype = (wdtype == DISP_NAME) ? DISP_OTHER : DISP_NAME ; ! draw_screen(wdtype) ; } /* KeyPress. */ --- 548,563 ---- /* ButtonPress. */ ! else if (event.type == ButtonPress) { ! if (button1clear && event.xbutton.button == Button1) ! do_key(KEY_CLEAR) ; ! else if ((button1clear && event.xbutton.button == Button2) || ! (!button1clear && event.xbutton.button == Button1)) ! { ! wdtype = (wdtype == DISP_NAME) ? DISP_OTHER : DISP_NAME ; ! draw_screen(wdtype) ; ! } } /* KeyPress. */ ------- TODO ------- *** /tmp/da20261 Thu Oct 11 15:42:37 1990 --- TODO Thu Oct 11 15:25:04 1990 *************** *** 34,41 **** (a) There are two warnings on compiling news.c, due to FILE operations being performed on PSFILE variables. ! (b) The new input functionality (click left mouse, Del, ^L and q) has ! to be added in. 7/ With the XView version, add a Properties pinup window which would allow you to change the various monitoring options on the fly. --- 34,41 ---- (a) There are two warnings on compiling news.c, due to FILE operations being performed on PSFILE variables. ! (b) The new input functionality (click left/middle mouse, raise window, ! Del, ^L and q) has to be added in. 7/ With the XView version, add a Properties pinup window which would allow you to change the various monitoring options on the fly. *************** *** 93,99 **** 17/ Provide a template of what each of the independent graphics routine do, to aid porting to new graphics environments. ! 18/ Add an option to disable flashing and beeping when new mail arrives. 19/ From Pat Lashley <patl@Sun.COM> Change window header to show what is being monitored (mail, lp1, users, --- 93,109 ---- 17/ Provide a template of what each of the independent graphics routine do, to aid porting to new graphics environments. ! 18/ From John Mackin <john@cs.su.oz.au> ! If the mailbox is empty, or contains just one mail item, faces -a starts ! out 10 icon-widths long (with the right-hand part being white instead of ! background grey), then shrinks to one icon-width as soon as a mail item ! arrives or you delete the mail. I don't care about this since I don't ! use -a, but what I _would_ like to see (here comes the wishlist item) is ! an option that you can use with monitor-new that keeps the window always ! 10 (or -c if specified) icon-widths wide, but adds extra rows of icons as ! needed if more than 10/-c new mail items arrive between clearings of the ! window, and shrinks the window back to one row/-c widths when it is ! cleared. 19/ From Pat Lashley <patl@Sun.COM> Change window header to show what is being monitored (mail, lp1, users, *************** *** 122,125 **** 24/ When the -w and/or -h options are used with the SunView version, the size of the icon created is incorrect. ! 25/ Optimise. --- 132,210 ---- 24/ When the -w and/or -h options are used with the SunView version, the size of the icon created is incorrect. ! 25/ From John Mackin <john@cs.su.oz.au> ! The usage message claims you can use "-bg background_color". This isn't ! in the manual page, and it also doesn't work at all (under X11). The ! argument appears to be completely ignored ! ! 26/ From John Mackin <john@cs.su.oz.au> ! The "-b icon_file" option doesn't work. It still comes up with the ! default background. ! ! 27/ From John Mackin <john@cs.su.oz.au> ! The manual entry makes no mention of X-Face: lines. ! ! 28/ From John Mackin <john@cs.su.oz.au> ! It should be made more explicit in the manual page that in the ! previous version of faces, a -f option _added_ the directory to ! the face search path, so that if you did -f you got those faces ! in addition to the system default faces, whereas now -f ! _supersedes_ the system faces and you must include a trailing ! colon to have them searched. ! ! 29/ From John Mackin <john@cs.su.oz.au> ! A comment on the domain lookup algorithm. According to the manual page: ! ! $DIR/machine.dom.ain/uid/iconname ! $DIR/dom.ain/uid/iconname ! $DIR/ain/uid/iconname ! $DIR/misc./uid/iconname ! $DIR/machine.dom.ain/unknown/iconname ! $DIR/dom.ain/unknown/iconname ! $DIR/ain/unknown/iconname ! $DIR/misc./unknown/iconname ! ! This leads to a top-level directory with a _lot_ of subdirectories. ! I think this is responsible for much of faces' CPU time; it's well ! known that large directories are a UNIX performance no-no. What I ! would like to see instead (or in addition, or as an option, perhaps ! compile-time) is the following. ! ! $DIR/ain/dom/uid/iconname ! $DIR/ain/uid/iconname ! $DIR/misc./uid/iconname ! $DIR/ain/dom/machine/unknown/iconname ! $DIR/ain/dom/unknown/iconname ! $DIR/ain/unknown/iconname ! $DIR/misc./unknown/iconname ! ! The idea is that at each level, if the next component exists and is ! a directory, you descend into it and look there. ! ! 30/ From John Mackin <john@cs.su.oz.au> ! The code in mon.c recognises From: lines in the body of the mail. ! This is an error. From: lines should only be recognised before ! the first blank line. ! ! 31/ From John Mackin <john@cs.su.oz.au> ! You test if the beginning of the line is identically equal to ! "X-Face:" or "From:". This is contrary to RFC822, which specifies ! ! (1) that headers should be recognised in either case (so "X-Face:" ! and "X-FACE:" and "x-FaCe:" are all equivalent). ! (2) that there may be linear white space (spaces or tabs) between ! the field-name and the colon (so "FRoM : Foo Bar <foo@bar>" ! should work). ! ! 32/ From John Mackin <john@cs.su.oz.au> ! The RFC822 address parsing in parsefrom.c appears, on quick ! inspection, to be grossly inadequate. (It certainly doesn't ! handle comments in addresses, for one thing.) ! ! 33/ From Alan Skea <skea@prl.dec.com> ! If you are running faces with the -a option, and mail arrived from ! x@y with an X-Face: line then another article arrives from x@y with ! a different X-Face: line, then the second face is not shown; just ! the count of the first face get's incremented. ! ! 34/ Optimise. ------- xview.c ------- *** /tmp/da20264 Thu Oct 11 15:42:38 1990 --- xview.c Thu Oct 11 14:17:20 1990 *************** *** 103,112 **** int nextc ; nextc = event_id(event) ; ! if (event_is_down(event) && nextc == MS_LEFT) { ! wdtype = (wdtype == DISP_NAME) ? DISP_OTHER : DISP_NAME ; ! draw_screen(wdtype) ; } else if (event_is_ascii(event)) do_key(nextc) ; } --- 103,117 ---- int nextc ; nextc = event_id(event) ; ! if (event_is_down(event)) { ! if (button1clear && nextc == MS_LEFT) do_key(KEY_CLEAR) ; ! else if ((button1clear && nextc == MS_MIDDLE) || ! (!button1clear && nextc == MS_LEFT)) ! { ! wdtype = (wdtype == DISP_NAME) ? DISP_OTHER : DISP_NAME ; ! draw_screen(wdtype) ; ! } } else if (event_is_ascii(event)) do_key(nextc) ; } *************** *** 240,246 **** } if (strlen(bgicon)) GET_SUN_ICON(bgicon, buf) ; ! load_icon(BACKGROUND, buf) ; STRCPY(fname[0], "sun.icon") ; STRCPY(fname[1], "48x48x1") ; --- 245,251 ---- } if (strlen(bgicon)) GET_SUN_ICON(bgicon, buf) ; ! load_icon(BACKIMAGE, buf) ; STRCPY(fname[0], "sun.icon") ; STRCPY(fname[1], "48x48x1") ; *************** *** 353,360 **** if (dest == CUROFF) dpm = pr[(int) dtype] ; else dpm = old_pr[(int) dtype] ; ! if (depth == 1) XSetStipple(dpy, tilegc, images[(int) BACKGROUND]) ; ! else XSetTile(dpy, tilegc, images[(int) BACKGROUND]) ; XFillRectangle(dpy, dpm, tilegc, 0, 0, width, height) ; } --- 358,365 ---- if (dest == CUROFF) dpm = pr[(int) dtype] ; else dpm = old_pr[(int) dtype] ; ! if (depth == 1) XSetStipple(dpy, tilegc, images[(int) BACKIMAGE]) ; ! else XSetTile(dpy, tilegc, images[(int) BACKIMAGE]) ; XFillRectangle(dpy, dpm, tilegc, 0, 0, width, height) ; } *************** *** 362,367 **** --- 367,374 ---- show_display() /* Show the latest set of mail icon faces. */ { Rect *temprect ; + + if (raise != 0 && newmail) wmgr_top(frame) ; if (invert) /* Invert the memory pixrects before displaying. */ { ------- CHANGES ------- *** /tmp/da20267 Thu Oct 11 15:42:39 1990 --- CHANGES Thu Oct 11 15:20:41 1990 *************** *** 347,349 **** --- 347,534 ---- * From Lindsay F. Marshall <Lindsay.Marshall%newcastle.ac.uk@munnari.oz> faces works incorrectly when either the -h <height> or the -w <width> options are given. The image area is not being cleared first. + + v1.4 - patchlevel 9 - 11th October 1990. + + * From Robert Adams <adams@littlei.intel.com> + Speedups in directory searching in main.c: + 1) all of the lists are now terminated by a NULL (saves + a 'strlen' call); + 2) the removal of the leading "." is done earlier and a + check is made for removing a last trailing dot (this + saves an extra bunch of stat's for the dir "misc."); + 3) if the 'stat' for the old style file name fails, that + means that the directory containing the files also + can't be there. The loop is terminated if the 'stat' + fails. This reduces the number of 'stat's done + when searching for a face by an order of magnitude. + + * From Robert Adams <adams@littlei.intel.com> + The time delay for the SysV kludge 'select' replacement was reduced + from 5 to 3. + + * From Johan Vromans <jv@mh.nl> + With GNU gcc, you cannot say "#ifdef XXX || YYY". It must be either + "#if XXX || YYY" or "#if defined(XXX) || defined(YYY)". + + * From Johan Vromans <jv@mh.nl> + Defined CC and $(CC) in the compface/Makefile, which can easily be + altered for other C compilers. + + * From Bruno Pillard <bp@chorus.fr> + The installation of the machine.tab and the people.tab has been + removed from the standard "make install" rules in the Makefile. + Typically sites will have customised these files in their faces + directory, and do want them overwritten when you do a new + installation of the faces program. + + Instead, an extra definition has been added to the Makefile. If you + now do a "make tables", then the default machine and people tables + will be installed. The README has been updated to reflect this + change. + + * From John Mackin <john@cs.su.oz.au> + Some systems (that don't use Berkeley Mail) have a ~/.mailrc format + that is not compatible with the format of the commands that faces + wants to find there. So, look for .facesrc first, and if that is + found use it; otherwise examine .mailrc. This has been implemented, + and the manual pages have been updated to reflect these changes. + + * From John Mackin <john@cs.su.oz.au> + The manual page did not actually document the format of the commands + faces looks for in .mailrc/.facesrc (that is, "set bell = <number>" + and "set flash = <number>"). These have been documented, and two + new options have also been added: "set raise" causes the window to + be raised when new mail arrives, and "set button1clear" causes + button 1 to clear the window, like it did in the previous version + of faces, and like hitting Delete does now, and moves button 1's + "toggling" function to button 2. This functionality is present in + the X11, XView and SunView drivers. The TODO file has been updated + to show that the NeWS driver still needs to be modified. + + * From John Mackin <john@cs.su.oz.au> + Several functions (getenv, malloc, index and rindex) are all + standard V7 and are all always char *. There is no reason they + should be declared inside the SYSV32 conditional. + + * From John Mackin <john@cs.su.oz.au> + The code has been made more robust for the case where uncompface + never gets called. It will core-dump otherwise if an X-Face: line + is the last thing in the mail file. In any case, the return value + of index should always be checked. + + * From John Mackin <john@cs.su.oz.au> + Various #include file adjustments for a MIPS machine: + + netdb.h ==> bsd/netdb.h + sys/types.h ==> bsd/sys/types.h + sys/time.h ==> bsd/sys/time.h + + In general, you should not assume that sys/time.h will automatically + include sys/types.h for you. + + * From John Mackin <john@cs.su.oz.au> + X-Face: lines are ignored if we've already seen one in this mail + item. (This is similar to the way From: lines are already treated.) + This will work correctly in all cases except when someone who puts + their X-Face: in their signature includes (and doesn't indent) mail + with an X-Face: in it. The TODO file entry has been modified to + reflect this change. + + * From John Mackin <john@cs.su.oz.au> + An extra definition has been added to the Makefile. This is + NO_SELECT, and should be uncommented if your machine doesn't have + the select() system call. Before this patch, this option was + determined by the SYSV32 #ifdef. In these days of hybrid Unix + systems this is no longer appropriate. + + * From John Mackin <john@cs.su.oz.au> + The X11 driver now sets the WM_CLIENT_MACHINE property. + + * From John Mackin <john@cs.su.oz.au> + Fixed a bad, core-dump-causing bug in the compface/compress routine. + BigRead calls BigMul which assumes B is initialised. That's fine for + the compface and uncompface _programs_ -- in that case it is + initialised to zero, being statically allocated -- but a disaster + for programs that call the library routines repeatedly, as faces does. + + * From John Mackin <john@cs.su.oz.au> + Fixed a naming conflict between BACKGROUND in faces.h, and the + Makefile definition BACKGROUND (if uncommented). + + * From John Mackin <john@cs.su.oz.au> + The following points have been added to the TODO file: + + - If the mailbox is empty, or contains just one mail item, faces -a + starts out 10 icon-widths long (with the right-hand part being + white instead of background grey), then shrinks to one icon-width + as soon as a mail item arrives or you delete the mail. + I don't care about this since I don't use -a, but what I _would_ + like to see (here comes the wishlist item) is an option that you + can use with monitor-new that keeps the window always 10 (or -c + if specified) icon-widths wide, but adds extra rows of icons as + needed if more than 10/-c new mail items arrive between clearings + of the window, and shrinks the window back to one row/-c widths + when it is cleared. + + - The usage message claims you can use "-bg background_color". + This isn't in the manual page, and it also doesn't work at all + (under X11). The argument appears to be completely ignored + + - The "-b icon_file" option doesn't work. It still comes up with + the default background. + + - The manual entry makes no mention of X-Face: lines. + + - It should be made more explicit in the manual page that in the + previous version of faces, a -f option _added_ the directory to + the face search path, so that if you did -f you got those faces + in addition to the system default faces, whereas now -f + _supersedes_ the system faces and you must include a trailing + colon to have them searched. + + - A comment on the domain lookup algorithm. According to the manual + page: + + $DIR/machine.dom.ain/uid/iconname + $DIR/dom.ain/uid/iconname + $DIR/ain/uid/iconname + $DIR/misc./uid/iconname + $DIR/machine.dom.ain/unknown/iconname + $DIR/dom.ain/unknown/iconname + $DIR/ain/unknown/iconname + $DIR/misc./unknown/iconname + + This leads to a top-level directory with a _lot_ of subdirectories. + I think this is responsible for much of faces' CPU time; it's well + known that large directories are a UNIX performance no-no. What I + would like to see instead (or in addition, or as an option, perhaps + compile-time) is the following. + + $DIR/ain/dom/uid/iconname + $DIR/ain/uid/iconname + $DIR/misc./uid/iconname + $DIR/ain/dom/machine/unknown/iconname + $DIR/ain/dom/unknown/iconname + $DIR/ain/unknown/iconname + $DIR/misc./unknown/iconname + + The idea is that at each level, if the next component exists and is + a directory, you descend into it and look there. + + - The code in mon.c recognises From: lines in the body of the mail. + This is an error. From: lines should only be recognised before + the first blank line. + + - You test if the beginning of the line is identically equal to + "X-Face:" or "From:". This is contrary to RFC822, which specifies + + (1) that headers should be recognised in either case (so "X-Face:" + and "X-FACE:" and "x-FaCe:" are all equivalent). + (2) that there may be linear white space (spaces or tabs) between + the field-name and the colon (so "FRoM : Foo Bar <foo@bar>" + should work). + + - The RFC822 address parsing in parsefrom.c appears, on quick + inspection, to be grossly inadequate. (It certainly doesn't + handle comments in addresses, for one thing.) ------- parsefrom.c ------- *** /tmp/da20270 Thu Oct 11 15:42:40 1990 --- parsefrom.c Wed Oct 10 18:13:47 1990 *************** *** 15,21 **** */ #include <stdio.h> ! #ifdef SYSV32 || hpux #include <string.h> #else #include <strings.h> --- 15,21 ---- */ #include <stdio.h> ! #if SYSV32 || hpux #include <string.h> #else #include <strings.h> ------- compface/Makefile ------- *** /tmp/da20307 Thu Oct 11 15:55:23 1990 --- compface/Makefile Wed Oct 10 18:17:25 1990 *************** *** 32,41 **** HDRS = compface.h data.h OTHERS = README $(NAME).1 $(NAME).3 Makefile CFLAGS = -g $(NAME) : main.o $(LIBNAME) ! cc $(CFLAGS) -o $(NAME) main.o $(LIBNAME) rm -f $(UNNAME) ln $(NAME) $(UNNAME) --- 32,42 ---- HDRS = compface.h data.h OTHERS = README $(NAME).1 $(NAME).3 Makefile + CC = cc CFLAGS = -g $(NAME) : main.o $(LIBNAME) ! $(CC) $(CFLAGS) -o $(NAME) main.o $(LIBNAME) rm -f $(UNNAME) ln $(NAME) $(UNNAME) ------- compface/compress.c ------- *** /tmp/da20313 Thu Oct 11 15:55:24 1990 --- compface/compress.c Thu Oct 11 12:31:30 1990 *************** *** 156,161 **** --- 156,162 ---- { register char *p; + B.b_words = 0; BigRead(fbuf); p = F; while (p < F + PIXELS)