home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / PASCAL / PT03.ZIP / UNIQUE.AR < prev    next >
Encoding:
Text File  |  1983-09-06  |  795 b   |  40 lines

  1. -h- unique.cmd 309
  2. { unique -- remove adjacent duplicate lines }
  3. procedure unique;
  4. var
  5.  buf : array [0..1] of string;
  6.  cur : 0..1;
  7. begin
  8.  cur := 1;
  9.  buf[1-cur][1] := ENDSTR;
  10.  while (getline(buf[cur], STDIN, MAXSTR)) do
  11.   if (not equal(buf[cur], buf[1-cur])) then begin
  12.    putstr(buf[cur], STDOUT);
  13.    cur := 1 - cur
  14.   end
  15. end;
  16.  
  17. -h- unique.pas 300
  18. {$debug-}
  19. program outer (input,output);
  20.  
  21. {$include:'globcons.inc'}
  22. {$include:'globtyps.inc'}
  23.  
  24. {$include:'initio.dcl'}
  25. {$include:'flush.dcl' }
  26.  
  27. {$include:'getline.dcl' }
  28. {$include:'equal.dcl'   }
  29. {$include:'putstr.dcl'  }
  30.  
  31. {$include:'unique.cmd'  }
  32. BEGIN
  33.   minitio; initio;
  34.   unique;
  35.   flush(0);
  36. END.
  37. -h- unique.mak 90
  38. unique+initio+getfcb+error+getarg+nargs+flush+
  39. getline+getcf+getc+putstr+putc+putcf+equal
  40.