From 3d73829c187f7d34c5c3c44047da1137adf36d86 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 16 Dec 2000 17:50:48 +0000 Subject: Update. 2000-12-16 Ulrich Drepper * timezone/asia: Update from tzdata2000h. * timezone/australasia: Likewise. * timezone/backward: Likewise. * timezone/europe: Likewise. * timezone/northamerica: Likewise. * timezone/southamerica: Likewise. * timezone/zone.tab: Likewise. 2000-12-14 Jakub Jelinek * io/ftw.c (ftw_dir): If process_entry returned non-zero result and dir.stream is NULL, only free dir.content. * io/ftwtest.c (cb, main): Add --early-exit option to test it. * io/ftwtest-sh: Test with --early-exit. --- io/ftwtest.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'io/ftwtest.c') diff --git a/io/ftwtest.c b/io/ftwtest.c index 6079265175..851ed1d587 100644 --- a/io/ftwtest.c +++ b/io/ftwtest.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -10,12 +11,14 @@ int do_depth; int do_chdir; int do_phys; +int do_exit; struct option options[] = { { "depth", no_argument, &do_depth, 1 }, { "chdir", no_argument, &do_chdir, 1 }, { "phys", no_argument, &do_phys, 1 }, + { "early-exit", no_argument, &do_exit, 1 }, { NULL, 0, NULL, 0 } }; @@ -31,9 +34,12 @@ const char *flag2name[] = }; -int +static int cb (const char *name, const struct stat *st, int flag, struct FTW *f) { + if (do_exit && strcmp (name + f->base, "file@2")) + return 0; + printf ("base = \"%.*s\", file = \"%s\", flag = %s", f->base, name, name + f->base, flag2name[flag]); if (do_chdir) @@ -43,7 +49,7 @@ cb (const char *name, const struct stat *st, int flag, struct FTW *f) free (cwd); } printf (", level = %d\n", f->level); - return 0; + return do_exit ? 26 : 0; } int @@ -64,8 +70,13 @@ main (int argc, char *argv[]) if (do_phys) flag |= FTW_PHYS; - r = nftw (optind < argc ? argv[optind] : ".", cb, 3, flag); - if (r) + r = nftw (optind < argc ? argv[optind] : ".", cb, do_exit ? 1 : 3, flag); + if (r < 0) perror ("nftw"); + if (do_exit) + { + puts (r == 26 ? "succeeded" : "failed"); + return r == 26 ? 0 : 1; + } return r; } -- cgit v1.2.3