Changeset c06a32 in git for Singular/fehelp.cc


Ignore:
Timestamp:
Sep 20, 1999, 8:03:51 PM (25 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
70883173be34d0af981d9af508ccbb1e77912676
Parents:
aef7ccb547c93eee9ab75ef2c46ce9149f6dd9ca
Message:
* New Handling of Command-line options


git-svn-id: file:///usr/local/Singular/svn/trunk@3623 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/fehelp.cc

    raef7ccb rc06a32  
    2121#include "ipshell.h"
    2222#include "libparse.h"
     23#include "feOpt.h"
    2324
    2425/*****************************************************************
     
    149150        Warn("No help for topic '%s' (not even for '*%s*')", str, str);
    150151        WarnS("Try '?;'       for general help");
    151         WarnS("or  '?Index;'  for all available help topics");
     152        WarnS("or  '?Index;'  for all available help topics.");
    152153        return;
    153154      }
     
    182183{
    183184  int i = 0;
    184   extern void mainSetSingOptionValue(const char* name, char* value);
    185   char* mainGetSingOptionValue(const char* name);
    186 
    187   // if no argument, see what we have as value to the option
    188   if (which == NULL || *which == '\0')
    189     which = mainGetSingOptionValue("browser");
    190185
    191186  // if no argument, choose first available help browser
    192187  if (which == NULL || *which == '\0')
    193188  {
    194     // unles one is already set
    195     if (heCurrentHelpBrowser != NULL) goto Finish;
    196 
     189    // return, if already set
     190    if (heCurrentHelpBrowser != NULL)
     191      return heCurrentHelpBrowser->browser;
     192
     193    // First, try emacs, if emacs-option is set
     194    if (feOptValue(FE_OPT_EMACS) != NULL)
     195    {
     196      while (heHelpBrowsers[i].browser != NULL)
     197      {
     198        if (strcmp(heHelpBrowsers[i].browser, "emacs") == 0 &&
     199            (heHelpBrowsers[i].init_proc(0)))
     200        {
     201          heCurrentHelpBrowser = &(heHelpBrowsers[i]);
     202          goto Finish;
     203        }
     204        i++;
     205      }
     206      i=0;
     207    }
    197208    while (heHelpBrowsers[i].browser != NULL)
    198209    {
     
    200211      {
    201212        heCurrentHelpBrowser = &(heHelpBrowsers[i]);
    202         return heCurrentHelpBrowser->browser;
     213        goto Finish;
    203214      }
    204215      i++;
     
    215226  if (heHelpBrowsers[i].browser == NULL)
    216227  {
    217     if (warn) Warn("No help browser '%s' available", which);
     228    if (warn) Warn("No help browser '%s' available.", which);
    218229  }
    219230  else
     
    230241  if (heCurrentHelpBrowser == NULL)
    231242  {
    232     // choose first available help browser
    233     mainSetSingOptionValue("browser", "");
    234243    feHelpBrowser();
    235244    assume(heCurrentHelpBrowser != NULL);
    236245    if (warn)
    237       Warn("Setting help browser to '%s'", heCurrentHelpBrowser->browser);
     246      Warn("Setting help browser to '%s'.", heCurrentHelpBrowser->browser);
    238247    return heCurrentHelpBrowser->browser;
    239248  }
     
    242251    // or, leave as is
    243252    if (warn)
    244       Warn("Help browser stays at '%s'",  heCurrentHelpBrowser->browser);
     253      Warn("Help browser stays at '%s'.",  heCurrentHelpBrowser->browser);
     254    return heCurrentHelpBrowser->browser;
    245255  }
    246256
    247257  Finish:
    248   mainSetSingOptionValue("browser", heCurrentHelpBrowser->browser);
     258  // update value of Browser Option
     259  if (feOptSpec[FE_OPT_BROWSER].value == NULL ||
     260      strcmp((char*) feOptSpec[FE_OPT_BROWSER].value, 
     261             heCurrentHelpBrowser->browser) != 0)
     262  {
     263    if (feOptSpec[FE_OPT_BROWSER].value == NULL)
     264      FreeL(feOptSpec[FE_OPT_BROWSER].value);
     265   feOptSpec[FE_OPT_BROWSER].value
     266     = (void*) mstrdup(heCurrentHelpBrowser->browser);
     267  }
    249268  return heCurrentHelpBrowser->browser;
    250269}
     
    642661    return;
    643662
    644   if (heCurrentHelpBrowser == NULL) feHelpBrowser();
     663  if (heCurrentHelpBrowser == NULL) feHelpBrowser(NULL, 0);
    645664  assume(heCurrentHelpBrowser != NULL);
    646665  if (! feHelpCalled)
     
    722741  {
    723742    if (warn) WarnS("no local HtmlDir found");
    724     if (warn) Warn("using %s instead", feResource('u' /*"ManualUrl"*/, warn));
     743    return FALSE;
     744//    if (warn) Warn("using %s instead", feResource('u' /*"ManualUrl"*/, warn));
    725745  }
    726746  return TRUE;
Note: See TracChangeset for help on using the changeset viewer.