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 >
Wrap
Text File
|
1996-06-19
|
11KB
|
393 lines
diff -ru --new-file vim-4.2.orig/doc/vim_os2.txt vim-4.2/doc/vim_os2.txt
--- vim-4.2.orig/doc/vim_os2.txt Sun Jun 16 15:14:34 1996
+++ vim-4.2/doc/vim_os2.txt Tue Jun 18 22:15:08 1996
@@ -64,7 +64,16 @@
HOME. Additionally you can use other environment variables in file names, as
as ":n $SRC/*.c".
+The HOME environment variable is also used to locate the .viminfo file
+(see |viminfo_file|). There is no support yet for .viminfo on FAT file systems
+yet, sorry. You could try the -i startup flag (as in "vim -i $HOME/_viminfo")
+however.
+
If the HOME environment variable is not set, the value "C:/" is used as a
+default.
+
+It helps to set the environment variable TMP to some sensible directory, such
+as C:\TMP (make sure it exists!). If this is not set, C:/ is used as a
default.
Using slashes ('/') and backslashes ('\') can be a bit of a problem (see
diff -ru --new-file vim-4.2.orig/src/unix.c vim-4.2/src/unix.c
--- vim-4.2.orig/src/unix.c Sun Jun 16 14:15:16 1996
+++ vim-4.2/src/unix.c Tue Jun 18 20:37:32 1996
@@ -2473,11 +2473,8 @@
files_alloced = EXPL_ALLOC_INC; /* how much space is allocated */
files_free = EXPL_ALLOC_INC; /* how much space is not used */
*file = (char_u **) alloc(sizeof(char_u **) * files_alloced);
- if (!*file)
- {
- emsg(e_outofmem);
+ if (*file == NULL)
return FAIL;
- }
for (; num_pat > 0; num_pat--, pat++)
{
@@ -2485,17 +2482,12 @@
if (vim_strchr(*pat, '$') || vim_strchr(*pat, '~'))
{
/* expand environment var or home dir */
- char_u *buf = alloc(1024);
- if (!buf)
- {
- emsg(e_outofmem);
+ char_u *buf = alloc(MAXPATHL);
+ if (buf == NULL)
return FAIL;
- }
- expand_env(*pat, buf, 1024);
+ expand_env(*pat, buf, MAXPATHL);
if (mch_has_wildcard(buf)) /* still wildcards in there? */
- {
expl_files = (char_u **)_fnexplode(buf);
- }
if (expl_files == NULL)
{
/*
@@ -2507,9 +2499,12 @@
* will at least edits exist.c and then say
* notexist* [new file]
*/
- expl_files = (char_u **)alloc(sizeof(char_u **) * 2);
- expl_files[0] = strsave(buf);
- expl_files[1] = NULL;
+ if ((expl_files = (char_u **)alloc(sizeof(char_u **) * 2))
+ != NULL)
+ {
+ expl_files[0] = strsave(buf);
+ expl_files[1] = NULL;
+ }
}
vim_free(buf);
}
@@ -2519,9 +2514,12 @@
if (expl_files == NULL)
{
/* see above for explanation */
- expl_files = (char_u **)alloc(sizeof(char_u **) * 2);
- expl_files[0] = strsave(*pat);
- expl_files[1] = NULL;
+ if ((expl_files = (char_u **)alloc(sizeof(char_u **) * 2))
+ != NULL)
+ {
+ expl_files[0] = strsave(*pat);
+ expl_files[1] = NULL;
+ }
}
}
if (!expl_files)
@@ -2530,9 +2528,9 @@
char_u msg[128];
sprintf(msg, "%s (unix.c:%d)", e_internal, __LINE__);
emsg(msg);
- *file = (char_u **)"";
+ *file = NULL;
*num_file = 0;
- return OK;
+ return FAIL;
}
/*
* Count number of names resulting from expansion,
@@ -2545,31 +2543,37 @@
{
/* need more room in table of pointers */
files_alloced += EXPL_ALLOC_INC;
- *file = (char_u **) realloc(*file,
- sizeof(char_u **) * files_alloced);
+ if ((*file = (char_u **)realloc(*file,
+ sizeof(char_u **) * files_alloced)) == NULL)
+ {
+ emsg(e_outofmem);
+ *num_file = 0;
+ return FAIL;
+ }
files_free = EXPL_ALLOC_INC;
}
slash_adjust(p);
if (mch_isdir(p))
{
len = strlen(p);
- p = realloc(p, len + 2);
- if (!p)
+ if (((*file)[*num_file] = alloc(len + 2)) != NULL)
{
- emsg(e_outofmem);
- return FAIL;
+ strcpy((*file)[*num_file], p);
+ (*file)[*num_file][len] = '\\';
+ (*file)[*num_file][len+1] = 0;
}
- (*file)[*num_file] = p;
- p += len;
- *p++ = '\\';
- *p = 0;
}
else
{
(*file)[*num_file] = strsave(p);
}
+ if ((*file)[*num_file] == NULL)
+ {
+ /* error message already given by either alloc or strsave */
+ break; /* should return FAIL, but returning OK works also */
+ }
}
- _fnexplodefree(expl_files);
+ _fnexplodefree((char **)expl_files);
}
return OK;
diff -ru --new-file vim-4.2.orig/src/version.c vim-4.2/src/version.c
--- vim-4.2.orig/src/version.c Mon Jun 17 15:26:28 1996
+++ vim-4.2/src/version.c Wed Jun 19 07:55:04 1996
@@ -133,11 +133,11 @@
* Don't forget to update the numbers in version.h for Win32!!!
*/
-char *Version = "VIM 4.2";
+char *Version = "VIM 4.2o1";
#ifdef HAVE_DATE_TIME
-char *longVersion = "VIM - Vi IMproved 4.2 (1996 June 17, compiled " __DATE__ " " __TIME__ ")";
+char *longVersion = "VIM - Vi IMproved 4.2o1 (1996 June 18, compiled " __DATE__ " " __TIME__ ")";
#else
-char *longVersion = "VIM - Vi IMproved 4.2 (1996 June 17)";
+char *longVersion = "VIM - Vi IMproved 4.2o1 (1996 June 18)";
#endif
static void version_msg __ARGS((char *s));
diff -ru --new-file vim-4.2.orig/src/vim.h vim-4.2/src/vim.h
--- vim-4.2.orig/src/vim.h Mon Jun 17 12:14:36 1996
+++ vim-4.2/src/vim.h Tue Jun 18 20:41:22 1996
@@ -113,11 +113,19 @@
* maximum length of a file name and a path (for non-unix systems)
*/
#ifndef MAXNAMLEN
-# define MAXNAMLEN 31
+# ifdef MAXPATHLEN
+# define MAXNAMLEN MAXPATHLEN
+# else
+# define MAXNAMLEN 255
+# endif
#endif
#ifndef MAXPATHL
-# define MAXPATHL 128 /* not too long to put name on stack */
+# ifdef MAXPATHLEN
+# define MAXPATHL MAXPATHLEN
+# else
+# define MAXPATHL 255
+# endif
#endif
/*
diff -ru --new-file vim-4.2.orig/tools/ctags/Makefile.os2 vim-4.2/tools/ctags/Makefile.os2
--- vim-4.2.orig/tools/ctags/Makefile.os2 Thu Jan 01 00:00:00 1970
+++ vim-4.2/tools/ctags/Makefile.os2 Tue Jun 18 21:40:04 1996
@@ -0,0 +1,11 @@
+# A very (if not the most) simplistic Makefile for OS/2
+
+CC=gcc
+CFLAGS=-O2 -fno-strength-reduce -DOS2
+
+ctags.exe: ctags.c
+ $(CC) $(CFLAGS) -s -o $@ $<
+
+clean:
+ - del ctags.o
+ - del ctags.exe
diff -ru --new-file vim-4.2.orig/tools/tee/makefile vim-4.2/tools/tee/makefile
--- vim-4.2.orig/tools/tee/makefile Thu Jan 01 00:00:00 1970
+++ vim-4.2/tools/tee/makefile Tue Jun 18 21:33:36 1996
@@ -0,0 +1,8 @@
+CC=gcc
+CFLAGS=-O2 -fno-strength-reduce
+
+tee.exe: tee.o
+ $(CC) $(CFLAGS) -s -o $@ $<
+
+tee.o: tee.c
+ $(CC) $(CFLAGS) -c $<
diff -ru --new-file vim-4.2.orig/tools/tee/tee.c vim-4.2/tools/tee/tee.c
--- vim-4.2.orig/tools/tee/tee.c Thu Jan 01 00:00:00 1970
+++ vim-4.2/tools/tee/tee.c Tue Jun 18 22:25:28 1996
@@ -0,0 +1,153 @@
+/* vim:set ts=4 sw=4:
+ *
+ * Copyright (c) 1996, Paul Slootman
+ *
+ * Author: Paul Slootman
+ * (paul@wurtel.hobby.nl, paul@murphy.nl, paulS@toecompst.nl)
+ *
+ * This source code is released into the public domain. It is provided on an
+ * as-is basis and no responsibility is accepted for its failure to perform
+ * as expected. It is worth at least as much as you paid for it!
+ *
+ * tee.c - pipe fitting
+ *
+ * tee reads stdin, and writes what it reads to each of the specified
+ * files. The primary reason of existence for this version is a quick
+ * and dirty implementation to distribute with Vim, to make one of the
+ * most useful features of Vim possible on OS/2: quickfix.
+ *
+ * Of course, not using tee but instead redirecting make's output directly
+ * into a temp file and then processing that is possible, but if we have a
+ * system capable of correctly piping (unlike DOS, for example), why not
+ * use it as well as possible? This tee should also work on other systems,
+ * but it's not been tested there, only on OS/2.
+ *
+ * tee is also available in the GNU shellutils package, which is available
+ * precompiled for OS/2. That one probably works better.
+ */
+
+#include <unistd.h>
+#include <malloc.h>
+#include <stdio.h>
+
+void usage(void)
+{
+ fprintf(stderr,
+"tee usage:\n\
+\ttee [-a] file ... file_n\n\
+\n\
+\t-a\tappend to files instead of truncating\n\
+\nTee reads its input, and writes to each of the specified files,\n\
+as well as to the standard output.\n\
+\n\
+This version supplied with Vim 4.2 to make ':make' possible.\n\
+For a more complete and stable version, consider getting\n\
+[a port of] the GNU shellutils package.\n\
+");
+}
+
+/*
+ * fread only returns when count is read or at EOF.
+ * We could use fgets, but I want to be able to handle binary blubber.
+ */
+
+int
+myfread(char *buf, int elsize /*ignored*/, int max, FILE *fp)
+{
+ int c;
+ int n = 0;
+
+ while ((n < max) && ((c = getchar()) != EOF))
+ {
+ *(buf++) = c;
+ n++;
+ if (c == '\n' || c == '\r')
+ break;
+ }
+ return n;
+}
+
+
+void
+main(int argc, char *argv[])
+{
+ int append = 0;
+ int numfiles;
+ int opt;
+ int maxfiles;
+ FILE **filepointers;
+ int i;
+ char buf[BUFSIZ];
+ int n;
+ extern int optind;
+
+ while ((opt = getopt(argc, argv, "a")) != EOF)
+ {
+ switch (opt)
+ {
+ case 'a': append++;
+ break;
+ default: usage();
+ exit(2);
+ }
+ }
+
+ numfiles = argc - optind;
+
+ if (numfiles == 0)
+ {
+ fprintf(stderr, "doesn't make much sense using tee without any file name arguments...\n");
+ usage();
+ exit(2);
+ }
+
+ maxfiles = sysconf(_SC_OPEN_MAX); /* or fill in 10 or so */
+ if (maxfiles < 0)
+ maxfiles = 10;
+ if (numfiles + 3 > maxfiles) /* +3 accounts for stdin, out, err */
+ {
+ fprintf(stderr, "Sorry, there is a limit of max %d files.\n", maxfiles - 3);
+ exit(1);
+ }
+ filepointers = calloc(numfiles, sizeof(FILE *));
+ if (filepointers == NULL)
+ {
+ fprintf(stderr, "Error allocating memory for %d files\n", numfiles);
+ exit(1);
+ }
+ for (i = 0; i < numfiles; i++)
+ {
+ filepointers[i] = fopen(argv[i+optind], append ? "ab" : "wb");
+ if (filepointers[i] == NULL)
+ {
+ fprintf(stderr, "Can't open \"%s\"\n", argv[i+optind]);
+ exit(1);
+ }
+ }
+ _fsetmode(stdin, "b");
+ fflush(stdout); /* needed for _fsetmode(stdout) */
+ _fsetmode(stdout, "b");
+
+ while ((n = myfread(buf, sizeof(char), sizeof(buf), stdin)) > 0)
+ {
+ fwrite(buf, sizeof(char), n, stdout);
+ fflush(stdout);
+ for (i = 0; i < numfiles; i++)
+ {
+ if (filepointers[i] &&
+ fwrite(buf, sizeof(char), n, filepointers[i]) != n)
+ {
+ fprintf(stderr, "Error writing to file \"%s\"\n", argv[i+optind]);
+ fclose(filepointers[i]);
+ filepointers[i] = NULL;
+ }
+ }
+ }
+ for (i = 0; i < numfiles; i++)
+ {
+ if (filepointers[i])
+ fclose(filepointers[i]);
+ }
+
+ exit(0);
+}
diff -ru --new-file vim-4.2.orig/tools/xxd/makefile.os2 vim-4.2/tools/xxd/makefile.os2
--- vim-4.2.orig/tools/xxd/makefile.os2 Thu Jan 01 00:00:00 1970
+++ vim-4.2/tools/xxd/makefile.os2 Tue Jun 18 21:42:24 1996
@@ -0,0 +1,11 @@
+# A very (if most the most) simplistic Makefile for OS/2
+
+CC=gcc
+CFLAGS=-O2 -fno-strength-reduce -DOS2
+
+xxd.exe: xxd.c
+ $(CC) $(CFLAGS) -s -o $@ $<
+
+clean:
+ - del xxd.o
+ - del xxd.exe