diff options
author | Andi Gutmans <andi@php.net> | 2000-02-19 10:10:46 +0000 |
---|---|---|
committer | Andi Gutmans <andi@php.net> | 2000-02-19 10:10:46 +0000 |
commit | 0cda28f77bcea25a35b2d55ee1bb52c5fdb34f2a (patch) | |
tree | 11e6fbfcc15fe72ed98e6736d84b47ac9250fcc0 /ext/mysql/libmysql/mf_loadpath.c | |
parent | fe9abd3219b097e0c0f2c9106751d35b2bede2d6 (diff) | |
download | php-git-0cda28f77bcea25a35b2d55ee1bb52c5fdb34f2a.tar.gz |
- Add libmysql to the tree
Diffstat (limited to 'ext/mysql/libmysql/mf_loadpath.c')
-rw-r--r-- | ext/mysql/libmysql/mf_loadpath.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/ext/mysql/libmysql/mf_loadpath.c b/ext/mysql/libmysql/mf_loadpath.c new file mode 100644 index 0000000000..8e3118968d --- /dev/null +++ b/ext/mysql/libmysql/mf_loadpath.c @@ -0,0 +1,39 @@ +/* Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB + This file is public domain and comes with NO WARRANTY of any kind */ + +#include "mysys_priv.h" +#include <m_string.h> + + /* Returns full load-path for a file. to may be = path */ + /* if path is a hard-path return path */ + /* if path starts with home-dir return path */ + /* if path starts with current dir or parent-dir unpack path */ + /* if there is no path, prepend with own_path_prefix if given */ + /* else unpack path according to current dir */ + +my_string my_load_path(my_string to, const char *path, + const char *own_path_prefix) +{ + char buff[FN_REFLEN]; + DBUG_ENTER("my_load_path"); + DBUG_PRINT("enter",("path: %s prefix: %d",path,own_path_prefix)); + + if ((path[0] == FN_HOMELIB && path[1] == FN_LIBCHAR) || + test_if_hard_path(path)) + VOID(strmov(buff,path)); + else if ((path[0] == FN_CURLIB && path[1] == FN_LIBCHAR) || + (is_prefix((gptr) path,FN_PARENTDIR) && + path[strlen(FN_PARENTDIR)] == FN_LIBCHAR) || + ! own_path_prefix) + { + if (! my_getwd(buff,(uint) (FN_REFLEN-strlen(path)),MYF(0))) + VOID(strcat(buff,path)); + else + VOID(strmov(buff,path)); + } + else + VOID(strxmov(buff,own_path_prefix,path,NullS)); + strmov(to,buff); + DBUG_PRINT("exit",("to: %s",to)); + DBUG_RETURN(to); +} /* my_load_path */ |