git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] Report errors when failing to launch the html browser in mingw.

From
Erik Faye-Lund <kusmabite@googlemail.com>
Date
Mar 17, 2010, 17:01 UTC
Message-ID
<40aa078e1003171001s2c6a8765ve3bee38dddc2211c@mail.gmail.com>
In-Reply-To
<87aau7dkon.fsf@fox.patthoyts.tk>

On Wed, Mar 17, 2010 at 4:20 PM, Pat Thoyts <patthoyts@users.sourceforge.net> wrote:

Show 30 quoted lines
> The mingw function to launch the system html browser is silent if the
> target file does not exist leaving the user confused. Make it display
> something.
>
> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
> ---
>  compat/mingw.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/compat/mingw.c b/compat/mingw.c
> index 9c10a4c..d6539ef 100644
> --- a/compat/mingw.c
> +++ b/compat/mingw.c
> @@ -1548,6 +1548,7 @@ void mingw_open_html(const char *unixpath)
>                        const char *, const char *, const char *, INT);
>        T ShellExecute;
>        HMODULE shell32;
> +       int r;
>
>        shell32 = LoadLibrary("shell32.dll");
>        if (!shell32)
> @@ -1557,9 +1558,11 @@ void mingw_open_html(const char *unixpath)
>                die("cannot run browser");
>
>        printf("Launching default browser to display HTML ...\n");
> -       ShellExecute(NULL, "open", htmlpath, NULL, "\\", 0);
> -
> +       r = (int)ShellExecute(NULL, "open", htmlpath, NULL, "\\", SW_SHOWNORMAL);
>        FreeLibrary(shell32);
> +       if (r < 33) {

While entirely correct, this looks a little weird to me. How about "if (r <= 32)" (since 32 is the number MSDN mentions) and a comment?

-- 
Erik "kusma" Faye-Lund
Previous: Pat Thoyts
Message 2 of 2 in “Report errors when failing to launch the html browser in mingw.”
  1. 2/2 Report errors when failing to launch the html browser in mingw.Pat Thoyts, Mar 17, 2010
  2. Erik Faye-LundMar 17, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.