From owner-ports-jp@jp.FreeBSD.org Mon May 31 22:13:44 2004
Received: (from daemon@localhost)
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) id i4VDDi899580;
	Mon, 31 May 2004 22:13:44 +0900 (JST)
	(envelope-from owner-ports-jp@jp.FreeBSD.org)
Received: from athena.ginganet.org (postfix@tk0008-202x210x243x26.ap-TK.usen.ad.jp [202.210.243.26])
	by castle.jp.FreeBSD.org (8.11.6p2+3.4W/8.11.3) with ESMTP/inet id i4VDDh999573
	for <ports-jp@jp.FreeBSD.org>; Mon, 31 May 2004 22:13:43 +0900 (JST)
	(envelope-from ginga@ginganet.org)
Received: by athena.ginganet.org (Postfix, from userid 5003)
	id 37BBDCF86; Mon, 31 May 2004 22:13:40 +0900 (JST)
From: Kawaguti Ginga <ginga-freebsd@ginganet.org>
To: ports-jp@jp.FreeBSD.org
Message-ID: <20040531131340.GG592%ginga-freebsd@ginganet.org>
References: <040531042125.M0172593@pelsia.ensure-tech.co.jp> <86ekp1c6rw.wl@vega.sitc.toshiba.co.jp> <20040530130758.GE592%ginga-freebsd@ginganet.org> <040531042125.M0172593@pelsia.ensure-tech.co.jp>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="ikeVEW9yuYc//A+q"
Content-Disposition: inline
In-Reply-To: <86ekp1c6rw.wl@vega.sitc.toshiba.co.jp> <040531042125.M0172593@pelsia.ensure-tech.co.jp>
User-Agent: Mutt/1.5.4i-ja.1
Reply-To: dirthumb.patch@ginganet.org
Precedence: list
Date: Mon, 31 May 2004 22:13:40 +0900
X-Sequence: ports-jp 14747
Subject: [ports-jp 14747] Re: additional modified patch for xv
Sender: owner-ports-jp@jp.FreeBSD.org
X-Originator: ginga-freebsd@ginganet.org
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+040515


--ikeVEW9yuYc//A+q
Content-Type: text/plain; charset=iso-2022-jp
Content-Disposition: inline

