[hackers] [wmii] Cleanup build on KenCC.

From: Kris Maglione <jg_AT_suckless.org>
Date: Tue Jul 03 11:19:37 2007

changeset: 2188:b37c9ae37c52
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Tue Jul 03 05:13:01 2007 -0400
summary: Cleanup build on KenCC.

diff -r 88ef945d14cc -r b37c9ae37c52 cmd/util.c
--- a/cmd/util.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/util.c Tue Jul 03 05:13:01 2007 -0400
@@ -6,8 +6,8 @@
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
+#include <util.h>
 #include <fmt.h>
-#include <util.h>
 
 static int
 Vfmt(Fmt *f) {
@@ -28,6 +28,7 @@ fatal(const char *fmt, ...) {
         va_list ap;
 
         fmtinstall('V', Vfmt);
+ fmtinstall('\001', Vfmt);
 
         va_start(ap, fmt);
         fprint(2, "%s: fatal: %V\n", argv0, fmt, ap);
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/area.c
--- a/cmd/wmii/area.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/area.c Tue Jul 03 05:13:01 2007 -0400
@@ -7,7 +7,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <util.h>
 #include "dat.h"
 #include "fns.h"
 
@@ -109,7 +108,7 @@ create_area(View *v, Area *pos, uint w)
                 focus_area(a);
 
         if(!a->floating)
- write_event("CreateColumn %d\n", i);
+ write_event("CreateColumn %ud\n", i);
         return a;
 }
 
@@ -152,7 +151,7 @@ destroy_area(Area *a) {
                         ta = ta->next;
                 focus_area(ta);
         }
- write_event("DestroyColumn %d\n", i);
+ write_event("DestroyColumn %ud\n", i);
 
         free(a);
 }
