cpio_windows.h revision 1.1.1.3 1 /*-
2 * Copyright (c) 2009 Michihiro NAKAJIMA
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25 #ifndef CPIO_WINDOWS_H
26 #define CPIO_WINDOWS_H 1
27 #include <windows.h>
28
29 #include <io.h>
30 #include <string.h>
31
32 #define getgrgid(id) NULL
33 #define getgrnam(name) NULL
34 #define getpwnam(name) NULL
35 #define getpwuid(id) NULL
36
37 #if defined(_MSC_VER)
38 #if _MSC_VER < 1900
39 #define snprintf sprintf_s
40 #endif // _MSC_VER < 1900
41 #define strdup _strdup
42 #define open _open
43 #define read _read
44 #define close _close
45 #endif
46
47 struct passwd {
48 char *pw_name;
49 uid_t pw_uid;
50 gid_t pw_gid;
51 };
52
53 struct group {
54 char *gr_name;
55 gid_t gr_gid;
56 };
57
58 struct _timeval64i32 {
59 time_t tv_sec;
60 long tv_usec;
61 };
62 #define __timeval _timeval64i32
63
64 extern int futimes(int fd, const struct __timeval *times);
65 #ifndef HAVE_FUTIMES
66 #define HAVE_FUTIMES 1
67 #endif
68 extern int utimes(const char *name, const struct __timeval *times);
69 #ifndef HAVE_UTIMES
70 #define HAVE_UTIMES 1
71 #endif
72
73 #endif /* CPIO_WINDOWS_H */
74