From fa4eff3d4c2648089c3834f801e45c74bd420676 Mon Sep 17 00:00:00 2001 From: "Charles.Forsyth" Date: Fri, 1 Jun 2007 16:04:53 +0000 Subject: 20070601-1703 --- CHANGES | 1 + appl/cmd/ls.b | 14 ++++++++++++++ dis/ls.dis | Bin 3890 -> 4025 bytes man/1/ls | 19 +++++++++++++++++-- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 1811d78f..f696f442 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,5 @@ 20070601 + /appl/cmd/ls.b /dis/ls.dis /man/1/ls: document new -F option and -T option /appl/cmd/auth/factotum/factotum.b: ignore empty writes, don't fail; make a few diagnostics match plan 9 rename /appl/cmd/mc.b to /appl/cmd/calc.b; also /man/1/mc to /man/1/calc; /dis/mc.dis to /dis/calc.dis add /appl/cmd/mc.b (initial version) diff --git a/appl/cmd/ls.b b/appl/cmd/ls.b index 3d27d59e..6ffe29fb 100644 --- a/appl/cmd/ls.b +++ b/appl/cmd/ls.b @@ -39,6 +39,7 @@ qopt := 0; sopt := 0; topt := 0; uopt := 0; +Fopt := 0; Topt := 0; now: int; sortby: int; @@ -112,6 +113,8 @@ init(nil: ref Context, argv: list of string) rev = Readdir->DESCENDING; 'T' => Topt++; + 'F' => + Fopt++; * => sys->fprint(stderr, "usage: ls [-delmnpqrstucT] [files]\n"); raise "fail:usage"; @@ -271,6 +274,8 @@ lslineprint(dirname, name: string, dir: ref Dir, w: ref Widths) else file = dirname + "/" + file; } + if(Fopt) + file += fileflag(dir); if(lopt) { @@ -291,6 +296,15 @@ lslineprint(dirname, name: string, dir: ref Dir, w: ref Widths) out.puts(file+"\n"); } +fileflag(dir: ref Dir): string +{ + if(dir.qid.qtype & Sys->QTDIR) + return "/"; + if(dir.mode & 8r111) + return "*"; + return ""; +} + mtab := array[] of { "---", "--x", "-w-", "-wx", "r--", "r-x", "rw-", "rwx" diff --git a/dis/ls.dis b/dis/ls.dis index 35454538..9a661143 100644 Binary files a/dis/ls.dis and b/dis/ls.dis differ diff --git a/man/1/ls b/man/1/ls index aaba3516..1a7d548a 100644 --- a/man/1/ls +++ b/man/1/ls @@ -4,14 +4,14 @@ ls, lc \- list files .SH SYNOPSIS .B ls [ -.B -lpmnqduntscr +.B -lpmnqduntscrFT ] [ .IR file ... ] .LP .B lc [ -.B -lpmnqduntscr +.B -lpmnqduntscrFT ] [ .IR file ... ] @@ -141,6 +141,21 @@ Sort by size (smallest first). .TP .B -r Reverse the sort order. +.TP +.B -F +Add the character +.B / +after all directory names +and the character +.B * +after all executable files. +.TP +.B -T +Print the character +.B t +before each file if it has the temporary flag set, and +.B - +otherwise. .PP .I Lc is the same as -- cgit v1.2.3