home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / vim42os2.zip / vim-4.2 / patches.os2 < prev    next >
Text File  |  1996-06-19  |  11KB  |  393 lines

  1. diff -ru --new-file vim-4.2.orig/doc/vim_os2.txt vim-4.2/doc/vim_os2.txt
  2. --- vim-4.2.orig/doc/vim_os2.txt    Sun Jun 16 15:14:34 1996
  3. +++ vim-4.2/doc/vim_os2.txt    Tue Jun 18 22:15:08 1996
  4. @@ -64,7 +64,16 @@
  5.  HOME.  Additionally you can use other environment variables in file names, as
  6.  as ":n $SRC/*.c".
  7.  
  8. +The HOME environment variable is also used to locate the .viminfo file
  9. +(see |viminfo_file|). There is no support yet for .viminfo on FAT file systems
  10. +yet, sorry. You could try the -i startup flag (as in "vim -i $HOME/_viminfo")
  11. +however.
  12. +
  13.  If the HOME environment variable is not set, the value "C:/" is used as a
  14. +default.
  15. +
  16. +It helps to set the environment variable TMP to some sensible directory, such
  17. +as C:\TMP (make sure it exists!). If this is not set, C:/ is used as a
  18.  default.
  19.  
  20.  Using slashes ('/') and backslashes ('\') can be a bit of a problem (see
  21. diff -ru --new-file vim-4.2.orig/src/unix.c vim-4.2/src/unix.c
  22. --- vim-4.2.orig/src/unix.c    Sun Jun 16 14:15:16 1996
  23. +++ vim-4.2/src/unix.c    Tue Jun 18 20:37:32 1996
  24. @@ -2473,11 +2473,8 @@
  25.      files_alloced = EXPL_ALLOC_INC;    /* how much space is allocated */
  26.      files_free = EXPL_ALLOC_INC;    /* how much space is not used  */
  27.      *file = (char_u **) alloc(sizeof(char_u **) * files_alloced);
  28. -    if (!*file)
  29. -    {
  30. -        emsg(e_outofmem);
  31. +    if (*file == NULL)
  32.          return FAIL;
  33. -    }
  34.  
  35.      for (; num_pat > 0; num_pat--, pat++)
  36.      {
  37. @@ -2485,17 +2482,12 @@
  38.          if (vim_strchr(*pat, '$') || vim_strchr(*pat, '~'))
  39.          {
  40.              /* expand environment var or home dir */
  41. -            char_u    *buf = alloc(1024);
  42. -            if (!buf)
  43. -            {
  44. -                emsg(e_outofmem);
  45. +            char_u    *buf = alloc(MAXPATHL);
  46. +            if (buf == NULL)
  47.                  return FAIL;
  48. -            }
  49. -            expand_env(*pat, buf, 1024);
  50. +            expand_env(*pat, buf, MAXPATHL);
  51.              if (mch_has_wildcard(buf))    /* still wildcards in there? */
  52. -            {
  53.                  expl_files = (char_u **)_fnexplode(buf);
  54. -            }
  55.              if (expl_files == NULL)
  56.              {
  57.                  /*
  58. @@ -2507,9 +2499,12 @@
  59.                   * will at least edits exist.c and then say
  60.                   * notexist* [new file]
  61.                   */
  62. -                expl_files = (char_u **)alloc(sizeof(char_u **) * 2);
  63. -                expl_files[0] = strsave(buf);
  64. -                expl_files[1] = NULL;
  65. +                if ((expl_files = (char_u **)alloc(sizeof(char_u **) * 2))
  66. +                        != NULL)
  67. +                {
  68. +                    expl_files[0] = strsave(buf);
  69. +                    expl_files[1] = NULL;
  70. +                }
  71.              }
  72.              vim_free(buf);
  73.          }
  74. @@ -2519,9 +2514,12 @@
  75.              if (expl_files == NULL)
  76.              {
  77.                  /* see above for explanation */
  78. -                expl_files = (char_u **)alloc(sizeof(char_u **) * 2);
  79. -                expl_files[0] = strsave(*pat);
  80. -                expl_files[1] = NULL;
  81. +                if ((expl_files = (char_u **)alloc(sizeof(char_u **) * 2))
  82. +                        != NULL)
  83. +                {
  84. +                    expl_files[0] = strsave(*pat);
  85. +                    expl_files[1] = NULL;
  86. +                }
  87.              }
  88.          }
  89.          if (!expl_files)
  90. @@ -2530,9 +2528,9 @@
  91.              char_u msg[128];
  92.              sprintf(msg, "%s (unix.c:%d)", e_internal, __LINE__);
  93.              emsg(msg);
  94. -            *file = (char_u **)"";
  95. +            *file = NULL;
  96.              *num_file = 0;
  97. -            return OK;
  98. +            return FAIL;
  99.          }
  100.          /*
  101.           * Count number of names resulting from expansion,
  102. @@ -2545,31 +2543,37 @@
  103.              {
  104.                  /* need more room in table of pointers */
  105.                  files_alloced += EXPL_ALLOC_INC;
  106. -                *file = (char_u **) realloc(*file,
  107. -                                            sizeof(char_u **) * files_alloced);
  108. +                if ((*file = (char_u **)realloc(*file,
  109. +                                    sizeof(char_u **) * files_alloced)) == NULL)
  110. +                {
  111. +                    emsg(e_outofmem);
  112. +                    *num_file = 0;
  113. +                    return FAIL;
  114. +                }
  115.                  files_free = EXPL_ALLOC_INC;
  116.              }
  117.              slash_adjust(p);
  118.              if (mch_isdir(p))
  119.              {
  120.                  len = strlen(p);
  121. -                p = realloc(p, len + 2);
  122. -                if (!p)
  123. +                if (((*file)[*num_file] = alloc(len + 2)) != NULL)
  124.                  {
  125. -                    emsg(e_outofmem);
  126. -                    return FAIL;
  127. +                    strcpy((*file)[*num_file], p);
  128. +                    (*file)[*num_file][len] = '\\';
  129. +                    (*file)[*num_file][len+1] = 0;
  130.                  }
  131. -                (*file)[*num_file] = p;
  132. -                p += len;
  133. -                *p++ = '\\';
  134. -                *p = 0;
  135.              }
  136.              else
  137.              {
  138.                  (*file)[*num_file] = strsave(p);
  139.              }
  140. +            if ((*file)[*num_file] == NULL)
  141. +            {
  142. +                /* error message already given by either alloc or strsave */
  143. +                break;    /* should return FAIL, but returning OK works also */
  144. +            }
  145.          }
  146. -        _fnexplodefree(expl_files);
  147. +        _fnexplodefree((char **)expl_files);
  148.      }
  149.      return OK;
  150.  
  151. diff -ru --new-file vim-4.2.orig/src/version.c vim-4.2/src/version.c
  152. --- vim-4.2.orig/src/version.c    Mon Jun 17 15:26:28 1996
  153. +++ vim-4.2/src/version.c    Wed Jun 19 07:55:04 1996
  154. @@ -133,11 +133,11 @@
  155.   * Don't forget to update the numbers in version.h for Win32!!!
  156.   */
  157.  
  158. -char           *Version = "VIM 4.2";
  159. +char           *Version = "VIM 4.2o1";
  160.  #ifdef HAVE_DATE_TIME
  161. -char           *longVersion = "VIM - Vi IMproved 4.2 (1996 June 17, compiled " __DATE__ " " __TIME__ ")";
  162. +char           *longVersion = "VIM - Vi IMproved 4.2o1 (1996 June 18, compiled " __DATE__ " " __TIME__ ")";
  163.  #else
  164. -char           *longVersion = "VIM - Vi IMproved 4.2 (1996 June 17)";
  165. +char           *longVersion = "VIM - Vi IMproved 4.2o1 (1996 June 18)";
  166.  #endif
  167.  
  168.  static void version_msg __ARGS((char *s));
  169. diff -ru --new-file vim-4.2.orig/src/vim.h vim-4.2/src/vim.h
  170. --- vim-4.2.orig/src/vim.h    Mon Jun 17 12:14:36 1996
  171. +++ vim-4.2/src/vim.h    Tue Jun 18 20:41:22 1996
  172. @@ -113,11 +113,19 @@
  173.   * maximum length of a file name and a path    (for non-unix systems)
  174.   */
  175.  #ifndef MAXNAMLEN
  176. -# define MAXNAMLEN 31
  177. +# ifdef MAXPATHLEN
  178. +#  define MAXNAMLEN    MAXPATHLEN
  179. +# else
  180. +#  define MAXNAMLEN    255
  181. +# endif
  182.  #endif
  183.  
  184.  #ifndef MAXPATHL
  185. -# define MAXPATHL    128            /* not too long to put name on stack */
  186. +# ifdef MAXPATHLEN
  187. +#  define MAXPATHL    MAXPATHLEN
  188. +# else
  189. +#  define MAXPATHL    255
  190. +# endif
  191.  #endif
  192.  
  193.  /*
  194. diff -ru --new-file vim-4.2.orig/tools/ctags/Makefile.os2 vim-4.2/tools/ctags/Makefile.os2
  195. --- vim-4.2.orig/tools/ctags/Makefile.os2    Thu Jan 01 00:00:00 1970
  196. +++ vim-4.2/tools/ctags/Makefile.os2    Tue Jun 18 21:40:04 1996
  197. @@ -0,0 +1,11 @@
  198. +# A very (if not the most) simplistic Makefile for OS/2
  199. +
  200. +CC=gcc
  201. +CFLAGS=-O2 -fno-strength-reduce -DOS2
  202. +
  203. +ctags.exe: ctags.c
  204. +    $(CC) $(CFLAGS) -s -o $@ $<
  205. +
  206. +clean:
  207. +    - del ctags.o
  208. +    - del ctags.exe
  209. diff -ru --new-file vim-4.2.orig/tools/tee/makefile vim-4.2/tools/tee/makefile
  210. --- vim-4.2.orig/tools/tee/makefile    Thu Jan 01 00:00:00 1970
  211. +++ vim-4.2/tools/tee/makefile    Tue Jun 18 21:33:36 1996
  212. @@ -0,0 +1,8 @@
  213. +CC=gcc
  214. +CFLAGS=-O2 -fno-strength-reduce
  215. +
  216. +tee.exe: tee.o
  217. +    $(CC) $(CFLAGS) -s -o $@ $<
  218. +
  219. +tee.o: tee.c
  220. +    $(CC) $(CFLAGS) -c $<
  221. diff -ru --new-file vim-4.2.orig/tools/tee/tee.c vim-4.2/tools/tee/tee.c
  222. --- vim-4.2.orig/tools/tee/tee.c    Thu Jan 01 00:00:00 1970
  223. +++ vim-4.2/tools/tee/tee.c    Tue Jun 18 22:25:28 1996
  224. @@ -0,0 +1,153 @@
  225. +/*  vim:set ts=4 sw=4:
  226. + *
  227. + *    Copyright (c) 1996, Paul Slootman
  228. + *
  229. + *    Author: Paul Slootman
  230. + *            (paul@wurtel.hobby.nl, paul@murphy.nl, paulS@toecompst.nl)
  231. + *
  232. + *    This source code is released into the public domain. It is provided on an
  233. + *    as-is basis and no responsibility is accepted for its failure to perform
  234. + *    as expected. It is worth at least as much as you paid for it!
  235. + *
  236. + * tee.c - pipe fitting
  237. + *
  238. + * tee reads stdin, and writes what it reads to each of the specified
  239. + * files. The primary reason of existence for this version is a quick
  240. + * and dirty implementation to distribute with Vim, to make one of the
  241. + * most useful features of Vim possible on OS/2: quickfix.
  242. + *
  243. + * Of course, not using tee but instead redirecting make's output directly
  244. + * into a temp file and then processing that is possible, but if we have a
  245. + * system capable of correctly piping (unlike DOS, for example), why not
  246. + * use it as well as possible? This tee should also work on other systems,
  247. + * but it's not been tested there, only on OS/2.
  248. + *
  249. + * tee is also available in the GNU shellutils package, which is available
  250. + * precompiled for OS/2. That one probably works better.
  251. + */
  252. +
  253. +#include <unistd.h>
  254. +#include <malloc.h>
  255. +#include <stdio.h>
  256. +
  257. +void usage(void)
  258. +{
  259. +    fprintf(stderr,
  260. +"tee usage:\n\
  261. +\ttee [-a] file ... file_n\n\
  262. +\n\
  263. +\t-a\tappend to files instead of truncating\n\
  264. +\nTee reads its input, and writes to each of the specified files,\n\
  265. +as well as to the standard output.\n\
  266. +\n\
  267. +This version supplied with Vim 4.2 to make ':make' possible.\n\
  268. +For a more complete and stable version, consider getting\n\
  269. +[a port of] the GNU shellutils package.\n\
  270. +");
  271. +}
  272. +
  273. +/*
  274. + * fread only returns when count is read or at EOF.
  275. + * We could use fgets, but I want to be able to handle binary blubber.
  276. + */
  277. +
  278. +int
  279. +myfread(char *buf, int elsize /*ignored*/, int max, FILE *fp)
  280. +{
  281. +    int    c;
  282. +    int    n = 0;
  283. +
  284. +    while ((n < max) && ((c = getchar()) != EOF))
  285. +    {
  286. +        *(buf++) = c;
  287. +        n++;
  288. +        if (c == '\n' || c == '\r')
  289. +            break;
  290. +    }
  291. +    return n;
  292. +}
  293. +
  294. +
  295. +void
  296. +main(int argc, char *argv[])
  297. +{
  298. +    int    append = 0;
  299. +    int    numfiles;
  300. +    int    opt;
  301. +    int    maxfiles;
  302. +    FILE    **filepointers;
  303. +    int    i;
  304. +    char    buf[BUFSIZ];
  305. +    int    n;
  306. +    extern int    optind;
  307. +    
  308. +    while ((opt = getopt(argc, argv, "a")) != EOF)
  309. +    {
  310. +        switch (opt)
  311. +        {
  312. +            case 'a':    append++;
  313. +                    break;
  314. +            default:    usage();
  315. +                    exit(2);
  316. +        }
  317. +    }
  318. +    
  319. +    numfiles = argc - optind;
  320. +    
  321. +    if (numfiles == 0)
  322. +    {
  323. +        fprintf(stderr, "doesn't make much sense using tee without any file name arguments...\n");
  324. +        usage();
  325. +        exit(2);
  326. +    }
  327. +    
  328. +    maxfiles = sysconf(_SC_OPEN_MAX);    /* or fill in 10 or so */
  329. +    if (maxfiles < 0)
  330. +        maxfiles = 10;
  331. +    if (numfiles + 3 > maxfiles)    /* +3 accounts for stdin, out, err */
  332. +    {
  333. +        fprintf(stderr, "Sorry, there is a limit of max %d files.\n", maxfiles - 3);
  334. +        exit(1);
  335. +    }
  336. +    filepointers = calloc(numfiles, sizeof(FILE *));
  337. +    if (filepointers == NULL)
  338. +    {
  339. +        fprintf(stderr, "Error allocating memory for %d files\n", numfiles);
  340. +        exit(1);
  341. +    }
  342. +    for (i = 0; i < numfiles; i++)
  343. +    {
  344. +        filepointers[i] = fopen(argv[i+optind], append ? "ab" : "wb");
  345. +        if (filepointers[i] == NULL)
  346. +        {
  347. +            fprintf(stderr, "Can't open \"%s\"\n", argv[i+optind]);
  348. +            exit(1);
  349. +        }
  350. +    }
  351. +    _fsetmode(stdin,  "b");
  352. +    fflush(stdout);    /* needed for _fsetmode(stdout) */
  353. +    _fsetmode(stdout, "b");
  354. +
  355. +    while ((n = myfread(buf, sizeof(char), sizeof(buf), stdin)) > 0)
  356. +    {
  357. +        fwrite(buf, sizeof(char), n, stdout);
  358. +        fflush(stdout);
  359. +        for (i = 0; i < numfiles; i++)
  360. +        {
  361. +            if (filepointers[i] &&
  362. +                 fwrite(buf, sizeof(char), n, filepointers[i]) != n)
  363. +            {
  364. +                fprintf(stderr, "Error writing to file \"%s\"\n", argv[i+optind]);
  365. +                fclose(filepointers[i]);
  366. +                filepointers[i] = NULL;
  367. +            }
  368. +        }
  369. +    }
  370. +    for (i = 0; i < numfiles; i++)
  371. +    {
  372. +        if (filepointers[i])
  373. +            fclose(filepointers[i]);
  374. +    }
  375. +
  376. +    exit(0);
  377. +}
  378. diff -ru --new-file vim-4.2.orig/tools/xxd/makefile.os2 vim-4.2/tools/xxd/makefile.os2
  379. --- vim-4.2.orig/tools/xxd/makefile.os2    Thu Jan 01 00:00:00 1970
  380. +++ vim-4.2/tools/xxd/makefile.os2    Tue Jun 18 21:42:24 1996
  381. @@ -0,0 +1,11 @@
  382. +# A very (if most the most) simplistic Makefile for OS/2
  383. +
  384. +CC=gcc
  385. +CFLAGS=-O2 -fno-strength-reduce -DOS2
  386. +
  387. +xxd.exe: xxd.c
  388. +    $(CC) $(CFLAGS) -s -o $@ $<
  389. +
  390. +clean:
  391. +    - del xxd.o
  392. +    - del xxd.exe
  393.