#
# 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
