[9front] walk: properly format permissions
This patch adds dirmodefmt from fcall.h to pretty-print file permissions, similarly to ls -l. I didn't notice any performance degradation. I hope no-one relied on the old behaviour.
This commit is contained in:
parent
d41c867696
commit
4c981d440d
2 changed files with 4 additions and 3 deletions
|
@ -123,8 +123,6 @@ walk -fn1 -esp
|
||||||
.IR ls (1),
|
.IR ls (1),
|
||||||
.IR du (1)
|
.IR du (1)
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
Statfmt character `x' displays permissions as an integer.
|
|
||||||
.PP
|
|
||||||
Manipulating ifs is a nuisance.
|
Manipulating ifs is a nuisance.
|
||||||
.PP
|
.PP
|
||||||
File names are assumed to not contain newlines.
|
File names are assumed to not contain newlines.
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <bio.h>
|
#include <bio.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
#include <fcall.h>
|
||||||
|
|
||||||
int Cflag = 0;
|
int Cflag = 0;
|
||||||
int uflag = 0;
|
int uflag = 0;
|
||||||
|
@ -70,7 +71,7 @@ dofile(char *path, Dir *f, int pathonly)
|
||||||
break;
|
break;
|
||||||
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, "%M", f->mode); break;
|
||||||
|
|
||||||
/* These two are slightly different, as they tell us about the fileserver instead of the file */
|
/* 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 'D': Bprint(bout, "%ud", f->dev); break;
|
||||||
|
@ -250,6 +251,8 @@ main(int argc, char **argv)
|
||||||
usage();
|
usage();
|
||||||
}ARGEND;
|
}ARGEND;
|
||||||
|
|
||||||
|
fmtinstall('M', dirmodefmt);
|
||||||
|
|
||||||
if((bout = Bfdopen(1, OWRITE)) == nil)
|
if((bout = Bfdopen(1, OWRITE)) == nil)
|
||||||
sysfatal("Bfdopen: %r");
|
sysfatal("Bfdopen: %r");
|
||||||
Blethal(bout, nil);
|
Blethal(bout, nil);
|
||||||
|
|
Loading…
Reference in a new issue