Go to the first, previous, next, last section, table of contents.
#include <libc/dosio.h> int _put_path(const char *path); int _put_path2(const char *path, int offset);
These functions are used internally by all low-level library functions
that need to pass file names to DOS. _put_path
copies its
argument path to the transfer buffer
(see section _go32_info_block) starting at the beginning of the transfer
buffer; _put_path2
does the same except that it puts the file
name starting at offset bytes from the beginning of the transfer
buffer.
These functions are meant to be called by low-level library functions,
not by applications. You should only call them if you know what you are
doing. In particular, if you call any library function between a call
to _put_path
or _put_path2
and the call to a DOS function
that uses the file name, the file name in the transfer buffer could be
wiped out, corrupted or otherwise changed. You have been
warned!
Some constructs in file names are transformed while copying them, to allow transparent support for nifty features. Here's the list of these transformations:
DJDIR
is
computed by the DJGPP startup code and pushed into the environment of
every DJGPP program before main
is called.)
Note that environment variables are case-sensitive, so
`/dev/env/foo' and `/dev/env/FOO' are not the same.
DOS shells usually upcase the name of the environment variable if you
set it with the built-in command `SET', so if you type
e.g. `SET foo=bar', the shell defines a variable named FOO
.
If the environment variable is undefined, it will expand into an empty
string. The expansion is done recursively, so environment variables may
reference other environment variables using the same `/dev/env/'
notation. For example, if the variable HOME
is set to
`/dev/env/DJDIR/home', and DJGPP is installed in
`c:/software/djgpp', then `/dev/env/HOME/sources' will expand
to `c:/software/djgpp/home/sources'.
It is possible to supply a default value, to be used if the variable is
not defined, or has an empty value. To this end, put the default value
after the name of the variable and delimit it by `~', like in
`/dev/env/DJDIR~c:/djgpp~/include'.
If you need to include a literal character `~' in either the
environment variable name or in the default value that replaces it, use
two `~'s in a row. For example, `/dev/env/FOO~~' will expand
to the value of the variable FOO~
. Likewise,
`/dev/env/FOO~~BAR~foo~~baz~' will expand to the value of the
variable FOO~BAR
if it is defined and nonempty, and to
`foo~baz' otherwise. Leading `~' in the default value isn't
supported (it is interpreted as part of the preceding variable name).
The default value may also reference (other) environment variables, but
nested default values can get tricky. For example,
`/dev/env/foo~/dev/env/bar~' will work, but
`/dev/env/foo~/dev/env/bar~baz~~' will not. To use nested
default values, you need to double the quoting of the `~'
characters, like in `/dev/env/foo~/dev/env/bar~~baz~~~'.
Both functions return the offset into the transfer buffer of the terminating null character that ends the file name.
not ANSI, not POSIX
These functions are meant to be called by low-level library functions,
not by applications. You should only call them if you know what you are
doing. In particular, if you call any library function between a call
to _put_path
or _put_path2
and the call to a DOS function
that uses the file name, the file name in the transfer buffer could be
wiped out, corrupted and otherwise changed. You have been
warned!
__dpmi_regs r; _put_path("/dev/c/djgpp/bin/"); r.x.ax = 0x4300; /* get file attributes */ r.x.ds = __tb >> 4; r.x.dx = __tb & 0x0f; __dpmi_int(0x21, &r);
Go to the first, previous, next, last section, table of contents.