$B@n8}$G$9(B

In Mon, May 31, 2004 at 04:21:25AM +0900,
Norikatsu Shigemura <nork@cityfujisawa.ne.jp> wrote:
> 	shige $B$5$s(B, mita $B$5$sN>L>$N(B ports $B$K$D$$$F$O(B, $B$*FsJ}$+$iD>@\(B
> 	blanket apporval $BD:$$$F$$$k$N$G(B, $B<+J,$G(B ok $B$H;W$C$?$i(B ports-jp
> 	$B$"$?$j$KN.$7$FD:$1$l$P(B commit $B$7$^$9!#0l!9N>L>$K8@$o$J$/$F$b(B
> 	ok $B$G$9(B(^^;$B!#(B

$BN;2rCW$7$^$7$?!%(B

> 	$B5,LO$K1~$8$^$9$,(B, $BBg$-$$$J$iJLESG[I[(B, $B>.$5$$$J$i(B files/patch-*
> 	$B$GF~$l$F$7$^$&$N$,$$$$$+$H;W$$$^$9!#(B

$BBg$-$5$O!$(B15kB $BDxEY$G$9!%(B

$B%*%j%8%J%k(B(dirthumb.patch)$B$H!$8=9T(B ports $B$N3F<o%Q%C%AE,MQ8e$KEv$F$k$?$a$K(B
$B$A$g$C$H=$@5$7$?HG$NN>J}$rE:IU$7$^$9!%(B
($BG[I[85$,!$$A$g$&$I?t=54VA0(B(?)$B0L$K>C<:$7$F$7$^$C$?$h$&$J$N$G(B...)

$B8e<T$O(B post-patch $BMs$N:G8e$KF~$l$l$P$h$$$H$3$m$^$G$O3NG'CW$7$^$7$?!%(B
--- /usr/ports/graphics/xv/Makefile	Sat Nov 22 09:59:26 2003
+++ Makefile	Mon May 31 22:06:48 2004
@@ -58,6 +58,7 @@
 	${PATCH} ${PATCH_ARGS} -p1 < ${XVDIST}/xv-png-1.2d.patch
 	${PATCH} ${PATCH_ARGS} -p0 < ${XVDIST}/xvpng-1.2d-fix3.patch
 	${PATCH} ${PATCH_ARGS} -p1 < ${XVDIST}/jp-ext-bzip2-1.1.patch
+	${PATCH} ${PATCH_ARGS} -p0 < ${XVDIST}/dirthumb-xvbrowse.patch
 	@${MV} ${WRKSRC}/config.h ${WRKSRC}/config.h.in
 	@${CAT} ${WRKSRC}/config.h.in | \
 		${SED} -e "s@%%LOCALBASE%%@${LOCALBASE}@" > ${WRKSRC}/config.h

($B$J$K$,5/$-$k$+$O!$(Bmake $B$7$F(B visual shunauser $B$G(B
 cd [$B2hA|(B directory]/.. $B$7$F(B ^u (update) $B$7$F(B
 $B$b$i$($l$PJ,$+$j$^$9(B :-)

# $BK\Ev$O!$7'C+$5$s:n$N%Q%C%A$K$O$b$&0l$D$"$C$F(B($B$H$$$&$+!$$3$C$A$,K\L?(B?)
# "XV Algorithm Extension"(algext.patch) $B$H$$$&$N$,$"$k$N$G$9$,!$;d<+?H$O(B
# $B$<$s$<$s;H$C$F$$$J$$$N$G!$<{MW$N$[$I$ONI$/J,$+$j$^$;$s!%(B

In Mon, May 31, 2004 at 05:58:27PM +0900,
Shigeyuki Fukushima <shige@freebsd.org> wrote:
> $B8=:_!"(Bgraphics/xv $B$O%Q%C%A%a%s%F%J$H2=$7$F$$$^$9$,!"(B
> $B$$$m$$$m$JMW5a$N%Q%C%A$,B?$$$N$G!"$3$l$i$,8_$$$N%Q%C%A$K(B
> $B1F6A$r<u$1$F(B reject $B$5$l$k$3$H$,B?$$$N$G!"(BOS Depend $B$J(B
> $B=$@5ItJ,0J30$O!"$3$l$i$r$^$H$a$F$7$^$$$?$$$H;W$C$F$$$^$9!#(B

jp-extensions $B$J$i$L!$(BFreeBSD-extensions patch kit$B!$$H$$$&$3$H$G$9$M!%(B
-- 
       $B"J"J(B
Zzz.. (- - )$B"^"^"=!A(B           $B@n8}(B $B6d2O(B
      ##############   ginga-freebsd@ginganet.org

--ikeVEW9yuYc//A+q
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="dirthumb.patch"

--- xv-3.10a_jp_org/xvbrowse.c	Mon Sep  1 18:51:23 1997
+++ xv-3.10a_jp_work/xvbrowse.c	Fri Mar 20 14:21:31 1998
@@ -17,6 +17,28 @@
 
 #include "copyright.h"
 
+/* If you enable DIRTHUMB, the visual schnauzer will search a image in
+ * some directories to make thumb nail file of them. If AUTO_EXPAND,
+ * i.e. virtual directory, is enabled, it also searches in the
+ * archive file.
+ *                         these functions are added by Masaaki Kumagai
+ *                          kumagai@emura.mech.tohoku.ac.jp
+ */
+#define DIRTHUMB
+/* If you enable DIRTHUMB_NOPARENT, the DIRTHUMB function won't apply
+ * for parent directory */
+#define DIRTHUMB_NOPARENT
+/* If you enable DIRTHUMB_DUMMY_ICON, the xv create and uses dummy
+ * bitmap file temporarily for speed up of next 'update' */ 
+#define DIRTHUMB_DUMMY_ICON
+
+/* If (dirthumb_check_directory), xv searches diretory to obtain thumb-nail,
+ * otherwise it uses already-updated-icons but do not create new one 
+ */
+#ifdef DIRTHUMB
+int dirthumb_check_directory=1;
+#endif
+
 #define NEEDSDIR
 #include "xv.h"
 
@@ -1550,17 +1572,32 @@
   ix = x + ISPACE_WIDE/2 - bf->w/2;          /* center align */
   iy = y + ISPACE_TOP + ISIZE_HIGH - bf->h;  /* bottom align */
 
-
+#ifdef DIRTHUMB
+  if (((bf->ftype >= 0 && bf->ftype <BF_MAX)&&(bf->ftype!=BF_DIR))||
+      ((bf->ftype==BF_DIR)&&(bf->ximage==NULL))){  /* built-in icon */
+#else
   if (bf->ftype >= 0 && bf->ftype <BF_MAX) {  /* built-in icon */
+#endif
     XCopyPlane(theDisp, bfIcons[bf->ftype], br->iconW, theGC,
 	       0, 0, (u_int) bf->w, (u_int) bf->h, ix, iy, 1L);
   }
-
   else if (bf->ftype == BF_HAVEIMG && bf->ximage) {
     XPutImage(theDisp, br->iconW, theGC, bf->ximage, 0,0, ix,iy, 
 	      (u_int) bf->w, (u_int) bf->h);
   }
-
+#ifdef DIRTHUMB
+  else if((bf->ftype == BF_DIR)&&(bf->ximage!=NULL))
+    {
+	XCopyPlane(theDisp, bfIcons[BF_DIR], br->iconW, theGC,
+		   0, 0, (u_int) br_dir_width, (u_int) br_dir_height, 
+		   x + ISPACE_WIDE/2-br_dir_width/2, 
+		   y + ISPACE_TOP + ISIZE_HIGH-br_dir_height, 1L);
+	XPutImage(theDisp, br->iconW, theGC, bf->ximage, 0,0, 
+		   x + ISPACE_WIDE/2- bf->w/2 -1, 
+		   y + ISPACE_TOP + ISIZE_HIGH-bf->h/2-16,
+		  (u_int) bf->w, (u_int) bf->h);
+    }
+#endif
   else {  /* shouldn't happen */
     XDrawRectangle(theDisp, br->iconW, theGC, ix, iy, 
 		   (u_int) bf->w, (u_int) bf->h);
@@ -2355,13 +2392,21 @@
       x = (i%br->numWide) * ISPACE_WIDE;  /* x,y=top-left of icon region */
       y = (i/br->numWide) * ISPACE_HIGH;
 
+#ifdef DIRTHUMB
+      if(bf->ftype==BF_DIR)
+	{
+	    ix = x + ISPACE_WIDE/2 - br_dir_width/2;         /* center align */
+	    iy = y + ISPACE_TOP + ISIZE_HIGH - br_dir_height;/* bottom align */
+
+	    if (PTINRECT(mx,my, ix, iy, 48, 48)) break;
+	}
+#endif
       ix = x + ISPACE_WIDE/2 - bf->w/2;          /* center align */
       iy = y + ISPACE_TOP + ISIZE_HIGH - bf->h;  /* bottom align */
 
       if (PTINRECT(mx,my, ix, iy, bf->w, bf->h)) break;
     }
   }
-
   if (i==num) return -1;
   return sel;
 }
@@ -3581,6 +3626,111 @@
   SetCursors(-1);
 }
 
+#ifdef DIRTHUMB
+/***************************************************************/
+static char _dirimagefile[512];
+static char *searchGFile(dir)
+    char *dir;
+{
+    char wd[512];
+    char **dirs;
+    char *select=NULL,*select_COMPRESS=NULL;
+    int dirsize,i,ftype;
+    struct stat st;
+
+#ifdef DIRTHUMB_NOPARENT
+    if(strcmp(dir,"..")==0)
+      return NULL;
+#endif
+
+    xv_getwd(wd,512);
+#ifdef AUTO_EXPAND
+    Chvdir(dir);
+#else
+    chdir(dir);
+#endif
+    xv_getwd(_dirimagefile,512);
+    /* obtain all files in the directory */
+    dirs=getDirEntries(".",&dirsize,1);
+    /* first, I'd like to use uncompressed files */
+    for(i=0;i<dirsize;i++)
+      {
+	  if(strcmp(dirs[i],".")==0)
+	    continue;
+	  if(strcmp(dirs[i],"..")==0)
+	    continue;
+	  /* we should search a simple file */
+	  if(stat(dirs[i], &st))
+	    continue;
+#ifdef AUTO_EXPAND 
+	  ftype=stat2bf((u_int) st.st_mode , dirs[i]);
+#else
+	  ftype=stat2bf((u_int) st.st_mode);
+#endif
+	  if(ftype!=BF_FILE) continue;
+
+	  ftype=ReadFileType(dirs[i]);
+	  if((ftype==RFT_ERROR)||
+	     (ftype==RFT_UNKNOWN))
+	    continue;
+	  if(ftype==RFT_COMPRESS)
+	    {
+		if(select_COMPRESS==NULL)
+		  select_COMPRESS=dirs[i];
+		else if(strcmp(dirs[i],select_COMPRESS)<0)
+		  select_COMPRESS=dirs[i];
+	    }
+	  else
+	    {
+		if(select==NULL)
+		  select=dirs[i];
+		else if(strcmp(dirs[i],select)<0)
+		  select=dirs[i];
+	    }
+      }
+    if(select==NULL) select=select_COMPRESS;
+
+    xv_getwd(_dirimagefile,512);
+#ifdef AUTO_EXPAND
+    Dirtovd(_dirimagefile);
+    Chvdir(wd);
+#else
+    chdir(wd);
+#endif
+    if(select!=NULL)
+      { strcat(_dirimagefile,"/"); strcat(_dirimagefile,select);}
+    for(i=0;i<dirsize;i++) {if(dirs[i]) free(dirs[i]); }
+    if(dirs) free(dirs);
+    if(select!=NULL) return _dirimagefile;
+    /* do you want to dummy? */
+#ifndef DIRTHUMB_DUMMY_ICON
+    return NULL;  /* do nothing */
+#else
+    {
+	FILE *fp;
+	sprintf(_dirimagefile,"%s/__xvdummy",tmpdir);
+	fp=fopen(_dirimagefile,"r");
+	if(fp!=NULL)
+	  {
+	      fclose(fp);
+	      return _dirimagefile;
+	  }
+	fp=fopen(_dirimagefile,"w");
+	if(fp==NULL)
+	  return NULL;
+	fprintf(fp,"#define tmp_width 2\n");
+	fprintf(fp,"#define tmp_height 2\n");
+	fprintf(fp,"static unsigned char tmp_bits[] = {\n");
+	fprintf(fp,"   0xc0, 0xc0};");
+	fclose(fp);
+	chmod(_dirimagefile,0777);
+	return _dirimagefile;
+    }
+#endif
+    
+}
+
+#endif
 
 /***************************************************************/
 static void genIcon(br, bf)
@@ -3601,7 +3751,9 @@
   byte   *icon24, *icon8;
   char    str[256], str1[256], readname[128], uncompname[128];
   char    basefname[128], *uncName;
-  
+  char    *bfname;
+  int     bfftype;
+
   
   if (!bf || !bf->name || bf->name[0] == '\0') return;   /* shouldn't happen */
   str[0] = '\0';
@@ -3619,21 +3771,61 @@
   bf->pimage  = (byte *)   NULL;
   bf->ximage  = (XImage *) NULL;
 
+  bfname=bf->name;
+#ifdef DIRTHUMB
+  bfftype=bf->ftype;
+  if((bf->ftype==BF_DIR)&&(dirthumb_check_directory))
+    {
+	bfname=searchGFile(bf->name);
+	if(bfname==NULL) 
+	  {
+#ifdef AUTO_EXPAND      /* remove if directory is VD */ 
+	      if(strcmp(bf->name,".."))
+		{
+		    char bfrm1[512],bfrm2[512];
+		    xv_getwd(bfrm1,512);
+		    strcat(bfrm1,"/"); strcat(bfrm1,bf->name);
+		    strcpy(bfrm2,bfrm1);
+		    Dirtovd(bfrm2);
+		    if(strcmp(bfrm1,bfrm2)!=0)
+		      { Rmvdir(bfrm1); }
+		}
+	      else
+		{
+		    bf->w=br_dir_width; 
+		    bf->h=br_dir_height; /* reset size of parent icon */
+		}
+	      return;
+#endif
+	  }
+
+/*	printf("directory image: %s\n",bfname);*/
+	strcpy(readname, bfname);
+    }
 
   /* skip all 'special' files */
+  if((bf->ftype!=BF_DIR)&&(!ISLOADABLE(bf->ftype))) return;
+  if((bf->ftype==BF_DIR)&&(!dirthumb_check_directory)) 
+    {
+	bf->w=br_dir_width;
+	bf->h=br_dir_height;
+	return;
+    }
+#else
+  /* skip all 'special' files */
   if (!ISLOADABLE(bf->ftype)) return;
+#endif
   
-  filetype = ReadFileType(bf->name);
-  
+  filetype = ReadFileType(bfname);
   if (filetype == RFT_COMPRESS) {
 #if (defined(VMS) && !defined(GUNZIP))
     /* VMS decompress doesn't like the file to have a trailing .Z in fname
        however, GUnZip is OK with it, which we are calling UnCompress */
-    strcpy (basefname, bf->name);
+    strcpy (basefname, bfname);
     *rindex (basefname, '.') = '\0';
     uncName = basefname;
 #else
-    uncName = bf->name;
+    uncName = bfname;
 #endif
     
     if (UncompressFile(uncName, uncompname)) {
@@ -3641,7 +3833,7 @@
       strcpy(readname, uncompname);
     }
     else {
-      sprintf(str, "Couldn't uncompress file '%s'", bf->name);
+      sprintf(str, "Couldn't uncompress file '%s'", bfname);
       setBrowStr(br, str);
       bf->ftype = BF_ERROR;
     }
@@ -3650,11 +3842,11 @@
 #ifdef MACBINARY
   if (handlemacb && macb_file == True && bf->ftype != BF_ERROR) {
     if (RemoveMacbinary(readname, uncompname)) {
-      if (strcmp(readname, bf->name)!=0) unlink(readname);
+      if (strcmp(readname, bfname)!=0) unlink(readname);
       strcpy(readname, uncompname);
     }
     else {
-      sprintf(str, "Unable to remove a InfoFile header form '%s'.", bf->name);
+      sprintf(str, "Unable to remove a InfoFile header form '%s'.", bfname);
       setBrowStr(br, str);
       bf->ftype = BF_ERROR;
     }
@@ -3667,7 +3859,7 @@
       char tmpname[128];
       char *icom;
 
-      if((icom = mgcsfx_auto_input_com(bf->name)) != NULL){
+      if((icom = mgcsfx_auto_input_com(bfname)) != NULL){
 	sprintf(tmpname, "%s/xvmsautoXXXXXX", tmpdir);
 	mktemp(tmpname);
 	SetISTR(ISTR_INFO, "Converting to known format by MgcSfx auto...");
@@ -3679,12 +3871,12 @@
 #else
       if (!system(str)) {
 #endif
-        sprintf(str, "Unable to convert '%s' by MgcSfx auto.", bf->name);
+        sprintf(str, "Unable to convert '%s' by MgcSfx auto.", bfname);
         setBrowStr(br, str);
         bf->ftype = BF_ERROR;
       } else {
         filetype = ReadFileType(tmpname);
-        if (strcmp(readname, bf->name)!=0) unlink(readname);
+        if (strcmp(readname, bfname)!=0) unlink(readname);
         strcpy(readname, tmpname);
       }
     }
@@ -3696,7 +3888,7 @@
   if (pinfo.comment) free(pinfo.comment);  pinfo.comment = (char *) NULL;
   
   if (filetype == RFT_ERROR) { 
-    sprintf(str,"Couldn't open file '%s'", bf->name);
+    sprintf(str,"Couldn't open file '%s'", bfname);
     setBrowStr(br, str);
     bf->ftype = BF_ERROR;
   }
@@ -3731,10 +3923,28 @@
   }
   
   /* if we made an uncompressed file, we can rm it now */
-  if (strcmp(readname, bf->name)!=0) unlink(readname);
+  if (strcmp(readname, bfname)!=0) unlink(readname);
   
   
   /* at this point either BF_ERROR, BF_UNKNOWN, BF_EXE or pic */
+#ifdef DIRTHUMB
+    if((bfftype==BF_DIR)&&
+       ((bf->ftype==BF_ERROR)||(bf->ftype==BF_UNKNOWN)||(bf->ftype==BF_EXE)||
+	(!pinfo.pic)))
+      {
+	  char bfrm[512];
+	  bf->ftype=BF_DIR;
+#ifdef AUTO_EXPAND
+	  if(strrchr(bfname,'/')!=NULL)     /* remove if directory is VD */ 
+	    *(strrchr(bfname,'/'))='\0';
+	  strcpy(bfrm,bfname);
+	  Vdtodir(bfrm);
+	  if(strcmp(bfrm,bfname)!=0)
+	    { Rmvdir(bfrm);}
+	  return;
+#endif 
+      }
+#endif
   
   if (!pinfo.pic) {
     if (bf->ftype == BF_EXE) return;  /* don't write thumbfiles for exe's */
@@ -3758,6 +3968,20 @@
 #endif /* VS_ADJUST */
   hexpand = (double) pinfo.h / (double) ISIZE_HIGH;
 
+#ifdef DIRTHUMB  /* Create Picture that can be included in bits/br_dir */
+    if(bfftype==BF_DIR)
+      {
+#ifdef VS_ADJUST
+	  if (!vsadjust) normaspect = 1;
+
+	  wexpand = (double) (pinfo.w * normaspect) / 45.0;
+#else
+	  wexpand = (double) pinfo.w / (double) 45.0;
+#endif /* VS_ADJUST */
+	  hexpand = (double) pinfo.h / (double) 29.0;
+      }
+#endif
+
   if (wexpand >= 1.0 || hexpand >= 1.0) {   /* don't expand small icons */
     if (wexpand>hexpand) {
 #ifdef VS_ADJUST
@@ -3842,7 +4066,7 @@
      long  filesize;
      char  buf[64];
      
-     fp = fopen(bf->name, "r");
+     fp = fopen(bfname, "r");
      if (fp) {
        fseek(fp, 0L, 2);
        filesize = ftell(fp);
@@ -3875,7 +4099,21 @@
   bf->w       = iwide;
   bf->h       = ihigh;
   bf->ftype   = BF_HAVEIMG;
-  
+#ifdef DIRTHUMB
+    if(bfftype==BF_DIR)
+      {
+	  char bfrm[512];
+	  bf->ftype=BF_DIR;
+#ifdef AUTO_EXPAND
+	  if(strrchr(bfname,'/')!=NULL)     /* remove if directory is VD */ 
+	    *(strrchr(bfname,'/'))='\0';
+	  strcpy(bfrm,bfname);
+	  Vdtodir(bfrm);
+	  if(strcmp(bfrm,bfname)!=0)
+	    { Rmvdir(bfrm); }
+#endif 
+      }
+#endif
   bf->ximage = Pic8ToXImage(icon8, (u_int) iwide, (u_int) ihigh, browcols,
 			    browR, browG, browB);
   
@@ -3934,6 +4172,11 @@
 
   info = NULL;  icon8 = NULL;  builtin = 0;
 
+#ifdef DIRTHUMB
+  if(bf->ftype==BF_DIR)
+    sprintf(thFname, "%s%s/%s__DIR", br->path, THUMBDIR, bf->name);
+  else
+#endif
   sprintf(thFname, "%s%s/%s", br->path, THUMBDIR, bf->name);
 
 #ifdef AUTO_EXPAND
@@ -4015,6 +4258,16 @@
   else {
     if (info) free(info);
   }
+#ifdef DIRTHUMB
+  {
+      struct stat st;
+      int f=0;
+      sprintf(thFname, "%s%s", br->path, bf->name);
+      if((stat(thFname, &st)==0)&&
+	 ((f=stat2bf((u_int) st.st_mode , thFname)) == BF_DIR))
+	{ /*printf("faked dir %s\n",thFname);*/ bf->ftype=BF_DIR;}
+  }
+#endif
   
   fclose(fp);
   return;
@@ -4051,14 +4304,18 @@
   if (!i) perm = st.st_mode & 07777;
      else perm = 0755;
 
-
-
+#ifdef DIRTHUMB
+  if(bf->ftype==BF_DIR)
+    sprintf(thFname, "%s%s/%s__DIR", br->path, THUMBDIR, bf->name);
+  else
+#endif
   sprintf(thFname, "%s%s/%s", br->path, THUMBDIR, bf->name);
 
 #ifdef AUTO_EXPAND
   Dirtovd(thFname);
 #endif
 
+/*  printf("%s\n",thFname);*/
   fp = fopen(thFname, "w");
   if (!fp) {
     sprintf(buf, "Can't create thumbnail file '%s':  %s", thFname, 
@@ -4096,6 +4353,7 @@
   }
 
   if (ferror(fp)) {  /* error occurred */
+      printf("error\n");
     fclose(fp);
     unlink(thFname);  /* delete it */
     sprintf(buf, "Can't write thumbnail file '%s':  %s", thFname,
@@ -4186,8 +4444,12 @@
   WaitCursor();
 
   for (i=0, bf=br->bfList; i<br->bfLen; i++, bf++) {
+#ifdef DIRTHUMB
+    if (bf->ftype <= BF_FILE || bf->ftype >= BF_ERROR || bf->ftype==BF_EXE ||
+	bf->ftype==BF_DIR) {
+#else
     if (bf->ftype <= BF_FILE || bf->ftype >= BF_ERROR || bf->ftype==BF_EXE) {
-
+#endif
       /* ie, not a 'special' file */
 
       int  s1, s2;
@@ -4199,6 +4461,11 @@
       s1 = stat(bf->name, &filest);
 
       /* see if this file has an associated thumbnail file */
+#ifdef DIRTHUMB
+      if(bf->ftype==BF_DIR)
+	sprintf(thfname, "%s%s/%s__DIR", br->path, THUMBDIR, bf->name);
+      else
+#endif
       sprintf(thfname, "%s/%s", THUMBDIR, bf->name);
       s2 = stat(thfname, &thumbst);
 
@@ -4235,6 +4502,13 @@
 
   clearTemp(br);
 
+#if defined(DIRTHUMB) && defined(DIRTHUMB_DUMMY_ICON)
+  {
+      char tmp[256];
+      sprintf(tmp,"%s/__xvdummy",tmpdir);
+      unlink(tmp);
+  }
+#endif
 
 
   /* search the THUMBDIR directory, looking for thumbfiles that don't have
@@ -4247,10 +4521,30 @@
   if (dirp) {
     while ( (dp = readdir(dirp)) != NULL) {
       char thfname[256];
+      char *d_name;
+#ifdef DIRTHUMB
+      char d_name_file[256];
+#endif
       struct stat filest, thumbst;
 
       /* stat this directory entry to make sure it's a plain file */
       sprintf(thfname, "%s/%s", THUMBDIR, dp->d_name);
+      d_name=dp->d_name;
+#ifdef DIRTHUMB
+#ifdef DIRTHUMB_NOPARENT
+      if(strcmp(d_name,"..__DIR")==0)  /* remove if not need parent icon */
+	d_name="..parent_remove"; /* set original filename to non-exist */
+      else
+#endif
+      if((strstr(d_name,"__DIR")!=NULL)&&
+	 (*(strstr(d_name,"__DIR")+5)=='\0'))
+	{
+	    strcpy(d_name_file,d_name);
+	    *(strstr(d_name_file,"__DIR"))='\0'; /* cut option */
+	    d_name=d_name_file;
+	}
+#endif
+
       if (stat(thfname, &thumbst)==0) {  /* success */
 	int tmp;
 #ifdef AUTO_EXPAND
@@ -4261,7 +4555,7 @@
 
 	if (tmp == BF_FILE) {  /* a plain file */
 	  /* see if this thumbfile has an associated pic file */
-	  if (stat(dp->d_name, &filest)) {  /* failed!: guess it doesn't */
+	  if (stat(d_name, &filest)) {  /* failed!: guess it doesn't */
 	    if (unlink(thfname)==0) iconsKilled++;
 	  }
 	}

--ikeVEW9yuYc//A+q
Content-Type: text/plain; charset=us-ascii
Content-Description: dirthumb-xvbrowse.patch
Content-Disposition: attachment; filename="dirthumb-freebsdportspatch.diff"

--- xvbrowse.c.orig	Mon May 31 21:39:05 2004
+++ xvbrowse.c	Mon May 31 21:47:52 2004
@@ -17,6 +17,28 @@
 
 #include "copyright.h"
 
+/* If you enable DIRTHUMB, the visual schnauzer will search a image in
+ * some directories to make thumb nail file of them. If AUTO_EXPAND,
+ * i.e. virtual directory, is enabled, it also searches in the
+ * archive file.
+ *                         these functions are added by Masaaki Kumagai
+ *                          kumagai@emura.mech.tohoku.ac.jp
+ */
+#define DIRTHUMB
+/* If you enable DIRTHUMB_NOPARENT, the DIRTHUMB function won't apply
+ * for parent directory */
+#define DIRTHUMB_NOPARENT
+/* If you enable DIRTHUMB_DUMMY_ICON, the xv create and uses dummy
+ * bitmap file temporarily for speed up of next 'update' */ 
+#define DIRTHUMB_DUMMY_ICON
+
+/* If (dirthumb_check_directory), xv searches diretory to obtain thumb-nail,
+ * otherwise it uses already-updated-icons but do not create new one 
+ */
+#ifdef DIRTHUMB
+int dirthumb_check_directory=1;
+#endif
+
 #define NEEDSDIR
 #include "xv.h"
 
@@ -1558,17 +1580,32 @@
   ix = x + ISPACE_WIDE/2 - bf->w/2;          /* center align */
   iy = y + ISPACE_TOP + ISIZE_HIGH - bf->h;  /* bottom align */
 
-
+#ifdef DIRTHUMB
+  if (((bf->ftype >= 0 && bf->ftype <BF_MAX)&&(bf->ftype!=BF_DIR))||
+      ((bf->ftype==BF_DIR)&&(bf->ximage==NULL))){  /* built-in icon */
+#else
   if (bf->ftype >= 0 && bf->ftype <BF_MAX) {  /* built-in icon */
+#endif
     XCopyPlane(theDisp, bfIcons[bf->ftype], br->iconW, theGC,
 	       0, 0, (u_int) bf->w, (u_int) bf->h, ix, iy, 1L);
   }
-
   else if (bf->ftype == BF_HAVEIMG && bf->ximage) {
     XPutImage(theDisp, br->iconW, theGC, bf->ximage, 0,0, ix,iy, 
 	      (u_int) bf->w, (u_int) bf->h);
   }
-
+#ifdef DIRTHUMB
+  else if((bf->ftype == BF_DIR)&&(bf->ximage!=NULL))
+    {
+	XCopyPlane(theDisp, bfIcons[BF_DIR], br->iconW, theGC,
+		   0, 0, (u_int) br_dir_width, (u_int) br_dir_height, 
+		   x + ISPACE_WIDE/2-br_dir_width/2, 
+		   y + ISPACE_TOP + ISIZE_HIGH-br_dir_height, 1L);
+	XPutImage(theDisp, br->iconW, theGC, bf->ximage, 0,0, 
+		   x + ISPACE_WIDE/2- bf->w/2 -1, 
+		   y + ISPACE_TOP + ISIZE_HIGH-bf->h/2-16,
+		  (u_int) bf->w, (u_int) bf->h);
+    }
+#endif
   else {  /* shouldn't happen */
     XDrawRectangle(theDisp, br->iconW, theGC, ix, iy, 
 		   (u_int) bf->w, (u_int) bf->h);
@@ -2364,13 +2401,21 @@
       x = (i%br->numWide) * ISPACE_WIDE;  /* x,y=top-left of icon region */
       y = (i/br->numWide) * ISPACE_HIGH;
 
+#ifdef DIRTHUMB
+      if(bf->ftype==BF_DIR)
+	{
+	    ix = x + ISPACE_WIDE/2 - br_dir_width/2;         /* center align */
+	    iy = y + ISPACE_TOP + ISIZE_HIGH - br_dir_height;/* bottom align */
+
+	    if (PTINRECT(mx,my, ix, iy, 48, 48)) break;
+	}
+#endif
       ix = x + ISPACE_WIDE/2 - bf->w/2;          /* center align */
       iy = y + ISPACE_TOP + ISIZE_HIGH - bf->h;  /* bottom align */
 
       if (PTINRECT(mx,my, ix, iy, bf->w, bf->h)) break;
     }
   }
-
   if (i==num) return -1;
   return sel;
 }
@@ -3592,6 +3637,111 @@
   SetCursors(-1);
 }
 
+#ifdef DIRTHUMB
+/***************************************************************/
+static char _dirimagefile[512];
+static char *searchGFile(dir)
+    char *dir;
+{
+    char wd[512];
+    char **dirs;
+    char *select=NULL,*select_COMPRESS=NULL;
+    int dirsize,i,ftype;
+    struct stat st;
+
+#ifdef DIRTHUMB_NOPARENT
+    if(strcmp(dir,"..")==0)
+      return NULL;
+#endif
+
+    xv_getwd(wd,512);
+#ifdef AUTO_EXPAND
+    Chvdir(dir);
+#else
+    chdir(dir);
+#endif
+    xv_getwd(_dirimagefile,512);
+    /* obtain all files in the directory */
+    dirs=getDirEntries(".",&dirsize,1);
+    /* first, I'd like to use uncompressed files */
+    for(i=0;i<dirsize;i++)
+      {
+	  if(strcmp(dirs[i],".")==0)
+	    continue;
+	  if(strcmp(dirs[i],"..")==0)
+	    continue;
+	  /* we should search a simple file */
+	  if(stat(dirs[i], &st))
+	    continue;
+#ifdef AUTO_EXPAND 
+	  ftype=stat2bf((u_int) st.st_mode , dirs[i]);
+#else
+	  ftype=stat2bf((u_int) st.st_mode);
+#endif
+	  if(ftype!=BF_FILE) continue;
+
+	  ftype=ReadFileType(dirs[i]);
+	  if((ftype==RFT_ERROR)||
+	     (ftype==RFT_UNKNOWN))
+	    continue;
+	  if(ftype==RFT_COMPRESS)
+	    {
+		if(select_COMPRESS==NULL)
+		  select_COMPRESS=dirs[i];
+		else if(strcmp(dirs[i],select_COMPRESS)<0)
+		  select_COMPRESS=dirs[i];
+	    }
+	  else
+	    {
+		if(select==NULL)
+		  select=dirs[i];
+		else if(strcmp(dirs[i],select)<0)
+		  select=dirs[i];
+	    }
+      }
+    if(select==NULL) select=select_COMPRESS;
+
+    xv_getwd(_dirimagefile,512);
+#ifdef AUTO_EXPAND
+    Dirtovd(_dirimagefile);
+    Chvdir(wd);
+#else
+    chdir(wd);
+#endif
+    if(select!=NULL)
+      { strcat(_dirimagefile,"/"); strcat(_dirimagefile,select);}
+    for(i=0;i<dirsize;i++) {if(dirs[i]) free(dirs[i]); }
+    if(dirs) free(dirs);
+    if(select!=NULL) return _dirimagefile;
+    /* do you want to dummy? */
+#ifndef DIRTHUMB_DUMMY_ICON
+    return NULL;  /* do nothing */
+#else
+    {
+	FILE *fp;
+	sprintf(_dirimagefile,"%s/__xvdummy",tmpdir);
+	fp=fopen(_dirimagefile,"r");
+	if(fp!=NULL)
+	  {
+	      fclose(fp);
+	      return _dirimagefile;
+	  }
+	fp=fopen(_dirimagefile,"w");
+	if(fp==NULL)
+	  return NULL;
+	fprintf(fp,"#define tmp_width 2\n");
+	fprintf(fp,"#define tmp_height 2\n");
+	fprintf(fp,"static unsigned char tmp_bits[] = {\n");
+	fprintf(fp,"   0xc0, 0xc0};");
+	fclose(fp);
+	chmod(_dirimagefile,0777);
+	return _dirimagefile;
+    }
+#endif
+    
+}
+
+#endif
 
 /***************************************************************/
 static void genIcon(br, bf)
@@ -3612,7 +3762,9 @@
   byte   *icon24, *icon8;
   char    str[256], str1[256], readname[128], uncompname[128];
   char    basefname[128], *uncName;
-  
+  char    *bfname;
+  int     bfftype;
+
   
   if (!bf || !bf->name || bf->name[0] == '\0') return;   /* shouldn't happen */
   str[0] = '\0';
@@ -3630,21 +3782,61 @@
   bf->pimage  = (byte *)   NULL;
   bf->ximage  = (XImage *) NULL;
 
-
+  bfname=bf->name;
+#ifdef DIRTHUMB
+  bfftype=bf->ftype;
+  if((bf->ftype==BF_DIR)&&(dirthumb_check_directory))
+    {
+      bfname=searchGFile(bf->name);
+      if(bfname==NULL) 
+	{
+#ifdef AUTO_EXPAND      /* remove if directory is VD */ 
+	  if(strcmp(bf->name,".."))
+	    {
+	      char bfrm1[512],bfrm2[512];
+	      xv_getwd(bfrm1,512);
+	      strcat(bfrm1,"/"); strcat(bfrm1,bf->name);
+	      strcpy(bfrm2,bfrm1);
+	      Dirtovd(bfrm2);
+	      if(strcmp(bfrm1,bfrm2)!=0)
+		{ Rmvdir(bfrm1); }
+	    }
+	  else
+	    {
+	      bf->w=br_dir_width; 
+	      bf->h=br_dir_height; /* reset size of parent icon */
+	    }
+	  return;
+#endif
+	}
+ 
+      /*	printf("directory image: %s\n",bfname);*/
+      strcpy(readname, bfname);
+    }
+  /* skip all 'special' files */
+  if((bf->ftype!=BF_DIR)&&(!ISLOADABLE(bf->ftype))) return;
+  if((bf->ftype==BF_DIR)&&(!dirthumb_check_directory)) 
+    {
+      bf->w=br_dir_width;
+      bf->h=br_dir_height;
+      return;
+    }
+#else
   /* skip all 'special' files */
   if (!ISLOADABLE(bf->ftype)) return;
+#endif
   
-  filetype = ReadFileType(bf->name);
-  
+  filetype = ReadFileType(bfname);
+
   if ((filetype == RFT_COMPRESS) || (filetype == RFT_BZIP2)) {
 #if (defined(VMS) && !defined(GUNZIP))
     /* VMS decompress doesn't like the file to have a trailing .Z in fname
        however, GUnZip is OK with it, which we are calling UnCompress */
-    strcpy (basefname, bf->name);
+    strcpy (basefname, bfname);
     *rindex (basefname, '.') = '\0';
     uncName = basefname;
 #else
-    uncName = bf->name;
+    uncName = bfname;
 #endif
     
     if (UncompressFile(uncName, uncompname, filetype)) {
@@ -3652,7 +3844,7 @@
       strcpy(readname, uncompname);
     }
     else {
-      sprintf(str, "Couldn't uncompress file '%s'", bf->name);
+      sprintf(str, "Couldn't uncompress file '%s'", bfname);
       setBrowStr(br, str);
       bf->ftype = BF_ERROR;
     }
@@ -3661,11 +3853,11 @@
 #ifdef MACBINARY
   if (handlemacb && macb_file == True && bf->ftype != BF_ERROR) {
     if (RemoveMacbinary(readname, uncompname)) {
-      if (strcmp(readname, bf->name)!=0) unlink(readname);
+      if (strcmp(readname, bfname)!=0) unlink(readname);
       strcpy(readname, uncompname);
     }
     else {
-      sprintf(str, "Unable to remove a InfoFile header form '%s'.", bf->name);
+      sprintf(str, "Unable to remove a InfoFile header form '%s'.", bfname);
       setBrowStr(br, str);
       bf->ftype = BF_ERROR;
     }
@@ -3678,7 +3870,7 @@
       char tmpname[128];
       char *icom;
 
-      if((icom = mgcsfx_auto_input_com(bf->name)) != NULL){
+      if((icom = mgcsfx_auto_input_com(bfname)) != NULL){
 	sprintf(tmpname, "%s/xvmsautoXXXXXX", tmpdir);
 	mktemp(tmpname);
 	SetISTR(ISTR_INFO, "Converting to known format by MgcSfx auto...");
@@ -3690,12 +3882,12 @@
 #else
       if (!system(str)) {
 #endif
-        sprintf(str, "Unable to convert '%s' by MgcSfx auto.", bf->name);
+        sprintf(str, "Unable to convert '%s' by MgcSfx auto.", bfname);
         setBrowStr(br, str);
         bf->ftype = BF_ERROR;
       } else {
         filetype = ReadFileType(tmpname);
-        if (strcmp(readname, bf->name)!=0) unlink(readname);
+        if (strcmp(readname, bfname)!=0) unlink(readname);
         strcpy(readname, tmpname);
       }
     }
@@ -3707,7 +3899,7 @@
   if (pinfo.comment) free(pinfo.comment);  pinfo.comment = (char *) NULL;
   
   if (filetype == RFT_ERROR) { 
-    sprintf(str,"Couldn't open file '%s'", bf->name);
+    sprintf(str,"Couldn't open file '%s'", bfname);
     setBrowStr(br, str);
     bf->ftype = BF_ERROR;
   }
@@ -3742,10 +3934,28 @@
   }
   
   /* if we made an uncompressed file, we can rm it now */
-  if (strcmp(readname, bf->name)!=0) unlink(readname);
+  if (strcmp(readname, bfname)!=0) unlink(readname);
   
   
   /* at this point either BF_ERROR, BF_UNKNOWN, BF_EXE or pic */
+#ifdef DIRTHUMB
+    if((bfftype==BF_DIR)&&
+       ((bf->ftype==BF_ERROR)||(bf->ftype==BF_UNKNOWN)||(bf->ftype==BF_EXE)||
+	(!pinfo.pic)))
+      {
+	  char bfrm[512];
+	  bf->ftype=BF_DIR;
+#ifdef AUTO_EXPAND
+	  if(strrchr(bfname,'/')!=NULL)     /* remove if directory is VD */ 
+	    *(strrchr(bfname,'/'))='\0';
+	  strcpy(bfrm,bfname);
+	  Vdtodir(bfrm);
+	  if(strcmp(bfrm,bfname)!=0)
+	    { Rmvdir(bfrm);}
+	  return;
+#endif 
+      }
+#endif
   
   if (!pinfo.pic) {
     if (bf->ftype == BF_EXE) return;  /* don't write thumbfiles for exe's */
@@ -3769,6 +3979,20 @@
 #endif /* VS_ADJUST */
   hexpand = (double) pinfo.h / (double) ISIZE_HIGH;
 
+#ifdef DIRTHUMB  /* Create Picture that can be included in bits/br_dir */
+    if(bfftype==BF_DIR)
+      {
+#ifdef VS_ADJUST
+	  if (!vsadjust) normaspect = 1;
+
+	  wexpand = (double) (pinfo.w * normaspect) / 45.0;
+#else
+	  wexpand = (double) pinfo.w / (double) 45.0;
+#endif /* VS_ADJUST */
+	  hexpand = (double) pinfo.h / (double) 29.0;
+      }
+#endif
+
   if (wexpand >= 1.0 || hexpand >= 1.0) {   /* don't expand small icons */
     if (wexpand>hexpand) {
 #ifdef VS_ADJUST
@@ -3854,7 +4078,7 @@
      long  filesize;
      char  buf[64];
      
-     fp = fopen(bf->name, "r");
+     fp = fopen(bfname, "r");
      if (fp) {
        fseek(fp, 0L, 2);
        filesize = ftell(fp);
@@ -3887,7 +4111,21 @@
   bf->w       = iwide;
   bf->h       = ihigh;
   bf->ftype   = BF_HAVEIMG;
-  
+#ifdef DIRTHUMB
+    if(bfftype==BF_DIR)
+      {
+	  char bfrm[512];
+	  bf->ftype=BF_DIR;
+#ifdef AUTO_EXPAND
+	  if(strrchr(bfname,'/')!=NULL)     /* remove if directory is VD */ 
+	    *(strrchr(bfname,'/'))='\0';
+	  strcpy(bfrm,bfname);
+	  Vdtodir(bfrm);
+	  if(strcmp(bfrm,bfname)!=0)
+	    { Rmvdir(bfrm); }
+#endif 
+      }
+#endif
   bf->ximage = Pic8ToXImage(icon8, (u_int) iwide, (u_int) ihigh, browcols,
 			    browR, browG, browB);
   
@@ -3946,6 +4184,11 @@
 
   info = NULL;  icon8 = NULL;  builtin = 0;
 
+#ifdef DIRTHUMB
+  if(bf->ftype==BF_DIR)
+    sprintf(thFname, "%s%s/%s__DIR", br->path, THUMBDIR, bf->name);
+  else
+#endif
   sprintf(thFname, "%s%s/%s", br->path, THUMBDIR, bf->name);
 
 #ifdef AUTO_EXPAND
@@ -4027,6 +4270,16 @@
   else {
     if (info) free(info);
   }
+#ifdef DIRTHUMB
+  {
+      struct stat st;
+      int f=0;
+      sprintf(thFname, "%s%s", br->path, bf->name);
+      if((stat(thFname, &st)==0)&&
+	 ((f=stat2bf((u_int) st.st_mode , thFname)) == BF_DIR))
+	{ /*printf("faked dir %s\n",thFname);*/ bf->ftype=BF_DIR;}
+  }
+#endif
   
   fclose(fp);
   return;
@@ -4063,14 +4316,18 @@
   if (!i) perm = st.st_mode & 07777;
      else perm = 0755;
 
-
-
+#ifdef DIRTHUMB
+  if(bf->ftype==BF_DIR)
+    sprintf(thFname, "%s%s/%s__DIR", br->path, THUMBDIR, bf->name);
+  else
+#endif
   sprintf(thFname, "%s%s/%s", br->path, THUMBDIR, bf->name);
 
 #ifdef AUTO_EXPAND
   Dirtovd(thFname);
 #endif
 
+/*  printf("%s\n",thFname);*/
   fp = fopen(thFname, "w");
   if (!fp) {
     sprintf(buf, "Can't create thumbnail file '%s':  %s", thFname, 
@@ -4108,6 +4365,7 @@
   }
 
   if (ferror(fp)) {  /* error occurred */
+      printf("error\n");
     fclose(fp);
     unlink(thFname);  /* delete it */
     sprintf(buf, "Can't write thumbnail file '%s':  %s", thFname,
@@ -4198,8 +4456,12 @@
   WaitCursor();
 
   for (i=0, bf=br->bfList; i<br->bfLen; i++, bf++) {
+#ifdef DIRTHUMB
+    if (bf->ftype <= BF_FILE || bf->ftype >= BF_ERROR || bf->ftype==BF_EXE ||
+	bf->ftype==BF_DIR) {
+#else
     if (bf->ftype <= BF_FILE || bf->ftype >= BF_ERROR || bf->ftype==BF_EXE) {
-
+#endif
       /* ie, not a 'special' file */
 
       int  s1, s2;
@@ -4211,6 +4473,11 @@
       s1 = stat(bf->name, &filest);
 
       /* see if this file has an associated thumbnail file */
+#ifdef DIRTHUMB
+      if(bf->ftype==BF_DIR)
+	sprintf(thfname, "%s%s/%s__DIR", br->path, THUMBDIR, bf->name);
+      else
+#endif
       sprintf(thfname, "%s/%s", THUMBDIR, bf->name);
       s2 = stat(thfname, &thumbst);
 
@@ -4247,6 +4514,13 @@
 
   clearTemp(br);
 
+#if defined(DIRTHUMB) && defined(DIRTHUMB_DUMMY_ICON)
+  {
+      char tmp[256];
+      sprintf(tmp,"%s/__xvdummy",tmpdir);
+      unlink(tmp);
+  }
+#endif
 
 
   /* search the THUMBDIR directory, looking for thumbfiles that don't have
@@ -4259,10 +4533,30 @@
   if (dirp) {
     while ( (dp = readdir(dirp)) != NULL) {
       char thfname[256];
+      char *d_name;
+#ifdef DIRTHUMB
+      char d_name_file[256];
+#endif
       struct stat filest, thumbst;
 
       /* stat this directory entry to make sure it's a plain file */
       sprintf(thfname, "%s/%s", THUMBDIR, dp->d_name);
+      d_name=dp->d_name;
+#ifdef DIRTHUMB
+#ifdef DIRTHUMB_NOPARENT
+      if(strcmp(d_name,"..__DIR")==0)  /* remove if not need parent icon */
+	d_name="..parent_remove"; /* set original filename to non-exist */
+      else
+#endif
+      if((strstr(d_name,"__DIR")!=NULL)&&
+	 (*(strstr(d_name,"__DIR")+5)=='\0'))
+	{
+	    strcpy(d_name_file,d_name);
+	    *(strstr(d_name_file,"__DIR"))='\0'; /* cut option */
+	    d_name=d_name_file;
+	}
+#endif
+
       if (stat(thfname, &thumbst)==0) {  /* success */
 	int tmp;
 #ifdef AUTO_EXPAND
@@ -4273,7 +4567,7 @@
 
 	if (tmp == BF_FILE) {  /* a plain file */
 	  /* see if this thumbfile has an associated pic file */
-	  if (stat(dp->d_name, &filest)) {  /* failed!: guess it doesn't */
+	  if (stat(d_name, &filest)) {  /* failed!: guess it doesn't */
 	    if (unlink(thfname)==0) iconsKilled++;
 	  }
 	}

--ikeVEW9yuYc//A+q--
