Back to index

im-sdk  12.3.91
Functions
xaux_ext_help.c File Reference
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "iiimpAux.h"
#include "xaux_ext_help.h"

Go to the source code of this file.

Functions

void HelpInvoke (char *path)

Function Documentation

void HelpInvoke ( char *  path)

Definition at line 255 of file xaux_ext_help.c.

{
    char *browser;
    char *basepath;

    pid_t pid, pid2;

    if (!path) {
      return;
    }

#ifdef linux
    pid = fork();
#else
    pid = fork1();
#endif

#if defined(USE_GNOME_HELP)
    browser = "/usr/lib/iiim/le/sampleja4/help/help-handler";
#else /* USE_GNOME_HELP */
    if (getenv("HTT_HELP_BROWSER")){
      browser = getenv("HTT_HELP_BROWSER");
    } else {
      browser = "/usr/bin/netscape";
    }
#endif /* USE_GNOME_HELP */

    if (getenv("HTT_HELP_PATH")){
      basepath = getenv("HTT_HELP_PATH");
    } else {
      basepath = DEFAULT_HELP_PATH;
    }

    if (pid == (pid_t) (-1)) {
        return;
    } else if (0 == pid) {
        pid2 = fork();
        if(pid2 == -1) {
            _exit(1);
        } else if(pid2 == 0) {
           char *help = (char*)malloc(strlen(basepath) + strlen(path) +1 );
           sprintf(help, "%s%s", basepath, path);
           execl(browser, browser, help, NULL);
           free(help);
            _exit(1);
        } else {
            _exit(0);
        }
    } else {
        waitpid(pid, NULL, 0);
    }
    return;
}