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