Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
24
Добавлен:
10.12.2013
Размер:
842 б
Скачать
//*****************************************************
// This program is a primitive batch processor.
// It sends each line in the input file to the
//   command processor.
program batch(f, output);
var
   f : text;
   s : string;
   err : integer;
begin
   writeln('This is a simple command processor');
   writeln('Enter quit when done');
   writeln;
   err := 0;
   reset(f);    (* open input file or standard input file *)
   write('>');
   while not eof(f) do
      begin
         readln(f, s);
         if lowercase(trim(s)) = 'quit' then
            exit;
         writeln('Executing ', s);
         err := system(s);      (* Pass 's' to the command processor *)
         writeln('Error code is ', err);
         if err <> 0 then
            exit(err);
         write('>');
      end;
   exit(err)
end.
Соседние файлы в папке samples