bug 2148
Allan Cornet [Mon, 16 Oct 2006 19:09:37 +0000 (19:09 +0000)]
help browser is disabled if :
-nwni mode
-nogui mode
--texmacs mode

or %browserhelp == []

scilab/modules/helptools/macros/help.sci

index 5ca3cef..9e69812 100644 (file)
@@ -2,28 +2,58 @@ function help(key)
        
        //for compatibility with toolboxes making use of old cat files
        if (fileinfo('SCI/modules/helptools/help') <> []) then
+               global %browsehelp
+  
+    nwniarg=find(sciargs()=="-nwni");
+    texmacsarg=find(sciargs()=="--texmacs");
+    noguiarg=find(sciargs()=="-nogui");
+    
+    if (%browsehelp<>[])&(nwniarg == [])&(texmacsarg == [])&(noguiarg == []) then
+    
+                change_old_man()
+                INDEX=make_help_index()
                
-               change_old_man()
-               INDEX=make_help_index()
+                if argn(2)==0 then
+                        browsehelp(INDEX,"index");
+                        return
+                end
                
-               if argn(2)==0 then
-                       browsehelp(INDEX,"index");
-                       return
-               end
-               
-               key=stripblanks(key)
+                key=stripblanks(key)
                
-               if or(part(key,1)==['(',')','[',']','{','}','%','''','""',':','*','/', ...
-                       '\','.','<','>','&','^','|','~','+','-']) then
-                       key="symbols";
-               end
+                if or(part(key,1)==['(',')','[',']','{','}','%','''','""',':','*','/', ...
+                        '\','.','<','>','&','^','|','~','+','-']) then
+                        key="symbols";
+                end
                
-               path=gethelpfile(key)
+                path=gethelpfile(key)
                
-               if path<>[] then
-                       browsehelp(path,key)
+                if path<>[] then
+                        browsehelp(path,key)
+                else
+                        apropos(key)
+                end
                else
-                       apropos(key)
+                 if (%browsehelp == []) then 
+       warning('%browsehelp not correctly defined. help browser disabled. ');
+       return;
+      end
+   
+      errmsg='help browser disabled in this mode : ';
+      if ( nwniarg <> []) then
+       errmsg=errmsg+'-nwni';
+       warning(errmsg);
+       return;
+      end
+      if ( texmacsarg <> []) then
+       errmsg=errmsg+ '--texmacs';
+       warning(errmsg);
+       return;
+      end
+      if ( noguiarg <> [] ) then
+       errmsg=errmsg+ '-nogui';
+       warning(errmsg);
+       return;
+      end
                end
        else
                warning('Help not installed');