1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589
|
15a16,18
> #include <config.h>
> #include <curses.h>
>
18,19c21
< #include "config.h"
< #ifdef DOINGX
---
> #ifdef HAVE_X11_X_H
23,25c25
< #else
< #include <curses.h>
< #endif
---
> #endif /* HAVE_X11_X_H */
27d26
< #include <stdio.h>
30c29
< #ifdef DOINGX
---
> #ifdef HAVE_X11_X_H
33c32
< #endif
---
> #endif /* HAVE_X11_X_H */
45c44
< #ifdef DOINGX
---
> #ifdef HAVE_X11_X_H
50c49,50
< #endif
---
> int using_X = FALSE; /* set once we find $DISPLAY is working */
> #endif /* HAVE_X11_X_H */
120c120
< #if !defined(DOINGX) && defined(SIGWINCH)
---
> #if defined(SIGWINCH)
213c213
< #ifdef DOINGX
---
> #ifdef HAVE_X11_X_H
222c222,224
< #endif
---
> int try_X = TRUE; /* should we try to use X? */
> #endif /* HAVE_X11_X_H */
>
240c242
< #ifdef DOINGX
---
> #ifdef HAVE_X11_X_H
245c247
< #else
---
> #endif /* HAVE_X11_X_H */
247d248
< #endif /* DOINGX */
290,298c291,299
< #ifdef DOINGX
< case 'n':
< argv++;
< argc--;
< /*userfont = strdup(argv[0]);*/
< userfont = argv[0];
< break;
< case 'g':
< argv++;
---
> #ifdef HAVE_X11_X_H
> case 'n':
> argv++;
> argc--;
> /*userfont = strdup(argv[0]);*/
> userfont = argv[0];
> break;
> case 'g':
> argv++;
302c303
< #endif DOINGX
---
> #endif /* HAVE_X11_X_H */
305c306,310
< #ifdef DOINGX
---
> #ifdef HAVE_X11_X_H
> case 'X':
> try_X = FALSE;
> break;
>
312c317
< #endif DOINGX
---
> #endif /* HAVE_X11_X_H */
333,335c338,341
< #ifdef DOINGX
< sc_Xinit(copyc, copyv);
< #endif DOINGX
---
> #ifdef HAVE_X11_X_H
> if (try_X) /* sets using_X if it seems it might work... */
> sc_Xinit(copyc, copyv);
> #endif /* HAVE_X11_X_H */
342,344c348,349
< #ifndef DOINGX
< startdisp();
< #endif
---
> if (!using_X)
> startdisp();
406c411
< #if !defined(DOINGX) && defined(SIGWINCH)
---
> #if defined(SIGWINCH)
408c413
< if (hitwinch)
---
> if (using_X && hitwinch)
420,421c425,428
< #ifdef DOINGX
< if (!seenerr)
---
> #ifdef HAVE_X11_X_H
> if (using_X)
> {
> if (!seenerr)
423,424c430,431
< seenerr = 0; /* note, this is here (vs below ifdef DOINGX),
< because in X nmgetch() may set seenerr */
---
> seenerr = 0; /* note, this is here (vs below),
> because in X nmgetch() may set seenerr */
426,427c433,434
< c = nmgetch();
< if (!running) /* nmgetch would set this in Main_Menu() */
---
> c = nmgetch();
> if (!running) /* nmgetch would set this in Main_Menu() */
429,430c436,439
< #else
< seenerr = 0;
---
> } else { /* curses below */
> #endif /* HAVE_X11_X_H */
>
> seenerr = 0;
432c441
< (void) refresh(); /* 5.3 does a refresh in getch */
---
> (void) refresh(); /* 5.3 does a refresh in getch */
434,437c443,448
< c = nmgetch();
< getyx(stdscr, tempy, tempx);
< clearlines(1,1);
< (void) move(tempy, tempx);
---
> c = nmgetch();
> getyx(stdscr, tempy, tempx);
> clearlines(1,1);
> (void) move(tempy, tempx);
> #ifdef HAVE_X11_X_H
> }
451c462
< #if !defined(DOINGX) && defined(SIGTSTP)
---
> #ifdef SIGTSTP
465,467c476,478
< #ifndef DOINGX
< (void) clearok(stdscr,1);
< #endif
---
> if (!using_X)
> (void) clearok(stdscr,1);
>
475,477c486,487
< #ifndef DOINGX
< (void) clearok(stdscr,1);
< #endif
---
> if (!using_X)
> (void) clearok(stdscr,1);
624,626c634,636
< #ifndef DOINGX
< (void) refresh();
< #endif
---
> if (!using_X)
> (void) refresh();
>
807,809c817,819
< #ifndef DOINGX
< deraw();
< #endif
---
> if (!using_X)
> deraw();
>
841,843c851,852
< #ifndef DOINGX
< goraw();
< #endif
---
> if (!using_X)
> goraw();
856,858c865,866
< #ifndef DOINGX
< (void) refresh();
< #endif
---
> if (!using_X)
> (void) refresh();
1044,1046c1052,1054
< case 'M': File_Menu(5); break; /* Merge "file" */
< case 'R': File_Menu(6); break; /* Merge "macrofile" */
< case 'D': File_Menu(7); break; /* mdir "macrodir" */
---
> case 'M': File_Menu(6); break; /* Merge "file" */
> case 'R': File_Menu(7); break; /* Merge "macrofile" */
> case 'D': File_Menu(8); break; /* mdir "macrodir" */
1227,1230c1235,1238
< sig_type doquit(int);
< sig_type dump_me(int);
< #if !defined(DOINGX) && defined(SIGWINCH)
< sig_type winchg(int);
---
> RETSIGTYPE doquit(int);
> RETSIGTYPE dump_me(int);
> #ifdef SIGWINCH
> RETSIGTYPE winchg(int);
1235,1238c1243,1246
< sig_type doquit();
< sig_type dump_me();
< #if !defined(DOINGX) && defined(SIGWINCH)
< sig_type winchg();
---
> RETSIGTYPE doquit();
> RETSIGTYPE dump_me();
> #ifdef SIGWINCH
> RETSIGTYPE winchg();
1247,1249c1255,1256
< #ifndef DOINGX
< (void) signal(SIGALRM, time_out);
< #endif
---
> if (!using_X)
> (void) signal(SIGALRM, time_out);
1254,1255c1261,1263
< #if !defined(DOINGX) && defined(SIGWINCH)
< (void) signal(SIGWINCH, winchg);
---
> #ifdef SIGWINCH
> if (!using_X)
> (void) signal(SIGWINCH, winchg);
1259,1260c1267,1268
< #if !defined(DOINGX) && defined(SIGWINCH)
< sig_type
---
> #if defined(SIGWINCH)
> RETSIGTYPE
1268c1276
< sig_type
---
> RETSIGTYPE
1277c1285
< sig_type
---
> RETSIGTYPE
1282,1284c1290,1291
< #ifndef DOINGX
< deraw();
< #endif
---
> if (!using_X)
> deraw();
1381c1388
< #ifdef DOINGX
---
> #ifdef HAVE_X11_X_H
1395,1397d1401
< #ifdef DOINGX
< /* TempX_Loc = event.xbutton.x; */
< #endif
1400c1404,1406
< #ifdef DOINGX
---
> #ifdef HAVE_X11_X_H
> if (using_X)
> {
1408c1414,1415
< #else
---
> } else {
> #endif /* HAVE_X11_X_H */
1419c1426,1428
< #endif
---
> #ifdef HAVE_X11_X_H
> }
> #endif /* HAVE_X11_X_H */
1421,1422c1430,1434
< #ifdef DOINGX
< XDrawImageString(dpy,mainwin,maingc,
---
> #ifdef HAVE_X11_X_H
> if (using_X)
> {
>
> XDrawImageString(dpy,mainwin,maingc,
1425,1429c1437,1445
< #else
< move(2, 0);
< addstr(help_prompt[choice - 1]);
< clrtoeol();
< #endif
---
> } else {
> #endif /* HAVE_X11_X_H */
> move(2, 0);
> addstr(help_prompt[choice - 1]);
> clrtoeol();
> #ifdef HAVE_X11_X_H
> }
> #endif /* HAVE_X11_X_H */
>
1433,1437c1449,1450
< /*** HACK COURTESY OF MIKE ***/
< #ifdef DOINGX
< XNextEvent(dpy,&event);
<
< switch(event.type)
---
> #ifdef HAVE_X11_X_H
> if (!using_X)
1438a1452,1455
> XNextEvent(dpy,&event);
>
> switch(event.type)
> {
1496,1497c1513,1514
<
< #else
---
> WE NEED HELP HERE
> #endif /* HAVE_X11_X_H */
1501c1518,1519
< #endif
---
> #endif /* DOINGX */
> WE NEED HELP HERE
1817,1818c1835,1837
< #ifdef DOINGX
< XDrawImageString(dpy,mainwin,maingc,
---
> #ifdef HAVE_X11_X_H
> if (using_X)
> { XDrawImageString(dpy,mainwin,maingc,
1821,1825c1840,1847
< XFlush(dpy);
< #else
< addstr(stringbuf);
< refresh();
< #endif
---
> XFlush(dpy);
> } else {
> #endif /* HAVE_X11_X_H */
> addstr(stringbuf);
> refresh();
> #ifdef HAVE_X11_X_H
> }
> #endif /* HAVE_X11_X_H */
1887,1891c1909,1915
< #ifdef DOINGX
< redraw_current(maingc);
< #else
< repaint(lastmx, lastmy, fwidth[lastcol]);
< #endif
---
> #ifdef HAVE_X11_X_H
> if (using_X)
> redraw_current(maingc);
> else
> #endif /* HAVE_X11_X_H */
> repaint(lastmx, lastmy, fwidth[lastcol]);
>
1898,1902c1922,1928
< #ifdef DOINGX
< redraw_current(maingc);
< #else
< repaint(lastmx, lastmy, fwidth[lastcol]);
< #endif
---
> #ifdef HAVE_X11_X_H
> if (using_X)
> redraw_current(maingc);
> else
> #endif /* HAVE_X11_X_H */
> repaint(lastmx, lastmy, fwidth[lastcol]);
>
2031c2057
< static char tmp[PATHLEN];
---
> char *defwfile;
2061,2062c2087,2095
< get_default_path(tmp);
< (void) sprintf(line, "get [\"source\"] \"%s", tmp);
---
> if (curfile)
> { defwfile = what_file(curfile, NULL);
> (void) sprintf (line, "get [\"source\"] \"%s",
> defwfile);
> scxfree(defwfile);
> }
> else
> (void) sprintf (line, "get [\"source\"] \"");
>
2066,2067c2099,2106
< get_default_path(tmp);
< (void) sprintf(line, "put [\"dest\" range] \"%s", tmp);
---
> if (*curfile)
> { defwfile = what_file(curfile, NULL);
> (void) sprintf (line, "put [\"dest\" range] \"%s",
> defwfile);
> scxfree(defwfile);
> }
> else
> (void) sprintf (line, "put [\"dest\" range] \"");
2071d2109
< (void) sprintf (line, "write [\"dest\" range] \"");
2073,2077c2111,2113
< { char *defwfile;
<
< defwfile = what_file(curfile, ".asc");
< sprintf(stringbuf, "Default file is \"%s\"", defwfile);
< scerror(stringbuf);
---
> { defwfile = what_file(curfile, ".asc");
> (void) sprintf (line, "write [\"dest\" range] \"%s",
> defwfile);
2080,2088d2115
< /*
< get_default_path(tmp);
< if (*curfile)
< { char *defwfile;
<
< defwfile = fsuffix(tmp, ".asc");
< sprintf(line, "write [\"dest\" range] \"%s",
< defwfile);
< }
2090,2091c2117
< sprintf(line, "write [\"dest\" range] \"%s", tmp);
< */
---
> (void) sprintf (line, "write [\"dest\" range] \"");
2096d2121
< (void) sprintf(line, "tbl [\"dest\" range] \"");
2102,2103c2127,2128
< sprintf(stringbuf, "Default table is \"%s\"", defwfile);
< scerror(stringbuf);
---
> (void) sprintf(line, "tbl [\"dest\" range] \"%s",
> defwfile);
2106,2130d2130
< /*
< get_default_path(tmp);
< if (*curfile)
< { char *deftfile;
< char *suffix;
< if (tbl_style == 0)
< suffix = ".cln";
< else if (tbl_style == TBL)
< suffix = ".tbl";
< else if (tbl_style == LATEX)
< suffix = ".lat";
< else if (tbl_style == SLATEX)
< suffix = ".stx";
< else if (tbl_style == TEX)
< suffix = ".tex";
< else
< suffix = NULL;
<
< if (suffix != NULL)
< { deftfile = fsuffix(tmp, suffix);
< sprintf(line, "tbl [\"dest\" range] \"%s",
< deftfile);
< scxfree(deftfile);
< }
< }
2132,2133c2132
< (void) sprintf(line, "tbl [\"dest\" range] \"%s", tmp);
< */
---
> (void) sprintf(line, "tbl [\"dest\" range] \"");
2138,2139c2137,2147
< get_default_dir(tmp);
< (void) sprintf (line, "read [\"source\" range] \"%s", tmp);
---
> if (*curfile)
> { char *defwfile;
>
> /* what_file() scmalloc's space */
> defwfile = what_file(curfile, NULL);
> (void) sprintf (line, "read [\"source\" range] \"%s",
> defwfile);
> scxfree(defwfile);
> }
> else
> (void) sprintf (line, "read [\"source\" range] \"");
2144,2145c2152,2162
< get_default_dir(tmp);
< (void) sprintf(line,"merge [\"merge_file\"] \"%s", tmp);
---
> if (*curfile)
> { char *defwfile;
>
> /* what_file() scmalloc's space */
> defwfile = what_file(curfile, NULL);
> (void) sprintf(line,"merge [\"merge_file\"] \"%s",
> defwfile);
> scxfree(defwfile);
> }
> else
> (void) sprintf(line,"merge [\"merge_file\"] \"");
2149a2167,2178
> if (*curfile)
> { char *defwfile;
>
> /* what_file() scmalloc's space */
> defwfile = what_file(curfile, NULL);
> (void) sprintf(line,"merge [\"macro_file\"] \"%s",
> defwfile);
> scxfree(defwfile);
> }
> else
> (void) sprintf(line,"merge [\"macro_file\"] \"");
> /*
2151c2180,2185
< (void)sprintf(line,"merge [\"macro_file\"] \"%s", tmp);
---
> if (mdir)
> (void) sprintf (line,"merge [\"macro_file\"] \"%s/%s",
> mdir, tmp);
> else
> (void) sprintf (line,"merge [\"macro_file\"] \"%s",tmp);
> */
2156,2157c2190,2193
< get_default_dir(tmp);
< (void) sprintf(line, "mdir [\"macro_dir\"] \"%s", tmp);
---
> if (mdir)
> (void) sprintf(line, "mdir [\"macro_dir\"] \"%s",mdir);
> else
> (void) sprintf(line, "mdir [\"macro_dir\"] \"");
2284,2288c2320,2326
< #ifdef DOINGX
< Graph_Menu();
< #else
< scerror("Graphing is not yet supported in curses");
< #endif
---
> #ifdef HAVE_X11_X_H
> if (using_X)
> Graph_Menu();
> else
> #endif /* HAVE_X11_X_H */
> scerror("Graphing is not yet supported in curses");
>
2300,2304c2338,2343
< #ifdef DOINGX /* many things are X specific ... */
< Color_Menu();
< #else
< message("Color curses isn't yet supported");
< #endif /* DOINGX */
---
> #ifdef HAVE_X11_X_H /* many things are X specific ... */
> if (using_X)
> Color_Menu();
> else
> #endif /* HAVE_X11_X_H */
> message("Color curses isn't yet supported");
2313c2352
< #ifdef DOINGX
---
> #ifdef HAVE_X11_X_H
2342c2381
< #endif
---
> #endif /* HAVE_X11_X_H */
|