Changeset 2702 for trunk/src/kmk/dir.c
- Timestamp:
- Nov 21, 2013, 1:11:08 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/dir.c
r2591 r2702 121 121 122 122 #ifdef WINDOWS32 123 #include <Windows.h> 123 124 #include "pathstuff.h" 124 125 #endif … … 244 245 # define FS_NTFS 0x2 245 246 # define FS_UNKNOWN 0x4 247 # ifdef KMK 248 time_t last_updated; /**< The last time the directory was re-read. */ 249 # endif 246 250 #else 247 251 # ifdef VMS … … 611 615 dc->ctime = st.st_ctime; 612 616 dc->mtime = st.st_mtime; 617 # ifdef KMK 618 dc->last_updated = time(NULL); 619 # endif 613 620 614 621 /* … … 691 698 struct dirent *d; 692 699 #ifdef WINDOWS32 700 # ifndef KMK 693 701 struct stat st; 702 # endif 694 703 int rehash = 0; 695 704 #endif … … 745 754 if (dir->dirstream == 0) 746 755 { 747 #if def WINDOWS32756 #if defined(WINDOWS32) && !defined(KMK) 748 757 /* 749 758 * Check to see if directory has changed since last read. FAT … … 751 760 * on directories (ugh!). 752 761 */ 762 # ifdef KMK 763 if (dir->path_key && time(NULL) > dc->last_updated + 2) /* KMK: Only recheck every 2 seconds. */ 764 # else 753 765 if (dir->path_key) 766 # endif 754 767 { 755 768 if ((dir->fs_flags & FS_FAT) != 0) … … 758 771 rehash = 1; 759 772 } 773 # ifdef KMK 774 else if ( birdStatModTimeOnly (dir->path_key, &st.st_mtim, 1) == 0 775 && st.st_mtime > dir->mtime) 776 # else 760 777 else if (stat (dir->path_key, &st) == 0 && st.st_mtime > dir->mtime) 778 # endif 761 779 { 762 780 /* reset date stamp to show most recent re-process. */ … … 765 783 } 766 784 785 767 786 /* If it has been already read in, all done. */ 768 787 if (!rehash) … … 773 792 if (!dir->dirstream) 774 793 return 0; 794 # ifdef KMK 795 dc->last_updated = time(NULL); 796 # endif 775 797 } 776 798 else … … 1400 1422 #endif 1401 1423 1424 #ifdef KMK 1425 static int dir_exists_p (const char *dirname) 1426 { 1427 if (file_exists_p (dirname)) 1428 { 1429 struct directory *dir = find_directory (dirname); 1430 if (dir != NULL && dir->contents && dir->contents->dirfiles.ht_vec != NULL) 1431 return 1; 1432 } 1433 return 0; 1434 } 1435 #endif 1436 1402 1437 void 1403 1438 dir_setup_glob (glob_t *gl) … … 1409 1444 #ifdef __EMX__ /* The FreeBSD implementation actually uses gl_lstat!! */ 1410 1445 gl->gl_lstat = local_stat; 1446 #endif 1447 #ifdef KMK 1448 gl->gl_exists = file_exists_p; 1449 gl->gl_isdir = dir_exists_p; 1411 1450 #endif 1412 1451 /* We don't bother setting gl_lstat, since glob never calls it. … … 1436 1475 #endif /* CONFIG_WITH_ALLOC_CACHES */ 1437 1476 } 1477
Note:
See TracChangeset
for help on using the changeset viewer.