Message-Id: <199603201703.CAA13569@inetnif.niftyserve.or.jp> Date: Thu, 21 Mar 1996 02:02:00 +0900 From: Kenji Masaki Subject: Re^2: Re:`stat' fails to detect nonexist To: djgpp-workers AT delorie DOT com Hello. ALL I try to make a patch for findfirst(). By this patch, stat() work correctly on my WIN-NT 3.51 (FAT and NTFS). *** old/findfirs.cSun Oct 29 01:15:10 1995 --- ./findfirs.cThu Mar 21 01:43:14 1996 *************** *** 89,97 **** --- 89,127 ---- /* Recover results */ dosmemget(__tb+pathlen, _sizeof_dos_ffblk, ffblk); + + /* Kenji Masaki add next 11 lines for WIN-NT */ + if (attrib == FA_LABEL && strpbrk("*?",pathname) == NULL){ + char *p=(char *)pathname; + if (p[1] == ':') + p += 2; + if (*p == '\\') + p++; + if (stricmp(p,ffblk->ff_name)){ + r.x.ax = 0x12; + goto error_end; /* sorry for goto */ + } + } + return 0; } } + error_end: errno = __doserr_to_errno(r.x.ax); return errno; } + + #ifdef TEST + + main(int argc,char **argv) + { + struct ffblk ff_blk; + + puts(argv[1]); + printf("findfirst = %d\n",findfirst(argv[1],&ff_blk,FA_LABEL)); + printf("time %x\n",ff_blk.ff_ftime); + printf("size %x\n",ff_blk.ff_fsize); + printf("name %s\n",ff_blk.ff_name); + printf("attrib %x\n",ff_blk.ff_attrib); + } + #endif Thank you Kenji Masaki (tantan) SGL00213 AT niftyserve DOT or DOT jp a staff member of FEXT