1
by brian
clean slate |
1 |
/* Copyright (C) 2000 MySQL AB
|
2 |
||
3 |
This program is free software; you can redistribute it and/or modify
|
|
4 |
it under the terms of the GNU General Public License as published by
|
|
5 |
the Free Software Foundation; version 2 of the License.
|
|
6 |
||
7 |
This program is distributed in the hope that it will be useful,
|
|
8 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10 |
GNU General Public License for more details.
|
|
11 |
||
12 |
You should have received a copy of the GNU General Public License
|
|
13 |
along with this program; if not, write to the Free Software
|
|
14 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
|
15 |
||
994.2.4
by Monty Taylor
Blast. Fixed some make distcheck issues. |
16 |
#include "mysys/mysys_priv.h" |
212.5.18
by Monty Taylor
Moved m_ctype, m_string and my_bitmap. Removed t_ctype. |
17 |
#include <mystrings/m_string.h> |
1
by brian
clean slate |
18 |
|
19 |
/* Returns full load-path for a file. to may be = path */
|
|
20 |
/* if path is a hard-path return path */
|
|
21 |
/* if path starts with home-dir return path */
|
|
22 |
/* if path starts with current dir or parent-dir unpack path */
|
|
23 |
/* if there is no path, prepend with own_path_prefix if given */
|
|
24 |
/* else unpack path according to current dir */
|
|
25 |
||
26 |
char * my_load_path(char * to, const char *path, |
|
27 |
const char *own_path_prefix) |
|
28 |
{
|
|
29 |
char buff[FN_REFLEN]; |
|
30 |
int is_cur; |
|
31 |
||
32 |
if ((path[0] == FN_HOMELIB && path[1] == FN_LIBCHAR) || |
|
33 |
test_if_hard_path(path)) |
|
641.4.1
by Toru Maesaka
First pass of replacing MySQL's my_stpcpy() with appropriate libc calls |
34 |
strcpy(buff,path); |
1
by brian
clean slate |
35 |
else if ((is_cur=(path[0] == FN_CURLIB && path[1] == FN_LIBCHAR)) || |
36 |
(is_prefix(path,FN_PARENTDIR)) || |
|
37 |
! own_path_prefix) |
|
38 |
{
|
|
39 |
if (is_cur) |
|
40 |
is_cur=2; /* Remove current dir */ |
|
895
by Brian Aker
Completion (?) of uint conversion. |
41 |
if (! getcwd(buff,(uint32_t) (FN_REFLEN-strlen(path)+is_cur))) |
398.1.10
by Monty Taylor
Actually removed VOID() this time. |
42 |
strcat(buff,path+is_cur); |
1
by brian
clean slate |
43 |
else
|
641.4.1
by Toru Maesaka
First pass of replacing MySQL's my_stpcpy() with appropriate libc calls |
44 |
strcpy(buff,path); /* Return org file name */ |
1
by brian
clean slate |
45 |
}
|
46 |
else
|
|
673.2.1
by Toru Maesaka
First pass of replacing MySQL's strxmov with libc alternatives |
47 |
sprintf(buff,"%s%s",own_path_prefix,path); |
641.4.1
by Toru Maesaka
First pass of replacing MySQL's my_stpcpy() with appropriate libc calls |
48 |
strcpy(to,buff); |
51.3.22
by Jay Pipes
Final round of removal of DBUG in mysys/, including Makefile |
49 |
return(to); |
1
by brian
clean slate |
50 |
} /* my_load_path */ |