3 eval <<'EndOfMain'; $evaloffset = __LINE__;
6 $| = 1; # command buffering on stdout
9 &slurpfile && &pagearray;
15 ################################################################################
19 &initscr; &cbreak; &noecho; &scrollok($stdscr, 1);
20 &defbell unless defined &bell;
22 $lines = $LINES; $lines1 = $lines - 1; $lines2 = $lines - 2;
23 $cols = $COLS; $cols1 = $cols - 1; $cols2 = $cols - 2;;
33 s/^(\t+)/' ' x length($1)/e;
35 if (length($_) < $cols) {
39 while ($_ && $_ ne "\n") {
40 push(@lines, substr($_,0,$cols));
41 substr($_,0,$cols) = '';
50 for ($line .. $line + $lines2) {
59 while (($off = index($_[0],"\t")) >= 0) {
60 substr($_[0], $off, 1) = ' ' x (8 - $off % 8);
69 for (&drawscreen;;&drawscreen) {
72 $ch = 'j' if $ch eq "\n";
75 last if $percent >= 100;
82 $line = 0 if $line < 0;
85 next if $percent >= 100;
89 &mvcur(0,0,$lines2,0);
90 print $ce,$lines[$line+$lines2],$ce;
93 &wmove($curscr,$lines2,0);
94 &waddstr($curscr,$lines[$line+$lines2]);
98 &wmove($stdscr,$lines2,0);
99 &waddstr($stdscr,$lines[$line+$lines2]);
107 if ($al && $ho && $ce) {
108 print $ho, $al, $ce, $lines[$line];
111 &waddstr($curscr,$lines[$line]);
115 &waddstr($stdscr,$lines[$line]);
120 elsif ($ch eq "\f") {
146 local(*lines) = *helplines;
152 @helplines = split(/\n/,<<'EOT');
157 SPACE Forward screen.
159 j, CR Forward 1 line.
170 $percent = int(($line + $lines1) * 100 / @lines);
172 &addstr("($percent%)");
184 print ""; # force flush of stdout
185 $@ =~ s/\(eval\)/$0/ && $@ =~ s/line (\d+)/'line ' . ($1 + $evaloffset)/e;