(*                     }
{*  MODULE:  iostd.p   }
{*  include file with PASCAL-SC extended procedures reset and rewrite }
{*  last modification:  08.07.91  12:18   }
{* uli 29.01.91 : f_flsh         }
{* uli 08.07.91 : exit , traceback , getenv }
{* uli 08.07.91 : a_syst         }
{*)

module iostd ;
global const
   stdin  = 0 ; { standard input }
   stdout = 1 ; { standard output }
   stderr = 2 ; { standard error }
   stdcon = 3 ; { Terminal, "/dev/tty" ? }
   stdprn = 4 ; { Printer }
   stdrdr = 5 ; { Reader (CPM-device) }
   stdpun = 6 ; { Puncher (CPM-device) }
   stdtmp = 8 ; { temporary file, will be deleted by close }
   stdorg = 9 ; { File, associated originally by command line }

{ use these constant names for the nr parameter in reset and rewrite }

global const filenamesize = 20 ;
global type  filenametype = global array [1..filenamesize] of char ;

global function  filexists (s:filenametype) : boolean  ; external f_exst ;
global function  filexists (s:string      ) : boolean  ; external f_sexs ;
global function  openp88 (var t : text ; s : string ; ct : integer)
			 : integer ; external f_op88 ;
global procedure reset   (var t : text ; nr : integer) ; external f_rstn ;
global procedure rewrite (var t : text ; nr : integer) ; external f_rwrn ;
global procedure close   (var t : text)                ; external f_free ;
global procedure flush   (var t : text)                ; external f_flsh ;
global function  system  (cmd : string    ) : integer  ; external a_syst ;
global procedure exit    (retcode : integer)           ; external a_exit ;
global procedure traceback (var t:text)                ; external f_back ;

 procedure geteenv (n: string; var v:string; var ex : boolean) ;
      external s_genv;
global function getenv    (s : string              ) : string ;
   var v : string ; b : boolean ;
   begin
     geteenv (s, v, b) ;
     getenv := v ;
   end ;

global function envexists  (s : string              ) : boolean ;
   var v : string ; b : boolean ;
   begin
     geteenv (s, v, b) ;
     envexists := b ;
   end ;

end.
