]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/cmd/walk.c
merge
[plan9front.git] / sys / src / cmd / walk.c
index 69a0f154fc8071cfcd86ab308d7cfb1bea5c080d..cd83acca74bbaaa6505c69d7757c09fdd8ba635c 100644 (file)
@@ -40,12 +40,10 @@ warn(char *fmt, ...)
 }
 
 void
-dofile(char *path, Dir *f, int pathonly, long depth)
+dofile(char *path, Dir *f, int pathonly)
 {
        char *p;
 
-       USED(depth);
-
        if(
                (f == dotdir)
                || (tflag && ! (f->qid.type & QTTMP))
@@ -73,6 +71,10 @@ dofile(char *path, Dir *f, int pathonly, long depth)
                case 'q': Bprint(bout, "%ullx.%uld.%.2uhhx", f->qid.path, f->qid.vers, f->qid.type); break;
                case 's': Bprint(bout, "%lld", f->length); break;
                case 'x': Bprint(bout, "%ulo", f->mode); break;
+
+               /* These two  are slightly different, as they tell us about the fileserver instead of the file */
+               case 'D': Bprint(bout, "%ud", f->dev); break;
+               case 'T': Bprint(bout, "%C", f->type); break;
                default:
                        abort();
                }
@@ -115,12 +117,12 @@ walk(char *path, Dir *cf, long depth)
                                continue;
                        if(! (f->qid.type & QTDIR)){
                                if(fflag && depth >= mindepth)
-                                       dofile(path, f, 0, depth);
+                                       dofile(path, f, 0);
                        } else if(strcmp(f->name, ".") == 0 || strcmp(f->name, "..") == 0){
                                warn(". or .. named file: %s/%s", path, f->name);
                        } else{
                                if(depth+1 > maxdepth){
-                                       dofile(path, f, 0, depth);
+                                       dofile(path, f, 0);
                                        continue;
                                } else if(path == dotpath){
                                        if((file = s_new()) == nil)
@@ -146,7 +148,7 @@ walk(char *path, Dir *cf, long depth)
 nodescend:
        depth--;
        if(dflag && depth >= mindepth)
-               dofile(path, cf, 0, depth);
+               dofile(path, cf, 0);
 }
 
 char*
@@ -240,9 +242,9 @@ main(int argc, char **argv)
                if((stfmt = s_reset(stfmt)) == nil)
                        sysfatal("s_reset: %r");
                s_append(stfmt, EARGF(usage()));
-               i = strspn(s_to_c(stfmt), "UGMamnpqsx");
+               i = strspn(s_to_c(stfmt), "UGMamnpqsxDT");
                if(i != s_len(stfmt))
-                       sysfatal("bad stfmt: %s\n", s_to_c(stfmt));
+                       sysfatal("bad stfmt: %s", s_to_c(stfmt));
                break;
        default:
                usage();
@@ -272,7 +274,7 @@ main(int argc, char **argv)
                }
                if((d = dirstat(argv[i])) != nil && ! (d->qid.type & QTDIR)){
                        if(fflag && !seen(d) && mindepth < 1)
-                               dofile(argv[i], d, 1, 0);
+                               dofile(argv[i], d, 1);
                } else
                        walk(argv[i], d, 1);
                free(d);