blob: 7ac60c6d7976f7c16311b4065e372eb1eaccffb5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
/** \file
* \brief GTK Driver IupHelp for non Windows systems
*
* See Copyright Notice in "iup.h"
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include "iup.h"
#include "iup_str.h"
int IupHelp(const char *url)
{
GError *error = NULL;
gchar *argv[3];
int ret;
char *browser = getenv("IUP_HELPAPP");
if (!browser)
browser = IupGetGlobal("HELPAPP");
if (!browser)
{
char* system = IupGetGlobal("SYSTEM");
if (iupStrEqualNoCase(system, "Linux") ||
iupStrEqualNoCase(system, "FreeBSD"))
browser = "firefox";
else if (iupStrEqualNoCase(system, "MacOS"))
browser = "safari";
else if (iupStrEqualPartial(system, "CYGWIN"))
browser = "iexplore";
else
browser = "netscape";
}
argv[0] = browser;
argv[1] = (gchar*)url;
argv[2] = NULL;
ret = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error);
if (error)
g_error_free(error);
if (!ret)
return -1;
return 1;
}
|