1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _unx_hxx 29 #define _unx_hxx 30 31 #include <string.h> 32 #include <sys/types.h> 33 #include <sys/stat.h> 34 #include <sys/param.h> 35 #include <dirent.h> 36 #include <unistd.h> 37 /* #include <sysent.h> */ 38 39 #define FSYS_UNIX TRUE 40 #define DRIVE_EXISTS(c) ( TRUE ) 41 42 #define _mkdir(p) mkdir(p, 0777) 43 #define _rmdir rmdir 44 #define _chdir chdir 45 #define _unlink unlink 46 #define _getcwd getcwd 47 #define _access access 48 49 #ifdef SYSV3 50 #define DEFSTYLE FSYS_STYLE_SYSV 51 #else 52 #define DEFSTYLE FSYS_STYLE_BSD 53 #endif 54 55 #define CMP_LOWER(s) (s) 56 #define TEMPNAME() tmpnam(0) 57 #define LOWER(aString) (aString.Lower()) 58 59 #include <time.h> 60 #include <tools/datetime.hxx> 61 62 inline Time Unx2Time( time_t nTime ) 63 { 64 tm atm; 65 tm *pTime; 66 pTime = localtime_r( &nTime, &atm ); 67 return Time( pTime->tm_hour, 68 pTime->tm_min, 69 pTime->tm_sec ); 70 } 71 72 inline Date Unx2Date( time_t nDate ) 73 { 74 tm atm; 75 tm *pTime; 76 pTime = localtime_r( &nDate, &atm ); 77 return Date( pTime->tm_mday, 78 pTime->tm_mon + 1, 79 pTime->tm_year + 1900 ); 80 } 81 82 inline void Unx2DateAndTime( time_t nDate, Time& rTime, Date& rDate ) 83 { 84 tm atm; 85 tm *pTime; 86 pTime = localtime_r( &nDate, &atm ); 87 rTime = Time( pTime->tm_hour, pTime->tm_min, pTime->tm_sec ); 88 rDate = Date( pTime->tm_mday, pTime->tm_mon + 1, pTime->tm_year + 1900 ); 89 } 90 91 const char* TempDirImpl( char *pBuf ); 92 93 #define FSysFailOnErrorImpl() 94 95 #endif 96