[go: up one dir, main page]

File: patattack.pl

package info (click to toggle)
sirc 2.211-9.1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny, squeeze
  • size: 476 kB
  • ctags: 420
  • sloc: perl: 5,330; ansic: 1,200; sh: 855; makefile: 78
file content (39 lines) | stat: -rw-r--r-- 1,060 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# patattack.pl is in the public domain.
# Written by Thomas Morgan <tmorgan@pobox.com>

$add_ons .= '+patattack.pl' unless $add_ons =~ /\+patattack\.pl/;

# The first argument to /patattack is the nick of the recipient.  The
# second is a size specification, in the form of ROWSxCOLS.  For
# example, `/patattack slackie 2x3' produces:
#
#   >slackie< *pat* *pat* *pat*
#   >slackie< *pat* *pat* *pat*
#
# /patattack accepts an option called `--combine' or `-c' for short.
# It directs /patattack to combine the pats to form a larger pat.  For
# example, `/patattack slackie 2x3' produces:
#
#   >slackie< *patpatpat*
#   >slackie< *patpatpat*

sub cmd_patattack
{
  local (@args);
  local ($floodee, $size);
  local ($rows, $cols);
  local ($combinep, $pat);

  $combinep = ($args =~ s/-c\b//g
	       || $args =~ s/--combine\b//g);

  ($floodee, $size) = split (" ", $args, 2);
  ($rows, $cols) = split (/x/, $size);

  $pat = ($combinep
	  ? '*' . 'pat' x $cols . '*'
	  : '*pat* ' x $cols);

  &msg ($floodee, $pat) while $rows--;
}
&addcmd ('patattack');