ref: 4c981d440d6740e553c90afbe8f682502615b7cb
parent: d41c867696019e4408431230d8fae0dcf7603dc4
author: Stephen Gregoratto <[email protected]>
date: Tue Apr 6 10:43:38 EDT 2021
[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.
--- a/sys/man/1/walk
+++ b/sys/man/1/walk
@@ -123,8 +123,6 @@
.IR ls (1),
.IR du (1)
.SH BUGS
-Statfmt character `x' displays permissions as an integer.
-.PP
Manipulating ifs is a nuisance.
.PP
File names are assumed to not contain newlines.
--- a/sys/src/cmd/walk.c
+++ b/sys/src/cmd/walk.c
@@ -2,6 +2,7 @@
#include <libc.h>
#include <bio.h>
#include <String.h>
+#include <fcall.h>
int Cflag = 0;
int uflag = 0;
@@ -70,7 +71,7 @@
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 '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 */
case 'D': Bprint(bout, "%ud", f->dev); break;
@@ -249,6 +250,8 @@
default:
usage();
}ARGEND;
+
+ fmtinstall('M', dirmodefmt);
if((bout = Bfdopen(1, OWRITE)) == nil)
sysfatal("Bfdopen: %r");