xref: /aoo41x/main/sal/osl/os2/uunxapi.cxx (revision 87d2adbc)
1*87d2adbcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*87d2adbcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*87d2adbcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*87d2adbcSAndrew Rist  * distributed with this work for additional information
6*87d2adbcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*87d2adbcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*87d2adbcSAndrew Rist  * "License"); you may not use this file except in compliance
9*87d2adbcSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*87d2adbcSAndrew Rist  *
11*87d2adbcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*87d2adbcSAndrew Rist  *
13*87d2adbcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*87d2adbcSAndrew Rist  * software distributed under the License is distributed on an
15*87d2adbcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*87d2adbcSAndrew Rist  * KIND, either express or implied.  See the License for the
17*87d2adbcSAndrew Rist  * specific language governing permissions and limitations
18*87d2adbcSAndrew Rist  * under the License.
19*87d2adbcSAndrew Rist  *
20*87d2adbcSAndrew Rist  *************************************************************/
21*87d2adbcSAndrew Rist 
22*87d2adbcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir  #ifndef _LIMITS_H
25cdf0e10cSrcweir  #include <limits.h>
26cdf0e10cSrcweir  #endif
27cdf0e10cSrcweir 
28cdf0e10cSrcweir  #ifndef _RTL_USTRING_HXX_
29cdf0e10cSrcweir  #include <rtl/ustring.hxx>
30cdf0e10cSrcweir  #endif
31cdf0e10cSrcweir 
32cdf0e10cSrcweir  #ifndef _OSL_THREAD_H_
33cdf0e10cSrcweir  #include <osl/thread.h>
34cdf0e10cSrcweir  #endif
35cdf0e10cSrcweir 
36cdf0e10cSrcweir  #ifndef _OSL_UUNXAPI_HXX_
37cdf0e10cSrcweir  #include "uunxapi.hxx"
38cdf0e10cSrcweir  #endif
39cdf0e10cSrcweir 
40cdf0e10cSrcweir  //###########################
41cdf0e10cSrcweir  //access_u
access_u(const rtl_uString * pustrPath,int mode)42cdf0e10cSrcweir  int access_u(const rtl_uString* pustrPath, int mode)
43cdf0e10cSrcweir  {
44cdf0e10cSrcweir 	return access(OUStringToOString(pustrPath).getStr(), mode);
45cdf0e10cSrcweir  }
46cdf0e10cSrcweir 
47cdf0e10cSrcweir  //#########################
48cdf0e10cSrcweir  //realpath_u
realpath_u(const rtl_uString * pustrFileName,rtl_uString ** ppustrResolvedName)49cdf0e10cSrcweir  sal_Bool realpath_u(const rtl_uString* pustrFileName, rtl_uString** ppustrResolvedName)
50cdf0e10cSrcweir  {
51cdf0e10cSrcweir  	rtl::OString fn = rtl::OUStringToOString(
52cdf0e10cSrcweir 		rtl::OUString(const_cast<rtl_uString*>(pustrFileName)),
53cdf0e10cSrcweir 		osl_getThreadTextEncoding());
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 	char  rp[PATH_MAX];
56cdf0e10cSrcweir 	bool  bRet = realpath(fn.getStr(), rp);
57cdf0e10cSrcweir 
58cdf0e10cSrcweir 	if (bRet)
59cdf0e10cSrcweir 	{
60cdf0e10cSrcweir 		rtl::OUString resolved = rtl::OStringToOUString(
61cdf0e10cSrcweir 			rtl::OString(static_cast<sal_Char*>(rp)),
62cdf0e10cSrcweir 			osl_getThreadTextEncoding());
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 		rtl_uString_assign(ppustrResolvedName, resolved.pData);
65cdf0e10cSrcweir 	}
66cdf0e10cSrcweir 	return bRet;
67cdf0e10cSrcweir  }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir  //#########################
70cdf0e10cSrcweir  //lstat_u
lstat_u(const rtl_uString * pustrPath,struct stat * buf)71cdf0e10cSrcweir   int lstat_u(const rtl_uString* pustrPath, struct stat* buf)
72cdf0e10cSrcweir  {
73cdf0e10cSrcweir 	return lstat(OUStringToOString(pustrPath).getStr(), buf);
74cdf0e10cSrcweir  }
75cdf0e10cSrcweir 
76cdf0e10cSrcweir  //#########################
77cdf0e10cSrcweir  // @see mkdir
mkdir_u(const rtl_uString * path,mode_t mode)78cdf0e10cSrcweir  int mkdir_u(const rtl_uString* path, mode_t mode)
79cdf0e10cSrcweir  {
80cdf0e10cSrcweir     return mkdir(OUStringToOString(path).getStr(), mode);
81cdf0e10cSrcweir  }
82cdf0e10cSrcweir 
83