1*8b851043SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*8b851043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*8b851043SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*8b851043SAndrew Rist * distributed with this work for additional information
6*8b851043SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*8b851043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*8b851043SAndrew Rist * "License"); you may not use this file except in compliance
9*8b851043SAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*8b851043SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*8b851043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*8b851043SAndrew Rist * software distributed under the License is distributed on an
15*8b851043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*8b851043SAndrew Rist * KIND, either express or implied. See the License for the
17*8b851043SAndrew Rist * specific language governing permissions and limitations
18*8b851043SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*8b851043SAndrew Rist *************************************************************/
21*8b851043SAndrew Rist
22*8b851043SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #ifndef _unx_hxx
25cdf0e10cSrcweir #define _unx_hxx
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include <string.h>
28cdf0e10cSrcweir #include <sys/types.h>
29cdf0e10cSrcweir #include <sys/stat.h>
30cdf0e10cSrcweir #include <sys/param.h>
31cdf0e10cSrcweir #include <dirent.h>
32cdf0e10cSrcweir #include <unistd.h>
33cdf0e10cSrcweir /* #include <sysent.h> */
34cdf0e10cSrcweir
35cdf0e10cSrcweir #define FSYS_UNIX TRUE
36cdf0e10cSrcweir #define DRIVE_EXISTS(c) ( TRUE )
37cdf0e10cSrcweir
38cdf0e10cSrcweir #define _mkdir(p) mkdir(p, 0777)
39cdf0e10cSrcweir #define _rmdir rmdir
40cdf0e10cSrcweir #define _chdir chdir
41cdf0e10cSrcweir #define _unlink unlink
42cdf0e10cSrcweir #define _getcwd getcwd
43cdf0e10cSrcweir #define _access access
44cdf0e10cSrcweir
45cdf0e10cSrcweir #ifdef SYSV3
46cdf0e10cSrcweir #define DEFSTYLE FSYS_STYLE_SYSV
47cdf0e10cSrcweir #else
48cdf0e10cSrcweir #define DEFSTYLE FSYS_STYLE_BSD
49cdf0e10cSrcweir #endif
50cdf0e10cSrcweir
51cdf0e10cSrcweir #define CMP_LOWER(s) (s)
52cdf0e10cSrcweir #define TEMPNAME() tmpnam(0)
53cdf0e10cSrcweir #define LOWER(aString) (aString.Lower())
54cdf0e10cSrcweir
55cdf0e10cSrcweir #include <time.h>
56cdf0e10cSrcweir #include <tools/datetime.hxx>
57cdf0e10cSrcweir
Unx2Time(time_t nTime)58cdf0e10cSrcweir inline Time Unx2Time( time_t nTime )
59cdf0e10cSrcweir {
60cdf0e10cSrcweir tm atm;
61cdf0e10cSrcweir tm *pTime;
62cdf0e10cSrcweir pTime = localtime_r( &nTime, &atm );
63cdf0e10cSrcweir return Time( pTime->tm_hour,
64cdf0e10cSrcweir pTime->tm_min,
65cdf0e10cSrcweir pTime->tm_sec );
66cdf0e10cSrcweir }
67cdf0e10cSrcweir
Unx2Date(time_t nDate)68cdf0e10cSrcweir inline Date Unx2Date( time_t nDate )
69cdf0e10cSrcweir {
70cdf0e10cSrcweir tm atm;
71cdf0e10cSrcweir tm *pTime;
72cdf0e10cSrcweir pTime = localtime_r( &nDate, &atm );
73cdf0e10cSrcweir return Date( pTime->tm_mday,
74cdf0e10cSrcweir pTime->tm_mon + 1,
75cdf0e10cSrcweir pTime->tm_year + 1900 );
76cdf0e10cSrcweir }
77cdf0e10cSrcweir
Unx2DateAndTime(time_t nDate,Time & rTime,Date & rDate)78cdf0e10cSrcweir inline void Unx2DateAndTime( time_t nDate, Time& rTime, Date& rDate )
79cdf0e10cSrcweir {
80cdf0e10cSrcweir tm atm;
81cdf0e10cSrcweir tm *pTime;
82cdf0e10cSrcweir pTime = localtime_r( &nDate, &atm );
83cdf0e10cSrcweir rTime = Time( pTime->tm_hour, pTime->tm_min, pTime->tm_sec );
84cdf0e10cSrcweir rDate = Date( pTime->tm_mday, pTime->tm_mon + 1, pTime->tm_year + 1900 );
85cdf0e10cSrcweir }
86cdf0e10cSrcweir
87cdf0e10cSrcweir const char* TempDirImpl( char *pBuf );
88cdf0e10cSrcweir
89cdf0e10cSrcweir #define FSysFailOnErrorImpl()
90cdf0e10cSrcweir
91cdf0e10cSrcweir #endif
92