walk: add D and T fmt characters (fileserver device/type)

This commit is contained in:
BurnZeZ 2020-01-28 01:27:41 +00:00
parent 0f1b442bc0
commit 2c0ccff286
2 changed files with 11 additions and 1 deletions

View file

@ -89,6 +89,12 @@ size in bytes
.TP .TP
.B x .B x
permissions permissions
.TP
.B D
server device
.TP
.B T
server type (kernel device rune)
.PD .PD
.PP .PP
The default statfmt is simply, The default statfmt is simply,

View file

@ -71,6 +71,10 @@ dofile(char *path, Dir *f, int pathonly)
case 'q': Bprint(bout, "%ullx.%uld.%.2uhhx", f->qid.path, f->qid.vers, f->qid.type); break; 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 's': Bprint(bout, "%lld", f->length); break;
case 'x': Bprint(bout, "%ulo", f->mode); 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: default:
abort(); abort();
} }
@ -238,7 +242,7 @@ main(int argc, char **argv)
if((stfmt = s_reset(stfmt)) == nil) if((stfmt = s_reset(stfmt)) == nil)
sysfatal("s_reset: %r"); sysfatal("s_reset: %r");
s_append(stfmt, EARGF(usage())); s_append(stfmt, EARGF(usage()));
i = strspn(s_to_c(stfmt), "UGMamnpqsx"); i = strspn(s_to_c(stfmt), "UGMamnpqsxDT");
if(i != s_len(stfmt)) if(i != s_len(stfmt))
sysfatal("bad stfmt: %s", s_to_c(stfmt)); sysfatal("bad stfmt: %s", s_to_c(stfmt));
break; break;