~ubuntu-branches/ubuntu/edgy/mew-beta/edgy

« back to all changes in this revision

Viewing changes to bin/w32/w32.h

  • Committer: Bazaar Package Importer
  • Author(s): Tatsuya Kinoshita
  • Date: 2004-06-13 01:11:33 UTC
  • Revision ID: james.westby@ubuntu.com-20040613011133-yaef6kqhoimiq3lx
Tags: upstream-4.0.65
ImportĀ upstreamĀ versionĀ 4.0.65

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * w32.h
 
3
 *
 
4
 * Author:  Shuichi Kitaguchi <kit@Mew.org>
 
5
 * Created: Jun 17, 2001
 
6
 * Revised: 
 
7
 *
 
8
 * Code:
 
9
 */
 
10
 
 
11
 
 
12
/*
 
13
 * Typedefs, definitions and functions for Win32 environment.
 
14
 */
 
15
 
 
16
#ifndef __W32_H__
 
17
#define __W32_H__
 
18
 
 
19
 
 
20
/* includes */
 
21
#include <direct.h>             /* for chdir()/mkdir()/... */
 
22
 
 
23
/* additional types for sys/types.h */
 
24
 
 
25
#ifndef _POSIX_SOURCE
 
26
typedef unsigned char   u_char;
 
27
typedef unsigned short  u_short;
 
28
typedef unsigned int    u_int;
 
29
typedef unsigned long   u_long;
 
30
typedef unsigned short  ushort;         /* Sys V compatibility */
 
31
typedef unsigned int    uint;           /* Sys V compatibility */
 
32
#endif
 
33
 
 
34
typedef unsigned char           u_int8_t;
 
35
typedef unsigned short          u_int16_t;
 
36
typedef unsigned long           u_int32_t;
 
37
typedef unsigned __int64        u_int64_t;
 
38
typedef signed char             int8_t;
 
39
typedef signed short            int16_t;
 
40
typedef signed long             int32_t;
 
41
typedef signed __int64          int64_t;
 
42
 
 
43
typedef u_int32_t pid_t;        /* process ID */
 
44
 
 
45
/* Borland C++ has uid_t and gid_t. Why? */
 
46
#ifndef __BORLANDC__
 
47
typedef u_int32_t uid_t;        /* user ID */
 
48
typedef u_int32_t gid_t;        /* group ID */
 
49
#endif
 
50
 
 
51
/* definitions */
 
52
 
 
53
#ifndef inline
 
54
#define inline __inline
 
55
#endif
 
56
 
 
57
/* POSIX macros */
 
58
 
 
59
#include <sys/stat.h>
 
60
 
 
61
#ifndef S_IFLNK
 
62
#define S_IFLNK 0120000         /* symbolic link */
 
63
#endif
 
64
#ifndef S_ISUID
 
65
#define S_ISUID 0004000         /* set user id on execution */
 
66
#endif
 
67
#ifndef S_ISGID
 
68
#define S_ISGID 0002000         /* set group id on execution */
 
69
#endif
 
70
#ifndef S_IRWXU
 
71
#define S_IRWXU 0000700           /* RWX for owner */
 
72
#endif
 
73
#ifndef S_IRUSR
 
74
#define S_IRUSR 0000400           /* R for owner */
 
75
#endif
 
76
#ifndef S_IWUSR
 
77
#define S_IWUSR 0000200           /* W for owner */
 
78
#endif
 
79
#ifndef S_IXUSR
 
80
#define S_IXUSR 0000100           /* E for owner */
 
81
#endif
 
82
#ifndef S_IRWXG
 
83
#define S_IRWXG 0000070           /* RWX for group */
 
84
#endif
 
85
#ifndef S_IRGRP
 
86
#define S_IRGRP 0000040           /* R for group */
 
87
#endif
 
88
#ifndef S_IWGRP
 
89
#define S_IWGRP 0000020           /* W for group */
 
90
#endif
 
91
#ifndef S_IXGRP
 
92
#define S_IXGRP 0000010           /* X for group */
 
93
#endif
 
94
#ifndef S_IRWXO
 
95
#define S_IRWXO 0000007           /* RWX for other */
 
96
#endif
 
97
#ifndef S_IROTH
 
98
#define S_IROTH 0000004           /* R for other */
 
99
#endif
 
100
#ifndef S_IWOTH
 
101
#define S_IWOTH 0000002           /* W for other */
 
102
#endif
 
103
#ifndef S_IXOTH
 
104
#define S_IXOTH 0000001           /* E for other */
 
105
#endif
 
106
 
 
107
#ifndef S_ISDIR
 
108
#define S_ISDIR(mode) (((mode)&(_S_IFMT))==(_S_IFDIR))
 
109
#endif
 
110
#ifndef S_ISREG
 
111
#define S_ISREG(mode) (((mode)&(_S_IFMT))==(_S_IFREG))
 
112
#endif
 
113
 
 
114
 
 
115
/* supplements for string.h */
 
116
 
 
117
#define strcasecmp     stricmp
 
118
#define strncasecmp    strnicmp
 
119
#define snprintf       _snprintf
 
120
#define vsnprintf      _vsnprintf
 
121
#define lstat          stat
 
122
 
 
123
size_t strlcpy(char *, const char*, size_t);
 
124
size_t strlcat(char *, const char*, size_t);
 
125
 
 
126
char *realpath(const char *, char*);
 
127
 
 
128
#ifdef INET6
 
129
#include <winsock2.h>
 
130
#else
 
131
#include <winsock.h>
 
132
#endif
 
133
 
 
134
int  wsa_socketpair(SOCKET *);
 
135
void wsa_create_terminal(SOCKET);
 
136
char *wsa_strerror(int);
 
137
void wsa_perror(char *);
 
138
#define wsa_lasterror() WSAGetLastError()
 
139
 
 
140
 
 
141
/* On Win32 environment, uid/gid does not exist. */
 
142
#define _W32_USER_ID       0
 
143
#define _W32_GROUP_ID      0
 
144
 
 
145
 
 
146
 
 
147
#endif /* __W32_H__ */
 
148
 
 
149
/* 
 
150
 * Copyright (C) 2001-2003 Mew developing team.
 
151
 * All rights reserved.
 
152
 * 
 
153
 * Redistribution and use in source and binary forms, with or without
 
154
 * modification, are permitted provided that the following conditions
 
155
 * are met:
 
156
 * 
 
157
 * 1. Redistributions of source code must retain the above copyright
 
158
 *    notice, this list of conditions and the following disclaimer.
 
159
 * 2. Redistributions in binary form must reproduce the above copyright
 
160
 *    notice, this list of conditions and the following disclaimer in the
 
161
 *    documentation and/or other materials provided with the distribution.
 
162
 * 3. Neither the name of the team nor the names of its contributors
 
163
 *    may be used to endorse or promote products derived from this software
 
164
 *    without specific prior written permission.
 
165
 * 
 
166
 * THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
 
167
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
168
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 
169
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE
 
170
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 
171
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 
172
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 
173
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 
174
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 
175
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 
176
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
177
 */
 
178
 
 
179
/*
 
180
 * w32.h ends here
 
181
 */