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