home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / gnu / djgpp / diffs / texinfo-.1 / info / session.c < prev    next >
Encoding:
Text File  |  1993-11-28  |  3.7 KB  |  122 lines

  1. *** orig/texinfo-.1/info/session.c    Sun Aug 29 18:41:10 1993
  2. --- src/texinfo-.1/info/session.c    Sun Aug 29 19:01:44 1993
  3. ***************
  4. *** 22,29 ****
  5. --- 22,35 ----
  6.      Written by Brian Fox (bfox@ai.mit.edu). */
  7.   
  8.   #include "info.h"
  9. + #if defined (__GO32__)
  10. + #include <pc.h>     /* to allow read of single keys by getkey */
  11. + #include <keys.h>   /* the definitions of the special characters */
  12. + #endif /* __GO32__ */
  13.   #include <sys/file.h>
  14. + #if !defined (__GO32__)
  15.   #include <sys/ioctl.h>
  16. + #endif /* !__GO32__ */
  17.   #include <fcntl.h>
  18.   
  19.   #if defined (HAVE_SYS_TIME_H)
  20. ***************
  21. *** 292,298 ****
  22. --- 298,308 ----
  23.   {
  24.     FILE *stream;
  25.   
  26. + #if defined (__MSDOS__)
  27. +   stream = fopen (filename, "rt");
  28. + #else /* __MSDOS__ */
  29.     stream = fopen (filename, "r");
  30. + #endif /* __MSDOS__*/
  31.   
  32.     if (!stream)
  33.       return;
  34. ***************
  35. *** 2410,2416 ****
  36. --- 2420,2430 ----
  37.     if (strcmp (output_filename, "-") == 0)
  38.       output_stream = stdout;
  39.     else
  40. + #if defined (__MSDOS__)
  41. +     output_stream = fopen (output_filename, "wb");
  42. + #else /* __MSDOS__ */
  43.       output_stream = fopen (output_filename, "w");
  44. + #endif /* __MSDOS__ */
  45.   
  46.     if (!output_stream)
  47.       {
  48. ***************
  49. *** 2535,2541 ****
  50. --- 2549,2559 ----
  51.     if (strcmp (filename, "-") == 0)
  52.       output_stream = stdout;
  53.     else
  54. + #if defined (__MSDOS__)
  55. +     output_stream = fopen (filename, "wb");
  56. + #else /* __MSDOS__ */
  57.       output_stream = fopen (filename, "w");
  58. + #endif /* __MSDOS__ */
  59.   
  60.     if (!output_stream)
  61.       {
  62. ***************
  63. *** 4135,4140 ****
  64. --- 4153,4209 ----
  65.       {
  66.         int rawkey;
  67.   
  68. + #if defined (__GO32__)
  69. +       if (info_input_stream == stdin) {
  70. +         char i;
  71. +         static struct
  72. +         {
  73. +           int inkey;
  74. +           unsigned char outkey1, outkey2;
  75. +         } GO32_keytab[] = {
  76. +           K_Right,          'N', 0,  /* these are for between nodes */
  77. +           K_Left,           'P', 0,  /* they're the Numeric-Keypad-Keys, so */
  78. +           K_Up,             'U', 0,  /* NUMLOCK should be off !! */
  79. +           K_Down,           'M', 0,
  80. +           K_Control_Right,  'F', 0,
  81. +           K_Center,         'L', 0,
  82. +           K_Home,           'T', 0,
  83. +           K_Control_Home,   'D', 0,
  84. +           K_EHome,      K_Control_A, 0, /* .. and these for moving IN a node */
  85. +           K_EEnd,       K_Control_E, 0,  /* they're the 'extended' keys */
  86. +           K_Eleft,      K_Control_B, 0,
  87. +           K_ERight,     K_Control_F, 0,
  88. +           K_EDown,      K_Control_N, 0,
  89. +           K_EUp,        K_Control_P, 0,
  90. +           K_EPageDown,  SPC, 0,
  91. +           K_EPageUp,    K_Control_Backspace, 0,
  92. +           K_Control_ELeft,  ESC, 'b',
  93. +           K_Control_ERight, ESC, 'f',
  94. +           K_Control_EHome,  'B', 0,
  95. +           K_Control_EEnd,   'E', 0,
  96. +           0x10f, ESC, TAB,  /* 0x10f is Shift-TAB, misses in KEYS.H */
  97. +           K_Alt_X, ESC, 'X', /* the most/only important M-???-key */
  98. +           K_F1, K_Control_H, 0, /* YEAH, gimme that goodold F-one-thing */
  99. +           K_Delete, K_Control_Backspace, 0, /* to make Delete be DEL (0x7f) */
  100. +           0, 0, 0
  101. +         };
  102. +         do {
  103. +           rawkey=getxkey();
  104. +           if (rawkey & 0x300) {
  105. +             for (i = 0; GO32_keytab[i].inkey; i++) {
  106. +               if (rawkey == GO32_keytab[i].inkey) {
  107. +                 rawkey = GO32_keytab[i].outkey1;
  108. +                 pending_input_character = GO32_keytab[i].outkey2;
  109. +                 break;
  110. +               }
  111. +             }
  112. +           }
  113. +         } while (rawkey & 0x300);
  114. +       } else
  115. + #endif /* __GO32__ */
  116.         rawkey = getc (info_input_stream);
  117.         keystroke = rawkey;
  118.   
  119.