MAPPATH(3) Library Routines MAPPATH(3)
NAME
_mapPath, _mapPathGS, _setPathMapping - (mapPath) convert GS/OS paths
to Unix-style paths.
SYNOPSIS
#include <gno/gno.h>
void _setPathMapping (int toggle);
char *_mapPath (char *pathname);
GSStringPtr _mapPathGS (GSStringPtr pathname);
DESCRIPTION
These routines are intended for use by application programmers who are
porting programs from Unix systems.
The POSIX 1003.1 standard indicates that the pathname separator (that
character which is used to delimit the components of a pathname) must
be the slash ('/') character. However, GS/OS internally uses the colon
(':') character. This can cause problems with programs that make as‐
sumptions about the pathname separator.
The routines _mapPath and _mapPathGS, if active, map all occurances of
the ':' character in pathname to the '/' character. These routines are
intended to be used whenever a pathname is returned from a GS/OS call.
No assumption is made as to the existance of the file nor the validity
of the filename for any given file system.
On success, these routines return their original arguments. The only
time _mapPath or _mapPathGS can fail is if mapping is active and path
name contains both the ':' and '/' characters. In such a case, the
routine will return NULL and pathname will be unchanged.
For compatibility with native IIgs programs, _mapPath and _mapPathGS
are by default null operations -- pathname is not modified. In order
to activate mapping, the function _setPathMapping must be called with a
non-zero toggle. Although the choice of whether or not to do mapping
is usually only made once in a program, mapping can be turned off again
by calling _setPathMapping with a zero toggle.
These functions are used in various parts of libc. Those routines mak‐
ing use of this mapping list the fact in their respective man pages.
OPTIMIZATION
In cases where it is desirable to avoid the overhead of a function
call, the value of the global integer __force_slash may be checked. If
it is non-zero, the mapping function should be called:
if (__force_slash) {
_mapPath(filename);
}
AUTHOR
Devin Reade <gdr@gno.org>
SEE ALSO
GS/OS Reference Manual.
GNO 11 December 1996 MAPPATH(3)
Man(1) output converted with
man2html