fix silly indirect-through-zero bug
[unix-history] / usr / src / usr.sbin / mtree / verify.c
index f0a337e..1bb6e46 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)verify.c   5.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)verify.c   5.9 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -39,27 +39,19 @@ vwalk()
 
        argv[0] = ".";
        argv[1] = (char *)NULL;
 
        argv[0] = ".";
        argv[1] = (char *)NULL;
-       if (!(t = ftsopen(argv, ftsoptions, (int (*)())NULL))) {
+       if (!(t = fts_open(argv, ftsoptions, (int (*)())NULL))) {
                (void)fprintf(stderr,
                (void)fprintf(stderr,
-                   "mtree: ftsopen: %s.\n", strerror(errno));
+                   "mtree: fts_open: %s.\n", strerror(errno));
                exit(1);
        }
        level = root;
                exit(1);
        }
        level = root;
-       while (p = ftsread(t)) {
+       while (p = fts_read(t)) {
                switch(p->fts_info) {
                case FTS_D:
                        if (!strcmp(p->fts_name, "."))
                                continue;
                        ftsdepth++; 
                        break;
                switch(p->fts_info) {
                case FTS_D:
                        if (!strcmp(p->fts_name, "."))
                                continue;
                        ftsdepth++; 
                        break;
-               case FTS_DC:
-                       (void)fprintf(stderr,
-                           "mtree: directory cycle: %s.\n", RP(p));
-                       continue;
-               case FTS_DNR:
-               case FTS_DNX:
-                       (void)fprintf(stderr,
-                           "mtree: %s: unable to read or search.\n", RP(p));
                case FTS_DP:
                        ftsdepth--; 
                        if (specdepth > ftsdepth) {
                case FTS_DP:
                        ftsdepth--; 
                        if (specdepth > ftsdepth) {
@@ -68,14 +60,12 @@ vwalk()
                                specdepth--;
                        }
                        continue;
                                specdepth--;
                        }
                        continue;
+               case FTS_DNR:
                case FTS_ERR:
                case FTS_ERR:
+               case FTS_NS:
                        (void)fprintf(stderr, "mtree: %s: %s.\n",
                            RP(p), strerror(errno));
                        continue;
                        (void)fprintf(stderr, "mtree: %s: %s.\n",
                            RP(p), strerror(errno));
                        continue;
-               case FTS_NS:
-                       (void)fprintf(stderr,
-                           "mtree: can't stat: %s.\n", RP(p));
-                       continue;
                default:
                        if (dflag)
                                continue;
                default:
                        if (dflag)
                                continue;
@@ -87,7 +77,7 @@ vwalk()
                            !strcmp(ep->name, p->fts_name)) {
                                ep->flags |= F_VISIT;
                                if (ep->flags & F_IGN) {
                            !strcmp(ep->name, p->fts_name)) {
                                ep->flags |= F_VISIT;
                                if (ep->flags & F_IGN) {
-                                       (void)ftsset(t, p, FTS_SKIP);
+                                       (void)fts_set(t, p, FTS_SKIP);
                                        continue;
                                }
                                compare(ep->name, ep, p);
                                        continue;
                                }
                                compare(ep->name, ep, p);
@@ -112,9 +102,9 @@ vwalk()
                        }
                        (void)putchar('\n');
                }
                        }
                        (void)putchar('\n');
                }
-               (void)ftsset(t, p, FTS_SKIP);
+               (void)fts_set(t, p, FTS_SKIP);
        }
        }
-       (void)ftsclose(t);
+       (void)fts_close(t);
 }
 
 miss(p, tail)
 }
 
 miss(p, tail)