1. Fixed help and apropos commands so that they default to english if
authorminima <minima>
Mon, 17 Sep 2001 11:34:34 +0000 (11:34 +0000)
committerminima <minima>
Mon, 17 Sep 2001 11:34:34 +0000 (11:34 +0000)
the language is not english and help in the 'not english' language isn't
available.
2. added some help text for sh/newc.

Changes
cmd/Aliases
cmd/Commands_en.hlp
cmd/apropos.pl
cmd/help.pl

diff --git a/Changes b/Changes
index 344b05740e7a70baf8259bfd7d525c9126988129..da9e2a8876b79a0ffda441aaad30ee89b17b7b15 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,8 @@
+17Sep01=======================================================================
+1. Fixed help and apropos commands so that they default to english if
+the language is not english and help in the 'not english' language isn't
+available.
+2. added some help text for sh/newc.
 15Sep01=======================================================================
 1. released 1.48
 2. found 1st bug, fixed unset/logininfo reseting itself after logout 
index fb6fd20a13e7187e1cd1819110fdf6414fee5048..57e524f4fd40589d3c7fcc89314f0e4736659a4a 100644 (file)
@@ -107,6 +107,7 @@ package CmdAlias;
          '^sh\w*/dx/(\d+)-(\d+)', 'show/dx $1-$2', 'show/dx',
          '^sh\w*/dx/(\d+)', 'show/dx $1', 'show/dx',
          '^sh\w*/dx/d(\d+)', 'show/dx from $1', 'show/dx',
+         '^sh\w*/newc/n', 'show/newconfiguration node', 'show/newconfiguration',
          '^sh\w*/tnc', 'who', 'who',
       '^sh\w*/up', 'show/cluster', 'show/cluster',
          '^sh\w*/w\w*/(\d+)-(\d+)', 'show/wwv $1-$2', 'show/wwv',
index 10a4805cd2261165f0c5cb239fc86428ad8dc285..095b7764cfa6977964bfc82873a00542fa91d1c7 100644 (file)
@@ -1580,6 +1580,21 @@ Gives you an estimate of the long path propagation characterics. It
 should be noted that the figures will probably not be very useful, nor
 terrible accurate, but it is included for completeness.
 
+=== 0^SHOW/NEWCONFIGURATION [<node>]^Show all the nodes and users visible
+This command allows you to see all the users that can be seen
+and the nodes to which they are connected. 
+
+This command produces essentially the same information as 
+SHOW/CONFIGURATION except that it shows all the duplication of
+any routes that might be present It also uses a different format
+which may not take up quite as much space if you don't have any
+loops.
+
+BE WARNED: the list that is returned can be VERY long
+
+=== 0^SHOW/NEWCONFIGURATION/NODE^Show all the nodes connected locally
+Show all the nodes connected to this node in the new format.
+
 === 1^SHOW/NODE [<callsign> ...]^Show the type and version number of nodes
 Show the type and version (if connected) of the nodes specified on the
 command line. If no callsigns are specified then a sorted list of all
index 1226a0a729df48fc63ebddeec50b0eb9c7d4d28c..8e4d4eb24fff17d4943e3db394bb13b3038b5771 100644 (file)
@@ -15,26 +15,37 @@ my @out;
 my $lang = $self->lang;
 $lang = 'en' if !$lang;
 
-my $h = new IO::File;
+my $in;
+$line = 'help' unless $line;
+$line =~ s/\W//g;   # remove dubious characters
+
+my ($priv, $cmd, $desc);
+my %cmd;
 
