From: minima Date: Fri, 14 Sep 2001 23:03:57 +0000 (+0000) Subject: enhance the blank command X-Git-Tag: R_1_48~6 X-Git-Url: http://dxcluster.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=46ac39b6f5ae340d6ce5ab930f712e1f3a367b57;p=spider.git enhance the blank command --- diff --git a/Changes b/Changes index 81d3a169..cf77e2f8 100644 --- a/Changes +++ b/Changes @@ -16,7 +16,8 @@ g1tlh-1 -> g1tlh-15 UNLESS one of these is specifically unlocked. 5. Make sh/log only show stuff that sh/ann, sh/talk, sh/rcmd doesn't. 6. Make the scripts look for user and node_default files if there isn't a more specific one. -7. add the blank command which prints nn blank lines (default 1) +7. add the blank command which prints nn blank lines (default 1), this cmd +can also print lines of characters: see help for examples. 13Sep01======================================================================= 1. did some work on making talk more intelligent and fixed a>b problem. 2. fixed a nasty problem on input when being hit with full buffers of diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index 159f0b7d..1daf05b2 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -207,7 +207,25 @@ This will send your announcement cluster wide Search the help database for (it isn't case sensitive), and print the names of all the commands that may be relevant. -=== 0^BLANK ^Print nn (default 1) blank lines +=== 0^BLANK [] []^Print nn (default 1) blank lines (or strings) +In its basic form this command prints one or more blank lines. However if +you pass it a string it will replicate the string for the width of the +screen (default 80) and then print that one or more times, so: + + blank 2 + +prints two blank lines + + blank - + +prints a row of - characters once. + + blank abc + +prints 'abcabcabcabcabcabc....' + +This is really only of any use in a script file and you can print a maximum +of 9 lines. === 0^BYE^Exit from the cluster This will disconnect you from the cluster diff --git a/cmd/blank.pl b/cmd/blank.pl index 7107f2dd..fb559a92 100644 --- a/cmd/blank.pl +++ b/cmd/blank.pl @@ -7,8 +7,19 @@ # my ($self, $line) = @_; -my ($lines) = $line =~ /^\s*(\d+)/; -$lines ||= 1; +my $lines = 1; +my $data = ' '; +my @f = split /\s+/, $line; +if (@f && $f[0] !~ /^\d+$/) { + $data = shift @f; + $data = $data x int(($self->width-1) / length($data)); + $data .= substr $data, 0, int(($self->width-1) % length($data)) +} +if (@f && $f[0] =~ /^\d+$/) { + $lines = shift @f; + $lines = 9 if $lines < 9; + $lines = 1 if $lines < 1; +} my @out; -push @out, ' ' for (1..$lines); +push @out, $data for (1..$lines); return (1, @out);