Rahmen des Kopierprogramms

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]

Concatenate.om
(*
   output all input files in the given order to stdout;
   take stdin if no input files are given
*)
MODULE Concatenate;

   IMPORT Args := UnixArguments, Process, Streams,
      UnixFiles, Write;

   PROCEDURE Copy(in, out: Streams.Stream) : BOOLEAN;
      (* copy all bytes from in to out;
         return FALSE in case of errors
      *)
      (* ... *)
   END Copy;

   PROCEDURE ProcessFiles;
      (* ... *)
   END ProcessFiles;

BEGIN
   ProcessFiles;
END Concatenate.

*Das Programm wird aufgeteilt in die Prozedur Copy, die von einer Eingabe-Verbindung zu einer Ausgabe-Verbindung kopiert und die Prozedur ProcessFiles, die durch sämtliche Dateinamen auf der Kommandozeile geht, die angegebenen Dateien eröffnet und Copy aufruft.
 

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]
Copyright © 2004, 2005 Andreas Borchert, in HTML konvertiert am 18.02.2005