UNIX Free Pascal


         

stdio - 19


function strspn(const s1, s2:pchar):longint;cdecl;external 'c';

function strcspn(const s1, s2:pchar):longint;cdecl;external 'c';

function strtok(s1:pchar; const s2:pchar):pchar;cdecl;external 'c';

function strtol(const str:pchar; endptr:ppchar; base:longint):longint;cdecl;external 'c';

function atoi(const str:pchar):longint;cdecl;external 'c';

function atol(const str:pchar):longint;cdecl;external 'c';

function strtod(const str:pchar; endptr:ppchar):double;cdecl;external 'c';

function atof(const str:pchar):double;cdecl;external 'c';

implementation

(* If WIFEXITED(STATUS), the low-order 8 bits of the status. *)

function WEXITSTATUS(status:integer):integer;

begin

WEXITSTATUS:=(status and $ff00) shr 8;

end;

(* If WIFSTOPPED(STATUS), the signal that stopped the child. *)

function WSTOPSIG(status:integer):integer;

begin

WSTOPSIG:=WEXITSTATUS(status);

end;

(* If WIFSIGNALED(STATUS), the terminating signal. *)

function WTERMSIG(status:integer):integer;

begin

WTERMSIG:=status and $7f;

end;

(* Nonzero if STATUS indicates the child dumped core. *)

function WCOREDUMP(status:integer):boolean;

begin

WCOREDUMP:=(status and WCOREFLAG) = 0;

end;

(* Nonzero if STATUS indicates normal termination. *)

function WIFEXITED(status:integer):boolean;

begin

WIFEXITED:=(status and $7f) = 0;

end;

(* If WIFSIGNALED(STATUS), the terminating signal. *)

function WIFSIGNALED(status:integer):boolean;

begin

WIFSIGNALED:=(not WIFSTOPPED(status)) and (not WIFEXITED(status));

end;

(* Nonzero if STATUS indicates the child is stopped. *)

function WIFSTOPPED(status:integer):boolean;

begin

WIFSTOPPED:=(status and $ff) = $7f;

end;

(* test on space character: space, CR, LF, Tab, VTab, FF *)

function isspace(c:integer):boolean;

begin

isspace:=c in [$9,$20,$a,$b,$c,$d];

end;

begin

stdin:=fdopen(0,'r');

stdout:=fdopen(1,'w');

end.