home *** CD-ROM | disk | FTP | other *** search
- -h- wordcnt.cmd 370
- { wordcount -- count words in standard input }
- procedure wordcount;
- var
- nw : integer;
- c : character;
- inword : boolean;
- begin
- nw := 0;
- inword := false;
- while (getc(c) <> ENDFILE) do
- if (c = BLANK) or (c = NEWLINE) or (c = TAB) then
- inword := false
- else if (not inword) then begin
- inword := true;
- nw := nw + 1
- end;
- putdec(nw, 1);
- putc(NEWLINE)
- end;
- -h- wordcnt.pas 296
- {$debug-}
- program outer (input,output);
-
- {$include:'globcons.inc'}
- {$include:'globtyps.inc'}
-
- {$include:'initio.dcl'}
- {$include:'getc.dcl' }
- {$include:'putc.dcl' }
- {$include:'putdec.dcl'}
- {$include:'flush.dcl' }
-
- {$include:'wordcnt.cmd' }
- BEGIN
- minitio; initio;
- wordcount;
- flush(0);
- END.
- -h- wordcnt.mak 62
- wordcnt+initio+getc+putc+putdec+itoc+getfcb+error+putcf+flush