[hackers] [wmii] Bunch of fixes.

From: Kris Maglione <jg_AT_suckless.org>
Date: Mon Jul 16 22:54:31 2007

changeset: 2197:42cf35f3acd3
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Mon Jul 16 16:52:35 2007 -0400
summary: Bunch of fixes.

diff -r 78e7a0ff3120 -r 42cf35f3acd3 cmd/Makefile
--- a/cmd/Makefile Sat Jul 14 12:05:07 2007 -0400
+++ b/cmd/Makefile Mon Jul 16 16:52:35 2007 -0400
@@ -17,7 +17,7 @@ FILTER = sed "s|CONFPREFIX|${ETC}|g; \
               s|P9PATHS|${P9PATHS}|g; \
               s|AWKPATH|${AWKPATH}|g"
 
-LDFLAGS += -lbio -lfmt -lutf
+LDFLAGS += -lfmt -lutf
 CFLAGS += ${INCX11} -DVERSION=\"${VERSION}\"
 
 include ${ROOT}/mk/many.mk
diff -r 78e7a0ff3120 -r 42cf35f3acd3 cmd/util.c
--- a/cmd/util.c Sat Jul 14 12:05:07 2007 -0400
+++ b/cmd/util.c Mon Jul 16 16:52:35 2007 -0400
@@ -135,6 +135,14 @@ str_nil(char *s) {
         return "<nil>";
 }
 
