+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
'^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',
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
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;
}
$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;
# 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*$/;
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
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);