Frank Heckenbach wrote:
Eli Zaretskii wrote:
Does this mean we shouldn't call usleep() and just accept that short delays don't work, or should we just call delay() because MS-Windows users are used to random system crashes and hangs, anyway? ;-)
You could use delay() on plain DOS and usleep() on Windows and OS/2.
So, how to distinguish them? -- I suppose that's in the FAQ or something, so perhaps some other DJGPP user can tell me how to do it or send me some code.
Not simple: a DOS box is made to let djgpp programs think they are on DOS. The only dirty trick I imagine is to check for the LFN API: it is present on a Windows DOS box and not in bare dos. There is a function _use_lfn in the djgpp libc to check that. I have checked the following program:
program test; function UseLFN(path:CString): byte; AsmName '_use_lfn'; begin Writeln(UseLFN('C:')); end.
gives 1 on a W98 dos box and 0 when booting in bare dos (on the same machine). It checks for the LFN API on this drive (assuming in fact that all drives have it simultaneously) and does not depend on the setting of LFN=y or LFN=n on the environment. There will be problems fot NT however. Hope this helps
Maurice