home *** CD-ROM | disk | FTP | other *** search
- -h- fprint.prt 800
- { fprint -- print file "name" from fin }
- procedure fprint (var name : string; fin : filedesc;
- var sdate,stime : string);
- const
- MARGIN1 = 2;
- MARGIN2 = 2;
- BOTTOM = 64;
- PAGELEN = 66;
- var
- line : string;
- lineno, pageno : integer;
- {$include:'skip.prt'}
- {$include:'head.prt'}
- begin
- pageno := 1;
- skip(MARGIN1);
- head(name, pageno, sdate, stime);
- skip(MARGIN2);
- lineno := MARGIN1 + MARGIN2 + 1;
- while (getline(line, fin, MAXSTR)) do begin
- if (lineno = 0) then begin
- skip(MARGIN1);
- pageno := pageno + 1;
- head(name, pageno, sdate, stime);
- skip(MARGIN2);
- lineno := MARGIN1 + MARGIN2 + 1
- end;
- putstr(line, STDOUT);
- lineno := lineno + 1;
- if (lineno >= BOTTOM) then begin
- skip(PAGELEN-lineno);
- lineno := 0
- end
- end;
- if (lineno > 0) then
- skip(PAGELEN-lineno)
- end;
-
- -h- head.prt 572
- { head -- print top of page header }
- procedure head (var name : string; pageno : integer;
- var sdate,stime: string);
- var
- page : string; { set to ' Page ' }
- begin
- { setstring(page, ' Page '); }
- page[1] := ord(' ');
- page[2] := ord(' ');
- page[3] := ord('P');
- page[4] := ord('a');
- page[5] := ord('g');
- page[6] := ord('e');
- page[7] := ord(' ');
- page[8] := ENDSTR;
- putstr(name, STDOUT);
- putstr(page, STDOUT);
- putdec(pageno, 1);
- putc(BLANK);
- putc(BLANK);
- putstr(sdate, STDOUT);
- putc(BLANK);
- putc(BLANK);
- putstr(stime, STDOUT);
- putc(NEWLINE)
- end;
-
- -h- printf.prt 601
- { print (default input STDIN) -- print files with headings }
- procedure print;
- var
- name : string;
- null : string; { value '' }
- i : integer;
- fin : filedesc;
- junk : boolean;
- sdate : string;
- stime : string;
- {$include:'fprint.prt'}
- begin
- gdate(sdate);
- gtime(stime);
- stime[6] := ENDSTR; { Don't want to print out seconds }
- { setstring(null, ''); }
- null[1] := ENDSTR;
- if (nargs = 0) then
- fprint(null, STDIN, sdate, stime)
- else
- for i := 1 to nargs do begin
- junk := getarg(i, name, MAXSTR);
- fin := mustopen(name, IOREAD);
- fprint(name, fin, sdate, stime);
- xclose(fin)
- end
- end;
-
- -h- skip.prt 128
- { skip -- output n blank lines }
- procedure skip (n : integer);
- var
- i : integer;
- begin
- for i := 1 to n do
- putc(NEWLINE)
- end;
- -h- printf.pas 482
- {$debug-}
- program outer (input,output);
-
- {$include:'globcons.inc'}
- {$include:'globtyps.inc'}
-
- {$include:'initio.dcl'}
- {$include:'flush.dcl' }
-
- {$include:'getarg.dcl' }
- {$include:'nargs.dcl' }
- {$include:'mustopen.dcl'}
- {$include:'close.dcl' }
- {$include:'getline.dcl' }
- {$include:'putstr.dcl' }
- {$include:'putdec.dcl' }
- {$include:'putc.dcl' }
- {$include:'gdate.dcl' }
- {$include:'gtime.dcl' }
-
- {$include:'printf.prt' }
- BEGIN
- minitio; initio;
- print;
- flush(0);
- END.
- -h- printf.mak 129
- printf+initio+getfcb+error+getarg+nargs+mustopen+open+
- close+getline+getcf+getc+putstr+putdec+putc+flush+
- putcf+itoc+gtime+gdate