File: repeat

package info (click to toggle)
ircii 4.4-3
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 4,256 kB
  • ctags: 2,797
  • sloc: ansic: 36,743; sh: 907; makefile: 483; lex: 16
file content (20 lines) | stat: -rw-r--r-- 298 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Use a simply while loop to repeat a command.
alias repeat {
	@ rep.cnt = [$0]
	while ( rep.cnt > 0 )
	{
		$1-
		@rep.cnt = rep.cnt - 1
	}
	^assign -rep.cnt
}

# Do the samn thing with recursion  See.. SET MAX_RECURSIONS
alias recrepeat {
	if ([$0] > 0)
	{
		$1-
		recrepeat ${[$0] -1} $1-
	}
}