RESOLV_PATH(2) SYSTEM CALLS RESOLV_PATH(2)
NAME
resolv_path - "calculates path name needed for cd command
SYNOPSIS
string resolv_path(string curr, string new);
DESCRIPTION
The "cd" command allows the use of special characters in the
pathname: "." to refer to the current directory, ".." to
refer to the current directory's parent directory, and "~"
to refer to a wizard's home directory. Path names beginning
with "/" are traced downwards from the root directory, and
pathnames without the initial "/" are assumed to be sub-
directories of the current directory. The resolv_path
simul_efun converts a relative path name (i.e. one contain-
ing "..", "~", etc.) into an absolute path name (e.g.
/adm/simul_efun).
Given the current working directory path name in "curr" and
a relative path name in "new", this simul_efun returns the
absolute path name obtained by moving up a level for each
"..", down a level for each named subdirectory, to the root
if "new" begins with a "/", and to a wizard's home directory
if "new" starts with "~".
EXAMPLE: resolv_path("/u/i/ichabod/man2",
"../../../m/mobydick")
would return "/u/m/mobydick".
resolve_path("/u/i/ichabod/man2", "~buddha")
would return "/u/b/buddha". and so on...
The "resolv_path" simul_efun is often called with the first
argument set equal to this_player()'s current working dir,
as in the following:
str = resolv_path(this_player()->query("cwd"), str);
SEE ALSO
/cmds/file/_mkdir.c, /cmds/file/_cd.c, et al.
AUTHOR
Ichabod@TMI, 3/9/93
MudOS Release 0.9 Last change: 3-19-93