home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fs.zip / octave / readline / patches.os2 < prev    next >
Text File  |  2000-01-15  |  30KB  |  994 lines

  1. diff -cwr octave-2.09.orig/readline/bind.c readline/bind.c
  2. *** octave-2.09.orig/readline/bind.c    Tue Sep 19 09:00:56 1995
  3. --- readline/bind.c    Sat Jan 31 11:49:46 1998
  4. ***************
  5. *** 1,3 ****
  6. --- 1,4 ----
  7. + /* Modified by Klaus Gebhardt, October 1996 */
  8.   /* bind.c -- key binding and startup file support for the readline library. */
  9.   
  10.   /* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
  11. ***************
  12. *** 96,112 ****
  13. --- 97,117 ----
  14.   
  15.   static int glean_key_from_name ();
  16.   
  17. + #ifndef HAVE_STRICMP
  18.   #if defined (HAVE_STRCASECMP)
  19.   #define stricmp strcasecmp
  20.   #else
  21.   static int stricmp ();
  22.   #endif
  23. + #endif
  24.   
  25. + #ifndef HAVE_STRNICMP
  26.   #if defined (HAVE_STRNCASECMP)
  27.   #define strnicmp strncasecmp
  28.   #else
  29.   static int strnicmp ();
  30.   #endif
  31. + #endif
  32.   
  33.   #if defined (STATIC_MALLOC)
  34.   static char *xmalloc (), *xrealloc ();
  35. ***************
  36. *** 1444,1449 ****
  37. --- 1449,1455 ----
  38.   
  39.   /* Compare at most COUNT characters from string1 to string2.  Case
  40.      doesn't matter. */
  41. + #ifndef HAVE_STRNICMP
  42.   static int
  43.   strnicmp (string1, string2, count)
  44.        char *string1, *string2;
  45. ***************
  46. *** 1462,1469 ****
  47. --- 1468,1477 ----
  48.       }
  49.     return (count);
  50.   }
  51. + #endif
  52.   
  53.   /* strcmp (), but caseless. */
  54. + #ifndef HAVE_STRICMP
  55.   static int
  56.   stricmp (string1, string2)
  57.        char *string1, *string2;
  58. ***************
  59. *** 1479,1484 ****
  60. --- 1487,1493 ----
  61.       }
  62.     return (*string1 - *string2);
  63.   }
  64. + #endif
  65.   #endif /* !HAVE_STRCASECMP */
  66.   
  67.   /* Determine if s2 occurs in s1.  If so, return a pointer to the
  68. diff -cwr octave-2.09.orig/readline/complete.c readline/complete.c
  69. *** octave-2.09.orig/readline/complete.c    Mon Dec  9 20:14:50 1996
  70. --- readline/complete.c    Sat Jan 31 11:49:46 1998
  71. ***************
  72. *** 1016,1022 ****
  73.        int state;
  74.        char *text;
  75.   {
  76. ! #if defined (__GO32__) || defined (__CYGWIN32__)
  77.     return (char *)NULL;
  78.   #else /* !__GO32__ */
  79.     static char *username = (char *)NULL;
  80. --- 1016,1022 ----
  81.        int state;
  82.        char *text;
  83.   {
  84. ! #if defined (__GO32__)
  85.     return (char *)NULL;
  86.   #else /* !__GO32__ */
  87.     static char *username = (char *)NULL;
  88. ***************
  89. *** 1232,1237 ****
  90. --- 1232,1238 ----
  91.       replace_dirname = 0;
  92.       if (rl_directory_completion_hook)
  93.         replace_dirname = (*rl_directory_completion_hook) (&dirname);
  94.       if (replace_dirname)
  95.         {
  96.           free (users_dirname);
  97. diff -cwr octave-2.09.orig/readline/config.h readline/config.h
  98. *** octave-2.09.orig/readline/config.h    Fri Dec  6 22:26:18 1996
  99. --- readline/config.h    Sat Jan 31 11:54:16 1998
  100. ***************
  101. *** 1,12 ****
  102.   /* config.h.  Generated automatically by configure.  */
  103. ! /* config.h.in.  Generated automatically from configure.in by autoheader.  */
  104.   
  105.   /* Define if using alloca.c.  */
  106. ! /* #undef C_ALLOCA */
  107.   
  108.   /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
  109.      This function is required for alloca.c support on those systems.  */
  110. ! /* #undef CRAY_STACKSEG_END */
  111.   
  112.   /* Define if you have alloca, as a function or macro.  */
  113.   #define HAVE_ALLOCA 1
  114. --- 1,12 ----
  115.   /* config.h.  Generated automatically by configure.  */
  116. ! /* Created by hand, Klaus Gebhardt, 1996 */
  117.   
  118.   /* Define if using alloca.c.  */
  119. ! #undef C_ALLOCA
  120.   
  121.   /* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
  122.      This function is required for alloca.c support on those systems.  */
  123. ! #undef CRAY_STACKSEG_END
  124.   
  125.   /* Define if you have alloca, as a function or macro.  */
  126.   #define HAVE_ALLOCA 1
  127. ***************
  128. *** 15,21 ****
  129.   #define HAVE_ALLOCA_H 1
  130.   
  131.   /* Define if you don't have vprintf but do have _doprnt.  */
  132. ! /* #undef HAVE_DOPRNT */
  133.   
  134.   /* Define if you have the vprintf function.  */
  135.   #define HAVE_VPRINTF 1
  136. --- 15,21 ----
  137.   #define HAVE_ALLOCA_H 1
  138.   
  139.   /* Define if you don't have vprintf but do have _doprnt.  */
  140. ! #undef HAVE_DOPRNT
  141.   
  142.   /* Define if you have the vprintf function.  */
  143.   #define HAVE_VPRINTF 1
  144. ***************
  145. *** 30,36 ****
  146.    STACK_DIRECTION < 0 => grows toward lower addresses
  147.    STACK_DIRECTION = 0 => direction of growth unknown
  148.    */
  149. ! /* #undef STACK_DIRECTION */
  150.   
  151.   /* Define if you have the ANSI C header files.  */
  152.   #define STDC_HEADERS 1
  153. --- 30,36 ----
  154.       STACK_DIRECTION < 0 => grows toward lower addresses
  155.       STACK_DIRECTION = 0 => direction of growth unknown
  156.    */
  157. ! #undef STACK_DIRECTION
  158.   
  159.   /* Define if you have the ANSI C header files.  */
  160.   #define STDC_HEADERS 1
  161. ***************
  162. *** 39,45 ****
  163.   #define TIME_WITH_SYS_TIME 1
  164.   
  165.   /* Define if you do not have <strings.h>, index, bzero, etc..  */
  166. ! /* #undef USG */
  167.   
  168.   /* Define if you have the getwd function.  */
  169.   #define HAVE_GETWD 1
  170. --- 39,45 ----
  171.   #define TIME_WITH_SYS_TIME 1
  172.   
  173.   /* Define if you do not have <strings.h>, index, bzero, etc..  */
  174. ! #undef USG
  175.   
  176.   /* Define if you have the getwd function.  */
  177.   #define HAVE_GETWD 1
  178. ***************
  179. *** 47,60 ****
  180.   /* Define if you have the select function.  */
  181.   #define HAVE_SELECT 1
  182.   
  183.   /* Define if you have the strcasecmp function.  */
  184. ! #define HAVE_STRCASECMP 1
  185.   
  186.   /* Define if you have the strerror function.  */
  187.   #define HAVE_STRERROR 1
  188.   
  189.   /* Define if you have the strncasecmp function.  */
  190. ! #define HAVE_STRNCASECMP 1
  191.   
  192.   /* Define if you have the <dirent.h> header file.  */
  193.   #define HAVE_DIRENT_H 1
  194. --- 47,66 ----
  195.   /* Define if you have the select function.  */
  196.   #define HAVE_SELECT 1
  197.   
  198. + /* Define if you have the stricmp function.  */
  199. + #define HAVE_STRICMP
  200.   /* Define if you have the strcasecmp function.  */
  201. ! #undef HAVE_STRCASECMP
  202.   
  203.   /* Define if you have the strerror function.  */
  204.   #define HAVE_STRERROR 1
  205.   
  206. + /* Define if you have the strnicmp function.  */
  207. + #define HAVE_STRNICMP
  208.   /* Define if you have the strncasecmp function.  */
  209. ! #undef HAVE_STRNCASECMP
  210.   
  211.   /* Define if you have the <dirent.h> header file.  */
  212.   #define HAVE_DIRENT_H 1
  213. ***************
  214. *** 63,72 ****
  215.   #define HAVE_FCNTL_H 1
  216.   
  217.   /* Define if you have the <ndir.h> header file.  */
  218. ! /* #undef HAVE_NDIR_H */
  219.   
  220.   /* Define if you have the <sgtty.h> header file.  */
  221. ! /* #undef HAVE_SGTTY_H */
  222.   
  223.   /* Define if you have the <stdlib.h> header file.  */
  224.   #define HAVE_STDLIB_H 1
  225. --- 69,78 ----
  226.   #define HAVE_FCNTL_H 1
  227.   
  228.   /* Define if you have the <ndir.h> header file.  */
  229. ! #undef HAVE_NDIR_H
  230.   
  231.   /* Define if you have the <sgtty.h> header file.  */
  232. ! #define HAVE_SGTTY_H
  233.   
  234.   /* Define if you have the <stdlib.h> header file.  */
  235.   #define HAVE_STDLIB_H 1
  236. ***************
  237. *** 75,81 ****
  238.   #define HAVE_STRING_H 1
  239.   
  240.   /* Define if you have the <sys/dir.h> header file.  */
  241. ! /* #undef HAVE_SYS_DIR_H */
  242.   
  243.   /* Define if you have the <sys/file.h> header file.  */
  244.   #define HAVE_SYS_FILE_H 1
  245. --- 81,87 ----
  246.   #define HAVE_STRING_H 1
  247.   
  248.   /* Define if you have the <sys/dir.h> header file.  */
  249. ! #define HAVE_SYS_DIR_H
  250.   
  251.   /* Define if you have the <sys/file.h> header file.  */
  252.   #define HAVE_SYS_FILE_H 1
  253. ***************
  254. *** 84,102 ****
  255.   #define HAVE_SYS_IOCTL_H 1
  256.   
  257.   /* Define if you have the <sys/ndir.h> header file.  */
  258. ! /* #undef HAVE_SYS_NDIR_H */
  259.   
  260.   /* Define if you have the <sys/pte.h> header file.  */
  261. ! /* #undef HAVE_SYS_PTE_H */
  262.   
  263.   /* Define if you have the <sys/ptem.h> header file.  */
  264. ! /* #undef HAVE_SYS_PTEM_H */
  265.   
  266.   /* Define if you have the <sys/select.h> header file.  */
  267. ! /* #undef HAVE_SYS_SELECT_H */
  268.   
  269.   /* Define if you have the <sys/stream.h> header file.  */
  270. ! /* #undef HAVE_SYS_STREAM_H */
  271.   
  272.   /* Define if you have the <sys/time.h> header file.  */
  273.   #define HAVE_SYS_TIME_H 1
  274. --- 90,108 ----
  275.   #define HAVE_SYS_IOCTL_H 1
  276.   
  277.   /* Define if you have the <sys/ndir.h> header file.  */
  278. ! #undef HAVE_SYS_NDIR_H
  279.   
  280.   /* Define if you have the <sys/pte.h> header file.  */
  281. ! #undef HAVE_SYS_PTE_H
  282.   
  283.   /* Define if you have the <sys/ptem.h> header file.  */
  284. ! #undef HAVE_SYS_PTEM_H
  285.   
  286.   /* Define if you have the <sys/select.h> header file.  */
  287. ! #define HAVE_SYS_SELECT_H
  288.   
  289.   /* Define if you have the <sys/stream.h> header file.  */
  290. ! #undef HAVE_SYS_STREAM_H
  291.   
  292.   /* Define if you have the <sys/time.h> header file.  */
  293.   #define HAVE_SYS_TIME_H 1
  294. diff -cwr octave-2.09.orig/readline/emacs_keymap.c readline/emacs_keymap.c
  295. *** octave-2.09.orig/readline/emacs_keymap.c    Tue Sep 19 08:20:14 1995
  296. --- readline/emacs_keymap.c    Sat Jan 31 12:03:04 1998
  297. ***************
  298. *** 1,3 ****
  299. --- 1,4 ----
  300. + /* Modified by Klaus Gebhardt, Octaber 1996 */
  301.   /* emacs_keymap.c -- the keymap for emacs_mode in readline (). */
  302.   
  303.   /* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
  304. ***************
  305. *** 33,39 ****
  306. --- 34,44 ----
  307.   KEYMAP_ENTRY_ARRAY emacs_standard_keymap = {
  308.   
  309.     /* Control keys. */
  310. + #if defined (__EMX__)
  311. +   { ISKMAP, (Function *)emacs_emx_keymap }, /* Control-@ */
  312. + #else
  313.     { ISFUNC, (Function *)0x0 },                    /* Control-@ */
  314. + #endif
  315.     { ISFUNC, rl_beg_of_line },        /* Control-a */
  316.     { ISFUNC, rl_backward },        /* Control-b */
  317.     { ISFUNC, (Function *)0x0 },        /* Control-c */
  318. ***************
  319. *** 883,885 ****
  320. --- 888,1025 ----
  321.     { ISFUNC, (Function *)0x0 }
  322.   #endif /* KEYMAP_SIZE > 128 */
  323.   };
  324. + #if defined (__EMX__)
  325. + KEYMAP_ENTRY_ARRAY emacs_emx_keymap = {
  326. +   { ISFUNC, (Function *)0x0 },      /*   0 */
  327. +   { ISFUNC, (Function *)0x0 },      /*   1 */
  328. +   { ISFUNC, (Function *)0x0 },      /*   2 */
  329. +   { ISFUNC, (Function *)0x0 },      /*   3 */
  330. +   { ISFUNC, (Function *)0x0 },      /*   4 */
  331. +   { ISFUNC, (Function *)0x0 },      /*   5 */
  332. +   { ISFUNC, (Function *)0x0 },      /*   6 */
  333. +   { ISFUNC, (Function *)0x0 },      /*   7 */
  334. +   { ISFUNC, (Function *)0x0 },      /*   8 */
  335. +   { ISFUNC, (Function *)0x0 },      /*   9 */
  336. +   { ISFUNC, (Function *)0x0 },      /*  10 */
  337. +   { ISFUNC, (Function *)0x0 },      /*  11 */
  338. +   { ISFUNC, (Function *)0x0 },      /*  12 */
  339. +   { ISFUNC, (Function *)0x0 },      /*  13 */
  340. +   { ISFUNC, (Function *)0x0 },      /*  14 */
  341. +   { ISFUNC, (Function *)0x0 },      /*  15 */
  342. +   { ISFUNC, (Function *)0x0 },      /*  16 */
  343. +   { ISFUNC, (Function *)0x0 },      /*  17 */
  344. +   { ISFUNC, (Function *)0x0 },      /*  18 */
  345. +   { ISFUNC, (Function *)0x0 },      /*  19 */
  346. +   { ISFUNC, (Function *)0x0 },      /*  20 */
  347. +   { ISFUNC, (Function *)0x0 },      /*  21 */
  348. +   { ISFUNC, (Function *)0x0 },      /*  22 */
  349. +   { ISFUNC, (Function *)0x0 },      /*  23 */
  350. +   { ISFUNC, (Function *)0x0 },      /*  24 */
  351. +   { ISFUNC, (Function *)0x0 },      /*  25 */
  352. +   { ISFUNC, (Function *)0x0 },      /*  26 */
  353. +   { ISFUNC, (Function *)0x0 },      /*  27 */
  354. +   { ISFUNC, (Function *)0x0 },      /*  28 */
  355. +   { ISFUNC, (Function *)0x0 },      /*  29 */
  356. +   { ISFUNC, (Function *)0x0 },      /*  30 */
  357. +   { ISFUNC, (Function *)0x0 },      /*  31 */
  358. +   { ISFUNC, (Function *)0x0 },      /*  32 */
  359. +   { ISFUNC, (Function *)0x0 },      /*  33 */
  360. +   { ISFUNC, (Function *)0x0 },      /*  34 */
  361. +   { ISFUNC, (Function *)0x0 },      /*  35 */
  362. +   { ISFUNC, (Function *)0x0 },      /*  36 */
  363. +   { ISFUNC, (Function *)0x0 },      /*  37 */
  364. +   { ISFUNC, (Function *)0x0 },      /*  38 */
  365. +   { ISFUNC, (Function *)0x0 },      /*  39 */
  366. +   { ISFUNC, (Function *)0x0 },      /*  40 */
  367. +   { ISFUNC, (Function *)0x0 },      /*  41 */
  368. +   { ISFUNC, (Function *)0x0 },      /*  42 */
  369. +   { ISFUNC, (Function *)0x0 },      /*  43 */
  370. +   { ISFUNC, (Function *)0x0 },      /*  44 */
  371. +   { ISFUNC, (Function *)0x0 },      /*  45 */
  372. +   { ISFUNC, (Function *)0x0 },      /*  46 */
  373. +   { ISFUNC, (Function *)0x0 },      /*  47 */
  374. +   { ISFUNC, (Function *)0x0 },      /*  48 */
  375. +   { ISFUNC, (Function *)0x0 },      /*  49 */
  376. +   { ISFUNC, (Function *)0x0 },      /*  50 */
  377. +   { ISFUNC, (Function *)0x0 },      /*  51 */
  378. +   { ISFUNC, (Function *)0x0 },      /*  52 */
  379. +   { ISFUNC, (Function *)0x0 },      /*  53 */
  380. +   { ISFUNC, (Function *)0x0 },      /*  54 */
  381. +   { ISFUNC, (Function *)0x0 },      /*  55 */
  382. +   { ISFUNC, (Function *)0x0 },      /*  56 */
  383. +   { ISFUNC, (Function *)0x0 },      /*  57 */
  384. +   { ISFUNC, (Function *)0x0 },      /*  58 */
  385. +   { ISFUNC, (Function *)0x0 },      /*  59 */
  386. +   { ISFUNC, (Function *)0x0 },      /*  60 */
  387. +   { ISFUNC, (Function *)0x0 },      /*  61 */
  388. +   { ISFUNC, (Function *)0x0 },      /*  62 */
  389. +   { ISFUNC, (Function *)0x0 },      /*  63 */
  390. +   { ISFUNC, (Function *)0x0 },      /*  64 */
  391. +   { ISFUNC, (Function *)0x0 },      /*  65 */
  392. +   { ISFUNC, (Function *)0x0 },      /*  66 */
  393. +   { ISFUNC, (Function *)0x0 },      /*  67 */
  394. +   { ISFUNC, (Function *)0x0 },      /*  68 */
  395. +   { ISFUNC, (Function *)0x0 },      /*  69 */
  396. +   { ISFUNC, (Function *)0x0 },      /*  70 */
  397. +   { ISFUNC, rl_beg_of_line },       /*  71: home */
  398. +   { ISFUNC, rl_get_previous_history }, /*  72: cursor up */
  399. +   { ISFUNC, rl_beginning_of_history }, /*  73: page up */
  400. +   { ISFUNC, (Function *)0x0 },      /*  74 */
  401. +   { ISFUNC, rl_backward },          /*  75: cursor left */
  402. +   { ISFUNC, (Function *)0x0 },      /*  76: center cursor */
  403. +   { ISFUNC, rl_forward },           /*  77: cursor right */
  404. +   { ISFUNC, (Function *)0x0 },      /*  78 */
  405. +   { ISFUNC, rl_end_of_line },       /*  79: end */
  406. +   { ISFUNC, rl_get_next_history },  /*  80: cursor down */
  407. +   { ISFUNC, rl_end_of_history },    /*  81: page down */
  408. +   { ISFUNC, (Function *)0x0 },      /*  82: ins */
  409. +   { ISFUNC, rl_delete },            /*  83: del */
  410. +   { ISFUNC, (Function *)0x0 },      /*  84 */
  411. +   { ISFUNC, (Function *)0x0 },      /*  85 */
  412. +   { ISFUNC, (Function *)0x0 },      /*  86 */
  413. +   { ISFUNC, (Function *)0x0 },      /*  87 */
  414. +   { ISFUNC, (Function *)0x0 },      /*  88 */
  415. +   { ISFUNC, (Function *)0x0 },      /*  89 */
  416. +   { ISFUNC, (Function *)0x0 },      /*  90 */
  417. +   { ISFUNC, (Function *)0x0 },      /*  91 */
  418. +   { ISFUNC, (Function *)0x0 },      /*  92 */
  419. +   { ISFUNC, (Function *)0x0 },      /*  93 */
  420. +   { ISFUNC, (Function *)0x0 },      /*  94 */
  421. +   { ISFUNC, (Function *)0x0 },      /*  95 */
  422. +   { ISFUNC, (Function *)0x0 },      /*  96 */
  423. +   { ISFUNC, (Function *)0x0 },      /*  97 */
  424. +   { ISFUNC, (Function *)0x0 },      /*  98 */
  425. +   { ISFUNC, (Function *)0x0 },      /*  99 */
  426. +   { ISFUNC, (Function *)0x0 },      /* 100 */
  427. +   { ISFUNC, (Function *)0x0 },      /* 101 */
  428. +   { ISFUNC, (Function *)0x0 },      /* 102 */
  429. +   { ISFUNC, (Function *)0x0 },      /* 103 */
  430. +   { ISFUNC, (Function *)0x0 },      /* 104 */
  431. +   { ISFUNC, (Function *)0x0 },      /* 105 */
  432. +   { ISFUNC, (Function *)0x0 },      /* 106 */
  433. +   { ISFUNC, (Function *)0x0 },      /* 107 */
  434. +   { ISFUNC, (Function *)0x0 },      /* 108 */
  435. +   { ISFUNC, (Function *)0x0 },      /* 109 */
  436. +   { ISFUNC, (Function *)0x0 },      /* 110 */
  437. +   { ISFUNC, (Function *)0x0 },      /* 111 */
  438. +   { ISFUNC, (Function *)0x0 },      /* 112 */
  439. +   { ISFUNC, (Function *)0x0 },      /* 113 */
  440. +   { ISFUNC, (Function *)0x0 },      /* 114 */
  441. +   { ISFUNC, rl_backward_word },     /* 115: ctrl cursor left */
  442. +   { ISFUNC, rl_forward_word },      /* 116: ctrl cursor right */
  443. +   { ISFUNC, rl_kill_line },         /* 117: ctrl end */
  444. +   { ISFUNC, (Function *)0x0 },      /* 118: ctrl page down */
  445. +   { ISFUNC, rl_backward_kill_line },/* 119: ctrl home */
  446. +   { ISFUNC, (Function *)0x0 },      /* 120: alt 1 */
  447. +   { ISFUNC, (Function *)0x0 },      /* 121 */
  448. +   { ISFUNC, (Function *)0x0 },      /* 122 */
  449. +   { ISFUNC, (Function *)0x0 },      /* 123 */
  450. +   { ISFUNC, (Function *)0x0 },      /* 124 */
  451. +   { ISFUNC, (Function *)0x0 },      /* 125 */
  452. +   { ISFUNC, (Function *)0x0 },      /* 126 */
  453. +   { ISFUNC, (Function *)0x0 },      /* 127 */
  454. + };
  455. + #endif
  456. diff -cwr octave-2.09.orig/readline/examples/fileman.c readline/examples/fileman.c
  457. *** octave-2.09.orig/readline/examples/fileman.c    Tue Sep 19 08:21:00 1995
  458. --- readline/examples/fileman.c    Sat Jan 31 12:31:30 1998
  459. ***************
  460. *** 54,60 ****
  461.   
  462.   char *
  463.   dupstr (s)
  464. !      int s;
  465.   {
  466.     char *r;
  467.   
  468. --- 54,60 ----
  469.   
  470.   char *
  471.   dupstr (s)
  472. !      char *s;
  473.   {
  474.     char *r;
  475.   
  476. diff -cwr octave-2.09.orig/readline/history.c readline/history.c
  477. *** octave-2.09.orig/readline/history.c    Tue Sep 19 09:00:56 1995
  478. --- readline/history.c    Sat Jan 31 11:49:46 1998
  479. ***************
  480. *** 1,3 ****
  481. --- 1,4 ----
  482. + /* Modified by Klaus Gebhardt, October 1996 */
  483.   /* History.c -- standalone history library */
  484.   
  485.   /* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
  486. ***************
  487. *** 124,130 ****
  488. --- 125,135 ----
  489.   
  490.   /* Non-zero means that we have enforced a limit on the amount of
  491.      history that we save. */
  492. + #if defined (__EMX__) && defined (OS2)
  493. + int history_stifled = 0;
  494. + #else
  495.   static int history_stifled = 0;
  496. + #endif
  497.   
  498.   /* If HISTORY_STIFLED is non-zero, then this is the maximum number of
  499.      entries to remember. */
  500. ***************
  501. *** 559,564 ****
  502. --- 564,622 ----
  503.        char *filename;
  504.        int from, to;
  505.   {
  506. + #if defined (__EMX__)
  507. + /*
  508. + ** read_history_range works now with text files.
  509. + ** Klaus Gebhardt, 1995
  510. + */
  511. +    register int line_start, line_end;
  512. +    char *input, *buffer = (char *)NULL;
  513. +    int file, current_line, st_size;
  514. +    struct stat finfo;
  515. +    input = history_filename (filename);
  516. +    file = open (input, O_RDONLY, 0666);
  517. +    if ((file < 0) || (stat (input, &finfo) == -1))
  518. +       error_and_exit:
  519. +    {
  520. +       if (file >= 0)  close (file);
  521. +       if (input)      free (input);
  522. +       if (buffer)     free (buffer);
  523. +       return (errno);
  524. +    }
  525. +    buffer = (char *)xmalloc (finfo.st_size + 1);
  526. +    st_size=read (file, buffer, finfo.st_size);
  527. +    close (file);
  528. +    if (to < 0)  to = st_size;
  529. +    line_start = line_end = current_line = 0;
  530. +    while (line_start < st_size && current_line < from)
  531. +    {
  532. +       for (line_end = line_start; line_end < st_size; line_end++)
  533. +      if (buffer[line_end] == '\n')
  534. +      {
  535. +         current_line++;
  536. +         line_start = line_end + 1;
  537. +         if (current_line == from)  break;
  538. +      }
  539. +    }
  540. +   for (line_end = line_start; line_end < st_size; line_end++)
  541. +      if (buffer[line_end] == '\n')
  542. +      {
  543. +     buffer[line_end] = '\0';
  544. +     if (buffer[line_start])  add_history (buffer + line_start);
  545. +     current_line++;
  546. +     if (current_line >= to)  break;
  547. +     line_start = line_end + 1;
  548. +      }
  549. +    if (input)   free (input);
  550. +    if (buffer)  free (buffer);
  551. +    return (0);
  552. + #else
  553.     register int line_start, line_end;
  554.     char *input, *buffer = (char *)NULL;
  555.     int file, current_line;
  556. ***************
  557. *** 633,638 ****
  558. --- 691,697 ----
  559.       free (buffer);
  560.   
  561.     return (0);
  562. + #endif
  563.   }
  564.   
  565.   /* Truncate the history file FNAME, leaving only LINES trailing lines.
  566. diff -cwr octave-2.09.orig/readline/keymaps.h readline/keymaps.h
  567. *** octave-2.09.orig/readline/keymaps.h    Fri Sep 22 08:29:42 1995
  568. --- readline/keymaps.h    Sat Jan 31 11:49:46 1998
  569. ***************
  570. *** 1,3 ****
  571. --- 1,4 ----
  572. + /* Modified by Klaus Gebhardt, October 1996 */
  573.   /* keymaps.h -- Manipulation of readline keymaps. */
  574.   
  575.   /* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
  576. ***************
  577. *** 30,36 ****
  578.   #if defined (READLINE_LIBRARY)
  579.   #  include "chardefs.h"
  580.   #else
  581. ! #  include <readline/chardefs.h>
  582.   #endif
  583.   
  584.   #if !defined (__FUNCTION_DEF)
  585. --- 31,37 ----
  586.   #if defined (READLINE_LIBRARY)
  587.   #  include "chardefs.h"
  588.   #else
  589. ! #  include <chardefs.h>
  590.   #endif
  591.   
  592.   #if !defined (__FUNCTION_DEF)
  593. ***************
  594. *** 70,75 ****
  595. --- 71,79 ----
  596.   #define ISMACR 2
  597.   
  598.   extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap, emacs_meta_keymap, emacs_ctlx_keymap;
  599. + #ifdef __EMX__
  600. + extern KEYMAP_ENTRY_ARRAY emacs_emx_keymap;
  601. + #endif
  602.   extern KEYMAP_ENTRY_ARRAY vi_insertion_keymap, vi_movement_keymap;
  603.   
  604.   /* Return a new, empty keymap.
  605. diff -cwr octave-2.09.orig/readline/parens.c readline/parens.c
  606. *** octave-2.09.orig/readline/parens.c    Fri Dec  6 01:08:00 1996
  607. --- readline/parens.c    Sat Jan 31 11:49:46 1998
  608. ***************
  609. *** 64,71 ****
  610.   #if defined (HAVE_SYS_SELECT_H)
  611.   #include <sys/select.h>
  612.   #endif
  613. ! /* Including sys/time.h on Linux (any others?) defines the FD_XXX macros. */
  614. ! #if defined (FD_SET) || defined (__linux__)
  615.   #  include <sys/time.h>
  616.   #endif /* FD_SET */
  617.   #include "readline.h"
  618. --- 64,70 ----
  619.   #if defined (HAVE_SYS_SELECT_H)
  620.   #include <sys/select.h>
  621.   #endif
  622. ! #if defined (FD_SET)
  623.   #  include <sys/time.h>
  624.   #endif /* FD_SET */
  625.   #include "readline.h"
  626. diff -cwr octave-2.09.orig/readline/readline.c readline/readline.c
  627. *** octave-2.09.orig/readline/readline.c    Tue Sep 19 09:00:56 1995
  628. --- readline/readline.c    Sat Jan 31 11:49:48 1998
  629. ***************
  630. *** 1,3 ****
  631. --- 1,4 ----
  632. + /* Modified by Klaus Gebhardt, October 1996 */
  633.   /* readline.c -- a general facility for reading lines of input
  634.      with emacs style editing and completion. */
  635.   
  636. ***************
  637. *** 66,71 ****
  638. --- 67,76 ----
  639.   #include "readline.h"
  640.   #include "history.h"
  641.   
  642. + #if defined (__EMX__) && defined (OS2)
  643. + #include "cursor.h"      
  644. + #endif
  645.   /* NOTE: Functions and variables prefixed with `_rl_' are
  646.      pseudo-global: they are global so they can be shared
  647.      between files in the readline library, but are not intended
  648. ***************
  649. *** 162,168 ****
  650. --- 167,177 ----
  651.   static int rl_initialized = 0;
  652.   
  653.   /* If non-zero, this program is running in an EMACS buffer. */
  654. + #ifdef __EMX__
  655. + static char *running_in_emacs = (char *)NULL;
  656. + #else
  657.   static int running_in_emacs = 0;
  658. + #endif
  659.   
  660.   /* The current offset in the current input line. */
  661.   int rl_point;
  662. ***************
  663. *** 932,937 ****
  664. --- 941,950 ----
  665.        terminal and data structures. */
  666.     if (!rl_initialized)
  667.       {
  668. + #if defined (__EMX__) && defined (OS2)
  669. +       _setcursortype (2);
  670. + #endif
  671.         readline_initialize_everything ();
  672.         rl_initialized++;
  673.       }
  674. ***************
  675. *** 966,972 ****
  676. --- 979,989 ----
  677.     char *t;
  678.   
  679.     /* Find out if we are running in Emacs. */
  680. + #ifdef __EMX__
  681. +   running_in_emacs = getenv ("EMACS");
  682. + #else
  683.     running_in_emacs = getenv ("EMACS") != (char *)0;
  684. + #endif
  685.   
  686.     /* Set up input and output if they are not already set up. */
  687.     if (!rl_instream)
  688. ***************
  689. *** 1256,1261 ****
  690. --- 1273,1287 ----
  691.       }
  692.   #endif /* TIOCGWINSZ */
  693.   
  694. + #if defined (__EMX__)
  695. +   {
  696. +     int size[2];
  697. +     _scrsize (size);
  698. +     screenwidth = size[0]; screenheight = size[1];
  699. +   }
  700. + #endif
  701.     /* Environment variable COLUMNS overrides setting of "co" if IGNORE_ENV
  702.        is unset. */
  703.     if (screenwidth <= 0)
  704. ***************
  705. *** 3433,3438 ****
  706. --- 3459,3475 ----
  707.   {
  708.     return (isdigit (c) ? c - '0' : c);
  709.   }
  710. + #if defined (__EMX__) && defined (OS2)
  711. + char *
  712. + _rl_savestring (str)
  713. +      char *str;
  714. + {
  715. +   char *copy = (char*) xmalloc (strlen (str) + 1);
  716. +   strcpy (copy, str);
  717. +   return copy;
  718. + }
  719. + #endif
  720.   
  721.   #if defined (STATIC_MALLOC)
  722.   
  723. diff -cwr octave-2.09.orig/readline/readline.h readline/readline.h
  724. *** octave-2.09.orig/readline/readline.h    Fri Sep 22 08:29:42 1995
  725. --- readline/readline.h    Sat Jan 31 11:49:48 1998
  726. ***************
  727. *** 1,3 ****
  728. --- 1,4 ----
  729. + /* Modified by Klaus Gebhardt, 1996 */
  730.   /* Readline.h -- the names of functions callable from within readline. */
  731.   
  732.   /* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
  733. ***************
  734. *** 31,38 ****
  735.   #  include "keymaps.h"
  736.   #  include "tilde.h"
  737.   #else
  738. ! #  include <readline/keymaps.h>
  739. ! #  include <readline/tilde.h>
  740.   #endif
  741.   
  742.   /* The functions for manipulating the text of the line within readline.
  743. --- 32,39 ----
  744.   #  include "keymaps.h"
  745.   #  include "tilde.h"
  746.   #else
  747. ! #  include <keymaps.h>
  748. ! #  include <tilde.h>
  749.   #endif
  750.   
  751.   /* The functions for manipulating the text of the line within readline.
  752. diff -cwr octave-2.09.orig/readline/rldefs.h readline/rldefs.h
  753. *** octave-2.09.orig/readline/rldefs.h    Mon Dec  9 20:13:14 1996
  754. --- readline/rldefs.h    Sat Jan 31 11:49:48 1998
  755. ***************
  756. *** 1,3 ****
  757. --- 1,4 ----
  758. + /* Modified by Klaus Gebhardt, 1996 */
  759.   /* rldefs.h -- an attempt to isolate some of the system-specific defines
  760.      for readline.  This should be included after any files that define
  761.      system-specific constants like _POSIX_VERSION or USG. */
  762. ***************
  763. *** 38,50 ****
  764.   #  include "memalloc.h"
  765.   #endif
  766.   
  767. - #if defined (__CYGWIN32__)
  768. - #define _POSIX_VERSION
  769. - #endif
  770.   #define NEW_TTY_DRIVER
  771.   #define HAVE_BSD_SIGNALS
  772.   /* #define USE_XON_XOFF */
  773.   
  774.   #if defined (__linux__) || defined (HAVE_TERMCAP_H)
  775.   #  include <termcap.h>
  776. --- 39,56 ----
  777.   #  include "memalloc.h"
  778.   #endif
  779.   
  780.   #define NEW_TTY_DRIVER
  781.   #define HAVE_BSD_SIGNALS
  782.   /* #define USE_XON_XOFF */
  783. + #ifdef __MSDOS__
  784. + #undef NEW_TTY_DRIVER
  785. + #undef HAVE_BSD_SIGNALS
  786. + #endif
  787. + #ifdef __EMX__
  788. + #undef HAVE_BSD_SIGNALS
  789. + #endif /* __EMX__ */
  790.   
  791.   #if defined (__linux__) || defined (HAVE_TERMCAP_H)
  792.   #  include <termcap.h>
  793. diff -cwr octave-2.09.orig/readline/rltty.c readline/rltty.c
  794. *** octave-2.09.orig/readline/rltty.c    Tue Sep 19 09:00:56 1995
  795. --- readline/rltty.c    Sat Jan 31 11:49:48 1998
  796. ***************
  797. *** 1,3 ****
  798. --- 1,4 ----
  799. + /* Modified by Klaus Gebhardt, October 1996 */
  800.   /* rltty.c -- functions to prepare and restore the terminal for readline's
  801.      use. */
  802.   
  803. ***************
  804. *** 21,26 ****
  805. --- 22,29 ----
  806.      have a copy of the license, write to the Free Software Foundation,
  807.      675 Mass Ave, Cambridge, MA 02139, USA. */
  808.   
  809. + /* Modified by Klaus Gebhardt, 1996 */
  810.   #ifdef HAVE_CONFIG_H
  811.   #include <config.h>
  812.   #endif
  813. ***************
  814. *** 36,41 ****
  815. --- 39,48 ----
  816.   #include <errno.h>
  817.   #include <stdio.h>
  818.   
  819. + #if defined (__EMX__)
  820. + #include <sys/termio.h>
  821. + #endif
  822.   #if defined (HAVE_UNISTD_H)
  823.   #  include <unistd.h>
  824.   #endif /* HAVE_UNISTD_H */
  825. ***************
  826. *** 79,84 ****
  827. --- 86,98 ----
  828.     if (sigint_blocked)
  829.       return;
  830.   
  831. + #if defined (__EMX__)
  832. +   sigemptyset (&sigint_set);
  833. +   sigemptyset (&sigint_oset);
  834. +   sigaddset (&sigint_set, SIGINT);
  835. +   sigaddset (&sigint_set, SIGBREAK);
  836. +   sigprocmask (SIG_BLOCK, &sigint_set, &sigint_oset);
  837. + #else
  838.   #if defined (HAVE_POSIX_SIGNALS)
  839.     sigemptyset (&sigint_set);
  840.     sigemptyset (&sigint_oset);
  841. ***************
  842. *** 93,98 ****
  843. --- 107,114 ----
  844.   #    endif /* HAVE_USG_SIGHOLD */
  845.   #  endif /* !HAVE_BSD_SIGNALS */
  846.   #endif /* !HAVE_POSIX_SIGNALS */
  847. + #endif
  848.     sigint_blocked = 1;
  849.   }
  850.   
  851. ***************
  852. *** 103,108 ****
  853. --- 119,127 ----
  854.     if (!sigint_blocked)
  855.       return;
  856.   
  857. + #if defined (__EMX__)
  858. +   sigprocmask (SIG_SETMASK, &sigint_oset, (sigset_t *)NULL);
  859. + #else
  860.   #if defined (HAVE_POSIX_SIGNALS)
  861.     sigprocmask (SIG_SETMASK, &sigint_oset, (sigset_t *)NULL);
  862.   #else
  863. ***************
  864. *** 114,119 ****
  865. --- 133,139 ----
  866.   #    endif /* HAVE_USG_SIGHOLD */
  867.   #  endif /* !HAVE_BSD_SIGNALS */
  868.   #endif /* !HAVE_POSIX_SIGNALS */
  869. + #endif
  870.   
  871.     sigint_blocked = 0;
  872.   }
  873. ***************
  874. *** 447,452 ****
  875. --- 467,475 ----
  876.   {
  877.     readline_echoing_p = (otio.c_lflag & ECHO);
  878.   
  879. + #if defined (__EMX__)
  880. +   tiop->c_lflag &= ~IDEFAULT;
  881. + #endif /* __EMX__ */
  882.     tiop->c_lflag &= ~(ICANON | ECHO);
  883.   
  884.     if ((unsigned char) otio.c_cc[VEOF] != (unsigned char) _POSIX_VDISABLE)
  885. diff -cwr octave-2.09.orig/readline/signals.c readline/signals.c
  886. *** octave-2.09.orig/readline/signals.c    Tue Sep 19 23:08:24 1995
  887. --- readline/signals.c    Sat Jan 31 11:49:48 1998
  888. ***************
  889. *** 1,3 ****
  890. --- 1,4 ----
  891. + /* Modified by Klaus Gebhardt, October 1996 */
  892.   /* signals.c -- signal handling support for readline. */
  893.   
  894.   /* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
  895. ***************
  896. *** 118,123 ****
  897. --- 119,128 ----
  898.   /* Interrupt handling. */
  899.   static SigHandler
  900.     *old_int  = (SigHandler *)NULL,
  901. + #if defined (__EMX__)
  902. +   *old_break= (SigHandler *)NULL,
  903. +   *old_term = (SigHandler *)NULL,
  904. + #endif
  905.     *old_alrm = (SigHandler *)NULL;
  906.   #if !defined (SHELL)
  907.   static SigHandler
  908. ***************
  909. *** 143,155 ****
  910. --- 148,167 ----
  911.   #if !defined (HAVE_BSD_SIGNALS) && !defined (HAVE_POSIX_SIGNALS)
  912.     /* Since the signal will not be blocked while we are in the signal
  913.        handler, ignore it until rl_clear_signals resets the catcher. */
  914. + #if ! defined (__EMX__)
  915.     if (sig == SIGINT)
  916. + #else
  917. +   if ((sig == SIGINT) || (sig == SIGBREAK))
  918. + #endif
  919.       signal (sig, SIG_IGN);
  920.   #endif /* !HAVE_BSD_SIGNALS */
  921.   
  922.     switch (sig)
  923.       {
  924.       case SIGINT:
  925. + #if defined (__EMX__)
  926. +     case SIGBREAK:
  927. + #endif
  928.         {
  929.       register HIST_ENTRY *entry;
  930.   
  931. ***************
  932. *** 174,179 ****
  933. --- 186,195 ----
  934.         rl_clear_signals ();
  935.         rl_pending_input = 0;
  936.   
  937. + #if defined (__EMX__)
  938. +       signal (sig, SIG_ACK);
  939. + #endif
  940.   #if defined (HAVE_POSIX_SIGNALS)
  941.         sigprocmask (SIG_BLOCK, (sigset_t *)NULL, &set);
  942.         sigdelset (&set, sig);
  943. ***************
  944. *** 229,234 ****
  945. --- 245,256 ----
  946.     if (old_int == (SigHandler *)SIG_IGN)
  947.       rl_set_sighandler (SIGINT, SIG_IGN);
  948.   
  949. + #if defined (__EMX__)
  950. +   old_break = (SigHandler *)rl_set_sighandler (SIGBREAK, rl_signal_handler);
  951. +   if (old_break == (SigHandler *)SIG_IGN)
  952. +     signal (SIGBREAK, SIG_IGN);
  953. + #endif
  954.     old_alrm = (SigHandler *)rl_set_sighandler (SIGALRM, rl_signal_handler);
  955.     if (old_alrm == (SigHandler *)SIG_IGN)
  956.       rl_set_sighandler (SIGALRM, SIG_IGN);
  957. ***************
  958. *** 263,268 ****
  959. --- 285,293 ----
  960.   rl_clear_signals ()
  961.   {
  962.     rl_set_sighandler (SIGINT, old_int);
  963. + #if defined (__EMX__)
  964. +   rl_set_sighandler (SIGBREAK, old_break);
  965. + #endif
  966.     rl_set_sighandler (SIGALRM, old_alrm);
  967.   
  968.   #if !defined (SHELL)
  969.