wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 6fbcbb537cfe636dde9e1d0c7796bce4639ac654
parent 5409d067c479b95a81bf3d7bef9dfb09f7ec27d9
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Sat,  4 Feb 2006 15:55:10 +0200

reading from ctl displays now the commands it understands


Diffstat:
cmd/wm/fs.c | 38++++++++++++++++++++++++++++++++++----
cmd/wmiibar.c | 8++++++--
2 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/cmd/wm/fs.c b/cmd/wm/fs.c @@ -60,7 +60,7 @@ */ static char E9pversion[] = "9P version not supported"; -static char Enoperm[] = "permission denied"; +/*static char Enoperm[] = "permission denied";*/ static char Enofid[] = "fid not assigned"; static char Enofile[] = "file not found"; static char Enomode[] = "mode not supported"; @@ -69,6 +69,24 @@ static char Enocommand[] = "command not supported"; const char *err; +static char Droot_ctlusage[] = + "quit - quits the wm\n" + "select [next | prev] [index] - selects the page\n" + "attach - attaches the client\n" + "detached - shows detached clients\n" + "pager - shows the pager\n"; + +static char Dpage_ctlusage[] = + "exec <command> - executes command in page\n" + "select [next | prev] [index] - selects the area\n"; + +static char Darea_ctlusage[] = + "select [next | prev] [index] - selects the client\n"; + +static char Dclient_ctlusage[] = + "detach - detaches the client\n" + "kill - kills the client\n"; + /* IXP stuff */ unsigned long long @@ -437,7 +455,7 @@ type_to_stat(Stat *stat, char *name, Qid *dir) return mkstat(stat, dir, name, 0, DMDIR | DMREAD | DMEXEC); break; case Fctl: - return mkstat(stat, dir, name, 0, DMWRITE); + return mkstat(stat, dir, name, 0, DMREAD | DMWRITE); break; case Fevent: return mkstat(stat, dir, name, 0, DMREAD); @@ -646,7 +664,7 @@ xread(IXPConn *c, Fcall *fcall) break; case Dpage: if(pg == npage) - alloc_page(); + focus_page(alloc_page()); fcall->count = type_to_stat(&stat, "ctl", &m->qid); p = ixp_enc_stat(p, &stat); fcall->count += type_to_stat(&stat, "new", &m->qid); @@ -698,8 +716,20 @@ xread(IXPConn *c, Fcall *fcall) p = ixp_enc_stat(p, &stat); break; case Fctl: - return Enoperm; + { + char *us = nil; + switch(m->qid.dtype) { + case Droot: us = Droot_ctlusage; break; + case Dpage: us = Dpage_ctlusage; break; + case Darea: us = Darea_ctlusage; break; + case Dclient: us = Dclient_ctlusage; break; + } + if(!us) + return Enofile; + fcall->count = strlen(us); + memcpy(p, us, fcall->count); break; + } case Ffont: if((fcall->count = strlen(def.font))) memcpy(p, def.font, fcall->count); diff --git a/cmd/wmiibar.c b/cmd/wmiibar.c @@ -88,6 +88,9 @@ static char *version[] = { " (C)opyright MMIV-MMVI Anselm R. Garbe\n", 0 }; +static char ctlusage[] = + "quit - quits the bar\n"; + static void usage() { @@ -471,7 +474,7 @@ type_to_stat(Stat *stat, char *name, Qid *dir) return mkstat(stat, dir, name, 0, DMDIR | DMREAD | DMEXEC); break; case Fctl: - return mkstat(stat, dir, name, 0, DMWRITE); + return mkstat(stat, dir, name, 0, DMREAD | DMWRITE); break; case Fevent: return mkstat(stat, dir, name, 0, DMREAD); @@ -612,7 +615,8 @@ xread(IXPConn *c, Fcall *fcall) p = ixp_enc_stat(p, &stat); break; case Fctl: - return Enoperm; + fcall->count = strlen(ctlusage); + memcpy(p, ctlusage, fcall->count); break; case Ffont: if((fcall->count = strlen(font)))