1
0
forked from aniani/vim

patch 7.4.1040

Problem:    The tee command is not available on MS-Windows.
Solution:   Adjust tee.c for MSVC and add a makefile. (Yasuhiro Matsumoto)
This commit is contained in:
Bram Moolenaar
2016-01-03 16:56:10 +01:00
parent d798af8c77
commit 24db72958f
4 changed files with 48 additions and 14 deletions

View File

@@ -946,8 +946,13 @@ LINKARGS1 = $(LINKARGS1) /LTCG:STATUS
!endif !endif
!endif !endif
all: $(VIM).exe vimrun.exe install.exe uninstal.exe xxd/xxd.exe \ all: $(VIM).exe \
GvimExt/gvimext.dll vimrun.exe \
install.exe \
uninstal.exe \
xxd/xxd.exe \
tee/tee.exe \
GvimExt/gvimext.dll
$(VIM).exe: $(OUTDIR) $(OBJ) $(GUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $(MZSCHEME_OBJ) \ $(VIM).exe: $(OUTDIR) $(OBJ) $(GUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $(MZSCHEME_OBJ) \
$(LUA_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(PYTHON3_OBJ) $(RUBY_OBJ) $(TCL_OBJ) \ $(LUA_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(PYTHON3_OBJ) $(RUBY_OBJ) $(TCL_OBJ) \
@@ -982,6 +987,11 @@ xxd/xxd.exe: xxd/xxd.c
$(MAKE) /NOLOGO -f Make_mvc.mak $(MAKE) /NOLOGO -f Make_mvc.mak
cd .. cd ..
tee/tee.exe: tee/tee.c
cd tee
$(MAKE) /NOLOGO -f Make_mvc.mak
cd ..
GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
cd GvimExt cd GvimExt
$(MAKE) /NOLOGO -f Makefile $(MAKEFLAGS_GVIMEXT) $(MAKE) /NOLOGO -f Makefile $(MAKEFLAGS_GVIMEXT)

14
src/tee/Make_mvc.mak Normal file
View File

@@ -0,0 +1,14 @@
# A very (if not the most) simplistic Makefile for MSVC
CC=cl
CFLAGS=/O2
tee.exe: tee.obj
$(CC) $(CFLAGS) /Fo$@ $**
tee.obj: tee.c
$(CC) $(CFLAGS) /c $**
clean:
- del tee.obj
- del tee.exe

View File

@@ -4,6 +4,7 @@
* *
* Author: Paul Slootman * Author: Paul Slootman
* (paul@wurtel.hobby.nl, paul@murphy.nl, paulS@toecompst.nl) * (paul@wurtel.hobby.nl, paul@murphy.nl, paulS@toecompst.nl)
* Modifications for MSVC: Yasuhiro Matsumoto
* *
* This source code is released into the public domain. It is provided on an * 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-is basis and no responsibility is accepted for its failure to perform
@@ -26,9 +27,16 @@
* precompiled for OS/2. That one probably works better. * precompiled for OS/2. That one probably works better.
*/ */
#include <unistd.h> #ifndef _MSC_VER
# include <unistd.h>
#endif
#include <malloc.h> #include <malloc.h>
#include <stdio.h> #include <stdio.h>
#include <fcntl.h>
#ifdef _WIN32
# define sysconf(x) -1
#endif
void usage(void) void usage(void)
{ {
@@ -79,17 +87,17 @@ main(int argc, char *argv[])
int i; int i;
char buf[BUFSIZ]; char buf[BUFSIZ];
int n; int n;
extern int optind; int optind = 1;
while ((opt = getopt(argc, argv, "a")) != EOF) for (i = 1; i < argc; i++)
{ {
switch (opt) if (argv[i][0] != '-')
{ break;
case 'a': append++; if (!strcmp(argv[i], "-a"))
break; append++;
default: usage(); else
exit(2); usage();
} optind++;
} }
numfiles = argc - optind; numfiles = argc - optind;
@@ -124,9 +132,9 @@ main(int argc, char *argv[])
exit(1); exit(1);
} }
} }
_fsetmode(stdin, "b"); setmode(fileno(stdin), O_BINARY);
fflush(stdout); /* needed for _fsetmode(stdout) */ fflush(stdout); /* needed for _fsetmode(stdout) */
_fsetmode(stdout, "b"); setmode(fileno(stdout), O_BINARY);
while ((n = myfread(buf, sizeof(char), sizeof(buf), stdin)) > 0) while ((n = myfread(buf, sizeof(char), sizeof(buf), stdin)) > 0)
{ {

View File

@@ -741,6 +741,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1040,
/**/ /**/
1039, 1039,
/**/ /**/