+int
+utflcpy(char *to, const char *from, int l) {
+ char *p;
+
+ p = utfecpy(to, to+l, from);
+ return p-to;
+}
+
 uint
 strlcat(char *dst, const char *src, uint size) {
         const char *s;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 cmd/wmii/bar.c
--- a/cmd/wmii/bar.c Sat Jul 14 12:05:07 2007 -0400
+++ b/cmd/wmii/bar.c Mon Jul 16 16:52:35 2007 -0400
@@ -53,7 +53,7 @@ create_bar(Bar **bp, char *name) {
                 b = emallocz(sizeof(Bar));
 
         b->id = id++;
- strncpy(b->name, name, sizeof(b->name));
+ utflcpy(b->name, name, sizeof(b->name));
         b->col = def.normcolor;
 
         for(; *bp; bp = &(*bp)->next)
@@ -144,7 +144,7 @@ draw_bar(WMScreen *s) {
                                 b->r.max.x += Dx(s->brect) - width;
 
                         if(tb)
- b->r = rectaddpt(b->r, Pt( tb->r.max.x, 0));
+ b->r = rectaddpt(b->r, Pt(tb->r.max.x, 0));
                 }
 
         r = rectsubpt(s->brect, s->brect.min);
@@ -162,7 +162,7 @@ draw_bar(WMScreen *s) {
         XSync(display, False);
 }
 
-Bar *
+Bar*
 bar_of_name(Bar *bp, const char *name) {
         Bar *b;
 
diff -r 78e7a0ff3120 -r 42cf35f3acd3 cmd/wmii/client.c
--- a/cmd/wmii/client.c Sat Jul 14 12:05:07 2007 -0400
+++ b/cmd/wmii/client.c Mon Jul 16 16:52:35 2007 -0400
@@ -96,9 +96,9 @@ manage_client(Client *c) {
                 tags = gettextproperty(&c->w, "_WIN_TAGS");
 
         if((trans = win2client(c->trans)))
- strncpy(c->tags, trans->tags, sizeof(c->tags));
+ utflcpy(c->tags, trans->tags, sizeof(c->tags));
         else if(tags)
- strncpy(c->tags, tags, sizeof(c->tags));
+ utflcpy(c->tags, tags, sizeof(c->tags));
 
         free(tags);
 
@@ -517,7 +517,7 @@ update_class(Client *c) {
                 strcpy(c->props, "::");
                 str = c->props + 1;
         }
- utfecpy(str+1, c->props+sizeof(c->props), c->name);
+ utflcpy(str+1, c->name, sizeof(c->props));
 }
 
 static void
@@ -530,7 +530,7 @@ update_client_name(Client *c) {
         if(str == nil)
                 str = gettextproperty(&c->w, "WM_NAME");
         if(str)
- utfecpy(c->name, c->name+sizeof(c->name), str);
+ utflcpy(c->name, str, sizeof(c->name));
         free(str);
 
         update_class(c);
@@ -558,6 +558,7 @@ updatemwm(Client *c) {
 
         if(c->sel)
                 r = frame2client(c->sel, c->sel->r);
+
         if(n >= 3 && (ret[Flags]&FlagDecor)) {
                 if(ret[Decor]&All)
                         ret[Decor] ^= ~0;
@@ -863,7 +864,7 @@ apply_tags(Client *c, const char *tags)
                         break;
 
         if(tags[n] == '+' || tags[n] == '-')
- strncpy(buf, c->tags, sizeof(c->tags));
+ utflcpy(buf, c->tags, sizeof(c->tags));
 
         strlcat(buf, &tags[n], sizeof(buf));
         trim(buf, " \t/");
diff -r 78e7a0ff3120 -r 42cf35f3acd3 cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Sat Jul 14 12:05:07 2007 -0400
+++ b/cmd/wmii/fns.h Mon Jul 16 16:52:35 2007 -0400
@@ -240,31 +240,5 @@ Rectangle sizehint(WinHints*, Rectangle)
 Rectangle sizehint(WinHints*, Rectangle);
 void sethints(Window*);
 
-/* utf.c */
-int chartorune(Rune*, char*);
-int fullrune(char*, int n);
-int runelen(long);
-int runenlen(Rune*, int nrune);
-Rune* runestrcat(Rune*, Rune*);
-Rune* runestrchr(Rune*, Rune);
-int runestrcmp(Rune*, Rune*);
-Rune* runestrcpy(Rune*, Rune*);
-Rune* runestrdup(Rune*) ;
-Rune* runestrecpy(Rune*, Rune *end, Rune*);
-long runestrlen(Rune*);
-Rune* runestrncat(Rune*, Rune*, long);
-int runestrncmp(Rune*, Rune*, long);
-Rune* runestrncpy(Rune*, Rune*, long);
-Rune* runestrrchr(Rune*, Rune);
-Rune* runestrstr(Rune*, Rune*);
-int runetochar(char*, Rune *rune);
-Rune totitlerune(Rune);
-char* utfecpy(char*, char *end, char*);
-int utflen(char*);
-int utfnlen(char*, long);
-char* utfrrune(char*, long);
-char* utfrune(char*, long);
-char* utfutf(char*, char*);
 char* toutf8n(char*, size_t);
 char* toutf8(char*);
-int isspacerune(Rune c);
diff -r 78e7a0ff3120 -r 42cf35f3acd3 cmd/wmii/fs.c
--- a/cmd/wmii/fs.c Sat Jul 14 12:05:07 2007 -0400
+++ b/cmd/wmii/fs.c Mon Jul 16 16:52:35 2007 -0400
@@ -901,7 +901,7 @@ fs_clunk(Ixp9Req *r) {
                         *q-- = '\0';
 
                 q = f->p.bar->text;
- utfecpy(q, q+sizeof(((Bar*)0)->text), (char*)m.pos);
+ utflcpy(q, (char*)m.pos, sizeof(((Bar*)0)->text));
 
                 free(p);
 
diff -r 78e7a0ff3120 -r 42cf35f3acd3 cmd/wmii/key.c
--- a/cmd/wmii/key.c Sat Jul 14 12:05:07 2007 -0400
+++ b/cmd/wmii/key.c Mon Jul 16 16:52:35 2007 -0400
@@ -97,7 +97,7 @@ get_key(const char *name) {
                 ungrab_key(k);
                 return k;
         }
- strncpy(buf, name, sizeof(buf));
+ utflcpy(buf, name, sizeof(buf));
         toks = tokenize(seq, 8, buf, ',');
         for(i = 0; i < toks; i++) {
                 if(!k)
@@ -106,7 +106,7 @@ get_key(const char *name) {
                         k->next = emallocz(sizeof(Key));
                         k = k->next;
                 }
- strncpy(k->name, name, sizeof(k->name));
+ utflcpy(k->name, name, sizeof(k->name));
                 kstr = strrchr(seq[i], '-');
                 if(kstr)
                         kstr++;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 cmd/wmii/main.c
--- a/cmd/wmii/main.c Sat Jul 14 12:05:07 2007 -0400
+++ b/cmd/wmii/main.c Mon Jul 16 16:52:35 2007 -0400
@@ -475,7 +475,7 @@ main(int argc, char *argv[]) {
         def.colmode = Coldefault;
 
         def.mod = Mod1Mask;
- strncpy(def.grabmod, "Mod1", sizeof(def.grabmod));
+ strcpy(def.grabmod, "Mod1");
 
         loadcolor(&def.focuscolor, FOCUSCOLORS);
         loadcolor(&def.normcolor, NORMCOLORS);
diff -r 78e7a0ff3120 -r 42cf35f3acd3 cmd/wmii/message.c
--- a/cmd/wmii/message.c Sat Jul 14 12:05:07 2007 -0400
+++ b/cmd/wmii/message.c Mon Jul 16 16:52:35 2007 -0400
@@ -359,7 +359,7 @@ message_root(void *p, IxpMsg *m) {
                 if((n & (Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) == 0)
                         return Ebadvalue;
 
- strncpy(def.grabmod, s, sizeof(def.grabmod));
+ utflcpy(def.grabmod, s, sizeof(def.grabmod));
                 def.mod = n;
                 break;
         default:
@@ -511,7 +511,7 @@ send_client(View *v, IxpMsg *m, Bool swa
                 break;
         }
 
- if(!to && !swap && (f->anext || f != a->frame))
+ if(!to && !swap && (f->anext || f != f->area->frame))
                 to = new_column(v, a, 0);
 
         if(!to)
diff -r 78e7a0ff3120 -r 42cf35f3acd3 cmd/wmii/rule.c
--- a/cmd/wmii/rule.c Sat Jul 14 12:05:07 2007 -0400
+++ b/cmd/wmii/rule.c Mon Jul 16 16:52:35 2007 -0400
@@ -77,7 +77,7 @@ update_rules(Rule **rule, const char *da
                                 trim(value, " \t/");
                                 (*rule)->regex = regcomp(regex);
                                 if((*rule)->regex) {
- strncpy((*rule)->value, value, sizeof(rul->value));
+ utflcpy((*rule)->value, value, sizeof(rul->value));
                                         rule = &(*rule)->next;
                                 }
                                 else free(*rule);
diff -r 78e7a0ff3120 -r 42cf35f3acd3 cmd/wmii/view.c
--- a/cmd/wmii/view.c Sat Jul 14 12:05:07 2007 -0400
+++ b/cmd/wmii/view.c Mon Jul 16 16:52:35 2007 -0400
@@ -64,7 +64,7 @@ create_view(const char *name) {
         v = emallocz(sizeof(View));
         v->id = id++;
 
- strncpy(v->name, name, sizeof(v->name));
+ utflcpy(v->name, name, sizeof(v->name));
 
         write_event("CreateTag %s\n", v->name);
         create_area(v, nil, 0);
@@ -154,7 +154,7 @@ select_view(const char *arg) {
 select_view(const char *arg) {
         char buf[256];
 
- strncpy(buf, arg, sizeof(buf));
+ utflcpy(buf, arg, sizeof(buf));
         trim(buf, " \t+/");
 
         if(strlen(buf) == 0)
@@ -172,7 +172,8 @@ attach_to_view(View *v, Frame *f) {
         
         c = f->client;
         c->revert = nil;
- if(c->trans || c->floating || c->fixedsize || c->fullscreen)
+ if(c->trans || c->floating || c->fixedsize
+ || c->titleless || c->borderless || c->fullscreen)
                 focus_area(v->area);
         else if(starting && v->sel->floating)
                 focus_area(v->area->next);
diff -r 78e7a0ff3120 -r 42cf35f3acd3 cmd/wmii/x11.c
--- a/cmd/wmii/x11.c Sat Jul 14 12:05:07 2007 -0400
+++ b/cmd/wmii/x11.c Mon Jul 16 16:52:35 2007 -0400
@@ -483,7 +483,7 @@ loadcolor(CTuple *c, char *str) {
 loadcolor(CTuple *c, char *str) {
         char buf[24];
 
- strncpy(buf, str, sizeof buf);
+ utflcpy(buf, str, sizeof(buf));
         memcpy(c->colstr, str, sizeof c->colstr);
 
         buf[7] = buf[15] = buf[23] = '\0';
diff -r 78e7a0ff3120 -r 42cf35f3acd3 cmd/wmiir.c
--- a/cmd/wmiir.c Sat Jul 14 12:05:07 2007 -0400
+++ b/cmd/wmiir.c Mon Jul 16 16:52:35 2007 -0400
@@ -16,7 +16,7 @@ static IxpClient *client;
 
 static void
 usage(void) {
- fprintf(stderr,
+ fprint(1,
                    "usage: %1$s [-a <address>] {create | read | ls [-ld] | remove | rm | write} <file>\n"
                    " %1$s [-a <address>] xwrite <file> <data>\n"
                    " %1$s -v\n", argv0);
@@ -64,7 +64,7 @@ setrwx(long m, char *s) {
 }
 
 static char *
-str_of_mode(uint mode) {
+modestr(uint mode) {
         static char buf[16];
 
         buf[0]='-';
@@ -79,7 +79,7 @@ str_of_mode(uint mode) {
 }
 
 static char *
-str_of_time(uint val) {
+timestr(uint val) {
         static char buf[32];
 
         ctime_r((time_t*)&val, buf);
@@ -90,13 +90,14 @@ static void
 static void
 print_stat(Stat *s, int lflag) {
         if(lflag)
- fprintf(stdout, "%s %s %s %5llu %s %s\n", str_of_mode(s->mode),
- s->uid, s->gid, s->length, str_of_time(s->mtime), s->name);
+ print("%s %s %s %5llud %s %s\n",
+ modestr(s->mode), s->uid, s->gid, s->length,
+ timestr(s->mtime), s->name);
         else {
                 if((s->mode&P9_DMDIR) && strcmp(s->name, "/"))
- fprintf(stdout, "%s/\n", s->name);
+ print("%s/\n", s->name);
                 else
- fprintf(stdout, "%s\n", s->name);
+ print("%s\n", s->name);
         }
 }
 
@@ -317,7 +318,7 @@ main(int argc, char *argv[]) {
 
         ARGBEGIN{
         case 'v':
- printf("%s-" VERSION ", ©2007 Kris Maglione\n", argv0);
+ print("%s-" VERSION ", ©2007 Kris Maglione\n", argv0);
                 exit(0);
         case 'a':
                 address = EARGF(usage());
diff -r 78e7a0ff3120 -r 42cf35f3acd3 config.mk
--- a/config.mk Sat Jul 14 12:05:07 2007 -0400
+++ b/config.mk Mon Jul 16 16:52:35 2007 -0400
@@ -14,7 +14,7 @@ LIBS = -L/usr/lib -lc -L${ROOT}/lib
 
 # Flags
 include ${ROOT}/mk/gcc.mk
-CFLAGS += -g -O0
+CFLAGS += -g -O0 -DIXPlint
 LDFLAGS += -g ${LIBS}
 STATIC = -static
 MKDEP = cpp -M
diff -r 78e7a0ff3120 -r 42cf35f3acd3 include/bio.h
--- a/include/bio.h Sat Jul 14 12:05:07 2007 -0400
+++ b/include/bio.h Mon Jul 16 16:52:35 2007 -0400
@@ -70,8 +70,8 @@ int Binits(Biobuf*, int, int, unsigned c
 int Binits(Biobuf*, int, int, unsigned char*, int);
 int Blinelen(Biobuf*);
 off_t Boffset(Biobuf*);
-Biobuf* Bopen(char*, int);
-int Bprint(Biobuf*, char*, ...);
+Biobuf* Bopen(const char*, int);
+int Bprint(Biobuf*, const char*, ...);
 int Bputc(Biobuf*, int);
 int Bputrune(Biobuf*, long);
 void* Brdline(Biobuf*, int);
@@ -82,6 +82,6 @@ int Bungetc(Biobuf*);
 int Bungetc(Biobuf*);
 int Bungetrune(Biobuf*);
 long Bwrite(Biobuf*, void*, long);
-int Bvprint(Biobuf*, char*, va_list);
+int Bvprint(Biobuf*, const char*, va_list);
 
 #endif
diff -r 78e7a0ff3120 -r 42cf35f3acd3 include/fmt.h
--- a/include/fmt.h Sat Jul 14 12:05:07 2007 -0400
+++ b/include/fmt.h Mon Jul 16 16:52:35 2007 -0400
@@ -108,41 +108,41 @@ extern int (*fmtdoquote)(int);
 #endif
 
 /* Edit .+1,/^$/ | cfn $PLAN9/src/lib9/fmt/?*.c | grep -v static |grep -v __ */
-int dofmt(Fmt *f, char *fmt);
+int dofmt(Fmt *f, const char *fmt);
 int dorfmt(Fmt *f, const Rune *fmt);
 double fmtcharstod(int(*f)(void*), void *vp);
 int fmtfdflush(Fmt *f);
 int fmtfdinit(Fmt *f, int fd, char *buf, int size);
 int fmtinstall(int c, int (*f)(Fmt*));
-int fmtprint(Fmt *f, char *fmt, ...);
+int fmtprint(Fmt *f, const char *fmt, ...);
 int fmtrune(Fmt *f, int r);
 int fmtrunestrcpy(Fmt *f, Rune *s);
-int fmtstrcpy(Fmt *f, char *s);
+int fmtstrcpy(Fmt *f, const char *s);
 char* fmtstrflush(Fmt *f);
 int fmtstrinit(Fmt *f);
 double fmtstrtod(const char *as, char **aas);
-int fmtvprint(Fmt *f, char *fmt, va_list args);
-int fprint(int fd, char *fmt, ...);
-int print(char *fmt, ...);
+int fmtvprint(Fmt *f, const char *fmt, va_list args);
+int fprint(int fd, const char *fmt, ...);
+int print(const char *fmt, ...);
 void quotefmtinstall(void);
 int quoterunestrfmt(Fmt *f);
 int quotestrfmt(Fmt *f);
 Rune* runefmtstrflush(Fmt *f);
 int runefmtstrinit(Fmt *f);
-Rune* runeseprint(Rune *buf, Rune *e, char *fmt, ...);
-Rune* runesmprint(char *fmt, ...);
-int runesnprint(Rune *buf, int len, char *fmt, ...);
-int runesprint(Rune *buf, char *fmt, ...);
-Rune* runevseprint(Rune *buf, Rune *e, char *fmt, va_list args);
-Rune* runevsmprint(char *fmt, va_list args);
-int runevsnprint(Rune *buf, int len, char *fmt, va_list args);
-char* seprint(char *buf, char *e, char *fmt, ...);
-char* smprint(char *fmt, ...);
-int snprint(char *buf, int len, char *fmt, ...);
-int sprint(char *buf, char *fmt, ...);
-int vfprint(int fd, char *fmt, va_list args);
-char* vseprint(char *buf, char *e, char *fmt, va_list args);
-char* vsmprint(char *fmt, va_list args);
-int vsnprint(char *buf, int len, char *fmt, va_list args);
+Rune* runeseprint(Rune *buf, Rune *e, const char *fmt, ...);
+Rune* runesmprint(const char *fmt, ...);
+int runesnprint(Rune *buf, int len, const char *fmt, ...);
+int runesprint(Rune *buf, const char *fmt, ...);
+Rune* runevseprint(Rune *buf, Rune *e, const char *fmt, va_list args);
+Rune* runevsmprint(const char *fmt, va_list args);
+int runevsnprint(Rune *buf, int len, const char *fmt, va_list args);
+char* seprint(char *buf, char *e, const char *fmt, ...);
+char* smprint(const char *fmt, ...);
+int snprint(char *buf, int len, const char *fmt, ...);
+int sprint(char *buf, const char *fmt, ...);
+int vfprint(int fd, const char *fmt, va_list args);
+char* vseprint(char *buf, char *e, const char *fmt, va_list args);
+char* vsmprint(const char *fmt, va_list args);
+int vsnprint(char *buf, int len, const char *fmt, va_list args);
 
 #endif
diff -r 78e7a0ff3120 -r 42cf35f3acd3 include/utf.h
--- a/include/utf.h Sat Jul 14 12:05:07 2007 -0400
+++ b/include/utf.h Mon Jul 16 16:52:35 2007 -0400
@@ -12,8 +12,8 @@ enum
 };
 
 /* Edit .+1,/^$/ | cfn $PLAN9/src/lib9/utf/?*.c | grep -v static |grep -v __ */
-int chartorune(Rune *rune, char *str);
-int fullrune(char *str, int n);
+int chartorune(Rune *rune, const char *str);
+int fullrune(const char *str, int n);
 int isalpharune(Rune c);
 int islowerrune(Rune c);
 int isspacerune(Rune c);
@@ -37,11 +37,11 @@ Rune tolowerrune(Rune c);
 Rune tolowerrune(Rune c);
 Rune totitlerune(Rune c);
 Rune toupperrune(Rune c);
-char* utfecpy(char *to, char *e, char *from);
-int utflen(char *s);
-int utfnlen(char *s, long m);
-char* utfrrune(char *s, long c);
-char* utfrune(char *s, long c);
-char* utfutf(char *s1, char *s2);
+char* utfecpy(char *to, char *e, const char *from);
+int utflen(const char *s);
+int utfnlen(const char *s, long m);
+char* utfrrune(const char *s, long c);
+char* utfrune(const char *s, long c);
+char* utfutf(const char *s1, const char *s2);
 
 #endif
diff -r 78e7a0ff3120 -r 42cf35f3acd3 include/util.h
--- a/include/util.h Sat Jul 14 12:05:07 2007 -0400
+++ b/include/util.h Mon Jul 16 16:52:35 2007 -0400
@@ -34,6 +34,7 @@ int max(int a, int b);
 int max(int a, int b);
 int min(int a, int b);
 char *str_nil(char *s);
+int utflcpy(char *to, const char *from, int l);
 uint strlcat(char *dst, const char *src, unsigned int siz);
 
 char *argv0;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libbio/binit.c
--- a/libbio/binit.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libbio/binit.c Mon Jul 16 16:52:35 2007 -0400
@@ -112,7 +112,7 @@ Bfdopen(int f, int mode)
 }
 
 Biobuf*
-Bopen(char *name, int mode)
+Bopen(const char *name, int mode)
 {
         Biobuf *bp;
         int f;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libbio/bprint.c
--- a/libbio/bprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libbio/bprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -2,7 +2,7 @@
 #include <bio.h>
 
 int
-Bprint(Biobuf *bp, char *fmt, ...)
+Bprint(Biobuf *bp, const char *fmt, ...)
 {
         int n;
         va_list arg;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libbio/bvprint.c
--- a/libbio/bvprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libbio/bvprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -17,7 +17,7 @@ fmtBflush(Fmt *f)
 }
 
 int
-Bvprint(Biobuf *bp, char *fmt, va_list arg)
+Bvprint(Biobuf *bp, const char *fmt, va_list arg)
 {
         int n;
         Fmt f;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/dofmt.c
--- a/libfmt/dofmt.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/dofmt.c Mon Jul 16 16:52:35 2007 -0400
@@ -19,7 +19,7 @@
 
 /* format the output into f->to and return the number of characters fmted */
 int
-dofmt(Fmt *f, char *fmt)
+dofmt(Fmt *f, const char *fmt)
 {
         Rune rune, *rt, *rs;
         int r;
@@ -249,7 +249,7 @@ __runefmt(Fmt *f)
 
 /* public helper routine: fmt out a null terminated string already in hand */
 int
-fmtstrcpy(Fmt *f, char *s)
+fmtstrcpy(Fmt *f, const char *s)
 {
         int i, j;
         Rune r;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/fmt.c
--- a/libfmt/fmt.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/fmt.c Mon Jul 16 16:52:35 2007 -0400
@@ -137,7 +137,7 @@ fmtfmt(int c)
 }
 
 void*
-__fmtdispatch(Fmt *f, void *fmt, int isrunes)
+__fmtdispatch(Fmt *f, const void *fmt, int isrunes)
 {
         Rune rune, r;
         int i, n;
@@ -213,6 +213,6 @@ __fmtdispatch(Fmt *f, void *fmt, int isr
                 if(n < 0)
                         return nil;
                 if(n == 0)
- return fmt;
+ return (void*)fmt;
         }
 }
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/fmtdef.h
--- a/libfmt/fmtdef.h Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/fmtdef.h Mon Jul 16 16:52:35 2007 -0400
@@ -43,7 +43,7 @@ int __flagfmt(Fmt *f);
 int __flagfmt(Fmt *f);
 int __fmtFdFlush(Fmt *f);
 int __fmtcpy(Fmt *f, const void *vm, int n, int sz);
-void* __fmtdispatch(Fmt *f, void *fmt, int isrunes);
+void* __fmtdispatch(Fmt *f, const void *fmt, int isrunes);
 void * __fmtflush(Fmt *f, void *t, int len);
 void __fmtlock(void);
 int __fmtpad(Fmt *f, int n);
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/fmtprint.c
--- a/libfmt/fmtprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/fmtprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -23,7 +23,7 @@
  * but ignore any width flags
  */
 int
-fmtprint(Fmt *f, char *fmt, ...)
+fmtprint(Fmt *f, const char *fmt, ...)
 {
         va_list va;
         int n;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/fmtvprint.c
--- a/libfmt/fmtvprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/fmtvprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -24,7 +24,7 @@
  * but ignore any width flags
  */
 int
-fmtvprint(Fmt *f, char *fmt, va_list args)
+fmtvprint(Fmt *f, const char *fmt, va_list args)
 {
         va_list va;
         int n;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/fprint.c
--- a/libfmt/fprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/fprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -17,7 +17,7 @@
 #include "fmtdef.h"
 
 int
-fprint(int fd, char *fmt, ...)
+fprint(int fd, const char *fmt, ...)
 {
         int n;
         va_list args;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/print.c
--- a/libfmt/print.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/print.c Mon Jul 16 16:52:35 2007 -0400
@@ -17,7 +17,7 @@
 #include "fmtdef.h"
 
 int
-print(char *fmt, ...)
+print(const char *fmt, ...)
 {
         int n;
         va_list args;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/runeseprint.c
--- a/libfmt/runeseprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/runeseprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -18,7 +18,7 @@
 #include "fmtdef.h"
 
 Rune*
-runeseprint(Rune *buf, Rune *e, char *fmt, ...)
+runeseprint(Rune *buf, Rune *e, const char *fmt, ...)
 {
         Rune *p;
         va_list args;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/runesmprint.c
--- a/libfmt/runesmprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/runesmprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -18,7 +18,7 @@
 #include "fmtdef.h"
 
 Rune*
-runesmprint(char *fmt, ...)
+runesmprint(const char *fmt, ...)
 {
         va_list args;
         Rune *p;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/runesnprint.c
--- a/libfmt/runesnprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/runesnprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -18,7 +18,7 @@
 #include "fmtdef.h"
 
 int
-runesnprint(Rune *buf, int len, char *fmt, ...)
+runesnprint(Rune *buf, int len, const char *fmt, ...)
 {
         int n;
         va_list args;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/runesprint.c
--- a/libfmt/runesprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/runesprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -18,7 +18,7 @@
 #include "fmtdef.h"
 
 int
-runesprint(Rune *buf, char *fmt, ...)
+runesprint(Rune *buf, const char *fmt, ...)
 {
         int n;
         va_list args;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/runevseprint.c
--- a/libfmt/runevseprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/runevseprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -18,7 +18,7 @@
 #include "fmtdef.h"
 
 Rune*
-runevseprint(Rune *buf, Rune *e, char *fmt, va_list args)
+runevseprint(Rune *buf, Rune *e, const char *fmt, va_list args)
 {
         Fmt f;
 
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/runevsmprint.c
--- a/libfmt/runevsmprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/runevsmprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -70,7 +70,7 @@ runefmtstrinit(Fmt *f)
  * print into an allocated string buffer
  */
 Rune*
-runevsmprint(char *fmt, va_list args)
+runevsmprint(const char *fmt, va_list args)
 {
         Fmt f;
         int n;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/runevsnprint.c
--- a/libfmt/runevsnprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/runevsnprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -18,7 +18,7 @@
 #include "fmtdef.h"
 
 int
-runevsnprint(Rune *buf, int len, char *fmt, va_list args)
+runevsnprint(Rune *buf, int len, const char *fmt, va_list args)
 {
         Fmt f;
 
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/seprint.c
--- a/libfmt/seprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/seprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -17,7 +17,7 @@
 #include "fmtdef.h"
 
 char*
-seprint(char *buf, char *e, char *fmt, ...)
+seprint(char *buf, char *e, const char *fmt, ...)
 {
         char *p;
         va_list args;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/smprint.c
--- a/libfmt/smprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/smprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -17,7 +17,7 @@
 #include "fmtdef.h"
 
 char*
-smprint(char *fmt, ...)
+smprint(const char *fmt, ...)
 {
         va_list args;
         char *p;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/snprint.c
--- a/libfmt/snprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/snprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -17,7 +17,7 @@
 #include "fmtdef.h"
 
 int
-snprint(char *buf, int len, char *fmt, ...)
+snprint(char *buf, int len, const char *fmt, ...)
 {
         int n;
         va_list args;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/sprint.c
--- a/libfmt/sprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/sprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -16,7 +16,7 @@
 #include "fmtdef.h"
 
 int
-sprint(char *buf, char *fmt, ...)
+sprint(char *buf, const char *fmt, ...)
 {
         int n;
         uint len;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/vfprint.c
--- a/libfmt/vfprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/vfprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -17,7 +17,7 @@
 #include "fmtdef.h"
 
 int
-vfprint(int fd, char *fmt, va_list args)
+vfprint(int fd, const char *fmt, va_list args)
 {
         Fmt f;
         char buf[256];
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/vseprint.c
--- a/libfmt/vseprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/vseprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -17,7 +17,7 @@
 #include "fmtdef.h"
 
 char*
-vseprint(char *buf, char *e, char *fmt, va_list args)
+vseprint(char *buf, char *e, const char *fmt, va_list args)
 {
         Fmt f;
 
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/vsmprint.c
--- a/libfmt/vsmprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/vsmprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -70,7 +70,7 @@ fmtstrinit(Fmt *f)
  * print into an allocated string buffer
  */
 char*
-vsmprint(char *fmt, va_list args)
+vsmprint(const char *fmt, va_list args)
 {
         Fmt f;
         int n;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libfmt/vsnprint.c
--- a/libfmt/vsnprint.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libfmt/vsnprint.c Mon Jul 16 16:52:35 2007 -0400
@@ -18,7 +18,7 @@
 #include "fmtdef.h"
 
 int
-vsnprint(char *buf, int len, char *fmt, va_list args)
+vsnprint(char *buf, int len, const char *fmt, va_list args)
 {
         Fmt f;
 
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libutf/rune.c
--- a/libutf/rune.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libutf/rune.c Mon Jul 16 16:52:35 2007 -0400
@@ -41,7 +41,7 @@ enum
 };
 
 int
-chartorune(Rune *rune, char *str)
+chartorune(Rune *rune, const char *str)
 {
         int c, c1, c2;
         long l;
@@ -161,7 +161,7 @@ runenlen(Rune *r, int nrune)
 }
 
 int
-fullrune(char *str, int n)
+fullrune(const char *str, int n)
 {
         int c;
 
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libutf/utfecpy.c
--- a/libutf/utfecpy.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libutf/utfecpy.c Mon Jul 16 16:52:35 2007 -0400
@@ -17,7 +17,7 @@
 #include "utf.h"
 
 char*
-utfecpy(char *to, char *e, char *from)
+utfecpy(char *to, char *e, const char *from)
 {
         char *end;
 
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libutf/utflen.c
--- a/libutf/utflen.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libutf/utflen.c Mon Jul 16 16:52:35 2007 -0400
@@ -17,7 +17,7 @@
 #include "utf.h"
 
 int
-utflen(char *s)
+utflen(const char *s)
 {
         int c;
         long n;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libutf/utfnlen.c
--- a/libutf/utfnlen.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libutf/utfnlen.c Mon Jul 16 16:52:35 2007 -0400
@@ -17,12 +17,12 @@
 #include "utf.h"
 
 int
-utfnlen(char *s, long m)
+utfnlen(const char *s, long m)
 {
         int c;
         long n;
         Rune rune;
- char *es;
+ const char *es;
 
         es = s + m;
         for(n = 0; s < es; n++) {
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libutf/utfrrune.c
--- a/libutf/utfrrune.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libutf/utfrrune.c Mon Jul 16 16:52:35 2007 -0400
@@ -17,11 +17,11 @@
 #include "utf.h"
 
 char*
-utfrrune(char *s, long c)
+utfrrune(const char *s, long c)
 {
         long c1;
         Rune r;
- char *s1;
+ const char *s1;
 
         if(c < Runesync) /* not part of utf sequence */
                 return strrchr(s, c);
@@ -31,7 +31,7 @@ utfrrune(char *s, long c)
                 c1 = *(uchar*)s;
                 if(c1 < Runeself) { /* one byte rune */
                         if(c1 == 0)
- return s1;
+ return (char*)s1;
                         if(c1 == c)
                                 s1 = s;
                         s++;
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libutf/utfrune.c
--- a/libutf/utfrune.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libutf/utfrune.c Mon Jul 16 16:52:35 2007 -0400
@@ -17,7 +17,7 @@
 #include "utf.h"
 
 char*
-utfrune(char *s, long c)
+utfrune(const char *s, long c)
 {
         long c1;
         Rune r;
@@ -32,13 +32,13 @@ utfrune(char *s, long c)
                         if(c1 == 0)
                                 return 0;
                         if(c1 == c)
- return s;
+ return (char*)s;
                         s++;
                         continue;
                 }
                 n = chartorune(&r, s);
                 if(r == c)
- return s;
+ return (char*)s;
                 s += n;
         }
 }
diff -r 78e7a0ff3120 -r 42cf35f3acd3 libutf/utfutf.c
--- a/libutf/utfutf.c Sat Jul 14 12:05:07 2007 -0400
+++ b/libutf/utfutf.c Mon Jul 16 16:52:35 2007 -0400
@@ -22,9 +22,9 @@
  * 0 if none
  */
 char*
-utfutf(char *s1, char *s2)
+utfutf(const char *s1, const char *s2)
 {
- char *p;
+ const char *p;
         long f, n1, n2;
         Rune r;
 
@@ -36,6 +36,6 @@ utfutf(char *s1, char *s2)
         n2 = strlen(s2);
         for(p=s1; p=utfrune(p, f); p+=n1)
                 if(strncmp(p, s2, n2) == 0)
- return p;
+ return (char*)p;
         return 0;
 }
diff -r 78e7a0ff3120 -r 42cf35f3acd3 mk/gcc.mk
--- a/mk/gcc.mk Sat Jul 14 12:05:07 2007 -0400
+++ b/mk/gcc.mk Mon Jul 16 16:52:35 2007 -0400
@@ -1,5 +1,5 @@ CFLAGS += \
 CFLAGS += \
- -std=gnu99 \
+ -std=c99 \
         -pipe \
         -Wall \
         -Wno-parentheses \
diff -r 78e7a0ff3120 -r 42cf35f3acd3 rc/rc.wmii.rc
--- a/rc/rc.wmii.rc Sat Jul 14 12:05:07 2007 -0400
+++ b/rc/rc.wmii.rc Mon Jul 16 16:52:35 2007 -0400
@@ -1,9 +1,34 @@
 #!/usr/bin/env wmii9rc
 # WMII Configuration
 
+confpath=`{echo $WMII_CONFPATH | sed 'y/:/ /'}
 oldpath=$path
 path=($PLAN9/bin $path)
 
+# Sanity checks
+if(echo $0 | grep -s '(^|/)rc\.wmii\.local$') {
+ echo >[1=2] Fatal: This file must not be named rc.wmii.local
+ exit badname
+}
+
+fn config_whatis {
+ prog = `{@{path=$confpath whatis $1} | grep -v '^fn|= ' || echo /dev/null}
+ shift; echo $prog $*
+}
+
+if(! test -x $PLAN9/bin/read) {
+ echo 'Can''t find the ''read'' command' >[1=2]
+ xmessage -file - <<'!'
+ exec `{config_whatis wmiirc}
+}
+rc.wmii can't run:
+ You have a Plan 9 utilities installed, but are missing the 'read' command.
+ This likely means that you have an out-of-date 9base installed.
+
+wmiirc will be run instead.
+!
+
+# Configurables
 MODKEY=Mod1
 UP=k
 DOWN=j
@@ -16,43 +41,6 @@ WMII_BACKGROUND='#333333'
 WMII_BACKGROUND='#333333'
 
 WMII_TERM=(xterm)
-
-fn wmiimenu {
- dmenu -b -fn $WMII_FONT \
- -nf $WMII_NORMCOLORS(1) -nb $WMII_NORMCOLORS(2) \
- -sf $WMII_FOCUSCOLORS(1) -sb $WMII_FOCUSCOLORS(2)
-}
-
-fn 9menu {
- wmii9menu -font $WMII_FONT \
- -^(nf nb br)^$WMII_NORMCOLORS \
- -^(sf sb br)^$WMII_FOCUSCOLORS $*
-}
-
-fn config_whatis {
- confpath=`{echo $WMII_CONFPATH | sed 'y/:/ /'}
- prog = `{{path=$confpath whatis $1} | grep -v '^fn|= '}; shift
- if(~ $#prog 0)
- prog = /dev/null
- echo $prog $*
-}
-
-if(echo $0 | grep -vs '/rc.wmii$') {
- echo Fatal: This file should only be run as rc.wmii >[1=2]
- exit badname
-}
-
-if(! test -x $PLAN9/bin/read) {
- echo 'Can''t find the ''read'' command' >[1=2]
- xmessage -file - <<'!'
- exec `{config_whatis wmiirc}
-}
-rc.wmii can't run:
- You have a Plan 9 utilities installed, but are missing the 'read' command.
- This likely means that you have an out-of-date 9base installed.
-
-wmiirc will be run instead.
-!
 
 # Column Rules
 wmiir write /colrules <<!
@@ -68,12 +56,22 @@ wmiir write /tagrules <<!
 !
 
 # Status Bar Info
-fn status {
- echo -n `{uptime | sed 's/.*://; s/,//g'} '|' `{date}
-}
-
-# Functions
+fn status { echo -n `{uptime | sed 's/.*://; s/,//g'} '|' `{date} }
+
 fn viewtitle { echo $* }
+
+# Convenience Functions
+fn wmiimenu {
+ dmenu -b -fn $WMII_FONT \
+ -nf $WMII_NORMCOLORS(1) -nb $WMII_NORMCOLORS(2) \
+ -sf $WMII_FOCUSCOLORS(1) -sb $WMII_FOCUSCOLORS(2)
+}
+
+fn 9menu {
+ wmii9menu -font $WMII_FONT \
+ -^(nf nb br)^$WMII_NORMCOLORS \
+ -^(sf sb br)^$WMII_FOCUSCOLORS $*
+}
 
 fn proglist {
         /bin/ls -lL `{echo $* | sed 'y/:/ /'} >[2]/dev/null \
@@ -81,31 +79,33 @@ fn proglist {
                 | sort | uniq
 }
 
-fn getfuns {
- env | sed -n 's/^fn#'^$1^'-([^=]+).*/\1/p'
-}
-
 fn actionlist {
         { proglist $WMII_CONFPATH
                  getfuns Action
         } | sort | uniq
 }
 
-fn initkeys {
- getfuns Key | wmiir write /keys
-}
-
-fn read_tags {
- wmiir ls /tag | sed 's,/,,; /^sel$/d'
-}
-
-fn run_command {
- @{
- rfork ns
- path=$oldpath
- eval exec $* &
- }
-}
+fn run_command { @{
+ rfork ns
+ path=$oldpath
+ eval exec $* &
+ }
+}
+
+fn getfuns { env | sed -n 's/^fn#'^$1^'-([^=]+).*/\1/p' }
+fn initkeys { getfuns Key | wmiir write /keys }
+fn read_tags { wmiir ls /tag | sed 's,/,,; /^sel$/d' }
+fn 'fn?' {rc -c 'whatis '$1 >[2]/dev/null | grep -s '^fn ' }
+
+# Events
+fn Event-Start {
+ switch($1) {
+ case wmiirc
+ rm -f $progs_file
+ exit
+ }
+}
+fn Event-Key { Key-$1 $1 }
 
 fn Event-CreateTag { echo $WMII_NORMCOLORS `{viewtitle $*} | wmiir create /lbar/$"* }
 fn Event-DestroyTag { wmiir remove /lbar/$"* }
@@ -116,7 +116,6 @@ fn Event-NotUrgentTag { shift; wmiir xwr
 
 fn Event-LeftBarClick { shift; wmiir xwrite /ctl view $* }
 
-menulast = ''
 fn Event-ClientMouseDown {
         client = $1; button = $2
         if(~ $button 3) {
@@ -131,10 +130,8 @@ fn Event-ClientMouseDown {
                         menulast = $do;
         }
 }
-
-fn 'fn?' {rc -c 'whatis '$1 >[2]/dev/null | grep -s '^fn ' }
-
-# Actions
+menulast = Nop
+
 fn Action {
         cmd=$1 action=Action-$cmd { shift
                 if('fn?' $action)
@@ -143,28 +140,26 @@ fn Action {
                         run_command `{config_whatis $cmd} $*
         } &
 }
-fn Action-rehash { proglist $PATH >$progs_file }
+
+# Actions
+fn Action-rehash {
+ if(test -d /proc/$pid)
+ for(i in $WMII_NS_DIR/proglist.*) {
+ id=`{echo $i | sed 's/.*\.(.*)/\1/'} \
+ if(! test -d /proc/$id) rm $i
+ }
+ proglist $PATH >$progs_file
+}
 fn Action-quit { wmiir xwrite /ctl quit }
 fn Action-exec { wmiir xwrite /ctl exec $* }
 fn Action-status {
- flag x -
- flag r -
+ flag x -; flag r -
         if(wmiir remove /rbar/status >[2]/dev/null)
                 sleep 2
         echo $WMII_NORMCOLORS | wmiir create /rbar/status
         while(status | wmiir write /rbar/status)
                 sleep 1
 }
-
-# Events
-fn Event-Start {
- switch($1) {
- case wmiirc
- rm -f $progs_file
- exit
- }
-}
-fn Event-Key { eval Key-$1 $1 }
 
 # Source Variables, &c
 local = `{config_whatis rc.wmii.local}
@@ -181,7 +176,13 @@ local = `{config_whatis rc.wmii.local}
         }' $local </dev/null}
 
 # Key Bindings
-fn Key-$MODKEY-Control-t {
+fn key {
+ key=()
+ for(k in Key-$*) if(! 'fn?' $k) key = ($key $k)
+ ~ $#key 0
+}
+
+key $MODKEY-Control-t || fn $key {
         switch(`{wmiir read /keys | wc -l}) {
         case 0 1
                 initkeys
@@ -192,37 +193,40 @@ fn Key-$MODKEY-Control-t {
         }
 }
 
-fn Key-$MODKEY-$LEFT { wmiir xwrite /tag/sel/ctl select left }
-fn Key-$MODKEY-$RIGHT { wmiir xwrite /tag/sel/ctl select right }
-fn Key-$MODKEY-$DOWN { wmiir xwrite /tag/sel/ctl select down }
-fn Key-$MODKEY-$UP { wmiir xwrite /tag/sel/ctl select up }
-
-fn Key-$MODKEY-Shift-$LEFT { wmiir xwrite /tag/sel/ctl send sel left }
-fn Key-$MODKEY-Shift-$RIGHT { wmiir xwrite /tag/sel/ctl send sel right }
-fn Key-$MODKEY-Shift-$DOWN { wmiir xwrite /tag/sel/ctl send sel down }
-fn Key-$MODKEY-Shift-$UP { wmiir xwrite /tag/sel/ctl send sel up }
-
-fn Key-$MODKEY-f { wmiir xwrite /client/sel/ctl Fullscreen toggle }
-
-fn Key-$MODKEY-space { wmiir xwrite /tag/sel/ctl select toggle }
-fn Key-$MODKEY-Shift-space { wmiir xwrite /tag/sel/ctl send sel toggle }
-
-fn Key-$MODKEY-d { wmiir xwrite /tag/sel/ctl colmode sel default }
-fn Key-$MODKEY-s { wmiir xwrite /tag/sel/ctl colmode sel stack }
-fn Key-$MODKEY-m { wmiir xwrite /tag/sel/ctl colmode sel max }
-
-fn Key-$MODKEY-Shift-c { wmiir xwrite /client/sel/ctl kill }
-
-fn Key-$MODKEY-a { Action `{actionlist | wmiimenu} & }
-fn Key-$MODKEY-p { ifs=() { run_command `{wmiimenu <$progs_file} & } }
-fn Key-$MODKEY-Return { run_command $WMII_TERM & }
-fn Key-$MODKEY-t { wmiir xwrite /ctl view `{read_tags | wmiimenu} & }
-fn Key-$MODKEY-Shift-t {
- wmiir xwrite /client/`{wmiir read /client/sel/ctl|sed 1q}^/tags `{read_tags | wmiimenu} &
-}
-
-fn Key-$MODKEY-^`{seq 0 9} { wmiir xwrite /ctl view `{echo $1 | sed 's/.*-//'} }
-fn Key-Shift-$MODKEY-^`{seq 0 9} { wmiir xwrite /client/sel/tags `{echo $1 | sed 's/.*-//'} }
+key $MODKEY-$LEFT || fn $key { wmiir xwrite /tag/sel/ctl select left }
+key $MODKEY-$RIGHT || fn $key { wmiir xwrite /tag/sel/ctl select right }
+key $MODKEY-$DOWN || fn $key { wmiir xwrite /tag/sel/ctl select down }
+key $MODKEY-$UP || fn $key { wmiir xwrite /tag/sel/ctl select up }
+
+key $MODKEY-Shift-$LEFT || fn $key { wmiir xwrite /tag/sel/ctl send sel left }
+key $MODKEY-Shift-$RIGHT || fn $key { wmiir xwrite /tag/sel/ctl send sel right }
+key $MODKEY-Shift-$DOWN || fn $key { wmiir xwrite /tag/sel/ctl send sel down }
+key $MODKEY-Shift-$UP || fn $key { wmiir xwrite /tag/sel/ctl send sel up }
+
+key $MODKEY-f || fn $key { wmiir xwrite /client/sel/ctl Fullscreen toggle }
+
+key $MODKEY-space || fn $key { wmiir xwrite /tag/sel/ctl select toggle }
+key $MODKEY-Shift-space || fn $key { wmiir xwrite /tag/sel/ctl send sel toggle }
+key $MODKEY-d || fn $key { wmiir xwrite /tag/sel/ctl colmode sel default }
+key $MODKEY-s || fn $key { wmiir xwrite /tag/sel/ctl colmode sel stack }
+key $MODKEY-m || fn $key { wmiir xwrite /tag/sel/ctl colmode sel max }
+
+key $MODKEY-Shift-c || fn $key { wmiir xwrite /client/sel/ctl kill }
+
+key $MODKEY-a || fn $key { Action `{actionlist | wmiimenu} & }
+key $MODKEY-p || fn $key { ifs=() { run_command `{wmiimenu <$progs_file} & } }
+key $MODKEY-Return || fn $key { run_command $WMII_TERM & }
+
+key $MODKEY-t || fn $key { wmiir xwrite /ctl view `{read_tags | wmiimenu} & }
+key $MODKEY-Shift-t || fn $key {
+ sel = `{wmiir read /client/sel/ctl | sed 1q} \
+ wmiir xwrite /client/$sel/tags `{read_tags | wmiimenu} &
+}
+
+key $MODKEY-^`{seq 0 9}|| fn $key { wmiir xwrite /ctl view `{echo $1 | sed 's/.*-//'} }
+key Shift-$MODKEY-^`{seq 0 9} || fn $key {
+ wmiir xwrite /client/sel/tags `{echo $1 | sed 's/.*-//'}
+}
 
 # WM Configuration
 wmiir write /ctl <<!
@@ -242,9 +246,9 @@ if not
         . `{config_whatis overridekeys}
 
 # Misc Setup
+progs_file=$WMII_NS_DIR/proglist.$pid
 Action status
-progs_file=$WMII_NS_DIR/proglist.$pid
-proglist $PATH >$progs_file &
+Action rehash
 
 # Tag Bar Setup
 ifs='#
@@ -263,7 +267,7 @@ initkeys
 initkeys
 
 if(echo Start wmiirc | ! wmiir write /event >[2]/dev/null)
- exit 1
+ exit write
 
 # Event Loop
 wmiir read /event |
@@ -271,4 +275,3 @@ wmiir read /event |
                 event = $1; shift
                 Event-$event $*
         } >[2]/dev/null </dev/null
-
diff -r 78e7a0ff3120 -r 42cf35f3acd3 rc/sh.wmii
--- a/rc/sh.wmii Sat Jul 14 12:05:07 2007 -0400
+++ b/rc/sh.wmii Mon Jul 16 16:52:35 2007 -0400
@@ -142,7 +142,7 @@ Event ClientMouseDown {
                 cmp := {~ $lastcmd $*}
                 if {$cmp Nop} {
                 } {$cmp Delete} { echo kill >/client/$client/ctl
- } {$cmp Fullscreen} { echo Fullscreen >/client/$client/ctl
+ } {$cmp Fullscreen} { echo Fullscreen toggle >/client/$client/ctl
                 }
         }
 }
@@ -197,6 +197,8 @@ Key $MODKEY-d { echo colmode sel default
 Key $MODKEY-d { echo colmode sel default >/tag/sel/ctl }
 Key $MODKEY-s { echo colmode sel stack >/tag/sel/ctl }
 Key $MODKEY-m { echo colmode sel max >/tag/sel/ctl }
+
+Key $MODKEY-f { echo Fullscreen toggle >/client/sel/ctl }
 
 Key $MODKEY-Shift-c { echo kill >/client/sel/ctl }
 
diff -r 78e7a0ff3120 -r 42cf35f3acd3 util/compile
--- a/util/compile Sat Jul 14 12:05:07 2007 -0400
+++ b/util/compile Mon Jul 16 16:52:35 2007 -0400
@@ -8,6 +8,7 @@ xtmp=/tmp/cc.$$.$USER.out
 xtmp=/tmp/cc.$$.$USER.out
 
 echo CC $($bin/cleanname ${BASE}$outfile)
+[ -n "$noisycc" ] && echo $CC -o $outfile $CFLAGS $@
 $CC -o $outfile $CFLAGS $@ 2>$xtmp
 status=$?
 
diff -r 78e7a0ff3120 -r 42cf35f3acd3 util/link
--- a/util/link Sat Jul 14 12:05:07 2007 -0400
+++ b/util/link Mon Jul 16 16:52:35 2007 -0400
@@ -21,6 +21,7 @@ xtmp=/tmp/ld.$$.$USER.out
 xtmp=/tmp/ld.$$.$USER.out
 
 echo LD "$($bin/cleanname ${BASE}$outfile)"
+[ -n "$noisycc" ] && echo $LD -o $outfile $ofiles $LDFLAGS $args
 $LD -o $outfile $ofiles $LDFLAGS $args >$xtmp 2>&1
 status=$?
 
Received on Mon Jul 16 2007 - 22:54:31 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:57:37 UTC