enhance the blank command
authorminima <minima>
Fri, 14 Sep 2001 23:03:57 +0000 (23:03 +0000)
committerminima <minima>
Fri, 14 Sep 2001 23:03:57 +0000 (23:03 +0000)
Changes
cmd/Commands_en.hlp
cmd/blank.pl

diff --git a/Changes b/Changes
index 81d3a169467b9e94a1f95977eba39d6a02db6ce3..cf77e2f8b7ab7a07532a738f0e61af0d129ee3f8 100644 (file)
--- 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 
index 159f0b7d5f3c83893b58779b56a90d60b2d210a1..1daf05b268d025060bd81a4661e3d0085dd68cec 100644 (file)
@@ -207,7 +207,25 @@ This will send your announcement cluster wide
 Search the help database for <string> (it isn't case sensitive), and print
 the names of all the commands that may be relevant.
 
-=== 0^BLANK <nn>^Print nn (default 1) blank lines
+=== 0^BLANK [<string>] [<nn>]^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
index 7107f2dd34c8dfec95c8389e608e3b7f87eca0ee..fb559a92ca75c9068bdddc749e797d35eeff5df3 100644 (file)
@@ -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);