From: Junio C Hamano Date: Fri, 9 Sep 2016 04:35:55 +0000 (-0700) Subject: Merge branch 'js/no-html-bypass-on-windows' into maint X-Git-Tag: v2.9.4~13 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/ba22efd8f5d9bd946925e72b5e6ede91ce2ec9be?ds=inline;hp=-c Merge branch 'js/no-html-bypass-on-windows' into maint On Windows, help.browser configuration variable used to be ignored, which has been corrected. * js/no-html-bypass-on-windows: Revert "display HTML in default browser using Windows' shell API" --- ba22efd8f5d9bd946925e72b5e6ede91ce2ec9be diff --combined builtin/help.c index 88480131cf,0c91ff5bfc..e8f79d7af5 --- a/builtin/help.c +++ b/builtin/help.c @@@ -127,7 -127,7 +127,7 @@@ static void exec_woman_emacs(const cha path = "emacsclient"; strbuf_addf(&man_page, "(woman \"%s\")", page); execlp(path, "emacsclient", "-e", man_page.buf, (char *)NULL); - warning(_("failed to exec '%s': %s"), path, strerror(errno)); + warning_errno(_("failed to exec '%s'"), path); } } @@@ -148,7 -148,7 +148,7 @@@ static void exec_man_konqueror(const ch path = "kfmclient"; strbuf_addf(&man_page, "man:%s(1)", page); execlp(path, filename, "newTab", man_page.buf, (char *)NULL); - warning(_("failed to exec '%s': %s"), path, strerror(errno)); + warning_errno(_("failed to exec '%s'"), path); } } @@@ -157,7 -157,7 +157,7 @@@ static void exec_man_man(const char *pa if (!path) path = "man"; execlp(path, "man", page, (char *)NULL); - warning(_("failed to exec '%s': %s"), path, strerror(errno)); + warning_errno(_("failed to exec '%s'"), path); } static void exec_man_cmd(const char *cmd, const char *page) @@@ -165,7 -165,7 +165,7 @@@ struct strbuf shell_cmd = STRBUF_INIT; strbuf_addf(&shell_cmd, "%s %s", cmd, page); execl(SHELL_PATH, SHELL_PATH, "-c", shell_cmd.buf, (char *)NULL); - warning(_("failed to exec '%s': %s"), cmd, strerror(errno)); + warning(_("failed to exec '%s'"), cmd); } static void add_man_viewer(const char *name) @@@ -379,17 -379,10 +379,10 @@@ static void get_html_page_path(struct s free(to_free); } - /* - * If open_html is not defined in a platform-specific way (see for - * example compat/mingw.h), we use the script web--browse to display - * HTML. - */ - #ifndef open_html static void open_html(const char *path) { execl_git_cmd("web--browse", "-c", "help.browser", path, (char *)NULL); } - #endif static void show_html_page(const char *git_cmd) { diff --combined compat/mingw.c index 2b5467dead,88a3242360..3fbfda5978 --- a/compat/mingw.c +++ b/compat/mingw.c @@@ -1930,48 -1930,6 +1930,6 @@@ int mingw_raise(int sig } } - - static const char *make_backslash_path(const char *path) - { - static char buf[PATH_MAX + 1]; - char *c; - - if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX) - die("Too long path: %.*s", 60, path); - - for (c = buf; *c; c++) { - if (*c == '/') - *c = '\\'; - } - return buf; - } - - void mingw_open_html(const char *unixpath) - { - const char *htmlpath = make_backslash_path(unixpath); - typedef HINSTANCE (WINAPI *T)(HWND, const char *, - const char *, const char *, const char *, INT); - T ShellExecute; - HMODULE shell32; - int r; - - shell32 = LoadLibrary("shell32.dll"); - if (!shell32) - die("cannot load shell32.dll"); - ShellExecute = (T)GetProcAddress(shell32, "ShellExecuteA"); - if (!ShellExecute) - die("cannot run browser"); - - printf("Launching default browser to display HTML ...\n"); - r = HCAST(int, ShellExecute(NULL, "open", htmlpath, - NULL, "\\", SW_SHOWNORMAL)); - FreeLibrary(shell32); - /* see the MSDN documentation referring to the result codes here */ - if (r <= 32) { - die("failed to launch browser for %.*s", MAX_PATH, unixpath); - } - } - int link(const char *oldpath, const char *newpath) { typedef BOOL (WINAPI *T)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES); @@@ -2162,7 -2120,7 +2120,7 @@@ int xwcstoutf(char *utf, const wchar_t return -1; } -static void setup_windows_environment() +static void setup_windows_environment(void) { char *tmp = getenv("TMPDIR"); @@@ -2204,7 -2162,7 +2162,7 @@@ typedef struct extern int __wgetmainargs(int *argc, wchar_t ***argv, wchar_t ***env, int glob, _startupinfo *si); -static NORETURN void die_startup() +static NORETURN void die_startup(void) { fputs("fatal: not enough memory for initialization", stderr); exit(128); @@@ -2224,7 -2182,7 +2182,7 @@@ static char *wcstoutfdup_startup(char * return memcpy(malloc_startup(len), buffer, len); } -void mingw_startup() +void mingw_startup(void) { int i, maxlen, argc; char *buffer; diff --combined compat/mingw.h index 95e128fcfd,17794e17a4..2cadb816ee --- a/compat/mingw.h +++ b/compat/mingw.h @@@ -73,9 -73,6 +73,9 @@@ typedef int pid_t #ifndef ECONNABORTED #define ECONNABORTED WSAECONNABORTED #endif +#ifndef ENOTSOCK +#define ENOTSOCK WSAENOTSOCK +#endif struct passwd { char *pw_name; @@@ -417,9 -414,6 +417,6 @@@ int mingw_offset_1st_component(const ch #include #endif - void mingw_open_html(const char *path); - #define open_html mingw_open_html - /** * Converts UTF-8 encoded string to UTF-16LE. * @@@ -535,10 -529,10 +532,10 @@@ extern CRITICAL_SECTION pinfo_cs * A replacement of main() that adds win32 specific initialization. */ -void mingw_startup(); -#define main(c,v) dummy_decl_mingw_main(); \ +void mingw_startup(void); +#define main(c,v) dummy_decl_mingw_main(void); \ static int mingw_main(c,v); \ -int main(int argc, char **argv) \ +int main(int argc, const char **argv) \ { \ mingw_startup(); \ return mingw_main(__argc, (void *)__argv); \