3.13. lib/linux.g - Linux library

/*--------------------------------------------------------------------
 * File:        linux.g
 *
 * Description: Functions that run only in Linux.
 *
 * Functions:
 *                anyos_system
 *                anyos_find_process
 *                anyos_assign
 *              anyos_change_settings
 *              anyos_help
 *------------------------------------------------------------------*/


require("lib/gtk.g");

/*--------------------------------------------------------------------
 * Function:    anyos_system
 * Returns:     doesn't return
 * Description: A wrapper for the system() function to allow for alternate
 *              code in QNX.
 *------------------------------------------------------------------*/
function anyos_system(call, sig)
{
  system(call);
}

/*--------------------------------------------------------------------
 * Function:    anyos_find_process
 * Returns:     t or nil
 * Description: A wrapper for the qnx_name_locate() function used in
 *              anyos_start_qnserves().  Allows for alternate code in
 *              QNX 6.
 *------------------------------------------------------------------*/
function anyos_find_process(command, name)
{
  qnx_name_locate (0, name, 0);
}

/*--------------------------------------------------------------------
 * Function:    anyos_assign
 * Returns:     function
 * Description: Not currently used in Linux.  Used in QNX 4 and QNX 6 
 *              for making OS-dependent assignments.
 *------------------------------------------------------------------*/
function anyos_assign(str)
{
  nil;
}

/*--------------------------------------------------------------------
 * Function:    anyos_help
 * Returns:     function
 * Description: Starts up a browser and displays the Tutorial docs.
 *------------------------------------------------------------------*/
function anyos_help()
{
  local url = "http://developers.cogentrts.com/cogent/cogentdocs/booktu.html";
  local browser, browsers = list("galeon", "mozilla", "lynx", "opera",
                                 "dillo", "netscape", "w3m", "netrik",
                                 "skipstone", "amaya", "phoenix", "elinks");
  local b_length = length(browsers);

  for (i = 0; i < b_length; i++)
    {
      browser = car(nth_cdr(browsers,i));
      if (find_on_path(browser))
        {
          system(string(browser, " ", url, " &"));
          i = b_length;
        }
      else if(i == (b_length - 1))
        anygui_makemsg(string("\nSorry, your browser isn't supported. ",
                          "Try installing one of these: \n",
                          browsers, "\n\n",
                          "Or modify the anyos_help() function, ",
                          "line 60, in lib/linux.d\n",
                          "and add your browser to the list.\n"));
    }
}

princ("OS is Linux.\n");