diff -urp global-6.6.2/configure.ac global-6.6-2/configure.ac --- global-6.6.2/configure.ac 2018-02-09 10:46:32 +1000 +++ global-6.6-2/configure.ac 2018-02-14 17:33:00 +1000 @@ -67,6 +67,10 @@ if test ${ac_header_dirent} = no; then AC_MSG_ERROR([dirent(3) is required but not found.]) fi +case "$host_os" in + mingw*|djgpp*) + ;; + *) AC_MSG_CHECKING(whether POSIX.1-2008 realpath is equipped) AC_CACHE_VAL(ac_cv_posix1_2008_realpath, [AC_RUN_IFELSE([AC_LANG_SOURCE([[ @@ -77,6 +81,8 @@ AC_MSG_RESULT($ac_cv_posix1_2008_realpat if test "$ac_cv_posix1_2008_realpath" = no; then AC_MSG_ERROR([POSIX.1-2008 realpath(3) is required.]) fi + ;; +esac AC_HEADER_STDC AC_HEADER_STAT AC_HEADER_TIME diff -urp global-6.6.2/global/global.c global-6.6-2/global/global.c --- global-6.6.2/global/global.c 2018-02-09 10:46:32 +1000 +++ global-6.6-2/global/global.c 2018-02-14 17:55:01 +1000 @@ -1097,7 +1097,7 @@ completion_idutils(const char *dbpath, c } if (chdir(root) < 0) die("cannot move to '%s' directory.", root); -#if defined(_WIN32) && !defined(__CYGWIN__) +#if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(__DJGPP__) strbuf_puts(sb, lid); strbuf_sprintf(sb, " --file=%s/ID", quote_shell(dbpath)); strbuf_puts(sb, " --key=token"); @@ -1152,7 +1152,7 @@ completion_idutils(const char *dbpath, c *p = '\0'; puts(line); } -#if defined(_WIN32) && !defined(__CYGWIN__) +#if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(__DJGPP__) if (pclose(ip) != 0) die("terminated abnormally (errno = %d).", errno); #else @@ -1313,7 +1313,7 @@ idutils(const char *pattern, const char * make lid command line. * Invoke lid with the --result=grep option to generate grep format. */ -#if defined(_WIN32) && !defined(__CYGWIN__) +#if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(__DJGPP__) strbuf_puts(ib, lid); strbuf_sprintf(ib, " --file=%s/ID", quote_shell(dbpath)); strbuf_puts(ib, " --separator=newline"); @@ -1411,7 +1411,7 @@ idutils(const char *pattern, const char break; } } -#if defined(_WIN32) && !defined(__CYGWIN__) +#if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(__DJGPP__) if (pclose(ip) != 0) die("terminated abnormally (errno = %d).", errno); #else diff -urp global-6.6.2/gtags-cscope/command.c global-6.6-2/gtags-cscope/command.c --- global-6.6.2/gtags-cscope/command.c 2018-02-09 10:46:32 +1000 +++ global-6.6-2/gtags-cscope/command.c 2018-02-14 18:37:50 +1000 @@ -404,6 +404,13 @@ cscope: cannot open pipe to shell comman return(NO); } strbuf_clear(sb); +#if defined(_WIN32) && !defined(__CYGWIN__) + /* + * Get around CMD.EXE's weird quoting rules by sticking another + * perceived whitespace in front (also works with Take Command). + */ + strbuf_putc(sb, ';'); +#endif strbuf_puts(sb, quote_shell(global_command)); strbuf_sprintf(sb, " %s %s > %s", globaloption, quote_shell(newpat), temp2); remove(temp2); diff -urp global-6.6.2/gtags-cscope/find.c global-6.6-2/gtags-cscope/find.c --- global-6.6.2/gtags-cscope/find.c 2018-02-09 10:46:32 +1000 +++ global-6.6-2/gtags-cscope/find.c 2018-02-14 18:37:51 +1000 @@ -28,6 +28,13 @@ common(void) { STATIC_STRBUF(sb); strbuf_clear(sb); +#if defined(_WIN32) && !defined(__CYGWIN__) + /* + * Get around CMD.EXE's weird quoting rules by sticking another + * perceived whitespace in front (also works with Take Command). + */ + strbuf_putc(sb, ';'); +#endif strbuf_sprintf(sb, "%s --encode-path=\" \t\" --result=cscope", quote_shell(global_command)); if (caseless == YES) strbuf_puts(sb, " -i"); diff -urp global-6.6.2/libutil/abs2rel.c global-6.6-2/libutil/abs2rel.c --- global-6.6.2/libutil/abs2rel.c 2018-02-09 10:46:33 +1000 +++ global-6.6-2/libutil/abs2rel.c 2018-02-14 17:39:34 +1000 @@ -38,6 +38,7 @@ #include "path.h" #if defined(_WIN32) || defined(__DJGPP__) #include "checkalloc.h" +#include #define LOCATEFLAG MATCH_AT_FIRST|IGNORE_CASE #define PATHCHAR(c) tolower(c) #else diff -urp global-6.6.2/libutil/path.c global-6.6-2/libutil/path.c --- global-6.6.2/libutil/path.c 2018-02-09 10:46:33 +1000 +++ global-6.6-2/libutil/path.c 2018-02-14 17:42:24 +1000 @@ -163,6 +163,7 @@ canonpath(char *path) } #if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(__DJGPP__) +#include "checkalloc.h" /** * realpath: get the complete path * @@ -173,6 +174,8 @@ canonpath(char *path) char * realpath(const char *in_path, char *out_path) { + if (out_path == NULL) + out_path = check_malloc(MAXPATHLEN); #ifdef __DJGPP__ /* * I don't use _fixpath or _truename in LFN because neither guarantee diff -urp global-6.6.2/libutil/secure_popen.c global-6.6-2/libutil/secure_popen.c --- global-6.6.2/libutil/secure_popen.c 2018-02-09 10:46:33 +1000 +++ global-6.6-2/libutil/secure_popen.c 2018-02-14 17:56:59 +1000 @@ -18,6 +18,7 @@ * along with this program. If not, see . */ +#if !((defined(_WIN32) && !defined(__CYGWIN__)) || defined(__DJGPP__)) #ifdef HAVE_CONFIG_H #include #endif @@ -96,3 +97,4 @@ secure_pclose(FILE *ip) return (ppid == -1 ? -1 : status); } +#endif