@@ -173,19 +172,16 @@ send_to_area(Area *to, Frame *f) {
         f->client->revert = from;
 
         detach_from_area(f);
- attach_to_area(to, f, True);
-}
-
-void
-attach_to_area(Area *a, Frame *f, Bool send) {
- uint h, n_frame;
+ attach_to_area(to, f);
+}
+
+void
+attach_to_area(Area *a, Frame *f) {
+ uint n_frame;
         Frame *ft;
         Client *c;
- View *v;
-
- v = a->view;
+
         c = f->client;
- h = 0;
 
         f->area = a;
 
@@ -331,6 +327,8 @@ place_frame(Frame *f) {
                 field = emallocz(sizeof(uint) * mwidth * my);
         }
 
+ SET(cx);
+ SET(cy);
         memset(field, ~0, (sizeof(uint) * mwidth * my));
         for(fr=a->frame; fr; fr=fr->anext) {
                 if(fr == f) {
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/bar.c
--- a/cmd/wmii/bar.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/bar.c Tue Jul 03 05:13:01 2007 -0400
@@ -4,7 +4,6 @@
  */
 #include <stdio.h>
 #include <string.h>
-#include <util.h>
 #include "dat.h"
 #include "fns.h"
 
@@ -98,11 +97,11 @@ draw_bar(WMScreen *s) {
         Bar *b, *tb, *largest, **pb;
         Rectangle r;
         Align align;
- uint width, tw, nb, size;
+ uint width, tw, nb;
         float shrink;
 
- largest = b = tb = nil;
- tw = width = nb = size = 0;
+ largest = nil;
+ tw = width = 0;
         for(nb = 0; nb < nelem(s->bar); nb++)
                 for(b = s->bar[nb]; b; b=b->next) {
                         b->r.min = ZP;
@@ -136,16 +135,13 @@ draw_bar(WMScreen *s) {
                         for(b = largest; b != tb->smaller; b = b->smaller)
                                 b->r.max.x *= shrink;
                 width += tw * shrink;
- tb = nil;
         }
 
+ SET(tb);
         for(nb = 0; nb < nelem(s->bar); nb++)
                 for(b = s->bar[nb]; b; tb=b, b=b->next) {
- if(b == s->bar[BarRight]) {
- align = EAST;
+ if(b == s->bar[BarRight])
                                 b->r.max.x += Dx(s->brect) - width;
- }else
- align = CENTER;
 
                         if(tb)
                                 b->r = rectaddpt(b->r, Pt( tb->r.max.x, 0));
@@ -154,7 +150,10 @@ draw_bar(WMScreen *s) {
         r = rectsubpt(s->brect, s->brect.min);
         fill(screen->ibuf, r, def.normcolor.bg);
         for(nb = 0; nb < nelem(s->bar); nb++)
- for(b = s->bar[nb]; b; tb=b, b=b->next) {
+ for(b = s->bar[nb]; b; b=b->next) {
+ align = CENTER;
+ if(b == s->bar[BarRight])
+ align = EAST;
                         fill(screen->ibuf, b->r, b->col.bg);
                         drawstring(screen->ibuf, def.font, b->r, align, b->text, b->col.fg);
                         border(screen->ibuf, b->r, 1, b->col.border);
@@ -176,6 +175,8 @@ static void
 static void
 bdown_event(Window *w, XButtonPressedEvent *e) {
         Bar *b;
+
+ USED(w);
 
         /* Ungrab so a menu can receive events before the button is released */
         XUngrabPointer(display, e->time);
@@ -196,6 +197,9 @@ static void
 static void
 bup_event(Window *w, XButtonPressedEvent *e) {
         Bar *b;
+
+ USED(w);
+ USED(e);
 
         for(b=screen->bar[BarLeft]; b; b=b->next)
                 if(ptinrect(Pt(e->x, e->y), b->r)) {
@@ -211,6 +215,8 @@ bup_event(Window *w, XButtonPressedEvent
 
 static void
 expose_event(Window *w, XExposeEvent *e) {
+ USED(w);
+ USED(e);
         draw_bar(screen);
 }
 
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/client.c
--- a/cmd/wmii/client.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/client.c Tue Jul 03 05:13:01 2007 -0400
@@ -7,7 +7,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <X11/Xatom.h>
-#include <util.h>
 #include "dat.h"
 #include "fns.h"
 
@@ -123,6 +122,8 @@ manage_client(Client *c) {
 
 static int /* Temporary Xlib error handler */
 ignoreerrors(Display *d, XErrorEvent *e) {
+ USED(d);
+ USED(e);
         return 0;
 }
 
@@ -481,6 +482,7 @@ set_urgent(Client *c, int urgent, Bool w
                         if(c->sel->view == screen->sel)
                                 draw_frame(c->sel);
                         for(f=c->frame; f; f=f->cnext) {
+ SET(ff);
                                 if(!urgent)
                                         for(a=f->view->area; a; a=a->next)
                                                 for(ff=a->frame; ff; ff=ff->anext)
@@ -626,11 +628,9 @@ static void
 static void
 configreq_event(Window *w, XConfigureRequestEvent *e) {
         Rectangle r, cr;
- Frame *f;
         Client *c;
 
         c = w->aux;
- f = c->sel;
 
         r = gravclient(c, ZR);
         r.max = subpt(r.max, r.min);
@@ -664,6 +664,9 @@ configreq_event(Window *w, XConfigureReq
 
 static void
 destroy_event(Window *w, XDestroyWindowEvent *e) {
+ USED(w);
+ USED(e);
+
         Dprint("client.c:destroy_event(%W)\n", w);
         destroy_client(w->aux);
 }
@@ -730,6 +733,8 @@ static void
 static void
 map_event(Window *w, XMapEvent *e) {
         Client *c;
+
+ USED(e);
         
         c = w->aux;
         if(c == selclient())
@@ -798,6 +803,7 @@ update_client_views(Client *c, char **ta
 
         fp = &c->frame;
         while(*fp || *tags) {
+ SET(cmp);
                 while(*fp) {
                         if(*tags) {
                                 cmp = strcmp((*fp)->view->name, *tags);
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/column.c
--- a/cmd/wmii/column.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/column.c Tue Jul 03 05:13:01 2007 -0400
@@ -6,7 +6,6 @@
 #include <math.h>
 #include <stdio.h>
 #include <string.h>
-#include <util.h>
 #include "dat.h"
 #include "fns.h"
 
@@ -168,6 +167,8 @@ static void
 static void
 bdown_event(Window *w, XButtonEvent *e) {
         Divide *d;
+
+ USED(e);
         
         d = w->aux;
         mouse_resizecol(d);
@@ -176,6 +177,8 @@ static void
 static void
 expose_event(Window *w, XExposeEvent *e) {
         Divide *d;
+
+ USED(e);
         
         d = w->aux;
         drawdiv(d);
@@ -243,7 +246,7 @@ scale_column(Area *a) {
                 if(i > ncol)
                         i = ncol;
                 ncol -= i;
- surplus += i * colh;
+ /* surplus += i * colh; */
         }
 
         j = nuncol - 1;
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/dat.h
--- a/cmd/wmii/dat.h Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/dat.h Tue Jul 03 05:13:01 2007 -0400
@@ -5,7 +5,9 @@
 #include <regexp9.h>
 #define IXP_P9_STRUCTS
 #define IXP_NO_P9_
+#include <stdint.h>
 #include <ixp.h>
+#include <util.h>
 #include <utf.h>
 #include <fmt.h>
 #include "x11.h"
@@ -13,14 +15,6 @@
 #define FONT "-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*"
 #define FOCUSCOLORS "#ffffff #335577 #447799"
 #define NORMCOLORS "#222222 #eeeeee #666666"
-
-#ifdef VARARGCK
-# pragma varargck type "C" Client*
-# pragma varargck type "W" Window*
-# pragma varargck type "P" Point
-# pragma varargck type "R" Rectangle
-# pragma varargck type "r" void
-#endif
 
 enum Align {
         NORTH = 0x01,
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/event.c
--- a/cmd/wmii/event.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/event.c Tue Jul 03 05:13:01 2007 -0400
@@ -3,7 +3,6 @@
  */
 #include <stdio.h>
 #include <X11/keysym.h>
-#include <util.h>
 #include "dat.h"
 #include "fns.h"
 #include "printevent.h"
@@ -15,7 +14,7 @@ dispatch_event(XEvent *e) {
                 handler[e->type](e);
 }
 
-#define handle(w, fn, ev) ((w)->handler->fn ? (w)->handler->fn((w), ev) : (void)0)
+#define handle(w, fn, ev) if(!(w)->handler->fn) {}else (w)->handler->fn((w), ev)
 
 uint
 flushevents(long event_mask, Bool dispatch) {
@@ -110,10 +109,8 @@ static void
 static void
 leavenotify(XEvent *e) {
         XCrossingEvent *ev;
- Window *w;
 
         ev = &e->xcrossing;
- w = findwin(ev->window);
         if((ev->window == scr.root.w) && !ev->same_screen) {
                 sel_screen = True;
                 draw_frames();
@@ -208,10 +205,8 @@ static void
 static void
 keypress(XEvent *e) {
         XKeyEvent *ev;
- Window *w;
 
         ev = &e->xkey;
- w = findwin(ev->window);
         ev->state &= valid_mask;
         if(ev->window == scr.root.w)
                 kpress(scr.root.w, ev->state, (KeyCode) ev->keycode);
@@ -230,11 +225,9 @@ static void
 static void
 maprequest(XEvent *e) {
         XMapRequestEvent *ev;
- Window *w;
         XWindowAttributes wa;
 
         ev = &e->xmaprequest;
- w = findwin(ev->window);
 
         if(!XGetWindowAttributes(display, ev->window, &wa))
                 return;
@@ -312,6 +305,9 @@ void
 void
 check_x_event(IxpConn *c) {
         XEvent ev;
+
+ USED(c);
+
         while(XPending(display)) {
                 XNextEvent(display, &ev);
                 dispatch_event(&ev);
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/fns.h Tue Jul 03 05:13:01 2007 -0400
@@ -4,6 +4,12 @@
 
 #ifdef VARARGCK
 # pragma varargck argpos write_event 1
+
+# pragma varargck type "C" Client*
+# pragma varargck type "W" Window*
+# pragma varargck type "P" Point
+# pragma varargck type "R" Rectangle
+# pragma varargck type "r" void
 #endif
 
 /* area.c */
@@ -14,7 +20,7 @@ Area *area_of_id(View*, ushort id);
 Area *area_of_id(View*, ushort id);
 void focus_area(Area*);
 void send_to_area(Area*, Frame*);
-void attach_to_area(Area*, Frame*, Bool send);
+void attach_to_area(Area*, Frame*);
 void detach_from_area(Frame*);
 Client *area_selclient(Area*);
 
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/frame.c
--- a/cmd/wmii/frame.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/frame.c Tue Jul 03 05:13:01 2007 -0400
@@ -3,7 +3,6 @@
  */
 #include <math.h>
 #include <stdio.h>
-#include <util.h>
 #include "dat.h"
 #include "fns.h"
 
@@ -190,6 +189,8 @@ expose_event(Window *w, XExposeEvent *e)
 expose_event(Window *w, XExposeEvent *e) {
         Client *c;
 
+ USED(e);
+
         c = w->aux;
         if(c->sel)
                 draw_frame(c->sel);
@@ -360,15 +361,12 @@ swap_frames(Frame *fa, Frame *fb) {
 
 void
 focus_frame(Frame *f, Bool restack) {
- Frame *old, *old_in_a;
         View *v;
         Area *a, *old_a;
 
         a = f->area;
         v = f->view;
- old = v->sel->sel;
         old_a = v->sel;
- old_in_a = a->sel;
 
         a->sel = f;
 
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/fs.c
--- a/cmd/wmii/fs.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/fs.c Tue Jul 03 05:13:01 2007 -0400
@@ -9,7 +9,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#include <util.h>
 #include "dat.h"
 #include "fns.h"
 
@@ -252,7 +251,7 @@ message(Ixp9Req *r, MsgFunc fn) {
                 c = *p;
                 *p = '\0';
 
- m = ixp_message(s, p-s, 0);
+ m = ixp_message((uchar*)s, p-s, 0);
                 s = fn(f->p.ref, &m);
                 if(s)
                         err = s;
@@ -361,6 +360,7 @@ lookup_file(FileId *parent, char *name)
                                                 file->tab.name = estrdup("sel");
                                         }if(name) goto LastItem;
                                 }
+ SET(id);
                                 if(name) {
                                         id = (uint)strtol(name, &name, 16);
                                         if(*name) goto NextItem;
@@ -595,7 +595,6 @@ fs_read(Ixp9Req *r) {
         int n, offset;
         int size;
 
- offset = 0;
         f = r->fid->aux;
 
         if(!verify_file(f)) {
@@ -610,7 +609,7 @@ fs_read(Ixp9Req *r) {
                 offset = 0;
                 size = r->ifcall.count;
                 buf = emallocz(size);
- m = ixp_message(buf, size, MsgPack);
+ m = ixp_message((uchar*)buf, size, MsgPack);
 
                 tf = f = lookup_file(f, nil);
                 /* Note: f->tab.name == "." so we skip it */
@@ -630,7 +629,7 @@ fs_read(Ixp9Req *r) {
                         free_file(f);
                 }
                 r->ofcall.count = r->ifcall.count - size;
- r->ofcall.data = m.data;
+ r->ofcall.data = (char*)m.data;
                 respond(r, nil);
                 return;
         }
@@ -702,7 +701,7 @@ void
 void
 fs_write(Ixp9Req *r) {
         FileId *f;
- char *errstr = nil;
+ char *errstr;
         uint i;
 
         if(r->ifcall.count == 0) {
@@ -742,7 +741,7 @@ fs_write(Ixp9Req *r) {
                 return;
         case FsFBar:
                 i = strlen(f->p.bar->buf);
- write_to_buf(r, &f->p.bar->buf, &i, 279);
+ write_to_buf(r, f->p.bar->buf, &i, 279);
                 r->ofcall.count = i - r->ifcall.offset;
                 respond(r, nil);
                 return;
@@ -894,15 +893,15 @@ fs_clunk(Ixp9Req *r) {
         case FsFBar:
                 p = toutf8(f->p.bar->buf);
                 
- m = ixp_message(p, strlen(p), 0);
+ m = ixp_message((uchar*)p, strlen(p), 0);
                 parse_colors(&m, &f->p.bar->col);
 
- q = m.end-1;
+ q = (char*)m.end-1;
                 while(q >= (char*)m.pos && *q == '\n')
                         *q-- = '\0';
 
                 q = f->p.bar->text;
- utfecpy(q, q+sizeof((Bar){}.text), m.pos);
+ utfecpy(q, q+sizeof(((Bar*)0)->text), (char*)m.pos);
 
                 free(p);
 
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/geom.c
--- a/cmd/wmii/geom.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/geom.c Tue Jul 03 05:13:01 2007 -0400
@@ -2,7 +2,6 @@
  * See LICENSE file for license details.
  */
 #include <stdio.h>
-#include <util.h>
 #include "dat.h"
 #include "fns.h"
 
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/key.c
--- a/cmd/wmii/key.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/key.c Tue Jul 03 05:13:01 2007 -0400
@@ -4,7 +4,6 @@
 #include <string.h>
 #include <stdlib.h>
 #include <X11/keysym.h>
-#include <util.h>
 #include "dat.h"
 #include "fns.h"
 
@@ -90,7 +89,9 @@ get_key(const char *name) {
         char *kstr;
         uint i, toks;
         static ushort id = 1;
- Key *k = 0, *r = 0;
+ Key *k, *r;
+
+ r = nil;
 
         if((k = name2key(name))) {
                 ungrab_key(k);
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/main.c
--- a/cmd/wmii/main.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/main.c Tue Jul 03 05:13:01 2007 -0400
@@ -14,7 +14,6 @@
 #include <sys/stat.h>
 #include <sys/wait.h>
 #include <unistd.h>
-#include <util.h>
 #include "dat.h"
 #include "fns.h"
 
@@ -115,7 +114,7 @@ init_ns(void) {
                 ns_path = estrdup(&address[5]);
                 s = strrchr(ns_path, '/');
                 if(s != nil)
- s = '\0';
+ *s = '\0';
         }
         else if((s = getenv("NAMESPACE")))
                 ns_path = s;
@@ -152,7 +151,7 @@ init_atoms(void) {
 init_atoms(void) {
         Atom net[] = { xatom("_NET_SUPPORTED"), xatom("_NET_WM_NAME") };
 
- changeprop_long(&scr.root, "_NET_SUPPORTED", "ATOM", net, nelem(net));
+ changeprop_long(&scr.root, "_NET_SUPPORTED", "ATOM", (long*)net, nelem(net));
 }
 
 static void
@@ -162,6 +161,7 @@ create_cursor(int ident, uint shape) {
 
 static void
 init_cursors(void) {
+ static char zchar[1];
         Pixmap pix;
         XColor black, dummy;
 
@@ -180,7 +180,7 @@ init_cursors(void) {
                         "black", &black, &dummy);
         pix = XCreateBitmapFromData(
                         display, scr.root.w,
- (char[]){0}, 1, 1);
+ zchar, 1, 1);
 
         cursor[CurNone] = XCreatePixmapCursor(display,
                         pix, pix,
@@ -252,6 +252,8 @@ errorhandler(Display *dpy, XErrorEvent *
 errorhandler(Display *dpy, XErrorEvent *error) {
         static Bool dead;
         int i;
+
+ USED(dpy);
 
         if(check_other_wm)
                 fatal("another window manager is already running");
@@ -385,11 +387,15 @@ spawn_command(const char *cmd) {
 
 static void
 check_preselect(IxpServer *s) {
+ USED(s);
+
         check_x_event(nil);
 }
 
 static void
 closedisplay(IxpConn *c) {
+ USED(c);
+
         XCloseDisplay(display);
 }
 
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/map.c
--- a/cmd/wmii/map.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/map.c Tue Jul 03 05:13:01 2007 -0400
@@ -2,7 +2,6 @@
 /* Public domain */
 #include <stdlib.h>
 #include <string.h>
-#include <util.h>
 #include "dat.h"
 #include "fns.h"
 
@@ -61,6 +60,7 @@ hashgetp(Map *map, char *str, int create
         if(*e && (*e)->key == nil)
                 (*e)->key = str;
         else {
+ SET(cmp);
                 for(; *e; e = &(*e)->next)
                         if((*e)->hash > h || (cmp = strcmp((*e)->key, str)) >= 0)
                                 break;
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/message.c
--- a/cmd/wmii/message.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/message.c Tue Jul 03 05:13:01 2007 -0400
@@ -6,7 +6,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <util.h>
 #include "dat.h"
 #include "fns.h"
 
@@ -120,7 +119,7 @@ eatrunes(IxpMsg *m, int (*p)(Rune), int
         int n;
 
         while(m->pos < m->end) {
- n = chartorune(&r, m->pos);
+ n = chartorune(&r, (char*)m->pos);
                 if(p(r) != val)
                         break;
                 m->pos += n;
@@ -136,9 +135,9 @@ getword(IxpMsg *m) {
         int n;
 
         eatrunes(m, isspacerune, 1);
- ret = m->pos;
+ ret = (char*)m->pos;
         eatrunes(m, isspacerune, 0);
- n = chartorune(&r, m->pos);
+ n = chartorune(&r, (char*)m->pos);
         *m->pos = '\0';
         m->pos += n;
         eatrunes(m, isspacerune, 1);
@@ -271,7 +270,7 @@ message_view(View *v, IxpMsg *m) {
         default:
                 return Ebadcmd;
         }
- assert(!"can't get here");
+ /* not reached */
 }
 
 char *
@@ -282,7 +281,7 @@ parse_colors(IxpMsg *m, CTuple *col) {
         int i, j;
 
         /* '#%6x #%6x #%6x' */
- p = m->pos;
+ p = (char*)m->pos;
         for(i = 0; i < 3 && p < (char*)m->end; i++) {
                 if(*p++ != '#')
                         return Ebad;
@@ -298,10 +297,10 @@ parse_colors(IxpMsg *m, CTuple *col) {
 
         c = *p;
         *p = '\0';
- loadcolor(col, m->pos);
+ loadcolor(col, (char*)m->pos);
         *p = c;
 
- m->pos = p;
+ m->pos = (uchar*)p;
         eatrunes(m, isspacerune, 1);
         return nil;
 }
@@ -312,6 +311,7 @@ message_root(void *p, IxpMsg *m) {
         char *s, *ret;
         ulong n;
 
+ USED(p);
         ret = nil;
         s = getword(m);
 
@@ -320,11 +320,11 @@ message_root(void *p, IxpMsg *m) {
                 srv.running = 0;
                 break;
         case LEXEC:
- execstr = smprint("exec %s", m->pos);
+ execstr = smprint("exec %s", (char*)m->pos);
                 srv.running = 0;
                 break;
         case LVIEW:
- select_view(m->pos);
+ select_view((char*)m->pos);
                 break;
         case LSELCOLORS:
                 fprint(2, "%s: warning: selcolors have been removed\n", argv0);
@@ -338,7 +338,7 @@ message_root(void *p, IxpMsg *m) {
                 focus_view(screen, screen->sel);
                 break;
         case LFONT:
- fn = loadfont(m->pos);
+ fn = loadfont((char*)m->pos);
                 if(fn) {
                         freefont(def.font);
                         def.font = fn;
@@ -380,6 +380,7 @@ read_root_ctl(void) {
         b = seprint(b, e, "font %s\n", def.font->name);
         b = seprint(b, e, "grabmod %s\n", def.grabmod);
         b = seprint(b, e, "border %d\n", def.border);
+ USED(b);
         return buffer;
 }
 
@@ -415,10 +416,8 @@ static char*
 static char*
 send_frame(Frame *f, int sym, Bool swap) {
         Frame *fp;
- Area *a;
-
- a = f->area;
-
+
+ SET(fp);
         switch(sym) {
         case LUP:
                 fp = f->aprev;
@@ -544,6 +543,7 @@ select_frame(Frame *f, IxpMsg *m, int sy
                 return Ebadvalue;
         a = f->area;
 
+ SET(fp);
         switch(sym) {
         case LUP:
                 for(fp = a->frame; fp->anext; fp = fp->anext)
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/mouse.c
--- a/cmd/wmii/mouse.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/mouse.c Tue Jul 03 05:13:01 2007 -0400
@@ -5,7 +5,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <util.h>
 #include "dat.h"
 #include "fns.h"
 
@@ -99,6 +98,8 @@ expose_event(Window *w, XExposeEvent *e)
         Framewin *f;
         Image *buf;
         CTuple *c;
+
+ USED(e);
 
         f = w->aux;
         c = &def.focuscolor;
@@ -681,7 +682,8 @@ do_mouse_resize(Client *c, Bool opaque,
                 return;
         }
 
- origin = frect = f->r;
+ origin = f->r;
+ frect = f->r;
         rects = rects_of_view(f->area->view, &num, c->frame);
 
         cur = cursor_of_quad(align);
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/printevent.c
--- a/cmd/wmii/printevent.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/printevent.c Tue Jul 03 05:13:01 2007 -0400
@@ -42,7 +42,6 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <util.h>
 #include <bio.h>
 #include "dat.h"
 //#include "fns.h"
@@ -91,7 +90,7 @@ unmask(Pair * list, uint val)
                         s += strlcat(s, p->val, end - s);
                 }
 
- s += strlcat(s, ")", end - s);
+ strlcat(s, ")", end - s);
 
         return buffer;
 }
@@ -110,6 +109,8 @@ strdec(int key) {
 
 static char *
 strign(int key) {
+ USED(key);
+
         return "?";
 }
 
@@ -300,6 +301,7 @@ TColMap(Biobuf *b, va_list *ap) {
         };
         int key;
 
+ key = va_arg(ap, int);
         Bprint(b, "%s", search(list, key, strign));
 }
 
@@ -505,6 +507,7 @@ pevent(void *ev, ...) {
         if(b == nil)
                 b = Bfdopen(2, O_WRONLY);
 
+ n = 0;
         va_start(ap, ev);
         for(;;) {
                 fn = va_arg(ap, Tfn);
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/rule.c
--- a/cmd/wmii/rule.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/rule.c Tue Jul 03 05:13:01 2007 -0400
@@ -6,7 +6,6 @@
 #include <assert.h>
 #include <string.h>
 #include <stdlib.h>
-#include <util.h>
 #include "dat.h"
 #include "fns.h"
 
@@ -39,6 +38,9 @@ update_rules(Rule **rule, const char *da
         char regex[256], value[256];
         char *r, *v;
         const char *p;
+
+ SET(r);
+ SET(v);
 
         if(!data || !strlen(data))
                 return;
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/utf.c
--- a/cmd/wmii/utf.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/utf.c Tue Jul 03 05:13:01 2007 -0400
@@ -2,7 +2,6 @@
 #include <errno.h>
 #include <iconv.h>
 #include <string.h>
-#include <util.h>
 #include "dat.h"
 #include "fns.h"
 
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/view.c
--- a/cmd/wmii/view.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/view.c Tue Jul 03 05:13:01 2007 -0400
@@ -5,7 +5,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <util.h>
 #include "dat.h"
 #include "fns.h"
 
@@ -48,6 +47,7 @@ get_view(const char *name) {
         View *v;
         int cmp;
 
+ SET(cmp);
         for(v = view; v; v=v->next)
                 if((cmp=strcmp(name, v->name)) >= 0)
                         break;
@@ -121,11 +121,10 @@ update_frame_selectors(View *v) {
 
 void
 focus_view(WMScreen *s, View *v) {
- View *old;
         Frame *f;
         Client *c;
-
- old = screen->sel;
+
+ USED(s);
 
         XGrabServer(display);
 
@@ -177,7 +176,7 @@ attach_to_view(View *v, Frame *f) {
                 focus_area(v->area);
         else if(starting && v->sel->floating)
                 focus_area(v->area->next);
- attach_to_area(v->sel, f, False);
+ attach_to_area(v->sel, f);
 }
 
 void
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii/x11.c
--- a/cmd/wmii/x11.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii/x11.c Tue Jul 03 05:13:01 2007 -0400
@@ -7,7 +7,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
-#include <util.h>
 #include <bio.h>
 #include "dat.h"
 #include "fns.h"
@@ -117,7 +116,7 @@ Wfmt(Fmt *f) {
         Window *w;
 
         w = va_arg(f->args, Window*);
- return fmtprint(f, "0x%ux", w->w);
+ return fmtprint(f, "0x%ulx", w->w);
 }
 
 /* Init */
@@ -415,6 +414,7 @@ drawstring(Image *dst, Font *font,
         y = r.min.y + Dy(r) / 2 - h / 2 + font->ascent;
 
         /* shorten text if necessary */
+ SET(w);
         while(len > 0) {
                 w = textwidth_l(font, buf, len + min(shortened, 3));
                 if(w <= Dx(r) - (font->height & ~1))
diff -r 88ef945d14cc -r b37c9ae37c52 cmd/wmii9menu.c
--- a/cmd/wmii9menu.c Mon Jul 02 21:58:14 2007 -0400
+++ b/cmd/wmii9menu.c Tue Jul 03 05:13:01 2007 -0400
@@ -145,6 +145,7 @@ main(int argc, char **argv)
                         exit(0);
                 }
 
+ SET(n);
                 for(ap = argtab; ap->name; ap++) {
                         n = strlen(ap->name);
                         if(strncmp(ap->name, argv[i]+1, n) == 0)
@@ -232,7 +233,7 @@ main(int argc, char **argv)
         run_menu();
 
         XCloseDisplay(dpy);
- exit(0);
+ return 0;
 }
 
 /* usage --- print a usage message and die */
@@ -247,23 +248,6 @@ usage(void)
 }
 
 /* run_menu --- put up the window, execute selected commands */
-
-void
-run_menu(void)
-{
- XEvent ev;
- int i, old, wide, high, dx, dy;
-
- dx = 0;
- for(i = 0; i < numitems; i++) {
- wide = XTextWidth(font, labels[i], strlen(labels[i])) + 4;
- if(wide > dx)
- dx = wide;
- }
- wide = dx;
-
- high = font->ascent + font->descent + 1;
- dy = numitems * high;
 
         enum {
         MouseMask =
@@ -277,14 +261,28 @@ run_menu(void)
                 | ExposureMask
         };
 
+void
+run_menu(void)
+{
+ XEvent ev;
+ int i, old, wide, high, dx;
+
+ dx = 0;
+ for(i = 0; i < numitems; i++) {
+ wide = XTextWidth(font, labels[i], strlen(labels[i])) + 4;
+ if(wide > dx)
+ dx = wide;
+ }
+ wide = dx;
+
+ high = font->ascent + font->descent + 1;
+
         create_window(wide, high);
         warpmouse(wide, high);
 
         XSelectInput(dpy, menuwin, MenuMask);
 
         XMapWindow(dpy, menuwin);
-
- i = 0; /* save menu Item position */
 
         for(;;) {
                 XNextEvent(dpy, &ev);
diff -r 88ef945d14cc -r b37c9ae37c52 config.mk
--- a/config.mk Mon Jul 02 21:58:14 2007 -0400
+++ b/config.mk Tue Jul 03 05:13:01 2007 -0400
@@ -9,20 +9,20 @@ INCLUDE = ${PREFIX}/include
 INCLUDE = ${PREFIX}/include
 
 # Includes and libs
-INCPATH = .:${ROOT}/include:${INCLUDE}:/usr/include
-LIBS = -L/usr/lib -lc -L${ROOT}/lib
+INCPATH = .:${HOME}/libixp/include:${ROOT}/include:${INCLUDE}:/usr/include
+LIBS = -L/usr/lib -lc -L${ROOT}/lib -L${HOME}/libixp/lib
 
 # Flags
-include ${ROOT}/mk/gcc.mk
-CFLAGS += -g -O0
-LDFLAGS += -g ${LIBS}
+#include ${ROOT}/mk/gcc.mk
+CFLAGS = -wF -DVARARGCK
+LDFLAGS += ${LIBS}
 STATIC = -static
 MKDEP = cpp -M
 
 # Compiler
-CC = cc -c
+CC = 8cc
 # Linker (Under normal circumstances, this should *not* be 'ld')
-LD = cc
+LD = : 8l
 # Archiver
 AR = ar crs
 
diff -r 88ef945d14cc -r b37c9ae37c52 include/fmt.h
--- a/include/fmt.h Mon Jul 02 21:58:14 2007 -0400
+++ b/include/fmt.h Tue Jul 03 05:13:01 2007 -0400
@@ -54,6 +54,59 @@ enum{
 
 extern int (*fmtdoquote)(int);
 
+#ifdef VARARGCK
+# pragma varargck argpos fmtprint 2
+# pragma varargck argpos fprint 2
+# pragma varargck argpos print 1
+# pragma varargck argpos runeseprint 3
+# pragma varargck argpos runesmprint 1
+# pragma varargck argpos runesnprint 3
+# pragma varargck argpos runesprint 2
+# pragma varargck argpos seprint 3
+# pragma varargck argpos smprint 1
+# pragma varargck argpos snprint 3
+# pragma varargck argpos sprint 2
+
+# pragma varargck type "lld" vlong
+# pragma varargck type "llx" vlong
+# pragma varargck type "lld" uvlong
+# pragma varargck type "llx" uvlong
+# pragma varargck type "ld" long
+# pragma varargck type "lx" long
+# pragma varargck type "lb" long
+# pragma varargck type "ld" ulong
+# pragma varargck type "lx" ulong
+# pragma varargck type "lb" ulong
+# pragma varargck type "d" int
+# pragma varargck type "x" int
+# pragma varargck type "c" int
+# pragma varargck type "C" int
+# pragma varargck type "b" int
+# pragma varargck type "d" uint
+# pragma varargck type "x" uint
+# pragma varargck type "c" uint
+# pragma varargck type "C" uint
+# pragma varargck type "b" uint
+# pragma varargck type "f" double
+# pragma varargck type "e" double
+# pragma varargck type "g" double
+# pragma varargck type "s" char*
+# pragma varargck type "q" char*
+# pragma varargck type "S" Rune*
+# pragma varargck type "Q" Rune*
+# pragma varargck type "r" void
+# pragma varargck type "%" void
+# pragma varargck type "n" int*
+# pragma varargck type "p" uintptr_t
+# pragma varargck type "p" void*
+# pragma varargck flag ','
+# pragma varargck flag 'h'
+# pragma varargck type "<" void*
+# pragma varargck type "[" void*
+# pragma varargck type "H" void*
+# pragma varargck type "lH" void*
+#endif
+
 /* Edit .+1,/^$/ | cfn $PLAN9/src/lib9/fmt/?*.c | grep -v static |grep -v __ */
 int dofmt(Fmt *f, char *fmt);
 int dorfmt(Fmt *f, const Rune *fmt);
diff -r 88ef945d14cc -r b37c9ae37c52 include/plan9.h
--- a/include/plan9.h Mon Jul 02 21:58:14 2007 -0400
+++ b/include/plan9.h Tue Jul 03 05:13:01 2007 -0400
@@ -1,28 +1,31 @@
 /*
  * compiler directive on Plan 9
  */
-#ifndef USED
-#define USED(x) if(x);else
-#endif
-
-#include <utf.h>
-#include <fmt.h>
-#include <string.h>
-#include <unistd.h>
 
 /*
  * easiest way to make sure these are defined
  */
-#define uchar _p9uchar
-#define ushort _p9ushort
-#define uint _p9uint
-#define ulong _p9ulong
+#ifndef KENC
+# ifndef USED
+# define USED(x) if(x);else
+# endif
+# define uchar _p9uchar
+# define ushort _p9ushort
+# define uint _p9uint
+# define ulong _p9ulong
+#endif
 typedef unsigned char uchar;
 typedef unsigned short ushort;
 typedef unsigned int uint;
 typedef unsigned long ulong;
 typedef long long vlong;
 typedef unsigned long long uvlong;
+
+#include <utf.h>
+#include <stdint.h>
+#include <fmt.h>
+#include <string.h>
+#include <unistd.h>
 
 #define OREAD O_RDONLY
 #define OWRITE O_WRONLY
diff -r 88ef945d14cc -r b37c9ae37c52 include/util.h
--- a/include/util.h Mon Jul 02 21:58:14 2007 -0400
+++ b/include/util.h Tue Jul 03 05:13:01 2007 -0400
@@ -8,12 +8,14 @@
 #undef ulong
 #undef uvlong
 #undef vlong
-#define uchar _wmiiuchar
-#define ushort _wmiiushort
-#define uint _wmiiuint
-#define ulong _wmiiulong
-#define vlong _wmiivlong
-#define uvlong _wmiiuvlong
+#ifndef KENC
+# define uchar _wmiiuchar
+# define ushort _wmiiushort
+# define uint _wmiiuint
+# define ulong _wmiiulong
+# define vlong _wmiivlong
+# define uvlong _wmiiuvlong
+#endif
 typedef unsigned char uchar;
 typedef unsigned short ushort;
 typedef unsigned int uint;
@@ -35,25 +37,33 @@ uint strlcat(char *dst, const char *src,
 uint strlcat(char *dst, const char *src, unsigned int siz);
 
 char *argv0;
+static void *__p;
+static int __i;
 #undef ARGBEGIN
 #undef ARGEND
 #undef ARGF
 #undef EARGF
-#define ARGBEGIN int _argi, _argtmp, _inargv=0; char *_argv; \
- if(!argv0)argv0=ARGF(); _inargv=1; \
+#define ARGBEGIN \
+ int _argi=0, _argtmp=0, _inargv=0; char *_argv=nil; \
+ if(!argv0) argv0=ARGF(); \
+ _inargv=1; USED(_inargv); \
                 while(argc && argv[0][0] == '-') { \
                         _argi=1; _argv=*argv++; argc--; \
                         while(_argv[_argi]) switch(_argv[_argi++])
-#define ARGEND }_inargv=0;USED(_argtmp);USED(_argv);USED(_argi)
+#define ARGEND }_inargv=0;USED(_argtmp);USED(_argv);USED(_argi);USED(_inargv)
+
 #define ARGF() ((_inargv && _argv[_argi]) ? \
- (_argtmp=_argi, _argi=strlen(_argv), _argv+_argtmp) \
- : ((argc > 0) ? (argc--, *argv++) : ((char*)0)))
+ (_argtmp=_argi, _argi=strlen(_argv), __i=_argi,_argv+_argtmp) \
+ : ((argc > 0) ? (--argc, ++argv, __i=argc, __p=argv, (*argv-1)) : ((char*)0)))
+
 #define EARGF(f) ((_inargv && _argv[_argi]) ? \
- (_argtmp=_argi, _argi=strlen(_argv), _argv+_argtmp) \
- : ((argc > 0) ? (argc--, *argv++) : ((f), (char*)0)))
+ (_argtmp=_argi, _argi=strlen(_argv), __i=_argi, _argv+_argtmp) \
+ : ((argc > 0) ? (--argc, ++argv, __i=argc, __p=argv, (*argv-1)) : ((f), (char*)0)))
 
-#undef USED
-#undef SET
-#define USED(x) if(x){}else
-#define SET(x) ((x)=0)
+#ifndef KENC
+# undef USED
+# undef SET
+# define USED(x) if(x){}else
+# define SET(x) ((x)=0)
+#endif
 
diff -r 88ef945d14cc -r b37c9ae37c52 libfmt/dorfmt.c
--- a/libfmt/dorfmt.c Mon Jul 02 21:58:14 2007 -0400
+++ b/libfmt/dorfmt.c Tue Jul 03 05:13:01 2007 -0400
@@ -57,5 +57,4 @@ dorfmt(Fmt *f, const Rune *fmt)
                 if(fmt == nil)
                         return -1;
         }
- return 0; /* not reached */
 }
diff -r 88ef945d14cc -r b37c9ae37c52 libfmt/fltfmt.c
--- a/libfmt/fltfmt.c Mon Jul 02 21:58:14 2007 -0400
+++ b/libfmt/fltfmt.c Tue Jul 03 05:13:01 2007 -0400
@@ -19,9 +19,7 @@
 #include <errno.h>
 #include <stdarg.h>
 #include <ctype.h>
-#include <fmt.h>
 #include "plan9.h"
-#include "fmt.h"
 #include "fmtdef.h"
 
 enum
diff -r 88ef945d14cc -r b37c9ae37c52 libfmt/sprint.c
--- a/libfmt/sprint.c Mon Jul 02 21:58:14 2007 -0400
+++ b/libfmt/sprint.c Tue Jul 03 05:13:01 2007 -0400
@@ -12,9 +12,7 @@
  * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  */
 #include <stdarg.h>
-#include <fmt.h>
 #include "plan9.h"
-#include "fmt.h"
 #include "fmtdef.h"
 
 int
Received on Tue Jul 03 2007 - 11:19:37 UTC

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