richb@sunchat.oz (Rich Burridge) (03/08/89)
It fixes the following problems: 1/ Bug report and fix from Pat Lashley (sun!cohesive!kla!pat) If the MAIL environment variable is specified, then faces will use the filename specified. This is used for ``home delivery'' of mail. 2/ Bug report from Pat Lashley (sun!cohesive!kla!pat) Both the standard Sun compiler and gcc automatically define 'sun386'. This makes the Makefile variable SUN386i redundant, and the code has been adjusted accordingly. 3/ Bug report and fix from Angus Duggan (angus@lfcs.ed.ac.uk) Icons in default directory are not found if -f option is used. 4/ Bug report and fix from Angus Duggan (angus@lfcs.ed.ac.uk) Directory searching order is wrong if -f option is used. If a user has an 'unknown' icon for a community, it will be found before searching for the user in the default directory. Many thanks for reporting these, and taking the time to fix them as well. [IMPORTANT NOTE: Does anybody have an email address fro Lou Katz, or any other members of the FaceSaver project?] Feed this file to Larry Walls' patch program, then recompile. Rich. ------CUT HERE------CUT HERE------ *** original/Makefile Sun Feb 26 19:20:55 1989 --- Makefile Wed Mar 8 15:01:00 1989 *************** *** 1,7 **** # # Makefile for faces, an icon face server, plus associated software. # ! # @(#)Makefile 1.8 89/02/26 # # Copyright (c) Rich Burridge. # Sun Microsystems, Australia - All rights reserved. --- 1,7 ---- # # Makefile for faces, an icon face server, plus associated software. # ! # @(#)Makefile 1.9 89/03/08 # # Copyright (c) Rich Burridge. # Sun Microsystems, Australia - All rights reserved. *************** *** 83,93 **** # #LDX11FLAGS = -Bstatic # - # If you are using a Sun386i and compiling for the SunView environment, - # then the following definition should be uncommented. - # - #ROADRUNNER = -DSUN386i - # # If you are compiling the MGR version, then the following three # definitions should be uncommented. # --- 83,88 ---- *************** *** 108,114 **** MANSECT = l CFLAGS = -g $(NEWSFILE) $(TTEXT) $(SELTYPE) \ ! $(ROADRUNNER) $(MGRPARAM) $(MGRINCDIR) $(VARIABLES) HDRS = extern.h faces.h patchlevel.h IMAGES = noface.icon nomail.icon noprint.icon \ nopaper.icon nousers.icon --- 103,109 ---- MANSECT = l CFLAGS = -g $(NEWSFILE) $(TTEXT) $(SELTYPE) \ ! $(MGRPARAM) $(MGRINCDIR) $(VARIABLES) HDRS = extern.h faces.h patchlevel.h IMAGES = noface.icon nomail.icon noprint.icon \ nopaper.icon nousers.icon *** original/get.c Wed Feb 22 15:21:12 1989 --- get.c Wed Mar 8 15:00:57 1989 *************** *** 1,6 **** /*LINTLIBRARY*/ #ifndef lint ! static char sccsid[] = "@(#)get.c 1.10 89/02/22" ; #endif /* Extraction routines used by faces. --- 1,6 ---- /*LINTLIBRARY*/ #ifndef lint ! static char sccsid[] = "@(#)get.c 1.11 89/03/08" ; #endif /* Extraction routines used by faces. *************** *** 34,44 **** { FGETS(nextline, MAXLINE, fin) ; ptr = nextline ; ! #ifdef SUN386i for (j = 2; j >= 0; j--) #else for (j = 0; j < 3; j++) ! #endif SUN386i { while (*ptr == ' ' || *ptr == '\t') ptr++ ; SSCANF(ptr,"0x%X",&temp) ; --- 34,44 ---- { FGETS(nextline, MAXLINE, fin) ; ptr = nextline ; ! #ifdef sun386 for (j = 2; j >= 0; j--) #else for (j = 0; j < 3; j++) ! #endif sun386 { while (*ptr == ' ' || *ptr == '\t') ptr++ ; SSCANF(ptr,"0x%X",&temp) ; *************** *** 451,462 **** { c = fscanf(fin, " 0x%X,", &temp) ; if (c == 0 || c == EOF) break ; ! #ifdef SUN386i buf[count++] = (short) ((revtable[temp & 0xFF] << 8) + ((revtable[(temp >> 8) & 0xFF]) & 0xFF)) ; #else buf[count++] = (short) temp ; ! #endif SUN386i } FCLOSE(fin) ; return(0) ; --- 451,462 ---- { c = fscanf(fin, " 0x%X,", &temp) ; if (c == 0 || c == EOF) break ; ! #ifdef sun386 buf[count++] = (short) ((revtable[temp & 0xFF] << 8) + ((revtable[(temp >> 8) & 0xFF]) & 0xFF)) ; #else buf[count++] = (short) temp ; ! #endif sun386 } FCLOSE(fin) ; return(0) ; *** original/main.c Sun Feb 26 19:20:55 1989 --- main.c Wed Mar 8 15:00:58 1989 *************** *** 1,5 **** #ifndef lint ! static char sccsid[] = "@(#)main.c 1.9 89/02/26" ; #endif /* Icon face server for monitoring mail and print jobs. --- 1,5 ---- #ifndef lint ! static char sccsid[] = "@(#)main.c 1.10 89/03/08" ; #endif /* Icon face server for monitoring mail and print jobs. *************** *** 41,46 **** --- 41,47 ---- char community[MAXLINE] ; /* Community name ("real" host name). */ char defdir[MAXLINE] ; /* The default face directory. */ char display[MAXLINE] ; /* X11 display information. */ + char *envmail ; /* Pointer to MAIL environment variable value */ char facedir[MAXLINE] ; /* Alternate face image directory. */ char fname[MAXTYPES][MAXLINE] ; /* Array of various face name types. */ char geometry[MAXLINE] ; /* X11 geometry information. */ *************** *** 223,230 **** #ifdef SPOOLFILE STRCPY(spoolfile,SPOOLFILE) ; /* Alternative spoolfile to monitor. */ #else ! username = getname() ; /* Get users name from passwd entry. */ ! SPRINTF(spoolfile,"/usr/spool/mail/%s",username) ; #endif SPOOLFILE #ifdef DONTSHOWTIME --- 224,235 ---- #ifdef SPOOLFILE STRCPY(spoolfile,SPOOLFILE) ; /* Alternative spoolfile to monitor. */ #else ! if (envmail = getenv("MAIL")) STRCPY(spoolfile, envmail) ; ! else ! { ! username = getname() ; /* Get users name from passwd entry. */ ! SPRINTF(spoolfile,"/usr/spool/mail/%s",username) ; ! } #endif SPOOLFILE #ifdef DONTSHOWTIME *************** *** 285,301 **** char *cptr ; int i ; for (i = 0; i < maxtypes; i++) for (cptr = community; cptr != NULL; cptr = index(cptr, '.')) { if (*cptr == '.') cptr++ ; ! SPRINTF(iconname, "%s/%s/%s/%s", facedir, cptr, user, fname[i]) ; if (stat(iconname, &buf) != -1) return 1 ; } for (i = 0; i < maxtypes; i++) { ! SPRINTF(iconname, "%s/misc./%s/%s", facedir, user, fname[i]) ; if (stat(iconname, &buf) != -1) { STRCPY(community, "misc.") ; --- 290,326 ---- char *cptr ; int i ; + if (strlen(facedir)) + for (i = 0; i < maxtypes; i++) + for (cptr = community; cptr != NULL; cptr = index(cptr, '.')) + { + if (*cptr == '.') cptr++ ; + SPRINTF(iconname, "%s/%s/%s/%s", facedir, cptr, user, fname[i]) ; + if (stat(iconname, &buf) != -1) return 1 ; + } + for (i = 0; i < maxtypes; i++) for (cptr = community; cptr != NULL; cptr = index(cptr, '.')) { if (*cptr == '.') cptr++ ; ! SPRINTF(iconname, "%s/%s/%s/%s", defdir, cptr, user, fname[i]) ; if (stat(iconname, &buf) != -1) return 1 ; } + if (strlen(facedir)) + for (i = 0; i < maxtypes; i++) + { + SPRINTF(iconname, "%s/misc./%s/%s", facedir, user, fname[i]) ; + if (stat(iconname, &buf) != -1) + { + STRCPY(community, "misc.") ; + return 1 ; + } + } + for (i = 0; i < maxtypes; i++) { ! SPRINTF(iconname, "%s/misc./%s/%s", defdir, user, fname[i]) ; if (stat(iconname, &buf) != -1) { STRCPY(community, "misc.") ; *************** *** 303,313 **** } } for (i = 0; i < maxtypes; i++) for (cptr = community; cptr != NULL; cptr = index(cptr, '.')) { if (*cptr == '.') cptr++ ; ! SPRINTF(iconname, "%s/%s/unknown/%s", facedir, cptr, fname[i]) ; if (stat(iconname, &buf) != -1) { if (mtype == MONALL) STRCPY(user, "unknown") ; --- 328,351 ---- } } + if (strlen(facedir)) + for (i = 0; i < maxtypes; i++) + for (cptr = community; cptr != NULL; cptr = index(cptr, '.')) + { + if (*cptr == '.') cptr++ ; + SPRINTF(iconname, "%s/%s/unknown/%s", facedir, cptr, fname[i]) ; + if (stat(iconname, &buf) != -1) + { + if (mtype == MONALL) STRCPY(user, "unknown") ; + return 1 ; + } + } + for (i = 0; i < maxtypes; i++) for (cptr = community; cptr != NULL; cptr = index(cptr, '.')) { if (*cptr == '.') cptr++ ; ! SPRINTF(iconname, "%s/%s/unknown/%s", defdir, cptr, fname[i]) ; if (stat(iconname, &buf) != -1) { if (mtype == MONALL) STRCPY(user, "unknown") ; *************** *** 315,323 **** } } for (i = 0; i < maxtypes; i++) { ! SPRINTF(iconname, "%s/misc./unknown/%s", facedir, fname[i]) ; if (stat(iconname, &buf) != -1) { STRCPY(community, "misc.") ; --- 353,373 ---- } } + if (strlen(facedir)) + for (i = 0; i < maxtypes; i++) + { + SPRINTF(iconname, "%s/misc./unknown/%s", facedir, fname[i]) ; + if (stat(iconname, &buf) != -1) + { + STRCPY(community, "misc.") ; + if (mtype == MONALL) STRCPY(user, "unknown") ; + return 1 ; + } + } + for (i = 0; i < maxtypes; i++) { ! SPRINTF(iconname, "%s/misc./unknown/%s", defdir, fname[i]) ; if (stat(iconname, &buf) != -1) { STRCPY(community, "misc.") ; *** original/mon.c Sun Feb 26 19:20:55 1989 --- mon.c Wed Mar 8 15:00:59 1989 *************** *** 1,6 **** /*LINTLIBRARY*/ #ifndef lint ! static char sccsid[] = "@(#)mon.c 1.10 89/02/26" ; #endif /* Monitoring routines used by the faces program. --- 1,6 ---- /*LINTLIBRARY*/ #ifndef lint ! static char sccsid[] = "@(#)mon.c 1.11 89/03/08" ; #endif /* Monitoring routines used by the faces program. *************** *** 129,139 **** h_to_c(host, community) ; /* Turn hostname into community name. */ a_to_u(community, user, realname) ; ! if (strlen(facedir)) ! found = make_iconname(facedir, community, realname) ; ! else found = make_iconname(defdir, community, realname) ; ! if (!found && strlen(facedir)) ! found = make_iconname(defdir, community, realname) ; if (mtype == MONNEW) { add_face(BOTH, ORDINARY, iconname) ; --- 129,135 ---- h_to_c(host, community) ; /* Turn hostname into community name. */ a_to_u(community, user, realname) ; ! found = make_iconname(facedir, community, realname) ; if (mtype == MONNEW) { add_face(BOTH, ORDINARY, iconname) ; *************** *** 194,204 **** SSCANF(&nextline[7], "%s", owner) ; SSCANF(&nextline[60], "%d", &size) ; h_to_c("", community) ; ! if (strlen(facedir)) ! found = make_iconname(facedir, community, owner) ; ! else found = make_iconname(defdir, community, owner) ; ! if (!found && strlen(facedir)) ! found = make_iconname(defdir, community, owner) ; add_record("",owner,"",size) ; } make_pixrect(noicons) ; --- 190,196 ---- SSCANF(&nextline[7], "%s", owner) ; SSCANF(&nextline[60], "%d", &size) ; h_to_c("", community) ; ! found = make_iconname(facedir, community, owner) ; add_record("",owner,"",size) ; } make_pixrect(noicons) ; *************** *** 280,290 **** { h_to_c(host, community) ; /* Turn hostname into community name. */ a_to_u(community, user, realname) ; ! if (strlen(facedir)) ! found = make_iconname(facedir, community, realname) ; ! else found = make_iconname(defdir, community, realname) ; ! if (!found && strlen(facedir)) ! found = make_iconname(defdir, community, realname) ; } if (EQUAL(user, "NOMAIL")) ftype = NOMAIL ; else if (EQUAL(user, "NOPAPER")) ftype = NOPAPER ; --- 272,278 ---- { h_to_c(host, community) ; /* Turn hostname into community name. */ a_to_u(community, user, realname) ; ! found = make_iconname(facedir, community, realname) ; } if (EQUAL(user, "NOMAIL")) ftype = NOMAIL ; else if (EQUAL(user, "NOPAPER")) ftype = NOPAPER ; *************** *** 324,334 **** SSCANF(&nextline[0], "%s", username) ; SSCANF(&nextline[38], "%s", ts) ; h_to_c("", community) ; ! if (strlen(facedir)) ! found = make_iconname(facedir, community, username) ; ! else found = make_iconname(defdir, community, username) ; ! if (!found && strlen(facedir)) ! found = make_iconname(defdir, community, username) ; add_record("", username, ts, 0) ; } if (!noicons) --- 312,318 ---- SSCANF(&nextline[0], "%s", username) ; SSCANF(&nextline[38], "%s", ts) ; h_to_c("", community) ; ! found = make_iconname(facedir, community, username) ; add_record("", username, ts, 0) ; } if (!noicons) *** original/patchlevel.h Sun Feb 26 19:20:55 1989 --- patchlevel.h Wed Mar 8 15:01:00 1989 *************** *** 1,5 **** ! /* @(#)patchlevel.h 1.12 89/02/26 * * This is the current patch level for this version of faces. * --- 1,5 ---- ! /* @(#)patchlevel.h 1.13 89/03/08 * * This is the current patch level for this version of faces. * *************** *** 14,17 **** * reported to me then an attempt will be made to fix them. */ ! #define PATCHLEVEL 11 --- 14,17 ---- * reported to me then an attempt will be made to fix them. */ ! #define PATCHLEVEL 12