61 |
|
|
62 |
|
extern char *progname; |
63 |
|
|
64 |
< |
int x_close(), x_clear(), x_paintr(), x_errout(), |
64 |
> |
static int x_close(), x_clear(), x_paintr(), x_errout(), |
65 |
|
x_getcur(), x_comout(), x_comin(), x_flush(); |
66 |
|
|
67 |
|
static struct driver x_driver = { |
146 |
|
int xres, yres; |
147 |
|
{ |
148 |
|
if (xres != gwidth || yres != gheight) { /* new window */ |
149 |
– |
if (comline != NULL) |
150 |
– |
xt_close(comline); |
149 |
|
XChangeWindow(gwind, xres, yres+COMHEIGHT); |
152 |
– |
comline = xt_open(gwind, 0, yres, xres, COMHEIGHT, 0, COMFN); |
153 |
– |
if (comline == NULL) { |
154 |
– |
stderr_v("Cannot open command line window\n"); |
155 |
– |
quit(1); |
156 |
– |
} |
150 |
|
gwidth = xres; |
151 |
|
gheight = yres; |
152 |
|
} else /* just clear */ |
156 |
|
stderr_v("cannot allocate colors\n"); |
157 |
|
else |
158 |
|
new_ctab(ncolors); |
159 |
< |
|
159 |
> |
/* open new command line */ |
160 |
> |
if (comline != NULL) |
161 |
> |
xt_close(comline); |
162 |
> |
comline = xt_open(gwind, 0, yres, xres, COMHEIGHT, 0, COMFN); |
163 |
> |
if (comline == NULL) { |
164 |
> |
stderr_v("Cannot open command line window\n"); |
165 |
> |
quit(1); |
166 |
> |
} |
167 |
|
XMapWindow(gwind); /* make sure it's mapped */ |
168 |
|
XSync(1); /* discard input */ |
169 |
|
return; |
199 |
|
x_comin(inp, prompt) /* read in a command line */ |
200 |
|
char *inp, *prompt; |
201 |
|
{ |
202 |
< |
int x_getc(), x_comout(); |
202 |
> |
extern int x_getc(); |
203 |
|
|
204 |
|
if (prompt != NULL) |
205 |
|
if (fromcombuf(inp, &x_driver)) |
216 |
|
x_comout(out) /* output a string to command line */ |
217 |
|
char *out; |
218 |
|
{ |
219 |
< |
if (comline != NULL) |
220 |
< |
xt_puts(out, comline); |
221 |
< |
XFlush(); |
219 |
> |
if (comline == NULL) |
220 |
> |
return; |
221 |
> |
xt_puts(out, comline); |
222 |
> |
if (out[strlen(out)-1] == '\n') |
223 |
> |
XFlush(); |
224 |
|
} |
225 |
|
|
226 |
|
|
228 |
|
x_errout(msg) /* output an error message */ |
229 |
|
char *msg; |
230 |
|
{ |
229 |
– |
x_comout(msg); |
231 |
|
stderr_v(msg); /* send to stderr also! */ |
232 |
+ |
x_comout(msg); |
233 |
|
} |
234 |
|
|
235 |
|
|