From: Frank Li Date: Mon, 10 Aug 2009 13:56:19 GMT Subject: Using VC build git Message-ID: <1976ea660908100656u57407131h83761329468607a8@mail.gmail.com> pull from git://repo.or.cz/tgit.git From 62b705d074a3eeffe8af5c8c0334f12ec76d1cee Mon Sep 17 00:00:00 2001 From: Frank Li Date: Sat, 8 Aug 2009 13:35:40 +0800 Subject: [PATCH 5/5] git commit okay Signed-off-by: Frank Li --- compat/mingw.c | 6 +++++- contrib/vcbuild/porting.c | 2 +- editor.c | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/compat/mingw.c b/compat/mingw.c index 1cc2cb7..79cbd9f 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -275,7 +275,7 @@ int mkstemp(char *template) char *filename = mktemp(template); if (filename == NULL) return -1; - return open(filename, O_RDWR | O_CREAT, 0600); + return _open(filename, _O_RDWR | _O_CREAT | _O_BINARY, 0600); } int gettimeofday(struct timeval *tv, void *tz) @@ -1144,6 +1144,10 @@ int link(const char *oldpath, const char *newpath) { typedef BOOL WINAPI (*T)(const char*, const char*, LPSECURITY_ATTRIBUTES); static T create_hard_link = NULL; + + errno = ENOSYS; + return -1; + if (!create_hard_link) { create_hard_link = (T) GetProcAddress( GetModuleHandle("kernel32.dll"), "CreateHardLinkA"); diff --git a/contrib/vcbuild/porting.c b/contrib/vcbuild/porting.c index 0625bb4..cf83efc 100644 --- a/contrib/vcbuild/porting.c +++ b/contrib/vcbuild/porting.c @@ -10,7 +10,7 @@ int snprintf(char *buff,int size, char *fmt, ...) int n; va_list pArgList; va_start(pArgList,fmt); - n=_snprintf(buff,size-1,fmt,pArgList); + n=_vsnprintf(buff,size-1,fmt,pArgList); va_end(pArgList); return n; } diff --git a/editor.c b/editor.c index 4d469d0..a9a3b7c 100644 --- a/editor.c +++ b/editor.c @@ -13,6 +13,8 @@ int launch_editor(const char *path, struct strbuf *buffer, const char *const *en editor = getenv("VISUAL"); if (!editor) editor = getenv("EDITOR"); + if (!editor) + editor = "notepad2"; terminal = getenv("TERM"); if (!editor && (!terminal || !strcmp(terminal, "dumb"))) -- 1.6.4.msysgit.0 From 5352796e16d5781613968dc4fcf74ad5e3d7306d Mon Sep 17 00:00:00 2001 From: Frank Li Date: Wed, 5 Aug 2009 12:51:46 +0800 Subject: [PATCH 1/5] build git library --- builtin-fast-export.c | 1 + compat/fopen.c | 1 + compat/mingw.c | 4 +- compat/mingw.h | 9 +- contrib/vcbuild/include/unistd.h | 8 +- contrib/vcbuild/libgit/libgit.vcproj | 2688 +++++++++++++++++----------------- contrib/vcbuild/vcbuild.sln | 29 + help.c | 3 +- run-command.c | 3 + 9 files changed, 1403 insertions(+), 1343 deletions(-) create mode 100644 contrib/vcbuild/vcbuild.sln diff --git a/builtin-fast-export.c b/builtin-fast-export.c index c48c18d..24a50ae 100644 --- a/builtin-fast-export.c +++ b/builtin-fast-export.c @@ -24,6 +24,7 @@ static const char *fast_export_usage[] = { static int progress; static enum { ABORT, VERBATIM, WARN, STRIP } signed_tag_mode = ABORT; +#undef ERROR static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ABORT; static int fake_missing_tagger; diff --git a/compat/fopen.c b/compat/fopen.c index b5ca142..b9a02e4 100644 --- a/compat/fopen.c +++ b/compat/fopen.c @@ -10,6 +10,7 @@ */ #undef FREAD_READS_DIRECTORIES #include "../git-compat-util.h" +#undef stat FILE *git_fopen(const char *path, const char *mode) { diff --git a/compat/mingw.c b/compat/mingw.c index 405a51e..f3a74f8 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -151,6 +151,7 @@ static inline time_t filetime_to_time_t(const FILETIME *ft) * When a path ends with a slash, the stat will fail with ENOENT. In * this case, we strip the trailing slashes and stat again. */ +#undef stat static int do_lstat(const char *file_name, struct stat *buf) { WIN32_FILE_ATTRIBUTE_DATA fdata; @@ -1200,8 +1201,9 @@ struct dirent *mingw_readdir(DIR *dir) if (dir->dd_handle == (long)INVALID_HANDLE_VALUE && dir->dd_stat == 0) { + DWORD lasterr; handle = FindFirstFileA(dir->dd_name, &buf); - DWORD lasterr = GetLastError(); + lasterr = GetLastError(); dir->dd_handle = (long)handle; if (handle == INVALID_HANDLE_VALUE && (lasterr != ERROR_NO_MORE_FILES)) { errno = err_win_to_posix(lasterr); diff --git a/compat/mingw.h b/compat/mingw.h index 0ede971..281bfde 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -171,13 +171,20 @@ int mingw_getpagesize(void); /* Use mingw_lstat() instead of lstat()/stat() and * mingw_fstat() instead of fstat() on Windows. */ +#undef off_t #define off_t off64_t -#define stat _stati64 +#undef stat +#define stat _stat64 +#define stat(x,y) _stati64(x,y) +#undef lseek #define lseek _lseeki64 int mingw_lstat(const char *file_name, struct stat *buf); int mingw_fstat(int fd, struct stat *buf); +#undef fstat #define fstat mingw_fstat +#undef lstat #define lstat mingw_lstat +#undef _stati64 #define _stati64(x,y) mingw_lstat(x,y) int mingw_utime(const char *file_name, const struct utimbuf *times); diff --git a/contrib/vcbuild/include/unistd.h b/contrib/vcbuild/include/unistd.h index 311cbc0..5b4d780 100644 --- a/contrib/vcbuild/include/unistd.h +++ b/contrib/vcbuild/include/unistd.h @@ -4,6 +4,7 @@ /*Configuration*/ #define __MINGW32__ +#define NO_LIBGEN_H #define NO_SYS_SELECT_H #define NO_PTHEADS #define HAVE_STRING_H 1 @@ -17,7 +18,7 @@ #define NTDDI_VERSION NTDDI_WIN2KSP1 #define inline __inline #define __inline__ __inline -#define NO_MMAP +#define USE_WIN32_MMAP #define SHA1_HEADER "mozilla-sha1\\sha1.h" #define NO_ST_BLOCKS_IN_STRUCT_STAT #define ETC_GITCONFIG "%HOME%" @@ -30,6 +31,7 @@ #define va_copy va_start #define NO_STRTOUMAX #define REGEX_MALLOC +#define NO_NSEC /* Win32 define for porting git*/ @@ -73,6 +75,8 @@ typedef unsigned long long uint64_t; typedef long long intmax_t; typedef unsigned long long uintmax_t; +typedef int64_t off64_t; + #define STDOUT_FILENO 1 #define STDERR_FILENO 2 @@ -137,6 +141,6 @@ typedef unsigned long long uintmax_t; #define close _close #define dup _dup #define dup2 _dup2 -#define lseek _lseek +//#define lseek _lseek #define write vs_write #endif \ No newline at end of file diff --git a/contrib/vcbuild/libgit/libgit.vcproj b/contrib/vcbuild/libgit/libgit.vcproj index b6579e4..8bf9696 100644 --- a/contrib/vcbuild/libgit/libgit.vcproj +++ b/contrib/vcbuild/libgit/libgit.vcproj @@ -1,1338 +1,1350 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/vcbuild/vcbuild.sln b/contrib/vcbuild/vcbuild.sln new file mode 100644 index 0000000..fbd1377 --- /dev/null +++ b/contrib/vcbuild/vcbuild.sln @@ -0,0 +1,29 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libgit", "libgit\libgit.vcproj", "{F6DEC8C3-B803-4A86-8848-430F08B499E3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "git", "git\git.vcproj", "{E3E30E51-C5AD-407B-AB43-985E4111474A}" + ProjectSection(ProjectDependencies) = postProject + {F6DEC8C3-B803-4A86-8848-430F08B499E3} = {F6DEC8C3-B803-4A86-8848-430F08B499E3} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F6DEC8C3-B803-4A86-8848-430F08B499E3}.Debug|Win32.ActiveCfg = Debug|Win32 + {F6DEC8C3-B803-4A86-8848-430F08B499E3}.Debug|Win32.Build.0 = Debug|Win32 + {F6DEC8C3-B803-4A86-8848-430F08B499E3}.Release|Win32.ActiveCfg = Release|Win32 + {F6DEC8C3-B803-4A86-8848-430F08B499E3}.Release|Win32.Build.0 = Release|Win32 + {E3E30E51-C5AD-407B-AB43-985E4111474A}.Debug|Win32.ActiveCfg = Debug|Win32 + {E3E30E51-C5AD-407B-AB43-985E4111474A}.Debug|Win32.Build.0 = Debug|Win32 + {E3E30E51-C5AD-407B-AB43-985E4111474A}.Release|Win32.ActiveCfg = Release|Win32 + {E3E30E51-C5AD-407B-AB43-985E4111474A}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/help.c b/help.c index 6c46d8b..399b0b4 100644 --- a/help.c +++ b/help.c @@ -127,7 +127,7 @@ static int is_executable(const char *name) return 0; #ifdef __MINGW32__ - /* cannot trust the executable bit, peek into the file instead */ +{ /* cannot trust the executable bit, peek into the file instead */ char buf[3] = { 0 }; int n; int fd = open(name, O_RDONLY); @@ -140,6 +140,7 @@ static int is_executable(const char *name) st.st_mode |= S_IXUSR; close(fd); } +} #endif return st.st_mode & S_IXUSR; } diff --git a/run-command.c b/run-command.c index ff3d8e2..06cce47 100644 --- a/run-command.c +++ b/run-command.c @@ -123,6 +123,7 @@ int start_command(struct child_process *cmd) exit(127); } #else +{ int s0 = -1, s1 = -1, s2 = -1; /* backups of stdin, stdout, stderr */ const char **sargv = cmd->argv; char **env = environ; @@ -186,6 +187,7 @@ int start_command(struct child_process *cmd) dup2(s1, 1), close(s1); if (s2 >= 0) dup2(s2, 2), close(s2); +} #endif if (cmd->pid < 0) { @@ -293,6 +295,7 @@ int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const } #ifdef __MINGW32__ +#define __stdcall static __stdcall unsigned run_thread(void *data) { struct async *async = data; -- 1.6.4.msysgit.0 From ba67bc0341367ccaab1317902ae8acd7209214b7 Mon Sep 17 00:00:00 2001 From: Frank Li Date: Wed, 5 Aug 2009 14:39:01 +0800 Subject: [PATCH 2/5] enable release build --- compat/mingw.c | 1 - compat/mingw.h | 13 +- contrib/vcbuild/git/git.vcproj | 6 +- contrib/vcbuild/include/unistd.h | 39 +- contrib/vcbuild/libgit/libgit.vcproj | 2700 +++++++++++++++++----------------- 5 files changed, 1394 insertions(+), 1365 deletions(-) diff --git a/compat/mingw.c b/compat/mingw.c index f3a74f8..96c1a5f 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -151,7 +151,6 @@ static inline time_t filetime_to_time_t(const FILETIME *ft) * When a path ends with a slash, the stat will fail with ENOENT. In * this case, we strip the trailing slashes and stat again. */ -#undef stat static int do_lstat(const char *file_name, struct stat *buf) { WIN32_FILE_ATTRIBUTE_DATA fdata; diff --git a/compat/mingw.h b/compat/mingw.h index 281bfde..b4276c4 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -173,19 +173,24 @@ int mingw_getpagesize(void); */ #undef off_t #define off_t off64_t -#undef stat + + +#define stat(x,y) mingw_lstat(x,y) #define stat _stat64 -#define stat(x,y) _stati64(x,y) + #undef lseek #define lseek _lseeki64 + int mingw_lstat(const char *file_name, struct stat *buf); int mingw_fstat(int fd, struct stat *buf); + #undef fstat #define fstat mingw_fstat + #undef lstat #define lstat mingw_lstat -#undef _stati64 -#define _stati64(x,y) mingw_lstat(x,y) + + int mingw_utime(const char *file_name, const struct utimbuf *times); #define utime mingw_utime diff --git a/contrib/vcbuild/git/git.vcproj b/contrib/vcbuild/git/git.vcproj index ff5e1d9..49ab8bf 100644 --- a/contrib/vcbuild/git/git.vcproj +++ b/contrib/vcbuild/git/git.vcproj @@ -91,10 +91,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 1.6.4.msysgit.0 From bbec8b9376d7183abda907de0e4f995f79fe9914 Mon Sep 17 00:00:00 2001 From: Frank Li Date: Wed, 5 Aug 2009 21:31:36 +0800 Subject: [PATCH 3/5] Release log command okay --- contrib/vcbuild/libgit/libgit.vcproj | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/contrib/vcbuild/libgit/libgit.vcproj b/contrib/vcbuild/libgit/libgit.vcproj index 7e45146..4f2d234 100644 --- a/contrib/vcbuild/libgit/libgit.vcproj +++ b/contrib/vcbuild/libgit/libgit.vcproj @@ -105,6 +105,7 @@ Date: Sat, 8 Aug 2009 11:45:17 +0800 Subject: [PATCH 4/5] Move open dir function to mingw.c Signed-off-by: Frank Li --- compat/mingw.c | 32 + contrib/vcbuild/include/unistd.h | 9 +- contrib/vcbuild/libgit/libgit.vcproj | 2702 +++++++++++++++++----------------- contrib/vcbuild/porting.c | 66 +- 4 files changed, 1393 insertions(+), 1416 deletions(-) diff --git a/compat/mingw.c b/compat/mingw.c index 96c1a5f..1cc2cb7 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -1234,4 +1234,36 @@ struct dirent *mingw_readdir(DIR *dir) return (struct dirent*)&dir->dd_dir; } + +DIR *opendir(const char *name) +{ + int len; + DIR *p; + p=(DIR*)malloc(sizeof(DIR)); + memset(p,0,sizeof(DIR)); + strncpy(p->dd_name,name,PATH_MAX); + len=strlen(p->dd_name); + p->dd_name[len]='/'; + p->dd_name[len+1]='*'; + + if(p==NULL) + return NULL; + + p->dd_handle=_findfirst(p->dd_name,&p->dd_dta); + + if(p->dd_handle == -1) + { + free(p); + return NULL; + } + return p; +} +int closedir(DIR *dir) +{ + _findclose(dir->dd_handle); + free(dir); + return 0; +} + #endif // !NO_MINGW_REPLACE_READDIR + diff --git a/contrib/vcbuild/include/unistd.h b/contrib/vcbuild/include/unistd.h index 3450bc3..93ecd74 100644 --- a/contrib/vcbuild/include/unistd.h +++ b/contrib/vcbuild/include/unistd.h @@ -151,9 +151,10 @@ typedef int64_t off64_t; #define GIT_VERSION "1.6" #define BINDIR "bin" #define PREFIX "." -#define GIT_MAN_PATH "../man" -#define GIT_INFO_PATH "../info" -#define GIT_HTML_PATH "../html" +#define GIT_MAN_PATH "man" +#define GIT_INFO_PATH "info" +#define GIT_HTML_PATH "html" +#define DEFAULT_GIT_TEMPLATE_DIR "templates" #define NO_STRLCPY #define NO_UNSETENV @@ -165,5 +166,5 @@ typedef int64_t off64_t; #define dup _dup #define dup2 _dup2 //#define lseek _lseek -#define write vs_write +//#define write vs_write #endif \ No newline at end of file diff --git a/contrib/vcbuild/libgit/libgit.vcproj b/contrib/vcbuild/libgit/libgit.vcproj index 4f2d234..5bac103 100644 --- a/contrib/vcbuild/libgit/libgit.vcproj +++ b/contrib/vcbuild/libgit/libgit.vcproj @@ -1,1351 +1,1351 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/vcbuild/porting.c b/contrib/vcbuild/porting.c index 5381862..0625bb4 100644 --- a/contrib/vcbuild/porting.c +++ b/contrib/vcbuild/porting.c @@ -7,10 +7,12 @@ int snprintf(char *buff,int size, char *fmt, ...) { + int n; va_list pArgList; va_start(pArgList,fmt); - _snprintf(buff,size-1,fmt,pArgList); + n=_snprintf(buff,size-1,fmt,pArgList); va_end(pArgList); + return n; } int strcasecmp (const char *s1, const char *s2) @@ -18,16 +20,12 @@ int strcasecmp (const char *s1, const char *s2) int size1=strlen(s1); int sisz2=strlen(s2); - _strnicmp(s1,s2,sisz2>size1?sisz2:size1); + return _strnicmp(s1,s2,sisz2>size1?sisz2:size1); } int strncasecmp (const char *s1, const char *s2,size_t n) { - _strnicmp(s1,s2,n); -} -size_t getpagesize(void) -{ - return 0x1000; + return _strnicmp(s1,s2,n); } unsigned long long int @@ -35,57 +33,3 @@ strtoull(const char *nptr, char **endptr, int base) { return _strtoui64(nptr,endptr,base); } - -DIR *opendir(const char *name) -{ - int len; - DIR *p; - p=(DIR*)malloc(sizeof(DIR)); - memset(p,0,sizeof(DIR)); - strncpy(p->dd_name,name,PATH_MAX); - len=strlen(p->dd_name); - p->dd_name[len]='/'; - p->dd_name[len+1]='*'; - - if(p==NULL) - return NULL; - - p->dd_handle=_findfirst(p->dd_name,&p->dd_dta); - - if(p->dd_handle == -1) - { - free(p); - return NULL; - } - return p; -} -int closedir(DIR *dir) -{ - _findclose(dir->dd_handle); - free(dir); - return 0; -} -struct dirent *readdir(DIR *dir) -{ - if(_findnext(dir->dd_handle,&dir->dd_dta)) - return NULL; - - strcpy(dir->dd_dir.d_name,dir->dd_dta.name); - dir->dd_dir.d_namlen = dir->dd_dta.size; - - return &dir->dd_dir; -} -char *mkdtemp(char *template) -{ - return NULL; -} -ssize_t pread(int fd, void *buf, size_t nbytes, off_t offset) -{ - _lseek(fd,offset,SEEK_SET); - return read(fd,buf,nbytes); -} - -int vs_write(int fd, void * buf, size_t nbytes) -{ - return _write(fd,buf,nbytes); -} \ No newline at end of file -- 1.6.4.msysgit.0