Let's try this - Dotfiles toggles listing of .* in directory listings.
This commit is contained in:
parent
7cf289ca89
commit
62c1415826
3 changed files with 21 additions and 0 deletions
|
|
@ -529,6 +529,7 @@ int editing;
|
||||||
int erroutfd;
|
int erroutfd;
|
||||||
int messagesize; /* negotiated in 9P version setup */
|
int messagesize; /* negotiated in 9P version setup */
|
||||||
int globalautoindent;
|
int globalautoindent;
|
||||||
|
int nodotfiles;
|
||||||
|
|
||||||
Channel *ckeyboard; /* chan(Rune)[10] */
|
Channel *ckeyboard; /* chan(Rune)[10] */
|
||||||
Channel *cplumb; /* chan(Plumbmsg*) */
|
Channel *cplumb; /* chan(Plumbmsg*) */
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ Buffer snarfbuf;
|
||||||
|
|
||||||
void del(Text*, Text*, Text*, int, int, Rune*, int);
|
void del(Text*, Text*, Text*, int, int, Rune*, int);
|
||||||
void delcol(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 dump(Text*, Text*, Text*, int, int, Rune*, int);
|
||||||
void edit(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);
|
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 LDel[] = { 'D', 'e', 'l', 0 };
|
||||||
static Rune LDelcol[] = { 'D', 'e', 'l', 'c', 'o', 'l', 0 };
|
static Rune LDelcol[] = { 'D', 'e', 'l', 'c', 'o', 'l', 0 };
|
||||||
static Rune LDelete[] = { 'D', 'e', 'l', 'e', 't', 'e', 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 LDump[] = { 'D', 'u', 'm', 'p', 0 };
|
||||||
static Rune LEdit[] = { 'E', 'd', 'i', 't', 0 };
|
static Rune LEdit[] = { 'E', 'd', 'i', 't', 0 };
|
||||||
static Rune LExit[] = { 'E', 'x', 'i', 't', 0 };
|
static Rune LExit[] = { 'E', 'x', 'i', 't', 0 };
|
||||||
|
|
@ -82,6 +84,7 @@ Exectab exectab[] = {
|
||||||
{ LDel, del, FALSE, FALSE, XXX },
|
{ LDel, del, FALSE, FALSE, XXX },
|
||||||
{ LDelcol, delcol, FALSE, XXX, XXX },
|
{ LDelcol, delcol, FALSE, XXX, XXX },
|
||||||
{ LDelete, del, FALSE, TRUE, XXX },
|
{ LDelete, del, FALSE, TRUE, XXX },
|
||||||
|
{ LDotfiles, dotfiles, FALSE, XXX, XXX },
|
||||||
{ LDump, dump, FALSE, TRUE, XXX },
|
{ LDump, dump, FALSE, TRUE, XXX },
|
||||||
{ LEdit, edit, FALSE, XXX, XXX },
|
{ LEdit, edit, FALSE, XXX, XXX },
|
||||||
{ LExit, xexit, FALSE, XXX, XXX },
|
{ LExit, xexit, FALSE, XXX, XXX },
|
||||||
|
|
@ -364,6 +367,21 @@ del(Text *et, Text *_0, Text *_1, int flag1, int _2, Rune *_3, int _4)
|
||||||
colclose(et->col, et->w, TRUE);
|
colclose(et->col, et->w, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
void
|
||||||
sort(Text *et, Text *_0, Text *_1, int _2, int _3, Rune *_4, int _5)
|
sort(Text *et, Text *_0, Text *_1, int _2, int _3, Rune *_4, int _5)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -224,6 +224,8 @@ textload(Text *t, uint q0, char *file, int setqid)
|
||||||
dbuf = nil;
|
dbuf = nil;
|
||||||
while((n=dirread(fd, &dbuf)) > 0){
|
while((n=dirread(fd, &dbuf)) > 0){
|
||||||
for(i=0; i<n; i++){
|
for(i=0; i<n; i++){
|
||||||
|
if(nodotfiles && dbuf[i].name[0] == '.')
|
||||||
|
continue;
|
||||||
dl = emalloc(sizeof(Dirlist));
|
dl = emalloc(sizeof(Dirlist));
|
||||||
j = strlen(dbuf[i].name);
|
j = strlen(dbuf[i].name);
|
||||||
tmp = emalloc(j+1+1);
|
tmp = emalloc(j+1+1);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue