Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

C's system() & COMMAND.COM (Developers)

posted by marcov(R), 13.09.2014, 16:50

> > That's Unix(POSIX), not C. What are you doing, implementing a C
> > compiler or an Unix-on-Dos emulation (as a cygwin for dos)?
>
> Not really.
>
> I want POSIX-ish behavior of system(). Some DOS compilers provide it and I
> am depending on it and implementing it in my C library for DOS.

As you wish. If you don't want to do it the proper way (with a POSIX compatible shell, since that is the part that returns the errorlevel to system), then parsing/interpreting the commandline is the only way I guess.

But of course that is fragile. If sb uses 4/ndos it might already break, since that has more built-ins.

Maybe looking at source of opensourced dos compilers (like watcom) can give you a clue. I don't have much experience of attempting to do POSIX outside *nix from an implementation viewpoint, since our runtime opts more for native.

> > The page says it is aligned with C, but the popup says that paragraph is
> an
> > extension to C, so it would still be interesting what a newer C
> standard
> > (C99) says about it. I may have that at work, which I can't access now.
>
> There's nothing of interest in C99. The return value of system(non-NULL
> pointer) is implementation-defined according to it.

Thanks, that saves me the time of looking it up.

 

Complete thread:

Back to the forum
Board view  Mix view
15195 Postings in 1365 Threads, 250 registered users, 10 users online (0 registered, 10 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum