
RESOLV_PATH(2)             silmul_efun             RESOLV_PATH(2)

名称
     resolv_path - 解开路径为绝对路径

语法
     string resolv_path(string curr, string new);

描述
     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);

相关命令
     /cmds/file/_mkdir.c, /cmds/file/_cd.c, et al.

作者
     Ichabod@TMI, 3/9/93
     wade@future 4/8/1996 翻译

MudOS Release 0.9         Last change:                   3-19-93

