File: more

package info (click to toggle)
epic 3.004-17.1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,192 kB
  • ctags: 3,197
  • sloc: ansic: 40,843; makefile: 530; sh: 129; perl: 17
file content (48 lines) | stat: -rw-r--r-- 710 bytes parent folder | download | duplicates (15)
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
40
41
42
43
44
45
46
47
48
#
# A file pager.  A demonstration of how to do something useful in ircII.
# Written by archon in 1996
#

alias more 
{
	if ([$0]) 
	{
		@ line = 0
		@ done = 0
		@ rows = winsize() - 1
		if (fexist($0) == 1) 
		{
			@ fd = open($0 R)
			while (!eof($fd) && (pause!=[q]))
			{
				while (line++ != rows) 
				{
					@ ugh = read($fd)
					if (eof($fd)) 
					{
						@ line = rows
						@ done = 1
					}
					{
						echo $ugh
					}
				}
				if (!done) 
				{
		^assign pause $"Enter q to quit, or anything else to continue "
		@ line = 0
				}
			}
			@ close($fd)
			@ fd = line = done = rows = pause = ugh = []
		}
		{
			echo $0\: no such file.
		}
	}
	{
		echo Usage: /more <filename>
	}
}

#archon'96