1 /***********************************************************************
3 * This software is part of the ast package *
4 * Copyright (c) 1985-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
13 * Information and Software Systems Research *
17 * Glenn Fowler <gsf@research.att.com> *
18 * David Korn <dgk@research.att.com> *
19 * Phong Vo <kpv@research.att.com> *
21 ***********************************************************************/
27 * convert path to native fs representation in <buf,siz>
28 * length of converted path returned
29 * if return length >= siz then buf is indeterminate, but another call
30 * with siz=length+1 would work
31 * if buf==0 then required size is returned
38 extern int uwin_path(const char*, char*, int);
41 pathnative(const char* path
, char* buf
, size_t siz
)
43 return uwin_path(path
, buf
, siz
);
50 extern void cygwin_conv_to_win32_path(const char*, char*);
53 pathnative(const char* path
, char* buf
, size_t siz
)
57 if (!buf
|| siz
< PATH_MAX
)
61 cygwin_conv_to_win32_path(path
, tmp
);
62 if ((n
= strlen(tmp
)) < siz
&& buf
)
63 memcpy(buf
, tmp
, n
+ 1);
66 cygwin_conv_to_win32_path(path
, buf
);
75 pathnative(const char* path
, char* buf
, size_t siz
)
80 if (!_fullpath(buf
, path
, siz
))
82 for (s
= buf
; *s
; s
++)
86 else if ((n
= strlen(path
)) < siz
&& buf
)
87 memcpy(buf
, path
, n
+ 1);
95 #include <interix/interix.h>
98 pathnative(const char* path
, char* buf
, size_t siz
)
102 strlcpy(buf
, path
, siz
);
104 unixpath2win(path
, 0, buf
, siz
);
111 pathnative(const char* path
, char* buf
, size_t siz
)
115 if ((n
= strlen(path
)) < siz
&& buf
)
116 memcpy(buf
, path
, n
+ 1);