-if (!open($h, "$main::localcmd/Commands_$lang.hlp")) {
-       if (!open($h, "$main::cmd/Commands_$lang.hlp")) {
+my $defh = new IO::File;
+unless ($defh->open("$main::localcmd/Commands_en.hlp")) {
+       unless($defh->open("$main::cmd/Commands_en.hlp")) {
                return (1, $self->msg('helpe1'));
        }
 }
-my $in;
 
-$line = 'help' unless $line;
-$line =~ s/\W//og;   # remove dubious characters
+my $h;
+unless ($lang ne 'en') {
+       $h = new IO::File;
+       unless ($h->open("$main::localcmd/Commands_$lang.hlp")) {
+               unless($h->open("$main::cmd/Commands_$lang.hlp")) {
+                       undef $h;
+               }
+       }
+}
 
+# do english help
 my $include;
-my ($priv, $cmd, $desc);
-
-foreach $in (<$h>) {
+foreach $in (<$defh>) {
        next if $in =~ /^\#/;
        chomp $in;
        if ($in =~ /^===/) {
-               push @out, "$cmd $desc" if $include;
+               $cmd{$cmd} = "$cmd $desc" if $include;
                $include = 0;
                $in =~ s/=== //;
                ($priv, $cmd, $desc) = split /\^/, $in;
@@ -46,9 +57,33 @@ foreach $in (<$h>) {
        }
        $include =~ 1 if $cmd =~ /$line/i;
 }
-push @out, "$cmd $desc" if $include;
+$cmd{$cmd} = "$cmd $desc" if $include;
+$defh->close;
+
+# override with any not english help
+if ($h) {
+       my $include;
+       foreach $in (<$h>) {
+               next if $in =~ /^\#/;
+               chomp $in;
+               if ($in =~ /^===/) {
+                       $cmd{$cmd} = "$cmd $desc" if $include;
+                       $include = 0;
+                       $in =~ s/=== //;
+                       ($priv, $cmd, $desc) = split /\^/, $in;
+                       next if $priv > $self->priv;             # ignore subcommands that are of no concern
+                       next unless $cmd =~ /$line/i || $desc =~ /$line/i;
+                       next if $cmd =~ /-$/o;
+                       $include = 1;
+                       next;
+               }
+               $include =~ 1 if $cmd =~ /$line/i;
+       }
+       $cmd{$cmd} = "$cmd $desc" if $include;
+       $h->close;
+}
 
-close($h);
+push @out, map {$cmd{$_}} sort keys %cmd;
 
 push @out, $self->msg('helpe2', $line) if @out == 0;
 
index 51dfa930a413d56e9e2900b10927dd5068fa602a..b44457b8b81bb8fe6721344781616ce9f85e863a 100644 (file)
@@ -19,30 +19,42 @@ $lang = 'en' if !$lang;
 
 # each help file contains lines that looks like:-
 #
-# === 0^EN^*^Description
+# === 0^*^Description
 # text
 # text
 #
-# === 0^EN^help^Description
+# === 0^help^Description
 # text
 # text
 # text 
 #
-# The fields are:- privilege level, Language, full command name, short description
+# The fields are:- privilege level, full command name, short description
 #
 
-my $h = new IO::File;
-
-if (!open($h, "$main::localcmd/Commands_$lang.hlp")) {
-       $lang = 'en';
-       if (!open($h, "$main::cmd/Commands_$lang.hlp")) {
+my $defh = new IO::File;
+unless ($defh->open("$main::localcmd/Commands_en.hlp")) {
+       unless($defh->open("$main::cmd/Commands_en.hlp")) {
                return (1, $self->msg('helpe1'));
        }
 }
+
+my $h;
+unless ($lang ne 'en') {
+       $h = new IO::File;
+       unless ($h->open("$main::localcmd/Commands_$lang.hlp")) {
+               unless($h->open("$main::cmd/Commands_$lang.hlp")) {
+                       undef $h;
+               }
+       }
+}
+
 my $in;
 
-$line =~ s/[^\w\/]//g;
-$line =~ s/\//\.\*\//g;
+#$line =~ s/[^\w\/]//g;
+#$line =~ s/\//\.\*\//g;
+
+$line =~ s{[^\w/]}{}g;
+$line =~ s{/}{.*/}g;
 $line =~ s/^\s+//g;
 $line =~ s/\s+$//g;
 $line = "help" if $line =~ /^\s*$/;
@@ -51,12 +63,40 @@ $line = "help" if $line =~ /^\s*$/;
 my $alias = CmdAlias::get_hlp($line);
 $line = $alias if $alias;
 
+# non english help (if available)
+if ($h) {
+       my $state = 0;
+       foreach $in (<$h>) {
+               next if $in =~ /^\#/;
+               chomp $in;
+               if ($in =~ /^===/) {
+                       last if $state == 2;           # come out on next command
+                       $in =~ s/=== //;
+                       my ($priv, $cmd, $desc) = split /\^/, $in;
+                       next if $priv > $self->priv;             # ignore subcommands that are of no concern
+                       next unless $cmd =~ /^$line/i;
+                       push @out, "$cmd $desc" unless $cmd =~ /-$/o;
+                       $state = 1;
+                       next;
+               }
+               if ($state > 0) {
+                       push @out, " $in";
+                       $state = 2;
+               }
+       }
+       $h->close;
+
+       # return if some help was given, otherwise continue to english help
+       return (1, @out) if @out && $state == 2;
+}
+
+# standard 'english' help
 my $state = 0;
-foreach $in (<$h>) {
+foreach $in (<$defh>) {
        next if $in =~ /^\#/;
        chomp $in;
        if ($in =~ /^===/) {
-           last if $state == 2;           # come out on next command
+               last if $state == 2;           # come out on next command
                $in =~ s/=== //;
                my ($priv, $cmd, $desc) = split /\^/, $in;
                next if $priv > $self->priv;             # ignore subcommands that are of no concern
@@ -66,14 +106,12 @@ foreach $in (<$h>) {
                next;
        }
        if ($state > 0) {
-           push @out, " $in";
+               push @out, " $in";
                $state = 2;
        }
 }
-
-close($h);
+$defh->close;
 
 push @out, $self->msg('helpe2', $line) if @out == 0;
-
 return (1, @out);