Unit DOS


The unit DOS allows an easy access to the functions of the operanting systems. The most functions of the unit DOS are available on every supported operanting system.



diskfree

function diskfree(drive : byte) : longint;

Returns the number of bytes free on a disk. drive specifies which drive. If drive is 0, the current drive is used

See also: disksize


disksize

function DiskSize(Drive: Byte): Longint;

Returns the total number of bytes on a disk. drive specifies which drive. If drive is 0, the current drive is used.

See also: diskfree


dosexitcode

function dosexitcode : word;

Returns the last exit code from an operanting system call.


dosversion

function dosversion : word;

Returns the version of the operating system.

For example, on a system with linux 2.0.0

writeln(dosversion);

reports 2.


dttounixdate

Function DTToUnixDate(DT: DateTime): LongInt;

Var
SecsPast, DaysPast: LongInt;

Begin
DaysPast := GregorianToJulian(DT) - c1970;
SecsPast := DaysPast * 86400;
SecsPast := SecsPast + (LongInt(DT.Hour) * 3600) + (DT.Min * 60) + (DT.Sec);
DTToUnixDate := SecsPast;
End;


envcount

function envcount : longint;

Returns the number of environmental variables.

See also: envstr, getenv



envstr

function envstr(index : integer) : string;

returns environmental variable #Index

Notes:envstr(0) is the same as envstr(1)
Also, if the environment string is longer than 256 characters
the program will crash. (On my computer the ls_color
variable was).

See also: envcount, getenv





Procedure Exec (Const Path: PathStr; Const ComLine: ComStr);
Runs the command Path (be sure to include the path)
With the Commandline Arguements in ComLine.
Notes: The string must not be longer than 255 characters.






Function FExpand(Const Path: PathStr): PathStr;
Takes a path string and returns the ENTIRE path for it.





Procedure FindClose(Var f: SearchRec);
{ Closes dirptr if it is open }





Procedure FindFirst(Const Path: PathStr; Attr: Word; Var f: SearchRec);
Will find the first file that meets the given requirements





Procedure FindNext(Var f: SearchRec);
Continues a file search started with findfirst.

See also:
findfirst





Function fsearch(path : pathstr;dirlist : string) : pathstr;
Find File





Procedure FSplit(Path: PathStr; Var Dir: DirStr; Var Name: NameStr;Var Ext: ExtStr);
Splits path into directory and filename





Procedure GetCBreak(Var BreakValue: Boolean);
Meaningless in Unix.





Procedure GetDate(Var Year, Month, MDay, WDay: Word);
Gets the date as 4 words.

For exampele, the code fragment

getdate(a,b,c,d);
writeln(a,' ',b,' ',c,' ',d);

with a,b,c and d type word, run on October 6, 1996 (sunday)
printed : 1996 10 6 0
(year 1996 month 10 day 6 day of week 0 (sunday))

Notes: The date will return the date at timezone zero (GMT), so
it will not necessarily be local time.
Also, day of week doesn't seem to work.

See also: gettime





Function GetEnv(EnvVar: String): String;
Gets value of Environmental Variable EnvVar

Note: If the environmental variable is longer than 255 characters,
it will be truncated to 255 characters.
Doserror will be set to 1 to indicate this error,
syslinux contains envp: ^pchar;
Which points to an array of pointers, and can be used
to access the entire environment string.

See also: envcount
envstr





Procedure getfattr(var f;var attr : word);
Var
{$ifdef nativelinux}
info : stat;
{$else}
Info: RtlInfoType;
{$endif}

Begin
{$ifdef nativelinux}
sys_stat (pchar (f),info);
attr :=info.mode
{$else}
_rtl_fstat(longint(f), longint(@Info));
attr := info.fmode;
{$endif}
End;





Procedure getftime(var f; var time : longint);
Gets time file was created.
Notes: Returns time in GMT, so will not be local time.
(Unless you live in Grenwich).

See also: gettime





Procedure getintvec(intno : byte;var vector : pointer);
Not Implemented. Meaningless in Linux.





Procedure GetTime(Var Hour, Minute, Second, Sec100: Word);
Gets the time
Notes: Returns time in GMT, so will not necessarily be local time.
Also Sec100 seems to always be 0.

See also: getdate
getftime






Procedure GetVerify(Var Verify: Boolean);
Not Implemented, meaningless in Linux





Function GregorianToJulian(DT: DateTime): LongInt;
Convert gregorian Date to Julian?





Procedure Intr (intno: byte; var regs: registers);
Does not apply to Linux - not implemented




Procedure JulianToGregorian(JulianDN: LongInt; Var Year, Month, Day: Integer);
Convert Julian date to gregorian





Procedure keep(exitcode : word);
Not applicable to Linux





Procedure msdos(var regs : registers);
Not applicable to Linux





Procedure packtime(var t : datetime;var p : longint);
packs time into one big longint





Procedure SetCBreak(BreakValue: Boolean);
Not applicable in Linux



setdate

Procedure SetDate(Year, Month, Day: Word);
Not implemented yet


setfattr

Procedure setfattr(var f;attr : word);
Not Implemented Yet





Procedure setftime(var f; time : longint);
Not Implemented Yet





Procedure setintvec(intno : byte;vector : pointer);
Not Implemented. Meaningless in Linux.





Procedure SetTime(Hour, Minute, Second, Sec100: Word);
Not Implemented Yet





Procedure SetVerify(Verify: Boolean);
Not Implemented, meaningless in Linux





Procedure SwapVectors;
Does not apply to Linux - Does Nothing




Procedure UnixToDt(SecsPast: LongInt; Var Dt: DateTime);
convert unix to dt





Procedure unpacktime(p : longint;var t : datetime);
Unpack the time. Not complete



klaempfl@haegar.cip.mw.uni-muenchen.de

Copyright (c) 1997 by Florian Klaempfl