diff options
author | Mystery Man <unknown@mandriva.org> | 2003-02-28 19:12:50 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2003-02-28 19:12:50 +0000 |
commit | 3cbfd41e073fbd2fbe6f548eefe650e21fec6250 (patch) | |
tree | cacec1f310fcee1e588e313dd109866b9ec12e0c /mdk-stage1/dietlibc/lib/ftw.c | |
parent | a63d6674452fb78472f75a3c129f77254572f8af (diff) | |
download | drakx-backup-do-not-use-9_1_11mdk.tar drakx-backup-do-not-use-9_1_11mdk.tar.gz drakx-backup-do-not-use-9_1_11mdk.tar.bz2 drakx-backup-do-not-use-9_1_11mdk.tar.xz drakx-backup-do-not-use-9_1_11mdk.zip |
This commit was manufactured by cvs2svn to create tag 'V9_1_11mdk'.V9_1_11mdk
Diffstat (limited to 'mdk-stage1/dietlibc/lib/ftw.c')
-rw-r--r-- | mdk-stage1/dietlibc/lib/ftw.c | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/mdk-stage1/dietlibc/lib/ftw.c b/mdk-stage1/dietlibc/lib/ftw.c deleted file mode 100644 index a3c04af9a..000000000 --- a/mdk-stage1/dietlibc/lib/ftw.c +++ /dev/null @@ -1,52 +0,0 @@ -#include <linux/stat.h> -#include <unistd.h> -#include <limits.h> -#include <ftw.h> -#include <dirent.h> -#include <string.h> -#include <stdlib.h> - -int ftw(const char *dir,int (*fn)(const char *file, const struct stat *sb, int flag), int depth) { - char *cwd; - int cwdlen; - DIR *d; - struct dirent *de; - struct stat sb; - if (chdir(dir)) return -1; - cwd=alloca(PATH_MAX+1); - if (!getcwd(cwd,PATH_MAX)) return -1; - cwd[PATH_MAX]=0; - cwdlen=strlen(cwd); -/* write(1,"ftw in ",7); puts(cwd); */ - if (!(d=opendir("."))) return -1; - while ((de=readdir(d))) { - int res; - int flag; - int nlen; - char *filename; - if (de->d_name[0]=='.' && - (de->d_name[1]==0 || - (de->d_name[1]=='.' && de->d_name[2]==0))) continue; - nlen=strlen(de->d_name); - filename=alloca(nlen+cwdlen+3); - memmove(filename,cwd,cwdlen); - filename[cwdlen]='/'; - memmove(filename+cwdlen+1,de->d_name,nlen+1); - if (!lstat(de->d_name,&sb)) { - if (S_ISLNK(sb.st_mode)) flag=FTW_SL; else - if (S_ISDIR(sb.st_mode)) flag=FTW_D; else - flag=FTW_F; - } else - flag=FTW_NS; - res=fn(filename,&sb,flag); - if (res) return res; - if (flag==FTW_D && depth>0) { - res=ftw(filename,fn,depth-1); - chdir(dir); - if (res) return res; - } -/* puts(de->d_name); */ - } - closedir(d); - return 0; -} |