diff options
author | rsc <devnull@localhost> | 2004-04-08 19:30:18 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-04-08 19:30:18 +0000 |
commit | 62c141582684ff2afdaa7c8698df9f596b2d3c84 (patch) | |
tree | 70dffb4142f241de9d91edbc81aeda836af2bd62 /src/cmd/acme | |
parent | 7cf289ca89a7416999ae02330236042b0d37e3db (diff) | |
download | plan9port-62c141582684ff2afdaa7c8698df9f596b2d3c84.tar.gz plan9port-62c141582684ff2afdaa7c8698df9f596b2d3c84.tar.bz2 plan9port-62c141582684ff2afdaa7c8698df9f596b2d3c84.zip |
Let's try this - Dotfiles toggles listing of .* in directory listings.
Diffstat (limited to 'src/cmd/acme')
-rw-r--r-- | src/cmd/acme/dat.h | 1 | ||||
-rw-r--r-- | src/cmd/acme/exec.c | 18 | ||||
-rw-r--r-- | src/cmd/acme/text.c | 2 |
3 files changed, 21 insertions, 0 deletions
diff --git a/src/cmd/acme/dat.h b/src/cmd/acme/dat.h index 338a1ff8..789ce1ca 100644 --- a/src/cmd/acme/dat.h +++ b/src/cmd/acme/dat.h @@ -529,6 +529,7 @@ int editing; int erroutfd; int messagesize; /* negotiated in 9P version setup */ int globalautoindent; +int nodotfiles; Channel *ckeyboard; /* chan(Rune)[10] */ Channel *cplumb; /* chan(Plumbmsg*) */ diff --git a/src/cmd/acme/exec.c b/src/cmd/acme/exec.c index 3c1aad20..15b14670 100644 --- a/src/cmd/acme/exec.c +++ b/src/cmd/acme/exec.c @@ -18,6 +18,7 @@ Buffer snarfbuf; void del(Text*, Text*, Text*, int, int, Rune*, int); void delcol(Text*, Text*, Text*, int, int, Rune*, int); +void dotfiles(Text*, Text*, Text*, int, int, Rune*, int); void dump(Text*, Text*, Text*, int, int, Rune*, int); void edit(Text*, Text*, Text*, int, int, Rune*, int); void xexit(Text*, Text*, Text*, int, int, Rune*, int); @@ -52,6 +53,7 @@ static Rune LCut[] = { 'C', 'u', 't', 0 }; static Rune LDel[] = { 'D', 'e', 'l', 0 }; static Rune LDelcol[] = { 'D', 'e', 'l', 'c', 'o', 'l', 0 }; static Rune LDelete[] = { 'D', 'e', 'l', 'e', 't', 'e', 0 }; +static Rune LDotfiles[] = { 'D', 'o', 't', 'f', 'i', 'l', 'e', 's', 0 }; static Rune LDump[] = { 'D', 'u', 'm', 'p', 0 }; static Rune LEdit[] = { 'E', 'd', 'i', 't', 0 }; static Rune LExit[] = { 'E', 'x', 'i', 't', 0 }; @@ -82,6 +84,7 @@ Exectab exectab[] = { { LDel, del, FALSE, FALSE, XXX }, { LDelcol, delcol, FALSE, XXX, XXX }, { LDelete, del, FALSE, TRUE, XXX }, + { LDotfiles, dotfiles, FALSE, XXX, XXX }, { LDump, dump, FALSE, TRUE, XXX }, { LEdit, edit, FALSE, XXX, XXX }, { LExit, xexit, FALSE, XXX, XXX }, @@ -365,6 +368,21 @@ del(Text *et, Text *_0, Text *_1, int flag1, int _2, Rune *_3, int _4) } void +dotfiles(Text *et, Text *_0, Text *_1, int _2, int _3, Rune *_4, int _5) +{ + USED(_0); + USED(_1); + USED(_2); + USED(_3); + USED(_4); + USED(_5); + USED(et); + + nodotfiles = !nodotfiles; + warning(nil, "%s dot files\n", nodotfiles ? "omitting" : "showing"); +} + +void sort(Text *et, Text *_0, Text *_1, int _2, int _3, Rune *_4, int _5) { USED(_0); diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c index 43463e95..7177127d 100644 --- a/src/cmd/acme/text.c +++ b/src/cmd/acme/text.c @@ -224,6 +224,8 @@ textload(Text *t, uint q0, char *file, int setqid) dbuf = nil; while((n=dirread(fd, &dbuf)) > 0){ for(i=0; i<n; i++){ + if(nodotfiles && dbuf[i].name[0] == '.') + continue; dl = emalloc(sizeof(Dirlist)); j = strlen(dbuf[i].name); tmp = emalloc(j+1+1); |