home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / elvis184.zip / patches.os2 < prev    next >
Text File  |  1995-04-23  |  10KB  |  404 lines

  1. *** elvis-1.8.4/Makefile.mix    Sat Jun 25 20:40:12 1994
  2. --- elvis-1.8.4-os2/Makefile.mix    Fri Apr 21 11:17:21 1995
  3. ***************
  4. *** 470,476 ****
  5.   #.obj.c:
  6.   #    $(CC) $(CFLAGS) $<.c
  7.   
  8. ! ##---- These settings pretty much work for OS/2 and emx+gcc 0.8g ----
  9.   #OBJ=    .obj
  10.   #EXE=    .exe
  11.   #COM=    .exe
  12. --- 470,476 ----
  13.   #.obj.c:
  14.   #    $(CC) $(CFLAGS) $<.c
  15.   
  16. ! ##---- These settings pretty much work for OS/2 and emx+gcc 0.9a ----
  17.   #OBJ=    .obj
  18.   #EXE=    .exe
  19.   #COM=    .exe
  20. ***************
  21. *** 478,485 ****
  22.   #EXTRA2=
  23.   #LIBS=    elvis.def -ltermcap
  24.   #BIN=    /usr/local/bin
  25. ! ## for emx 0.8f and earlier, change -Zmtd to -Zmt
  26. ! #CC=    gcc -Zomf -Zmtd -s -O
  27.   #CFLAGS=    -DOS2
  28.   #SMALL=    elvis.def
  29.   #LARGE=
  30. --- 478,486 ----
  31.   #EXTRA2=
  32.   #LIBS=    elvis.def -ltermcap
  33.   #BIN=    /usr/local/bin
  34. ! ## for emx 0.8f and earlier, change -Zcrtdll to -Zmt
  35. ! ## for emx 0.8g and 0.8h, change -Zcrtdll to -Zmtd
  36. ! #CC=    gcc -Zomf -Zcrtdll -s -O
  37.   #CFLAGS=    -DOS2
  38.   #SMALL=    elvis.def
  39.   #LARGE=
  40. diff -crP elvis-1.8.4/ctags.c elvis-1.8.4-os2/ctags.c
  41. *** elvis-1.8.4/ctags.c    Mon Jan 17 14:08:01 1994
  42. --- elvis-1.8.4-os2/ctags.c    Thu Apr 20 23:12:02 1995
  43. ***************
  44. *** 4,9 ****
  45. --- 4,14 ----
  46.    * and has heaps o' flags.  It is meant to be distributed with elvis.
  47.    */
  48.   
  49. + /* OS/2, emx+gcc 0.9a */
  50. + #ifdef OS2
  51. + # include <sys/emx.h>  /* sigh...emx insists this be the first header file */
  52. + #endif                 /* (used in wildcard.c, included at bottom of ctags.c) */
  53.   #include <stdio.h>
  54.   #ifdef __STDC__
  55.   # include <string.h>
  56. diff -crP elvis-1.8.4/elvis.def elvis-1.8.4-os2/elvis.def
  57. *** elvis-1.8.4/elvis.def    Wed Dec 31 16:00:00 1969
  58. --- elvis-1.8.4-os2/elvis.def    Thu Apr 20 23:16:14 1995
  59. ***************
  60. *** 0 ****
  61. --- 1,3 ----
  62. + NAME WINDOWCOMPAT NEWFILES
  63. + DESCRIPTION 'elvis - a vi clone'
  64. + STACKSIZE 0x50000
  65. diff -crP elvis-1.8.4/elvprsv.c elvis-1.8.4-os2/elvprsv.c
  66. *** elvis-1.8.4/elvprsv.c    Mon Mar 21 11:27:33 1994
  67. --- elvis-1.8.4-os2/elvprsv.c    Thu Apr 20 23:15:30 1995
  68. ***************
  69. *** 49,54 ****
  70. --- 49,59 ----
  71.    *                    - tell user that file was preserved
  72.    */
  73.   
  74. + /* OS/2, emx+gcc 0.9a */
  75. + #ifdef OS2
  76. + # include <sys/emx.h>   /* sigh...emx insists this be the first header file */
  77. + #endif                  /* (used in wildcard.c, included below) */
  78.   #include <stdio.h>
  79.   #include "config.h"
  80.   #include "vi.h"
  81. diff -crP elvis-1.8.4/opts.c elvis-1.8.4-os2/opts.c
  82. *** elvis-1.8.4/opts.c    Tue Jun 28 09:19:40 1994
  83. --- elvis-1.8.4-os2/opts.c    Thu Apr 20 22:45:14 1995
  84. ***************
  85. *** 131,137 ****
  86.   #endif
  87.   
  88.   #if OS2
  89. ! char    o_viomode[1] =        {FALSE};
  90.   #endif
  91.   
  92.   #ifndef NO_SHOWMATCH
  93. --- 131,137 ----
  94.   #endif
  95.   
  96.   #if OS2
  97. ! char    o_viomode[1] =        {TRUE};
  98.   #endif
  99.   
  100.   #ifndef NO_SHOWMATCH
  101. diff -crP elvis-1.8.4/sysos2.c elvis-1.8.4-os2/sysos2.c
  102. *** elvis-1.8.4/sysos2.c    Wed Dec 31 16:00:00 1969
  103. --- elvis-1.8.4-os2/sysos2.c    Mon Jan 10 13:55:34 1994
  104. ***************
  105. *** 0 ****
  106. --- 1,266 ----
  107. + /* sysos2.c  -- OS/2 version of system.c */
  108. + /* Authors:
  109. +  *    Kai Uwe Rommel, rommel@ars.muc.de
  110. +  *    Greg R Roelofs, newt@uchicago.edu
  111. +  */
  112. + #include "config.h"
  113. + #include "vi.h"
  114. + #include <stdio.h>
  115. + #include <process.h>
  116. + #define    INCL_DOSPROCESS        /* doesn't exist in emx 0.8f...? */
  117. + #define INCL_VIO
  118. + #include <os2.h>
  119. + void raw_set_stdio(rawstate)
  120. +     int rawstate;
  121. + {
  122. +       static int buffered = 0;
  123. +     if (!buffered)
  124. +     {
  125. +       buffered = 1;
  126. +       setvbuf(stdout, NULL, _IOFBF, BUFSIZ);
  127. +     }
  128. +     if (rawstate)
  129. +       setmode(fileno(stdout), O_BINARY);
  130. +     else
  131. +       setmode(fileno(stdout), O_TEXT);
  132. + }
  133. + int system(cmd)
  134. +     const    char    *cmd;    /* a command to run */
  135. + {
  136. +     int    status;    /* exit status of the command */
  137. +     if (cmd == o_shell)
  138. +       status = spawnl(P_WAIT, o_shell, o_shell, 0);
  139. +     else
  140. +       status = spawnl(P_WAIT, o_shell, o_shell, "/c", cmd, 0);
  141. +     return status;
  142. + }
  143. + static int pid[64];
  144. + int rpipe(cmd, in)
  145. +     char    *cmd;    /* the filter command to use */
  146. +     int    in;    /* the fd to use for stdin */
  147. + {
  148. +     int    r0w1[2];/* the pipe fd's */
  149. +     int     old0, old1;
  150. +     if (pipe(r0w1) < 0)
  151. +         return -1;
  152. +     /* save the parent's stdin, redirect the child's */
  153. +     old0 = dup(0);
  154. +     fcntl(old0, F_SETFD, 1);
  155. +     dup2(in, 0);
  156. +     /* save the parent's stdout, redirect the child's */
  157. +     old1 = dup(1);
  158. +     fcntl(old1, F_SETFD, 1);
  159. +     dup2(r0w1[1], 1);
  160. +     /* let the parent forget the writing end of the pipe */
  161. +     close(r0w1[1]);
  162. +     /* and don't let the child inherit the reading end of the pipe */
  163. +     fcntl(r0w1[0], F_SETFD, 1);
  164. +     pid[r0w1[0]] = spawnl(P_NOWAIT, o_shell, o_shell, "/c", cmd, 0);
  165. +     /* restore parent's stdin */
  166. +     dup2(old0, 0);
  167. +     close(old0);
  168. +     /* restore parent's stdout */
  169. +     dup2(old1, 1);
  170. +     close(old1);
  171. +     /* return reading end of pipe, i.e. child's output */
  172. +     return r0w1[0];
  173. + }
  174. + int rpclose(fd)
  175. +     int    fd;
  176. + {
  177. +       int    status;
  178. +     close(fd);
  179. +     waitpid(pid[fd], &status, 0);
  180. +     return status;
  181. + }
  182. + char *gethome(exe)
  183. +     char    *exe;    /* full pathname of the ELVIS.EXE file */
  184. + {
  185. +     static char    *home;
  186. +     if (!home)
  187. +     {
  188. +       home = getenv("HOME");
  189. +       if (!home)
  190. +       {
  191. +         PTIB pptib;
  192. +         PPIB pppib;
  193. +         char *path;
  194. +         DosGetInfoBlocks(&pptib, &pppib);
  195. +         path = pppib -> pib_pchenv;
  196. +         while (*path)
  197. +           path = strchr(path, 0) + 1;
  198. +         home = path + 1;
  199. +       }
  200. +     }
  201. +     return home;
  202. + }
  203. + void v_sr()   /* scroll reverse:  scroll whole screen down one line */
  204. + {
  205. +     CHAR cell[2];
  206. +     short len = sizeof(cell);
  207. +     refresh();   /* flush buffer before scrolling */
  208. +     VioReadCellStr(cell, &len, 0, 0, 0);   /* read current screen attr */
  209. +     cell[0] = ' ';
  210. +     VioScrollDn(0, 0, -1, -1, 1, cell, 0);
  211. + }
  212. + void audible_beep()   /* same pitch but shorter duration than ^G */
  213. + {
  214. +     DosBeep(800, 32);
  215. + }
  216. + static did_main_init = FALSE;
  217. + static ansi = FALSE;        /* assume no need to turn on ANSI */
  218. + static quit_attr = 0x07;    /* assume light gray on black, by default */
  219. + /* determine size of screen and set of attributes to use, and store
  220. +  * initial state */
  221. + void v_vio_init()
  222. + {
  223. +     char *str;
  224. +     CHAR cell[2];
  225. +     /* USHORT val = 2; */
  226. +     USHORT row, col, val=2;
  227. +     /* v_vio_init() is called from initscr(), which is called from main()
  228. +      * before options and EXINIT are processed...uh oh.  So do our own
  229. +      * quick and dirty pre-processing of EXINIT variable to see if vs or
  230. +      * viomode is set there.
  231. +      */
  232. +     str = getenv(EXINIT);
  233. +     if (str)
  234. +     {
  235. +         strlwr(str);
  236. +         if (strstr(str, "set viomode") != NULL ||
  237. +             strstr(str, "set vm") != NULL)
  238. +         {
  239. +             *o_viomode = TRUE;
  240. +         }
  241. +     }
  242. +     if (!*o_viomode)    /* not allowed to use these functions */
  243. +     {
  244. +         return;
  245. +     }
  246. +     VioGetCurPos(&row, &col, 0);
  247. +     if (row > 0)
  248. +     {
  249. +         --row;    /* cursor is on fresh line after CR: check line above */
  250. +     }
  251. +     /* get attribute of first character of command line and save for exit */
  252. +         VioReadCellStr(cell, &val, row, 0, 0);
  253. +     if (val > 0)
  254. +     {
  255. +         quit_attr = cell[1];
  256. +     }
  257. +     VioGetAnsi(&val, 0);
  258. +     if (val == ANSI_OFF)
  259. +     {
  260. +         VioSetAnsi(ANSI_ON, 0);
  261. +         ansi = TRUE;
  262. +     }
  263. +     did_main_init = TRUE;
  264. + }
  265. + /* restore initial video state (more or less) */
  266. + void v_vio_restore()
  267. + {
  268. +     if (!did_main_init)
  269. +     {
  270. +         /* didn't save anything, so don't try to restore it */
  271. +         return;
  272. +     }
  273. +     if (ansi)    /* ANSI was off and we turned it on; turn off again */
  274. +     {
  275. +         CHAR cell[3] = {' ', (CHAR)quit_attr, '\0'};
  276. +         USHORT row, col, count;
  277. +         VioSetAnsi(ANSI_OFF, 0);
  278. +         VioGetCurPos(&row, &col, 0);
  279. +         count = COLS - col;
  280. +         VioWrtNCell(cell, count, row, col, 0);    /* cursor stays put */
  281. +     }
  282. +     else
  283. +     {
  284. +         static char sgr2[8] = {'0', '4', '2', '6', '1', '5', '3', '7'};
  285. +         char sgrbuf[24];
  286. +         /* build ANSI SGR string out of BIOS code of saved color via
  287. +          * lookup table; honor foreground color (bits 0-2), background
  288. +          * color (bits 4-6), and bold/normal attribute (bit 3), but
  289. +          * forget about blinking attribute (bit 7):  too bad
  290. +          */
  291. +         sprintf(sgrbuf, "\033[%c;3%c;4%cm", (quit_attr & 8)? '1' : '0', 
  292. +             sgr2[quit_attr & 0x07], sgr2[(quit_attr & 0x70) >> 4]);
  293. +         qaddstr(sgrbuf);
  294. +         refresh();
  295. +     }
  296. + }
  297. + #ifndef NO_CURSORSHAPE
  298. + static VIOCURSORINFO vioci;
  299. + static did_cursor_init = FALSE;
  300. + /* cursor big: set begin scan to end scan - 4 */
  301. + void v_cb()
  302. + {
  303. +     if (!did_cursor_init)
  304. +     {
  305. +         VioGetCurType(&vioci, 0);
  306. +         did_cursor_init = TRUE;
  307. +     }
  308. +     vioci.yStart = vioci.cEnd - 4;    /* cEnd never changes */
  309. +     VioSetCurType(&vioci, 0);
  310. + }
  311. + /* cursor small:  set begin scan to end scan - 1 */
  312. + void v_cs()
  313. + {
  314. +     if (!did_cursor_init)
  315. +     {
  316. +         VioGetCurType(&vioci, 0);
  317. +         did_cursor_init = TRUE;
  318. +     }
  319. +     vioci.yStart = vioci.cEnd - 1;    /* cEnd never changes */
  320. +     VioSetCurType(&vioci, 0);
  321. + }
  322. + #endif /* !NO_CURSORSHAPE */
  323. diff -crP elvis-1.8.4/wildcard.c elvis-1.8.4-os2/wildcard.c
  324. *** elvis-1.8.4/wildcard.c    Mon Jan 10 13:55:48 1994
  325. --- elvis-1.8.4-os2/wildcard.c    Thu Apr 20 23:12:58 1995
  326. ***************
  327. *** 18,23 ****
  328. --- 18,28 ----
  329.    * we don't want a main function here.
  330.    */
  331.   
  332. + /* OS/2, emx+gcc 0.9a */
  333. + #if (defined(OS2) && !defined(WILDCARD_NO_MAIN))
  334. + # include <sys/emx.h>   /* sigh...emx insists this be the first header file */
  335. + #endif
  336.   #include <stdio.h>
  337.   #ifdef __STDC__
  338.   # include <stdlib.h>
  339. ***************
  340. *** 77,85 ****
  341.   
  342.   /* OS/2, emx+gcc 0.8x */
  343.   #if OS2
  344. - # define size_t xxx_size_t
  345. - # include <sys/emx.h>
  346. - # undef size_t
  347.   # define findfirst(a,b,c)    __findfirst(a,c,b)
  348.   # define findnext        __findnext
  349.   # define ffblk            _find
  350. --- 82,87 ----
  351.