summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2007-09-20 14:16:37 +0000
committerVladimir Glazounov <vg@openoffice.org>2007-09-20 14:16:37 +0000
commit0ddb1490d20156f80ad44ca86347f733b092e569 (patch)
tree104b895910ddb79be576e70189e46e3e0b03d989 /sal
parent98c4f3d885aa4233ff92d2a3359dd1123a945a72 (diff)
INTEGRATION: CWS os2port01 (1.1.2); FILE ADDED
2006/11/29 14:26:45 ydario 1.1.2.1: Initial OS/2 import.
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/os2/uunxapi.cxx120
-rw-r--r--sal/osl/os2/uunxapi.h120
-rw-r--r--sal/osl/os2/uunxapi.hxx140
3 files changed, 380 insertions, 0 deletions
diff --git a/sal/osl/os2/uunxapi.cxx b/sal/osl/os2/uunxapi.cxx
new file mode 100644
index 000000000000..53980646428b
--- /dev/null
+++ b/sal/osl/os2/uunxapi.cxx
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * $RCSfile: uunxapi.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: vg $ $Date: 2007-09-20 15:16:15 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+ #ifndef _LIMITS_H
+ #include <limits.h>
+ #endif
+
+ #ifndef _RTL_USTRING_HXX_
+ #include <rtl/ustring.hxx>
+ #endif
+
+ #ifndef _OSL_THREAD_H_
+ #include <osl/thread.h>
+ #endif
+
+ #ifndef _OSL_UUNXAPI_HXX_
+ #include "uunxapi.hxx"
+ #endif
+
+ //###########################
+ //access_u
+ int access_u(const rtl_uString* pustrPath, int mode)
+ {
+ return access(OUStringToOString(pustrPath).getStr(), mode);
+ }
+
+ //#########################
+ //realpath_u
+ sal_Bool realpath_u(const rtl_uString* pustrFileName, rtl_uString** ppustrResolvedName)
+ {
+ rtl::OString fn = rtl::OUStringToOString(
+ rtl::OUString(const_cast<rtl_uString*>(pustrFileName)),
+ osl_getThreadTextEncoding());
+
+ char rp[PATH_MAX];
+ bool bRet = realpath(fn.getStr(), rp);
+
+ if (bRet)
+ {
+ rtl::OUString resolved = rtl::OStringToOUString(
+ rtl::OString(static_cast<sal_Char*>(rp)),
+ osl_getThreadTextEncoding());
+
+ rtl_uString_assign(ppustrResolvedName, resolved.pData);
+ }
+ return bRet;
+ }
+
+ //#########################
+ //lstat_u
+ int lstat_u(const rtl_uString* pustrPath, struct stat* buf)
+ {
+ return lstat(OUStringToOString(pustrPath).getStr(), buf);
+ }
+
+ //#########################
+ // @see mkdir
+ int mkdir_u(const rtl_uString* path, mode_t mode)
+ {
+ return mkdir(OUStringToOString(path).getStr(), mode);
+ }
+
diff --git a/sal/osl/os2/uunxapi.h b/sal/osl/os2/uunxapi.h
new file mode 100644
index 000000000000..9d257aaead58
--- /dev/null
+++ b/sal/osl/os2/uunxapi.h
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * $RCSfile: uunxapi.h,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: vg $ $Date: 2007-09-20 15:16:26 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+ #ifndef _OSL_UUNXAPI_H_
+ #define _OSL_UUNXAPI_H_
+
+ #ifndef _UNISTD_H
+ #include <unistd.h>
+ #endif
+
+ #ifndef _STDLIB_H
+ #include <stdlib.h>
+ #endif
+
+ #ifndef _TYPES_H
+ #include <sys/types.h>
+ #endif
+
+ #ifndef _STAT_H
+ #include <sys/stat.h>
+ #endif
+
+ #ifndef _RTL_USTRING_H_
+ #include <rtl/ustring.h>
+ #endif
+
+
+ #ifdef __cplusplus
+ extern "C"
+ {
+ #endif
+
+ /* @see access */
+ int access_u(const rtl_uString* pustrPath, int mode);
+
+ /***********************************
+ @descr
+ The return value differs from the
+ realpath function
+
+ @returns sal_True on success else
+ sal_False
+
+ @see realpath
+ **********************************/
+ sal_Bool realpath_u(
+ const rtl_uString* pustrFileName,
+ rtl_uString** ppustrResolvedName);
+
+ /* @see lstat */
+ int lstat_u(const rtl_uString* pustrPath, struct stat* buf);
+
+ /* @see mkdir */
+ int mkdir_u(const rtl_uString* path, mode_t mode);
+
+ #ifdef __cplusplus
+ }
+ #endif
+
+
+ #endif /* _OSL_UUNXAPI_H_ */
+
diff --git a/sal/osl/os2/uunxapi.hxx b/sal/osl/os2/uunxapi.hxx
new file mode 100644
index 000000000000..e31e189a676e
--- /dev/null
+++ b/sal/osl/os2/uunxapi.hxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * $RCSfile: uunxapi.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: vg $ $Date: 2007-09-20 15:16:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+ #ifndef _OSL_UUNXAPI_HXX_
+ #define _OSL_UUNXAPI_HXX_
+
+ #ifndef _OSL_UUNXAPI_H_
+ #include "uunxapi.h"
+ #endif
+
+ #ifndef _RTL_USTRING_HXX_
+ #include <rtl/ustring.hxx>
+ #endif
+
+ //###########################
+ inline rtl::OString OUStringToOString(const rtl_uString* s)
+ {
+ return rtl::OUStringToOString(
+ rtl::OUString(const_cast<rtl_uString*>(s)),
+ osl_getThreadTextEncoding());
+ }
+
+ namespace osl
+ {
+
+ /***********************************
+ osl::access
+
+ @see access
+ **********************************/
+
+ inline int access(const rtl::OUString& ustrPath, int mode)
+ {
+ return access_u(ustrPath.pData, mode);
+ }
+
+ /***********************************
+ osl::realpath
+
+ @descr
+ The return value differs from the
+ realpath function
+
+ @returns sal_True on success else
+ sal_False
+
+ @see realpath
+ **********************************/
+
+ inline sal_Bool realpath(
+ const rtl::OUString& ustrFileName,
+ rtl::OUString& ustrResolvedName)
+ {
+ return realpath_u(ustrFileName.pData, &ustrResolvedName.pData);
+ }
+
+
+ /***********************************
+ osl::lstat
+
+ @see lstat
+ **********************************/
+
+ inline int lstat(const rtl::OUString& ustrPath, struct stat& buf)
+ {
+ return lstat_u(ustrPath.pData, &buf);
+ }
+
+ /***********************************
+ osl::mkdir
+ @see mkdir
+ **********************************/
+ inline int mkdir(const rtl::OUString& aPath, mode_t aMode)
+ {
+ return mkdir_u(aPath.pData, aMode);
+ }
+
+ } // end namespace osl
+
+
+ #endif /* _OSL_UUNXAPI_HXX_ */
+