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