clean up mkfile; fix winctlprint bug reported by peter canning

This commit is contained in:
rsc 2005-01-04 21:39:23 +00:00
parent f755d50401
commit 627bae9c76
4 changed files with 15 additions and 21 deletions

View file

@ -285,7 +285,7 @@ void winevent(Window*, char*, ...);
void winmousebut(Window*);
void winaddincl(Window*, Rune*, int);
void wincleartag(Window*);
void winctlprint(Window*, char*, int);
char *winctlprint(Window*, char*, int);
struct Column
{

View file

@ -1,5 +1,3 @@
# Acme is up-to-date w.r.t. sources as of 29 February 2004
<$PLAN9/src/mkhdr
TARG=acme
@ -30,14 +28,6 @@ HFILES=dat.h\
edit.h\
fns.h\
UPDATE=\
mkfile\
$HFILES\
${OFILES:%.$O=%.c}\
SHORTLIB=complete plumb fs mux thread frame draw bio 9
<$PLAN9/src/mkone
LDFLAGS=$LDFLAGS -L$X11/lib -lX11
edit.$O ecmd.$O elog.$O: edit.h

View file

@ -543,15 +543,15 @@ winclean(Window *w, int conservative) /* as it stands, conservative is always TR
return TRUE;
}
void
char*
winctlprint(Window *w, char *buf, int fonts)
{
int n;
n = sprint(buf, "%11d %11d %11d %11d %11d ", w->id, w->tag.file->b.nc,
sprint(buf, "%11d %11d %11d %11d %11d ", w->id, w->tag.file->b.nc,
w->body.file->b.nc, w->isdir, w->dirty);
if(fonts)
sprint(buf+n, "%11d %q %11d" , Dx(w->body.fr.r), w->body.reffont->f->name, w->body.fr.maxtab);
return smprint("%s%11d %q %11d ", buf, Dx(w->body.fr.r),
w->body.reffont->f->name, w->body.fr.maxtab);
return buf;
}
void

View file

@ -255,7 +255,7 @@ xfidread(Xfid *x)
int n, q;
uint off;
char *b;
char buf[128];
char buf[256];
Window *w;
q = FILE(x->f->qid);
@ -295,18 +295,22 @@ xfidread(Xfid *x)
break;
case QWctl:
winctlprint(w, buf, 1);
goto Readbuf;
b = winctlprint(w, buf, 1);
goto Readb;
Readbuf:
n = strlen(buf);
b = buf;
Readb:
n = strlen(b);
if(off > n)
off = n;
if(off+x->fcall.count > n)
x->fcall.count = n-off;
fc.count = x->fcall.count;
fc.data = buf+off;
fc.data = b+off;
respond(x, &fc, nil);
if(b != buf)
free(b);
break;
case QWevent: