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 winmousebut(Window*);
void winaddincl(Window*, Rune*, int); void winaddincl(Window*, Rune*, int);
void wincleartag(Window*); void wincleartag(Window*);
void winctlprint(Window*, char*, int); char *winctlprint(Window*, char*, int);
struct Column 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 <$PLAN9/src/mkhdr
TARG=acme TARG=acme
@ -30,14 +28,6 @@ HFILES=dat.h\
edit.h\ edit.h\
fns.h\ fns.h\
UPDATE=\
mkfile\
$HFILES\
${OFILES:%.$O=%.c}\
SHORTLIB=complete plumb fs mux thread frame draw bio 9
<$PLAN9/src/mkone <$PLAN9/src/mkone
LDFLAGS=$LDFLAGS -L$X11/lib -lX11
edit.$O ecmd.$O elog.$O: edit.h 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; return TRUE;
} }
void char*
winctlprint(Window *w, char *buf, int fonts) winctlprint(Window *w, char *buf, int fonts)
{ {
int n; sprint(buf, "%11d %11d %11d %11d %11d ", w->id, w->tag.file->b.nc,
n = sprint(buf, "%11d %11d %11d %11d %11d ", w->id, w->tag.file->b.nc,
w->body.file->b.nc, w->isdir, w->dirty); w->body.file->b.nc, w->isdir, w->dirty);
if(fonts) 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 void

View file

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