Q: Can I invoke my program with a command line longer than the
infamous DOS 126-character limit?
Q: I have a Makefile of Unix origin which contains some
very long command lines. Will it work with DJGPP?
A: Yes and yes. DJGPP supports several methods of passing command-line arguments which allow it to work around the DOS 126-character limit. These are:
!proxymethod. If you invoke the program from within another DJGPP program (like Make or Gcc compilation driver), it gets the address of the memory block where the actual command line is stored. The start-up code will detect this and use that info to retrieve the command-line arguments.
This method is suitable only for invoking DJGPP programs from other DJGPP
programs. You don't have to do anything special to use this method, it is
all done automagically for you by the library functions from the
execXX family on the parent program side, and
by the start-up code on the child side27.
!proxymethod above, but the information about the long command line is stored in an environment variable called " !proxy" (with the leading blank and in lower-case). The reason for two similar, but different methods is that command-line arguments passed by
systemlibrary functions should be globbed by the child, while the arguments passed by
execXXfamily of functions should not; thus the former uses the environment method while the latter use the
This method is used only by the
system library function, and only
when the command line is longer than the DOS 126-character limit.
@character (like in
myprog @file) will cause the named file to be read and its contents to be used as command-line arguments, like in many DOS-based compilers and linkers. If you invoke your DJGPP program from the DOS command line, this would be the only method available for you to pass long command lines (like when calling
Gawkor SED without the
This method is not used by the DJGPP library functions, but you can use it explicitly in your application code. It is designed for invoking non-DJGPP programs that support response files.
Note that this method makes
@ special when it is the first (or the
only) character of a command-line argument, which should be
protected with quotes if you want to use it verbatim (see how to pass the @ character).
Of course, if the DJGPP start-up code doesn't see any of the above methods, it will use the DOS command line by default.
Since the long command lines are a very important feature, DJGPP's
version of the
system library function avoids calling the DOS
COMMAND.COM, unless it needs to run a batch
file or an internal command of
COMMAND.COM. Other features of
the command processor, like redirection and pipes, are emulated
system. See the library reference for
system, for more details about its extended functionality.
|webmaster||delorie software privacy|
|Copyright © 2001 by Eli Zaretskii||Updated Apr 2001|