diff options
Diffstat (limited to 'iup/src/mot/iupunix_help.c')
| -rwxr-xr-x | iup/src/mot/iupunix_help.c | 44 | 
1 files changed, 44 insertions, 0 deletions
| diff --git a/iup/src/mot/iupunix_help.c b/iup/src/mot/iupunix_help.c new file mode 100755 index 0000000..02be1da --- /dev/null +++ b/iup/src/mot/iupunix_help.c @@ -0,0 +1,44 @@ +/** \file + * \brief Motif Driver IupHelp + * + * See Copyright Notice in "iup.h" + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include "iup.h" + +#include "iup_str.h" + +int IupHelp(const char *url) +{ +  char *cmd; +  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, "Darwin")) +      browser = "safari"; +    else if (iupStrEqualPartial(system, "CYGWIN")) +      browser = "iexplore"; +    else   +      browser = "netscape"; +  } +   +  cmd = (char*)malloc(sizeof(char)*(strlen(url)+strlen(browser)+3)); +  sprintf(cmd, "%s %s &", browser, url); +  ret = system(cmd);  +  free(cmd); +  if (ret == -1) +    return -1; +  return 1; +} | 
