From bad1ddf774c205e1cf0e012860d06481abbbb400 Mon Sep 17 00:00:00 2001 From: djk Date: Sat, 22 May 1999 20:39:20 +0000 Subject: [PATCH] added type and show/files --- cmd/Aliases | 3 ++- cmd/Commands_en.hlp | 18 ++++++++++++++++ cmd/show/files.pl | 52 +++++++++++++++++++++++++++++++++++++++++++++ cmd/type.pl | 29 +++++++++++++++++++++++++ 4 files changed, 101 insertions(+), 1 deletion(-) create mode 100644 cmd/show/files.pl create mode 100644 cmd/type.pl diff --git a/cmd/Aliases b/cmd/Aliases index d1f7cfb3..578f8662 100644 --- a/cmd/Aliases +++ b/cmd/Aliases @@ -100,7 +100,8 @@ package CmdAlias; '^sh\w*/w\w*/(\d+)', 'show/wwv $1', 'show/wwv', ], 't' => [ - '^t', 'talk', 'talk', + '^ta$', 'talk', 'talk', + '^t$', 'talk', 'talk', ], 'u' => [ ], diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index 20d92d15..61734e44 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -355,6 +355,16 @@ e.g. SH/DXCC G SH/DXCC W on 20m info iota +=== 0^SHOW/FILES []^List the contents of a filearea +SHOW/FILES on its own will show you a list of the various fileareas +available on the system. To see the contents of a particular file +area type:- + SH/FILES +where is the name of the filearea you want to see the +contents of. + +See also TYPE - to see the contents of a file. + === 0^SHOW/PREFIX ^Interrogate the prefix database This command takes the (which can be a full or partial callsign or a prefix), looks up which internal country number @@ -425,6 +435,14 @@ If you know that G3JNB is likely to be present on GB7TLH, but you can only see GB7TLH in the SH/C list but with no users, then you would use the second form of the talk message. +=== 0^TYPE /^Look at the contents of a file in one of the fileareas +Type out the contents of a file in a filearea. So, for example, in +filearea 'bulletins' you want to look at file 'arld051' you would +enter:- + TYPE bulletins/arld051 + +See also SHOW/FILES to see what fileareas are available and a list of content + === 0^WX ^Send a weather message to local users === 0^WX FULL ^Send a weather message to all cluster users === 5^WX SYSOP ^Send a weather message to other clusters only diff --git a/cmd/show/files.pl b/cmd/show/files.pl new file mode 100644 index 00000000..68526a49 --- /dev/null +++ b/cmd/show/files.pl @@ -0,0 +1,52 @@ +# +# the show/files command, list bulls, files and areas +# +# The equivalent of LS in other words +# +# Copyright (c) 1999 Dirk Koopman G1TLH +# +# $Id$ +# + +my ($self, $line) = @_; +my @f = split /\s+/, $line; +my $root = "$main::root/packclus"; +my @out; +my @file; +my @d; +my @slot; + +if (@f) { + my $fn = lc $f[0]; + $fn =~ s/\\/\//og; + $fn =~ s/\.//og; + $fn =~ s/^\///og; + $root = "$root/$fn"; +} + +opendir(DIR, $root) or return (1, $self->msg('e3', 'show/files', $f[0])); +@file = sort readdir(DIR); +closedir(DIR); + +my $flag = 0; +for (@file) { + next if /^\./; + my $fn = "$root/$_"; + my $size; + + @d = stat($fn); + if (-d $fn) { + $size = "DIR"; + } else { + $size = $d[7] + } + $slot[$flag] = sprintf("%-10.10s %7.7s %s", $_, $size, cldatetime($d[9])); + $flag ^= 1; + if ($flag == 0 && @slot >= 2) { + push @out, "$slot[0] $slot[1]"; + } +} +push @out, $slot[0] if $flag; +return (1, @out); + + diff --git a/cmd/type.pl b/cmd/type.pl new file mode 100644 index 00000000..e525f94e --- /dev/null +++ b/cmd/type.pl @@ -0,0 +1,29 @@ +# +# the type command, display bulls and files +# +# Copyright (c) 1999 Dirk Koopman G1TLH +# +# $Id$ +# + +my ($self, $line) = @_; +my @f = split /\s+/, $line; +my $root = "$main::root/packclus"; +my @out; +my @file; +my @d; +my @slot; + +if (@f) { + my $fn = lc $f[0]; + $fn =~ s/\\/\//og; + $fn =~ s/\.//og; + $fn =~ s/^\///og; + $root = "$root/$fn"; +} + +open(INP, $root) or return (1, $self->msg('e3', 'type', $f[0])); +@out = ; +close(INP); + +return (1, @out); -- 2.34.1