1 b3994ec5 2003-12-11 devnull #include <u.h>
2 b3994ec5 2003-12-11 devnull #include <libc.h>
3 b3994ec5 2003-12-11 devnull #include <draw.h>
4 b3994ec5 2003-12-11 devnull #include <thread.h>
5 b3994ec5 2003-12-11 devnull #include <cursor.h>
6 b3994ec5 2003-12-11 devnull #include <mouse.h>
7 b3994ec5 2003-12-11 devnull #include <keyboard.h>
8 b3994ec5 2003-12-11 devnull #include <frame.h>
9 b3994ec5 2003-12-11 devnull #include <fcall.h>
10 b3994ec5 2003-12-11 devnull #include <plumb.h>
11 b3994ec5 2003-12-11 devnull #include "dat.h"
12 b3994ec5 2003-12-11 devnull #include "fns.h"
14 b3994ec5 2003-12-11 devnull int winid;
17 b3994ec5 2003-12-11 devnull wininit(Window *w, Window *clone, Rectangle r)
19 b3994ec5 2003-12-11 devnull Rectangle r1, br;
21 b3994ec5 2003-12-11 devnull Reffont *rf;
22 b3994ec5 2003-12-11 devnull Rune *rp;
25 b3994ec5 2003-12-11 devnull w->tag.w = w;
26 33dc4226 2005-10-31 devnull w->taglines = 1;
27 768d880d 2005-12-21 devnull w->tagexpand = TRUE;
28 b3994ec5 2003-12-11 devnull w->body.w = w;
29 b3994ec5 2003-12-11 devnull w->id = ++winid;
30 b3994ec5 2003-12-11 devnull incref(&w->ref);
31 5a8e63b2 2004-02-29 devnull if(globalincref)
32 5a8e63b2 2004-02-29 devnull incref(&w->ref);
33 b3994ec5 2003-12-11 devnull w->ctlfid = ~0;
34 b3994ec5 2003-12-11 devnull w->utflastqid = -1;
37 33dc4226 2005-10-31 devnull w->tagtop = r;
38 33dc4226 2005-10-31 devnull w->tagtop.max.y = r.min.y + font->height;
40 33dc4226 2005-10-31 devnull r1.max.y = r1.min.y + w->taglines*font->height;
41 b3994ec5 2003-12-11 devnull incref(&reffont.ref);
42 b3994ec5 2003-12-11 devnull f = fileaddtext(nil, &w->tag);
43 b3994ec5 2003-12-11 devnull textinit(&w->tag, f, r1, &reffont, tagcols);
44 b3994ec5 2003-12-11 devnull w->tag.what = Tag;
45 b3994ec5 2003-12-11 devnull /* tag is a copy of the contents, not a tracked image */
46 b3994ec5 2003-12-11 devnull if(clone){
47 b3994ec5 2003-12-11 devnull textdelete(&w->tag, 0, w->tag.file->b.nc, TRUE);
48 b3994ec5 2003-12-11 devnull nc = clone->tag.file->b.nc;
49 b3994ec5 2003-12-11 devnull rp = runemalloc(nc);
50 b3994ec5 2003-12-11 devnull bufread(&clone->tag.file->b, 0, rp, nc);
51 b3994ec5 2003-12-11 devnull textinsert(&w->tag, 0, rp, nc, TRUE);
52 b3994ec5 2003-12-11 devnull free(rp);
53 b3994ec5 2003-12-11 devnull filereset(w->tag.file);
54 b3994ec5 2003-12-11 devnull textsetselect(&w->tag, nc, nc);
56 c1973705 2004-02-09 devnull //assert(w->body.w == w);
58 33dc4226 2005-10-31 devnull r1.min.y += w->taglines*font->height + 1;
59 b3994ec5 2003-12-11 devnull if(r1.max.y < r1.min.y)
60 b3994ec5 2003-12-11 devnull r1.max.y = r1.min.y;
62 b3994ec5 2003-12-11 devnull if(clone){
63 b3994ec5 2003-12-11 devnull f = clone->body.file;
64 b3994ec5 2003-12-11 devnull w->body.org = clone->body.org;
65 b3994ec5 2003-12-11 devnull w->isscratch = clone->isscratch;
66 b3994ec5 2003-12-11 devnull rf = rfget(FALSE, FALSE, FALSE, clone->body.reffont->f->name);
68 b3994ec5 2003-12-11 devnull rf = rfget(FALSE, FALSE, FALSE, nil);
69 c1973705 2004-02-09 devnull //assert(w->body.w == w);
70 b3994ec5 2003-12-11 devnull f = fileaddtext(f, &w->body);
71 b3994ec5 2003-12-11 devnull w->body.what = Body;
72 b3994ec5 2003-12-11 devnull textinit(&w->body, f, r1, rf, textcols);
73 b3994ec5 2003-12-11 devnull r1.min.y -= 1;
74 b3994ec5 2003-12-11 devnull r1.max.y = r1.min.y+1;
75 b3994ec5 2003-12-11 devnull draw(screen, r1, tagcols[BORD], nil, ZP);
76 b3994ec5 2003-12-11 devnull textscrdraw(&w->body);
77 b3994ec5 2003-12-11 devnull w->r = r;
78 b3994ec5 2003-12-11 devnull br.min = w->tag.scrollr.min;
79 b3994ec5 2003-12-11 devnull br.max.x = br.min.x + Dx(button->r);
80 b3994ec5 2003-12-11 devnull br.max.y = br.min.y + Dy(button->r);
81 b3994ec5 2003-12-11 devnull draw(screen, br, button, nil, button->r.min);
82 b3994ec5 2003-12-11 devnull w->filemenu = TRUE;
83 b3994ec5 2003-12-11 devnull w->maxlines = w->body.fr.maxlines;
84 53998c99 2004-09-28 devnull w->autoindent = globalautoindent;
85 c1973705 2004-02-09 devnull //assert(w->body.w == w);
86 b3994ec5 2003-12-11 devnull if(clone){
87 b3994ec5 2003-12-11 devnull w->dirty = clone->dirty;
88 2a373ea4 2005-03-18 devnull w->autoindent = clone->autoindent;
89 b3994ec5 2003-12-11 devnull textsetselect(&w->body, clone->body.q0, clone->body.q1);
90 b3994ec5 2003-12-11 devnull winsettag(w);
95 33dc4226 2005-10-31 devnull * Compute number of tag lines required
96 33dc4226 2005-10-31 devnull * to display entire tag text.
99 33dc4226 2005-10-31 devnull wintaglines(Window *w, Rectangle r)
102 33dc4226 2005-10-31 devnull Rune rune;
104 f8dea3c1 2005-12-16 devnull /* TAG policy here */
106 33dc4226 2005-10-31 devnull if(!w->tagexpand)
107 33dc4226 2005-10-31 devnull return 1;
108 33dc4226 2005-10-31 devnull w->tag.fr.noredraw = 1;
109 33dc4226 2005-10-31 devnull textresize(&w->tag, r, TRUE);
110 33dc4226 2005-10-31 devnull w->tag.fr.noredraw = 0;
112 f8dea3c1 2005-12-16 devnull /* can't use more than we have */
113 33dc4226 2005-10-31 devnull if(w->tag.fr.nlines >= w->tag.fr.maxlines)
114 33dc4226 2005-10-31 devnull return w->tag.fr.maxlines;
116 f8dea3c1 2005-12-16 devnull /* if tag ends with \n, include empty line at end for typing */
117 33dc4226 2005-10-31 devnull n = w->tag.fr.nlines;
118 8b9a1d4c 2006-02-06 devnull if(w->tag.file->b.nc > 0)
119 8b9a1d4c 2006-02-06 devnull bufread(&w->tag.file->b, w->tag.file->b.nc-1, &rune, 1);
120 33dc4226 2005-10-31 devnull if(rune == '\n')
122 8b9a1d4c 2006-02-06 devnull if(n == 0)
124 33dc4226 2005-10-31 devnull return n;
128 33dc4226 2005-10-31 devnull winresize(Window *w, Rectangle r, int safe, int keepextra)
130 cd1d0ab0 2006-01-12 devnull int oy, y, mouseintag, tagresized;
131 b3994ec5 2003-12-11 devnull Image *b;
132 ad80f870 2005-12-16 devnull Point p;
133 33dc4226 2005-10-31 devnull Rectangle br, r1;
135 20ae0b0f 2005-12-16 devnull if(0) fprint(2, "winresize %d %R safe=%d keep=%d h=%d\n", w->id, r, safe, keepextra, font->height);
136 33dc4226 2005-10-31 devnull w->tagtop = r;
137 33dc4226 2005-10-31 devnull w->tagtop.max.y = r.min.y+font->height;
140 f8dea3c1 2005-12-16 devnull * TAG If necessary, recompute the number of lines that should
141 f8dea3c1 2005-12-16 devnull * be in the tag.
144 f8dea3c1 2005-12-16 devnull r1.max.y = min(r.max.y, r1.min.y + w->taglines*font->height);
145 f8dea3c1 2005-12-16 devnull y = r1.max.y;
146 ad80f870 2005-12-16 devnull mouseintag = ptinrect(mouse->xy, w->tag.all);
147 cd1d0ab0 2006-01-12 devnull if(!safe || !w->tagsafe || !eqrect(w->tag.all, r1)){
149 f8dea3c1 2005-12-16 devnull w->taglines = wintaglines(w, r);
150 f8dea3c1 2005-12-16 devnull w->tagsafe = TRUE;
152 f8dea3c1 2005-12-16 devnull /* END TAG */
155 33dc4226 2005-10-31 devnull r1.max.y = min(r.max.y, r1.min.y + w->taglines*font->height);
156 b3994ec5 2003-12-11 devnull y = r1.max.y;
157 cd1d0ab0 2006-01-12 devnull tagresized = 0;
158 d5233ccb 2005-10-31 devnull if(1 || !safe || !eqrect(w->tag.all, r1)){
159 cd1d0ab0 2006-01-12 devnull tagresized = 1;
160 cd1d0ab0 2006-01-12 devnull if(0) fprint(2, "resize tag %R => %R\n", w->tag.all, r1);
161 d5233ccb 2005-10-31 devnull textresize(&w->tag, r1, TRUE);
162 20ae0b0f 2005-12-16 devnull if(0) fprint(2, "=> %R (%R)\n", w->tag.all, w->tag.fr.r);
163 d5233ccb 2005-10-31 devnull y = w->tag.fr.r.max.y;
164 b3994ec5 2003-12-11 devnull b = button;
165 b3994ec5 2003-12-11 devnull if(w->body.file->mod && !w->isdir && !w->isscratch)
166 b3994ec5 2003-12-11 devnull b = modbutton;
167 b3994ec5 2003-12-11 devnull br.min = w->tag.scrollr.min;
168 b3994ec5 2003-12-11 devnull br.max.x = br.min.x + Dx(b->r);
169 b3994ec5 2003-12-11 devnull br.max.y = br.min.y + Dy(b->r);
170 b3994ec5 2003-12-11 devnull draw(screen, br, b, nil, b->r.min);
171 ad80f870 2005-12-16 devnull /* TAG */
172 ad80f870 2005-12-16 devnull if(mouseintag && !ptinrect(mouse->xy, w->tag.all)){
173 ad80f870 2005-12-16 devnull p = mouse->xy;
174 ad80f870 2005-12-16 devnull p.y = w->tag.all.max.y-3;
175 ad80f870 2005-12-16 devnull moveto(mousectl, p);
177 ad80f870 2005-12-16 devnull /* END TAG */
182 33dc4226 2005-10-31 devnull r1.min.y = y;
183 cd1d0ab0 2006-01-12 devnull if(tagresized || !safe || !eqrect(w->body.all, r1)){
185 cd1d0ab0 2006-01-12 devnull if(0) fprint(2, "resizing body; safe=%d all=%R r1=%R\n", safe, w->body.all, r1);
186 33dc4226 2005-10-31 devnull if(y+1+w->body.fr.font->height <= r.max.y){ /* room for one line */
187 b3994ec5 2003-12-11 devnull r1.min.y = y;
188 33dc4226 2005-10-31 devnull r1.max.y = y+1;
189 33dc4226 2005-10-31 devnull draw(screen, r1, tagcols[BORD], nil, ZP);
191 33dc4226 2005-10-31 devnull r1.min.y = min(y, r.max.y);
192 33dc4226 2005-10-31 devnull r1.max.y = r.max.y;
194 33dc4226 2005-10-31 devnull r1.min.y = y;
195 33dc4226 2005-10-31 devnull r1.max.y = y;
197 cd1d0ab0 2006-01-12 devnull if(0) fprint(2, "resizing body; new r=%R; r1=%R\n", r, r1);
198 b3994ec5 2003-12-11 devnull w->r = r;
199 33dc4226 2005-10-31 devnull w->r.max.y = textresize(&w->body, r1, keepextra);
200 cd1d0ab0 2006-01-12 devnull if(0) fprint(2, "after textresize: body.all=%R\n", w->body.all);
201 b3994ec5 2003-12-11 devnull textscrdraw(&w->body);
202 cd1d0ab0 2006-01-12 devnull w->body.all.min.y = oy;
204 b3994ec5 2003-12-11 devnull w->maxlines = min(w->body.fr.nlines, max(w->maxlines, w->body.fr.maxlines));
205 b3994ec5 2003-12-11 devnull return w->r.max.y;
209 b3994ec5 2003-12-11 devnull winlock1(Window *w, int owner)
211 b3994ec5 2003-12-11 devnull incref(&w->ref);
212 b3994ec5 2003-12-11 devnull qlock(&w->lk);
213 b3994ec5 2003-12-11 devnull w->owner = owner;
217 b3994ec5 2003-12-11 devnull winlock(Window *w, int owner)
220 b3994ec5 2003-12-11 devnull File *f;
222 b3994ec5 2003-12-11 devnull f = w->body.file;
223 b3994ec5 2003-12-11 devnull for(i=0; i<f->ntext; i++)
224 b3994ec5 2003-12-11 devnull winlock1(f->text[i]->w, owner);
228 b3994ec5 2003-12-11 devnull winunlock(Window *w)
231 b3994ec5 2003-12-11 devnull File *f;
234 725d9fd7 2005-07-28 devnull * subtle: loop runs backwards to avoid tripping over
235 725d9fd7 2005-07-28 devnull * winclose indirectly editing f->text and freeing f
236 725d9fd7 2005-07-28 devnull * on the last iteration of the loop.
238 b3994ec5 2003-12-11 devnull f = w->body.file;
239 725d9fd7 2005-07-28 devnull for(i=f->ntext-1; i>=0; i--){
240 b3994ec5 2003-12-11 devnull w = f->text[i]->w;
241 b3994ec5 2003-12-11 devnull w->owner = 0;
242 b3994ec5 2003-12-11 devnull qunlock(&w->lk);
243 b3994ec5 2003-12-11 devnull winclose(w);
248 b3994ec5 2003-12-11 devnull winmousebut(Window *w)
250 33dc4226 2005-10-31 devnull moveto(mousectl, addpt(w->tag.scrollr.min,
251 33dc4226 2005-10-31 devnull divpt(Pt(Dx(w->tag.scrollr), font->height), 2)));
255 b3994ec5 2003-12-11 devnull windirfree(Window *w)
258 b3994ec5 2003-12-11 devnull Dirlist *dl;
260 b3994ec5 2003-12-11 devnull if(w->isdir){
261 b3994ec5 2003-12-11 devnull for(i=0; i<w->ndl; i++){
262 b3994ec5 2003-12-11 devnull dl = w->dlp[i];
263 b3994ec5 2003-12-11 devnull free(dl->r);
264 b3994ec5 2003-12-11 devnull free(dl);
266 b3994ec5 2003-12-11 devnull free(w->dlp);
268 b3994ec5 2003-12-11 devnull w->dlp = nil;
269 b3994ec5 2003-12-11 devnull w->ndl = 0;
273 b3994ec5 2003-12-11 devnull winclose(Window *w)
277 b3994ec5 2003-12-11 devnull if(decref(&w->ref) == 0){
278 b3994ec5 2003-12-11 devnull windirfree(w);
279 b3994ec5 2003-12-11 devnull textclose(&w->tag);
280 b3994ec5 2003-12-11 devnull textclose(&w->body);
281 b3994ec5 2003-12-11 devnull if(activewin == w)
282 b3994ec5 2003-12-11 devnull activewin = nil;
283 b3994ec5 2003-12-11 devnull for(i=0; i<w->nincl; i++)
284 b3994ec5 2003-12-11 devnull free(w->incl[i]);
285 b3994ec5 2003-12-11 devnull free(w->incl);
286 b3994ec5 2003-12-11 devnull free(w->events);
287 b3994ec5 2003-12-11 devnull free(w);
292 b3994ec5 2003-12-11 devnull windelete(Window *w)
294 b3994ec5 2003-12-11 devnull Xfid *x;
296 b3994ec5 2003-12-11 devnull x = w->eventx;
298 b3994ec5 2003-12-11 devnull w->nevents = 0;
299 b3994ec5 2003-12-11 devnull free(w->events);
300 b3994ec5 2003-12-11 devnull w->events = nil;
301 b3994ec5 2003-12-11 devnull w->eventx = nil;
302 b3994ec5 2003-12-11 devnull sendp(x->c, nil); /* wake him up */
307 b3994ec5 2003-12-11 devnull winundo(Window *w, int isundo)
309 b3994ec5 2003-12-11 devnull Text *body;
311 b3994ec5 2003-12-11 devnull File *f;
312 b3994ec5 2003-12-11 devnull Window *v;
314 b3994ec5 2003-12-11 devnull w->utflastqid = -1;
315 b3994ec5 2003-12-11 devnull body = &w->body;
316 b3994ec5 2003-12-11 devnull fileundo(body->file, isundo, &body->q0, &body->q1);
317 b3994ec5 2003-12-11 devnull textshow(body, body->q0, body->q1, 1);
318 b3994ec5 2003-12-11 devnull f = body->file;
319 b3994ec5 2003-12-11 devnull for(i=0; i<f->ntext; i++){
320 b3994ec5 2003-12-11 devnull v = f->text[i]->w;
321 b3994ec5 2003-12-11 devnull v->dirty = (f->seq != v->putseq);
322 b3994ec5 2003-12-11 devnull if(v != w){
323 b3994ec5 2003-12-11 devnull v->body.q0 = v->body.fr.p0+v->body.org;
324 b3994ec5 2003-12-11 devnull v->body.q1 = v->body.fr.p1+v->body.org;
327 b3994ec5 2003-12-11 devnull winsettag(w);
331 b3994ec5 2003-12-11 devnull winsetname(Window *w, Rune *name, int n)
333 b3994ec5 2003-12-11 devnull Text *t;
334 b3994ec5 2003-12-11 devnull Window *v;
336 b3994ec5 2003-12-11 devnull static Rune Lslashguide[] = { '/', 'g', 'u', 'i', 'd', 'e', 0 };
337 b3994ec5 2003-12-11 devnull static Rune Lpluserrors[] = { '+', 'E', 'r', 'r', 'o', 'r', 's', 0 };
338 b3994ec5 2003-12-11 devnull t = &w->body;
339 b3994ec5 2003-12-11 devnull if(runeeq(t->file->name, t->file->nname, name, n) == TRUE)
341 b3994ec5 2003-12-11 devnull w->isscratch = FALSE;
342 b3994ec5 2003-12-11 devnull if(n>=6 && runeeq(Lslashguide, 6, name+(n-6), 6))
343 b3994ec5 2003-12-11 devnull w->isscratch = TRUE;
344 b3994ec5 2003-12-11 devnull else if(n>=7 && runeeq(Lpluserrors, 7, name+(n-7), 7))
345 b3994ec5 2003-12-11 devnull w->isscratch = TRUE;
346 b3994ec5 2003-12-11 devnull filesetname(t->file, name, n);
347 b3994ec5 2003-12-11 devnull for(i=0; i<t->file->ntext; i++){
348 b3994ec5 2003-12-11 devnull v = t->file->text[i]->w;
349 b3994ec5 2003-12-11 devnull winsettag(v);
350 b3994ec5 2003-12-11 devnull v->isscratch = w->isscratch;
355 b3994ec5 2003-12-11 devnull wintype(Window *w, Text *t, Rune r)
359 b3994ec5 2003-12-11 devnull texttype(t, r);
360 b3994ec5 2003-12-11 devnull if(t->what == Body)
361 b3994ec5 2003-12-11 devnull for(i=0; i<t->file->ntext; i++)
362 b3994ec5 2003-12-11 devnull textscrdraw(t->file->text[i]);
363 b3994ec5 2003-12-11 devnull winsettag(w);
367 b3994ec5 2003-12-11 devnull wincleartag(Window *w)
369 b3994ec5 2003-12-11 devnull int i, n;
370 b3994ec5 2003-12-11 devnull Rune *r;
372 b3994ec5 2003-12-11 devnull /* w must be committed */
373 b3994ec5 2003-12-11 devnull n = w->tag.file->b.nc;
374 b3994ec5 2003-12-11 devnull r = runemalloc(n);
375 b3994ec5 2003-12-11 devnull bufread(&w->tag.file->b, 0, r, n);
376 b3994ec5 2003-12-11 devnull for(i=0; i<n; i++)
377 b3994ec5 2003-12-11 devnull if(r[i]==' ' || r[i]=='\t')
379 b3994ec5 2003-12-11 devnull for(; i<n; i++)
380 b3994ec5 2003-12-11 devnull if(r[i] == '|')
382 b3994ec5 2003-12-11 devnull if(i == n)
385 b3994ec5 2003-12-11 devnull textdelete(&w->tag, i, n, TRUE);
386 b3994ec5 2003-12-11 devnull free(r);
387 b3994ec5 2003-12-11 devnull w->tag.file->mod = FALSE;
388 b3994ec5 2003-12-11 devnull if(w->tag.q0 > i)
389 b3994ec5 2003-12-11 devnull w->tag.q0 = i;
390 b3994ec5 2003-12-11 devnull if(w->tag.q1 > i)
391 b3994ec5 2003-12-11 devnull w->tag.q1 = i;
392 b3994ec5 2003-12-11 devnull textsetselect(&w->tag, w->tag.q0, w->tag.q1);
396 b3994ec5 2003-12-11 devnull winsettag1(Window *w)
398 77c5c852 2006-01-12 devnull int bar, dirty, i, j, k, n, ntagname, resize;
399 d96da29b 2005-03-14 devnull Rune *new, *old, *r, *tagname;
400 b3994ec5 2003-12-11 devnull Image *b;
401 b3994ec5 2003-12-11 devnull uint q0, q1;
402 b3994ec5 2003-12-11 devnull Rectangle br;
403 b3994ec5 2003-12-11 devnull static Rune Ldelsnarf[] = { ' ', 'D', 'e', 'l', ' ',
404 b3994ec5 2003-12-11 devnull 'S', 'n', 'a', 'r', 'f', 0 };
405 b3994ec5 2003-12-11 devnull static Rune Lundo[] = { ' ', 'U', 'n', 'd', 'o', 0 };
406 b3994ec5 2003-12-11 devnull static Rune Lredo[] = { ' ', 'R', 'e', 'd', 'o', 0 };
407 b3994ec5 2003-12-11 devnull static Rune Lget[] = { ' ', 'G', 'e', 't', 0 };
408 b3994ec5 2003-12-11 devnull static Rune Lput[] = { ' ', 'P', 'u', 't', 0 };
409 b3994ec5 2003-12-11 devnull static Rune Llook[] = { ' ', 'L', 'o', 'o', 'k', ' ', 0 };
410 b3994ec5 2003-12-11 devnull static Rune Lpipe[] = { ' ', '|', 0 };
411 b3994ec5 2003-12-11 devnull /* there are races that get us here with stuff in the tag cache, so we take extra care to sync it */
412 b3994ec5 2003-12-11 devnull if(w->tag.ncache!=0 || w->tag.file->mod)
413 b3994ec5 2003-12-11 devnull wincommit(w, &w->tag); /* check file name; also guarantees we can modify tag contents */
414 b3994ec5 2003-12-11 devnull old = runemalloc(w->tag.file->b.nc+1);
415 b3994ec5 2003-12-11 devnull bufread(&w->tag.file->b, 0, old, w->tag.file->b.nc);
416 b3994ec5 2003-12-11 devnull old[w->tag.file->b.nc] = '\0';
417 b3994ec5 2003-12-11 devnull for(i=0; i<w->tag.file->b.nc; i++)
418 b3994ec5 2003-12-11 devnull if(old[i]==' ' || old[i]=='\t')
421 d96da29b 2005-03-14 devnull /* make sure the file name is set correctly in the tag */
422 d96da29b 2005-03-14 devnull ntagname = w->body.file->nname;
423 d96da29b 2005-03-14 devnull tagname = runemalloc(ntagname);
424 d96da29b 2005-03-14 devnull runemove(tagname, w->body.file->name, ntagname);
425 44e41b1f 2005-07-13 devnull abbrevenv(&tagname, (uint*)&ntagname);
428 3b33df99 2005-03-18 devnull * XXX Why is this here instead of letting the code
429 3b33df99 2005-03-18 devnull * down below do the work?
431 d96da29b 2005-03-14 devnull if(runeeq(old, i, tagname, ntagname) == FALSE){
432 3b33df99 2005-03-18 devnull q0 = w->tag.q0;
433 3b33df99 2005-03-18 devnull q1 = w->tag.q1;
434 b3994ec5 2003-12-11 devnull textdelete(&w->tag, 0, i, TRUE);
435 d96da29b 2005-03-14 devnull textinsert(&w->tag, 0, tagname, ntagname, TRUE);
436 b3994ec5 2003-12-11 devnull free(old);
437 b3994ec5 2003-12-11 devnull old = runemalloc(w->tag.file->b.nc+1);
438 b3994ec5 2003-12-11 devnull bufread(&w->tag.file->b, 0, old, w->tag.file->b.nc);
439 b3994ec5 2003-12-11 devnull old[w->tag.file->b.nc] = '\0';
440 3b33df99 2005-03-18 devnull if(q0 >= i){
442 3b33df99 2005-03-18 devnull * XXX common case - typing at end of name
444 3b33df99 2005-03-18 devnull w->tag.q0 = q0+ntagname-i;
445 3b33df99 2005-03-18 devnull w->tag.q1 = q1+ntagname-i;
449 d96da29b 2005-03-14 devnull /* compute the text for the whole tag, replacing current only if it differs */
450 d96da29b 2005-03-14 devnull new = runemalloc(ntagname+100);
452 d96da29b 2005-03-14 devnull runemove(new+i, tagname, ntagname);
453 d96da29b 2005-03-14 devnull i += ntagname;
454 b3994ec5 2003-12-11 devnull runemove(new+i, Ldelsnarf, 10);
455 b3994ec5 2003-12-11 devnull i += 10;
456 b3994ec5 2003-12-11 devnull if(w->filemenu){
457 cd1d0ab0 2006-01-12 devnull if(w->body.needundo || w->body.file->delta.nc>0 || w->body.ncache){
458 b3994ec5 2003-12-11 devnull runemove(new+i, Lundo, 5);
461 b3994ec5 2003-12-11 devnull if(w->body.file->epsilon.nc > 0){
462 b3994ec5 2003-12-11 devnull runemove(new+i, Lredo, 5);
465 b3994ec5 2003-12-11 devnull dirty = w->body.file->nname && (w->body.ncache || w->body.file->seq!=w->putseq);
466 b3994ec5 2003-12-11 devnull if(!w->isdir && dirty){
467 b3994ec5 2003-12-11 devnull runemove(new+i, Lput, 4);
471 b3994ec5 2003-12-11 devnull if(w->isdir){
472 b3994ec5 2003-12-11 devnull runemove(new+i, Lget, 4);
475 b3994ec5 2003-12-11 devnull runemove(new+i, Lpipe, 2);
477 b3994ec5 2003-12-11 devnull r = runestrchr(old, '|');
479 b3994ec5 2003-12-11 devnull k = r-old+1;
481 b3994ec5 2003-12-11 devnull k = w->tag.file->b.nc;
482 b3994ec5 2003-12-11 devnull if(w->body.file->seq == 0){
483 b3994ec5 2003-12-11 devnull runemove(new+i, Llook, 6);
487 b3994ec5 2003-12-11 devnull new[i] = 0;
488 b3994ec5 2003-12-11 devnull if(runestrlen(new) != i)
489 b3994ec5 2003-12-11 devnull fprint(2, "s '%S' len not %d\n", new, i);
490 b3994ec5 2003-12-11 devnull assert(i==runestrlen(new));
492 d96da29b 2005-03-14 devnull /* replace tag if the new one is different */
493 77c5c852 2006-01-12 devnull resize = 0;
494 b3994ec5 2003-12-11 devnull if(runeeq(new, i, old, k) == FALSE){
495 77c5c852 2006-01-12 devnull resize = 1;
497 b3994ec5 2003-12-11 devnull if(n > i)
499 b3994ec5 2003-12-11 devnull for(j=0; j<n; j++)
500 b3994ec5 2003-12-11 devnull if(old[j] != new[j])
502 b3994ec5 2003-12-11 devnull q0 = w->tag.q0;
503 b3994ec5 2003-12-11 devnull q1 = w->tag.q1;
504 b3994ec5 2003-12-11 devnull textdelete(&w->tag, j, k, TRUE);
505 b3994ec5 2003-12-11 devnull textinsert(&w->tag, j, new+j, i-j, TRUE);
506 b3994ec5 2003-12-11 devnull /* try to preserve user selection */
507 b3994ec5 2003-12-11 devnull r = runestrchr(old, '|');
509 b3994ec5 2003-12-11 devnull bar = r-old;
510 b3994ec5 2003-12-11 devnull if(q0 > bar){
511 b3994ec5 2003-12-11 devnull bar = (runestrchr(new, '|')-new)-bar;
512 b3994ec5 2003-12-11 devnull w->tag.q0 = q0+bar;
513 b3994ec5 2003-12-11 devnull w->tag.q1 = q1+bar;
517 d96da29b 2005-03-14 devnull free(tagname);
518 b3994ec5 2003-12-11 devnull free(old);
519 b3994ec5 2003-12-11 devnull free(new);
520 b3994ec5 2003-12-11 devnull w->tag.file->mod = FALSE;
521 b3994ec5 2003-12-11 devnull n = w->tag.file->b.nc+w->tag.ncache;
522 b3994ec5 2003-12-11 devnull if(w->tag.q0 > n)
523 b3994ec5 2003-12-11 devnull w->tag.q0 = n;
524 b3994ec5 2003-12-11 devnull if(w->tag.q1 > n)
525 b3994ec5 2003-12-11 devnull w->tag.q1 = n;
526 b3994ec5 2003-12-11 devnull textsetselect(&w->tag, w->tag.q0, w->tag.q1);
527 b3994ec5 2003-12-11 devnull b = button;
528 b3994ec5 2003-12-11 devnull if(!w->isdir && !w->isscratch && (w->body.file->mod || w->body.ncache))
529 b3994ec5 2003-12-11 devnull b = modbutton;
530 b3994ec5 2003-12-11 devnull br.min = w->tag.scrollr.min;
531 b3994ec5 2003-12-11 devnull br.max.x = br.min.x + Dx(b->r);
532 b3994ec5 2003-12-11 devnull br.max.y = br.min.y + Dy(b->r);
533 b3994ec5 2003-12-11 devnull draw(screen, br, b, nil, b->r.min);
534 cd1d0ab0 2006-01-12 devnull if(resize){
535 cd1d0ab0 2006-01-12 devnull w->tagsafe = 0;
536 77c5c852 2006-01-12 devnull winresize(w, w->r, TRUE, TRUE);
541 b3994ec5 2003-12-11 devnull winsettag(Window *w)
544 b3994ec5 2003-12-11 devnull File *f;
545 b3994ec5 2003-12-11 devnull Window *v;
547 b3994ec5 2003-12-11 devnull f = w->body.file;
548 b3994ec5 2003-12-11 devnull for(i=0; i<f->ntext; i++){
549 b3994ec5 2003-12-11 devnull v = f->text[i]->w;
550 b3994ec5 2003-12-11 devnull if(v->col->safe || v->body.fr.maxlines>0)
551 b3994ec5 2003-12-11 devnull winsettag1(v);
556 b3994ec5 2003-12-11 devnull wincommit(Window *w, Text *t)
558 b3994ec5 2003-12-11 devnull Rune *r;
560 b3994ec5 2003-12-11 devnull File *f;
562 b3994ec5 2003-12-11 devnull textcommit(t, TRUE);
563 b3994ec5 2003-12-11 devnull f = t->file;
564 b3994ec5 2003-12-11 devnull if(f->ntext > 1)
565 b3994ec5 2003-12-11 devnull for(i=0; i<f->ntext; i++)
566 b3994ec5 2003-12-11 devnull textcommit(f->text[i], FALSE); /* no-op for t */
567 b3994ec5 2003-12-11 devnull if(t->what == Body)
569 b3994ec5 2003-12-11 devnull r = runemalloc(w->tag.file->b.nc);
570 b3994ec5 2003-12-11 devnull bufread(&w->tag.file->b, 0, r, w->tag.file->b.nc);
571 b3994ec5 2003-12-11 devnull for(i=0; i<w->tag.file->b.nc; i++)
572 b3994ec5 2003-12-11 devnull if(r[i]==' ' || r[i]=='\t')
574 44e41b1f 2005-07-13 devnull expandenv(&r, (uint*)&i);
575 b3994ec5 2003-12-11 devnull if(runeeq(r, i, w->body.file->name, w->body.file->nname) == FALSE){
577 b3994ec5 2003-12-11 devnull filemark(w->body.file);
578 b3994ec5 2003-12-11 devnull w->body.file->mod = TRUE;
579 b3994ec5 2003-12-11 devnull w->dirty = TRUE;
580 b3994ec5 2003-12-11 devnull winsetname(w, r, i);
581 b3994ec5 2003-12-11 devnull winsettag(w);
583 b3994ec5 2003-12-11 devnull free(r);
587 b3994ec5 2003-12-11 devnull winaddincl(Window *w, Rune *r, int n)
589 b3994ec5 2003-12-11 devnull char *a;
591 b3994ec5 2003-12-11 devnull Runestr rs;
593 b3994ec5 2003-12-11 devnull a = runetobyte(r, n);
594 b3994ec5 2003-12-11 devnull d = dirstat(a);
595 b3994ec5 2003-12-11 devnull if(d == nil){
596 b3994ec5 2003-12-11 devnull if(a[0] == '/')
597 b3994ec5 2003-12-11 devnull goto Rescue;
598 b3994ec5 2003-12-11 devnull rs = dirname(&w->body, r, n);
599 b3994ec5 2003-12-11 devnull r = rs.r;
600 b3994ec5 2003-12-11 devnull n = rs.nr;
601 b3994ec5 2003-12-11 devnull free(a);
602 b3994ec5 2003-12-11 devnull a = runetobyte(r, n);
603 b3994ec5 2003-12-11 devnull d = dirstat(a);
604 b3994ec5 2003-12-11 devnull if(d == nil)
605 b3994ec5 2003-12-11 devnull goto Rescue;
606 b3994ec5 2003-12-11 devnull r = runerealloc(r, n+1);
607 b3994ec5 2003-12-11 devnull r[n] = 0;
609 b3994ec5 2003-12-11 devnull free(a);
610 b3994ec5 2003-12-11 devnull if((d->qid.type&QTDIR) == 0){
611 b3994ec5 2003-12-11 devnull free(d);
612 b3994ec5 2003-12-11 devnull warning(nil, "%s: not a directory\n", a);
613 b3994ec5 2003-12-11 devnull free(r);
616 b3994ec5 2003-12-11 devnull free(d);
617 b3994ec5 2003-12-11 devnull w->nincl++;
618 b3994ec5 2003-12-11 devnull w->incl = realloc(w->incl, w->nincl*sizeof(Rune*));
619 b3994ec5 2003-12-11 devnull memmove(w->incl+1, w->incl, (w->nincl-1)*sizeof(Rune*));
620 b3994ec5 2003-12-11 devnull w->incl[0] = runemalloc(n+1);
621 b3994ec5 2003-12-11 devnull runemove(w->incl[0], r, n);
622 b3994ec5 2003-12-11 devnull free(r);
626 b3994ec5 2003-12-11 devnull warning(nil, "%s: %r\n", a);
627 b3994ec5 2003-12-11 devnull free(r);
628 b3994ec5 2003-12-11 devnull free(a);
633 b3994ec5 2003-12-11 devnull winclean(Window *w, int conservative) /* as it stands, conservative is always TRUE */
635 b3994ec5 2003-12-11 devnull if(w->isscratch || w->isdir) /* don't whine if it's a guide file, error window, etc. */
636 b3994ec5 2003-12-11 devnull return TRUE;
637 b3994ec5 2003-12-11 devnull if(!conservative && w->nopen[QWevent]>0)
638 b3994ec5 2003-12-11 devnull return TRUE;
639 b3994ec5 2003-12-11 devnull if(w->dirty){
640 b3994ec5 2003-12-11 devnull if(w->body.file->nname)
641 b3994ec5 2003-12-11 devnull warning(nil, "%.*S modified\n", w->body.file->nname, w->body.file->name);
643 b3994ec5 2003-12-11 devnull if(w->body.file->b.nc < 100) /* don't whine if it's too small */
644 b3994ec5 2003-12-11 devnull return TRUE;
645 b3994ec5 2003-12-11 devnull warning(nil, "unnamed file modified\n");
647 b3994ec5 2003-12-11 devnull w->dirty = FALSE;
648 b3994ec5 2003-12-11 devnull return FALSE;
650 b3994ec5 2003-12-11 devnull return TRUE;
654 b3994ec5 2003-12-11 devnull winctlprint(Window *w, char *buf, int fonts)
656 627bae9c 2005-01-04 devnull sprint(buf, "%11d %11d %11d %11d %11d ", w->id, w->tag.file->b.nc,
657 b3994ec5 2003-12-11 devnull w->body.file->b.nc, w->isdir, w->dirty);
658 b3994ec5 2003-12-11 devnull if(fonts)
659 627bae9c 2005-01-04 devnull return smprint("%s%11d %q %11d ", buf, Dx(w->body.fr.r),
660 627bae9c 2005-01-04 devnull w->body.reffont->f->name, w->body.fr.maxtab);
661 627bae9c 2005-01-04 devnull return buf;
665 b3994ec5 2003-12-11 devnull winevent(Window *w, char *fmt, ...)
668 b3994ec5 2003-12-11 devnull char *b;
669 b3994ec5 2003-12-11 devnull Xfid *x;
670 b3994ec5 2003-12-11 devnull va_list arg;
672 b3994ec5 2003-12-11 devnull if(w->nopen[QWevent] == 0)
674 b3994ec5 2003-12-11 devnull if(w->owner == 0)
675 b3994ec5 2003-12-11 devnull error("no window owner");
676 b3994ec5 2003-12-11 devnull va_start(arg, fmt);
677 b3994ec5 2003-12-11 devnull b = vsmprint(fmt, arg);
678 b3994ec5 2003-12-11 devnull va_end(arg);
679 b3994ec5 2003-12-11 devnull if(b == nil)
680 b3994ec5 2003-12-11 devnull error("vsmprint failed");
681 b3994ec5 2003-12-11 devnull n = strlen(b);
682 b3994ec5 2003-12-11 devnull w->events = realloc(w->events, w->nevents+1+n);
683 b3994ec5 2003-12-11 devnull w->events[w->nevents++] = w->owner;
684 b3994ec5 2003-12-11 devnull memmove(w->events+w->nevents, b, n);
685 b3994ec5 2003-12-11 devnull free(b);
686 b3994ec5 2003-12-11 devnull w->nevents += n;
687 b3994ec5 2003-12-11 devnull x = w->eventx;
689 b3994ec5 2003-12-11 devnull w->eventx = nil;
690 b3994ec5 2003-12-11 devnull sendp(x->c, nil);
695 d96da29b 2005-03-14 devnull * This is here as a first stab at something.
696 d96da29b 2005-03-14 devnull * Run acme with the -'$' flag to enable it.
698 d96da29b 2005-03-14 devnull * This code isn't quite right, in that it doesn't play well with
699 d96da29b 2005-03-14 devnull * the plumber and with other applications. For example:
701 d96da29b 2005-03-14 devnull * If the window tag is $home/bin and you execute script, then acme runs
702 d96da29b 2005-03-14 devnull * script in $home/bin, via the shell, so everything is fine. If you do
703 d96da29b 2005-03-14 devnull * execute "echo $home", it too goes to the shell so you see the value
704 d96da29b 2005-03-14 devnull * of $home. And if you right-click on script, then acme plumbs "script"
705 d96da29b 2005-03-14 devnull * in the directory "/home/you/bin", so that works, but if you right-click
706 d96da29b 2005-03-14 devnull * on "$home/bin/script", then what? It's not correct to expand in acme
707 d96da29b 2005-03-14 devnull * since what you're plumbing might be a price tag for all we know. So the
708 d96da29b 2005-03-14 devnull * plumber has to expand it, but in order to do that the plumber should
709 d96da29b 2005-03-14 devnull * probably publish (and allow users to change) the set of variables it is
710 d96da29b 2005-03-14 devnull * using in expansions.
712 d96da29b 2005-03-14 devnull * Rob has suggested that a better solution is to make tag lines expand
713 d96da29b 2005-03-14 devnull * automatically to fit the necessary number of lines.
715 d96da29b 2005-03-14 devnull * The best solution, of course, is to use nice short path names, but this
716 d96da29b 2005-03-14 devnull * is not always possible.
720 d96da29b 2005-03-14 devnull expandenv(Rune **rp, uint *np)
722 d96da29b 2005-03-14 devnull char *s, *t;
723 d96da29b 2005-03-14 devnull Rune *p, *r, *q;
724 d96da29b 2005-03-14 devnull uint n, pref;
725 d96da29b 2005-03-14 devnull int nb, nr, slash;
726 d96da29b 2005-03-14 devnull Runestr rs;
728 d96da29b 2005-03-14 devnull if(!dodollarsigns)
729 d96da29b 2005-03-14 devnull return FALSE;
731 d96da29b 2005-03-14 devnull r = *rp;
732 d96da29b 2005-03-14 devnull n = *np;
733 d96da29b 2005-03-14 devnull if(n == 0 || r[0] != '$')
734 d96da29b 2005-03-14 devnull return FALSE;
735 d96da29b 2005-03-14 devnull for(p=r+1; *p && *p != '/'; p++)
737 d96da29b 2005-03-14 devnull pref = p-r;
738 d96da29b 2005-03-14 devnull s = runetobyte(r+1, pref-1);
739 d96da29b 2005-03-14 devnull if((t = getenv(s)) == nil){
740 d96da29b 2005-03-14 devnull free(s);
741 d96da29b 2005-03-14 devnull return FALSE;
744 d96da29b 2005-03-14 devnull q = runemalloc(utflen(t)+(n-pref));
745 d96da29b 2005-03-14 devnull cvttorunes(t, strlen(t), q, &nb, &nr, nil);
746 d96da29b 2005-03-14 devnull assert(nr==utflen(t));
747 d96da29b 2005-03-14 devnull runemove(q+nr, p, n-pref);
748 d96da29b 2005-03-14 devnull free(r);
749 d96da29b 2005-03-14 devnull rs = runestr(q, nr+(n-pref));
750 d96da29b 2005-03-14 devnull slash = rs.nr>0 && q[rs.nr-1] == '/';
751 d96da29b 2005-03-14 devnull rs = cleanrname(rs);
752 d96da29b 2005-03-14 devnull if(slash){
753 d96da29b 2005-03-14 devnull rs.r = runerealloc(rs.r, rs.nr+1);
754 d96da29b 2005-03-14 devnull rs.r[rs.nr++] = '/';
756 d96da29b 2005-03-14 devnull *rp = rs.r;
757 d96da29b 2005-03-14 devnull *np = rs.nr;
758 d96da29b 2005-03-14 devnull free(t);
759 d96da29b 2005-03-14 devnull return TRUE;
762 d96da29b 2005-03-14 devnull extern char **environ;
763 d96da29b 2005-03-14 devnull Rune **runeenv;
766 d96da29b 2005-03-14 devnull * Weird sort order -- shorter names first,
767 d96da29b 2005-03-14 devnull * prefer lowercase over uppercase ($home over $HOME),
768 d96da29b 2005-03-14 devnull * then do normal string comparison.
771 d96da29b 2005-03-14 devnull runeenvcmp(const void *va, const void *vb)
773 d96da29b 2005-03-14 devnull Rune *a, *b;
774 d96da29b 2005-03-14 devnull int na, nb;
776 d96da29b 2005-03-14 devnull a = *(Rune**)va;
777 d96da29b 2005-03-14 devnull b = *(Rune**)vb;
778 d96da29b 2005-03-14 devnull na = runestrchr(a, '=') - a;
779 d96da29b 2005-03-14 devnull nb = runestrchr(b, '=') - b;
780 d96da29b 2005-03-14 devnull if(na < nb)
781 d96da29b 2005-03-14 devnull return -1;
782 d96da29b 2005-03-14 devnull if(nb > na)
783 d96da29b 2005-03-14 devnull return 1;
784 d96da29b 2005-03-14 devnull if(na == 0)
785 d96da29b 2005-03-14 devnull return 0;
786 d96da29b 2005-03-14 devnull if(islowerrune(a[0]) && !islowerrune(b[0]))
787 d96da29b 2005-03-14 devnull return -1;
788 d96da29b 2005-03-14 devnull if(islowerrune(b[0]) && !islowerrune(a[0]))
789 d96da29b 2005-03-14 devnull return 1;
790 d96da29b 2005-03-14 devnull return runestrncmp(a, b, na);
794 d96da29b 2005-03-14 devnull mkruneenv(void)
796 d96da29b 2005-03-14 devnull int i, bad, n, nr;
797 d96da29b 2005-03-14 devnull char *p;
798 d96da29b 2005-03-14 devnull Rune *r, *q;
801 d96da29b 2005-03-14 devnull for(i=0; environ[i]; i++){
803 d96da29b 2005-03-14 devnull * Ignore some pollution.
805 d96da29b 2005-03-14 devnull if(environ[i][0] == '_')
806 d96da29b 2005-03-14 devnull continue;
807 d96da29b 2005-03-14 devnull if(strncmp(environ[i], "PWD=", 4) == 0)
808 d96da29b 2005-03-14 devnull continue;
809 d96da29b 2005-03-14 devnull if(strncmp(environ[i], "OLDPWD=", 7) == 0)
810 d96da29b 2005-03-14 devnull continue;
813 d96da29b 2005-03-14 devnull * Must be a rooted path.
815 d96da29b 2005-03-14 devnull if((p = strchr(environ[i], '=')) == nil || *(p+1) != '/')
816 d96da29b 2005-03-14 devnull continue;
819 d96da29b 2005-03-14 devnull * Only use the ones that we accept in look - all isfilec
821 d96da29b 2005-03-14 devnull bad = 0;
822 d96da29b 2005-03-14 devnull r = bytetorune(environ[i], &nr);
823 d96da29b 2005-03-14 devnull for(q=r; *q != '='; q++)
824 d96da29b 2005-03-14 devnull if(!isfilec(*q)){
825 d96da29b 2005-03-14 devnull free(r);
826 d96da29b 2005-03-14 devnull bad = 1;
829 d96da29b 2005-03-14 devnull if(!bad){
830 d96da29b 2005-03-14 devnull runeenv = erealloc(runeenv, (n+1)*sizeof(runeenv[0]));
831 d96da29b 2005-03-14 devnull runeenv[n++] = r;
834 d96da29b 2005-03-14 devnull runeenv = erealloc(runeenv, (n+1)*sizeof(runeenv[0]));
835 d96da29b 2005-03-14 devnull runeenv[n] = nil;
836 d96da29b 2005-03-14 devnull qsort(runeenv, n, sizeof(runeenv[0]), runeenvcmp);
840 d96da29b 2005-03-14 devnull abbrevenv(Rune **rp, uint *np)
842 d96da29b 2005-03-14 devnull int i, len, alen;
843 d96da29b 2005-03-14 devnull Rune *r, *p, *q;
846 d96da29b 2005-03-14 devnull if(!dodollarsigns)
847 d96da29b 2005-03-14 devnull return FALSE;
849 d96da29b 2005-03-14 devnull r = *rp;
850 d96da29b 2005-03-14 devnull n = *np;
851 d96da29b 2005-03-14 devnull if(n == 0 || r[0] != '/')
852 d96da29b 2005-03-14 devnull return FALSE;
854 d96da29b 2005-03-14 devnull if(runeenv == nil)
855 d96da29b 2005-03-14 devnull mkruneenv();
857 d96da29b 2005-03-14 devnull for(i=0; runeenv[i]; i++){
858 d96da29b 2005-03-14 devnull p = runestrchr(runeenv[i], '=')+1;
859 d96da29b 2005-03-14 devnull len = runestrlen(p);
860 d96da29b 2005-03-14 devnull if(len <= n && (r[len]==0 || r[len]=='/') && runeeq(r, len, p, len)==TRUE){
861 d96da29b 2005-03-14 devnull alen = (p-1) - runeenv[i];
862 d96da29b 2005-03-14 devnull q = runemalloc(1+alen+n-len);
863 d96da29b 2005-03-14 devnull q[0] = '$';
864 d96da29b 2005-03-14 devnull runemove(q+1, runeenv[i], alen);
865 d96da29b 2005-03-14 devnull runemove(q+1+alen, r+len, n-len);
866 d96da29b 2005-03-14 devnull free(r);
867 d96da29b 2005-03-14 devnull *rp = q;
868 d96da29b 2005-03-14 devnull *np = 1+alen+n-len;
869 d96da29b 2005-03-14 devnull return TRUE;
872 d96da29b 2005-03-14 devnull return FALSE;