summaryrefslogtreecommitdiff
path: root/legacy/evil
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2008-09-15 06:56:14 +0000
committerVincent Torri <vincent.torri@gmail.com>2008-09-15 06:56:14 +0000
commita7f00b51bcf19c8a5b040e6fc47398b689caa63f (patch)
tree75e34ba81140b77e14921744f28e1f98cd2fa43f /legacy/evil
parentbae73a2b6079992df4b24a003229940e318f42af (diff)
* Makefile.am:
add autogen.sh in archive distribution * configure.ac: remove useless defines first support of mingw32msvc compiler * src/lib/Evil.h: move some macro definitions * src/lib/Makefile.am: add evil_(fcntl/langinfo).(c/h) and install pwd.h * src/lib/dlfcn/dlfcn.h: remove useless ifdef * src/lib/evil.c: comment all code for now. It will be deleted later * src/lib/evil_fcntl.c: * src/lib/evil_fcntl.h: * src/lib/evil_langinfo.c: * src/lib/evil_langinfo.h: move fcntl and langinfo related code to their own files * src/lib/evil_mman.c: remove useless inclusion * src/lib/evil_pwd.c: pw var is not needed with cegcc * src/lib/evil_stdlib.c: fix bugs, formatting * src/lib/evil_unistd.c: add missing declarations and fix header files * src/lib/evil_unistd.h: move pid_t typedef to Evil.h * src/lib/evil_util.c: additional include and fix a bug in output * src/lib/pwd.h: use EAPI from Evil.h, define struct passwd when not using cegcc * src/lib/sys/mman.h: use EAPI from Evil.h * win32/common/fnmatch.c: * win32/common/fnmatch.h: * win32/common/fnmatch_list_of_states.c: * win32/vs8/evil.sln: fix and cleanup with vc++ compilation Based on patch by Dmitriy Mazovka SVN revision: 35993
Diffstat (limited to 'legacy/evil')
-rw-r--r--legacy/evil/ChangeLog58
-rw-r--r--legacy/evil/Makefile.am1
-rw-r--r--legacy/evil/configure.ac4
-rw-r--r--legacy/evil/src/lib/Evil.h160
-rw-r--r--legacy/evil/src/lib/Makefile.am13
-rw-r--r--legacy/evil/src/lib/dlfcn/dlfcn.h2
-rw-r--r--legacy/evil/src/lib/evil.c177
-rw-r--r--legacy/evil/src/lib/evil_fcntl.c82
-rw-r--r--legacy/evil/src/lib/evil_fcntl.h106
-rw-r--r--legacy/evil/src/lib/evil_langinfo.c50
-rw-r--r--legacy/evil/src/lib/evil_langinfo.h39
-rw-r--r--legacy/evil/src/lib/evil_mman.c2
-rw-r--r--legacy/evil/src/lib/evil_pwd.c5
-rw-r--r--legacy/evil/src/lib/evil_stdlib.c14
-rw-r--r--legacy/evil/src/lib/evil_unistd.c21
-rw-r--r--legacy/evil/src/lib/evil_unistd.h7
-rw-r--r--legacy/evil/src/lib/evil_util.c3
-rw-r--r--legacy/evil/src/lib/pwd.h23
-rw-r--r--legacy/evil/src/lib/sys/mman.h16
-rw-r--r--legacy/evil/win32/common/fnmatch.c30
-rw-r--r--legacy/evil/win32/common/fnmatch.h6
-rw-r--r--legacy/evil/win32/common/fnmatch_list_of_states.c7
-rw-r--r--legacy/evil/win32/vs8/evil.sln9
23 files changed, 469 insertions, 366 deletions
diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog
index 52fba7995a..4f858b86a6 100644
--- a/legacy/evil/ChangeLog
+++ b/legacy/evil/ChangeLog
@@ -1,3 +1,61 @@
12008-09-15 Vincent Torri <doursse at users dot sf dot net>
2
3 * Makefile.am:
4 add autogen.sh in archive distribution
5
6 * configure.ac:
7 remove useless defines
8 first support of mingw32msvc compiler
9
10 * src/lib/Evil.h:
11 move some macro definitions
12
13 * src/lib/Makefile.am:
14 add evil_(fcntl/langinfo).(c/h) and install pwd.h
15
16 * src/lib/dlfcn/dlfcn.h:
17 remove useless ifdef
18
19 * src/lib/evil.c:
20 comment all code for now. It will be deleted later
21
22 * src/lib/evil_fcntl.c:
23 * src/lib/evil_fcntl.h:
24 * src/lib/evil_langinfo.c:
25 * src/lib/evil_langinfo.h:
26 move fcntl and langinfo related code to their own files
27
28 * src/lib/evil_mman.c:
29 remove useless inclusion
30
31 * src/lib/evil_pwd.c:
32 pw var is not needed with cegcc
33
34 * src/lib/evil_stdlib.c:
35 fix bugs, formatting
36
37 * src/lib/evil_unistd.c:
38 add missing declarations and fix header files
39
40 * src/lib/evil_unistd.h:
41 move pid_t typedef to Evil.h
42
43 * src/lib/evil_util.c:
44 additional include and fix a bug in output
45
46 * src/lib/pwd.h:
47 use EAPI from Evil.h, define struct passwd when not using cegcc
48
49 * src/lib/sys/mman.h:
50 use EAPI from Evil.h
51
52 * win32/common/fnmatch.c:
53 * win32/common/fnmatch.h:
54 * win32/common/fnmatch_list_of_states.c:
55 * win32/vs8/evil.sln:
56 fix and cleanup with vc++ compilation
57 Based on patch by Dmitriy Mazovka
58
12008-09-14 Vincent Torri <doursse at users dot sf dot net> 592008-09-14 Vincent Torri <doursse at users dot sf dot net>
2 60
3 Fix compilation with vc++. Based on patch by Dmitriy Mazovka 61 Fix compilation with vc++. Based on patch by Dmitriy Mazovka
diff --git a/legacy/evil/Makefile.am b/legacy/evil/Makefile.am
index 24ac9cb9a7..18e70d3ffa 100644
--- a/legacy/evil/Makefile.am
+++ b/legacy/evil/Makefile.am
@@ -24,6 +24,7 @@ EXTRA_DIST = \
24COPYING \ 24COPYING \
25COPYING-PLAIN \ 25COPYING-PLAIN \
26Doxyfile \ 26Doxyfile \
27autogen.sh \
27evil.pc.in 28evil.pc.in
28 29
29pkgconfigdir = $(libdir)/pkgconfig 30pkgconfigdir = $(libdir)/pkgconfig
diff --git a/legacy/evil/configure.ac b/legacy/evil/configure.ac
index 0418e9a289..24dbb2c890 100644
--- a/legacy/evil/configure.ac
+++ b/legacy/evil/configure.ac
@@ -11,7 +11,7 @@ dnl for each platform.
11win32_libs="" 11win32_libs=""
12win32_cflags="" 12win32_cflags=""
13case "$host_os" in 13case "$host_os" in
14 mingw|mingw32) 14 mingw | mingw32 | mingw32msvc)
15 win32_libs="-lole32 -luuid -lws2_32" 15 win32_libs="-lole32 -luuid -lws2_32"
16 ;; 16 ;;
17 cegcc) 17 cegcc)
@@ -30,9 +30,7 @@ AC_SUBST(win32_libs)
30 30
31dnl needed for correct definition of EAPI 31dnl needed for correct definition of EAPI
32AC_DEFINE(EFL_EVIL_BUILD, 1, [Define to mention that evil is built]) 32AC_DEFINE(EFL_EVIL_BUILD, 1, [Define to mention that evil is built])
33AC_DEFINE(EFL_EVIL_MMAN_BUILD, 1, [Define to mention that evil mman is built])
34AC_DEFINE(EFL_EVIL_DLFCN_BUILD, 1, [Define to mention that evil dlfcn is built]) 33AC_DEFINE(EFL_EVIL_DLFCN_BUILD, 1, [Define to mention that evil dlfcn is built])
35AC_DEFINE(EFL_EVIL_PWD_BUILD, 1, [Define to mention that evil pwd is built])
36 34
37AM_INIT_AUTOMAKE(1.6 dist-bzip2) 35AM_INIT_AUTOMAKE(1.6 dist-bzip2)
38 36
diff --git a/legacy/evil/src/lib/Evil.h b/legacy/evil/src/lib/Evil.h
index ffdae28154..004e2daa6b 100644
--- a/legacy/evil/src/lib/Evil.h
+++ b/legacy/evil/src/lib/Evil.h
@@ -78,162 +78,36 @@ extern "C" {
78 78
79#ifdef _MSC_VER 79#ifdef _MSC_VER
80 80
81#define F_OK 0 /* Check for file existence */
82#define X_OK 1 /* MS access() doesn't check for execute permission. */
83#define W_OK 2 /* Check for write permission */
84#define R_OK 4 /* Check for read permission */
85
86#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
87#define _S_IXUSR _S_IEXEC
88#define _S_IWUSR _S_IWRITE
89#define _S_IRUSR _S_IREAD
90
91typedef int pid_t;
81typedef SSIZE_T ssize_t; 92typedef SSIZE_T ssize_t;
82typedef unsigned short mode_t; 93typedef unsigned short mode_t;
83 94
84#endif /* _MSC_VER */ 95#endif /* _MSC_VER */
85 96
86 97
87#include "evil_stdlib.h"
88#include "evil_unistd.h"
89#include "evil_util.h"
90
91
92#ifndef __CEGCC__ 98#ifndef __CEGCC__
93 99
94# include <sys/types.h>
95
96/**
97 * @def FD_CLOEXEC
98 * Specifies that the file descriptor should be closed when an exec()
99 * function is invoked.
100 */
101# define FD_CLOEXEC 1
102
103/**
104 * @def F_SETFD
105 * Specifies that fcntl() should set the file descriptor flags
106 * associated with the filedes argument.
107 */
108
109/**
110 * @def F_SETLK
111 * Specifies that fcntl() should set or clear a file segment lock
112 * according to the lock description pointed to by the third argument.
113 */
114
115/**
116 * @def F_SETLKW
117 * Equivalent to F_SETLK except that if a shared or exclusive lock
118 * is blocked by other locks, the thread shall wait until the request
119 * can be satisfied.
120 */
121
122# define F_SETFD 2
123# define F_SETLK 6
124# define F_SETLKW 7
125
126/**
127 * @def F_RDLCK
128 * Read (or shared) lock
129 */
130
131/**
132 * @def F_WRLCK
133 * Write (or exclusive) lock
134 */
135
136/**
137 * @def F_UNLCK
138 * Remove lock
139 */
140
141# ifndef F_RDLCK
142# define F_RDLCK 0
143# define F_WRLCK 1
144# define F_UNLCK 2
145# endif /* ! F_RDLCK */
146
147/**
148 * @struct flock
149 * @brief A structure that control the lock of a file descriptor.
150 */
151struct flock
152{
153 short int l_type; /**< lock type: read, write, ... */
154 short int l_whence; /**< type of l_start */
155 off_t l_start; /**< starting offset */
156 off_t l_len; /**< 0 means end of the file */
157 pid_t l_pid; /**< lock owner */
158};
159
160
161/**
162 * @brief Provide control over file descriptors.
163 *
164 * @param fd The file descriptor.
165 * @param cmd The type of control.
166 * @return 0 on success, -1 otherwise.
167 *
168 * Performs one of various miscellaneous operations on @p fd.
169 * The operation in question is determined by @p cmd:
170 *
171 * - F_SETFD: Set the close-on-exec flag to the value specified
172 * by the argument after command (only the least significant
173 * bit is used).
174 * - F_SETLK and F_SETLKW: used to manage discretionary file locks.
175 * The third argument must be a pointer to a struct flock (that
176 * may be overwritten by this call).
177 *
178 * This function returns 0 on success, -1 otherwise.
179 *
180 * Conformity: None.
181 *
182 * Supported OS: Windows Vista, Windows XP or Windows 2000
183 * Professional.
184 *
185 * @ingroup Evil
186 */
187EAPI int fcntl(int fd, int cmd, ...);
188
189
190#endif /* ! __CEGCC__ */
191
192typedef int nl_item;
193
194#define __NL_ITEM( CATEGORY, INDEX ) ((CATEGORY << 16) | INDEX)
195#define __NL_ITEM_CATEGORY( ITEM ) (ITEM >> 16)
196#define __NL_ITEM_INDEX( ITEM ) (ITEM & 0xffff)
197
198enum {
199 /*
200 * LC_CTYPE category...
201 * Character set classification items.
202 */
203 _NL_CTYPE_CODESET = __NL_ITEM( LC_CTYPE, 0 ),
204
205 /*
206 * Dummy entry, to terminate the list.
207 */
208 _NL_ITEM_CLASSIFICATION_END
209};
210
211/*
212 * Define the public aliases for the enumerated classification indices...
213 */
214# define CODESET _NL_CTYPE_CODESET
215
216EAPI char *nl_langinfo(nl_item index);
217
218
219#ifndef __CEGCC__
220typedef unsigned long uid_t; 100typedef unsigned long uid_t;
221typedef unsigned long gid_t; 101typedef unsigned long gid_t;
222#endif /* ! __CEGCC__ */
223 102
224#ifdef _MSC_VER 103#endif /* ! __CEGCC__ */
225
226#define F_OK 0 /* Check for file existence */
227#define X_OK 1 /* MS access() doesn't check for execute permission. */
228#define W_OK 2 /* Check for write permission */
229#define R_OK 4 /* Check for read permission */
230 104
231#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
232#define _S_IXUSR _S_IEXEC
233#define _S_IWUSR _S_IWRITE
234#define _S_IRUSR _S_IREAD
235 105
236#endif /* _MSC_VER */ 106#include "evil_fcntl.h"
107#include "evil_langinfo.h"
108#include "evil_stdlib.h"
109#include "evil_unistd.h"
110#include "evil_util.h"
237 111
238 112
239#if defined(__MSDOS__) || defined(__EMX__) || \ 113#if defined(__MSDOS__) || defined(__EMX__) || \
diff --git a/legacy/evil/src/lib/Makefile.am b/legacy/evil/src/lib/Makefile.am
index f66c565821..7df63b3524 100644
--- a/legacy/evil/src/lib/Makefile.am
+++ b/legacy/evil/src/lib/Makefile.am
@@ -5,11 +5,20 @@ SUBDIRS = . dlfcn
5 5
6lib_LTLIBRARIES = libevil.la 6lib_LTLIBRARIES = libevil.la
7 7
8include_HEADERS = Evil.h evil_stdlib.h evil_unistd.h evil_util.h 8include_HEADERS = \
9nobase_include_HEADERS = sys/mman.h 9Evil.h \
10evil_fcntl.h \
11evil_langinfo.h \
12evil_stdlib.h \
13evil_unistd.h \
14evil_util.h
15
16nobase_include_HEADERS = pwd.h sys/mman.h
10 17
11libevil_la_SOURCES = \ 18libevil_la_SOURCES = \
12evil.c \ 19evil.c \
20evil_fcntl.c \
21evil_langinfo.c \
13evil_mman.c \ 22evil_mman.c \
14evil_pwd.c \ 23evil_pwd.c \
15evil_stdlib.c \ 24evil_stdlib.c \
diff --git a/legacy/evil/src/lib/dlfcn/dlfcn.h b/legacy/evil/src/lib/dlfcn/dlfcn.h
index 4848459ec8..296f8f7fa1 100644
--- a/legacy/evil/src/lib/dlfcn/dlfcn.h
+++ b/legacy/evil/src/lib/dlfcn/dlfcn.h
@@ -8,7 +8,7 @@
8# undef _POSIX_ 8# undef _POSIX_
9#endif /* _MSC_VER */ 9#endif /* _MSC_VER */
10 10
11#if defined(__CEGCC__) || defined(__MINGW32CE__) 11#if defined(__CEGCC__)
12# include <sys/syslimits.h> 12# include <sys/syslimits.h>
13#else 13#else
14# include <limits.h> 14# include <limits.h>
diff --git a/legacy/evil/src/lib/evil.c b/legacy/evil/src/lib/evil.c
index 874e48d912..422b65a7c4 100644
--- a/legacy/evil/src/lib/evil.c
+++ b/legacy/evil/src/lib/evil.c
@@ -1,141 +1,38 @@
1#define WIN32_LEAN_AND_MEAN 1/* #define WIN32_LEAN_AND_MEAN */
2#include <winsock2.h> 2/* #include <winsock2.h> */
3#undef WIN32_LEAN_AND_MEAN 3/* #undef WIN32_LEAN_AND_MEAN */
4
5/* #include <stdlib.h> */
6/* #include <stdio.h> */
7
8/* #ifndef __CEGCC__ */
9/* # include <errno.h> */
10/* # include <sys/locking.h> */
11/* # include <io.h> */
12/* # include <shlobj.h> */
13/* # include <objidl.h> */
14/* #else */
15/* # include <sys/syslimits.h> */
16/* #endif /\* __CEGCC__ *\/ */
17
18/* #ifdef UNICODE */
19/* # include <wchar.h> */
20/* #endif /\* UNICODE *\/ */
21
22/* #include <sys/types.h> */
23/* #include <sys/timeb.h> */
24/* #include <fcntl.h> */
25/* #include <sys/stat.h> */
26
27/* #ifdef HAVE_CONFIG_H */
28/* # include "config.h" */
29/* #endif /\* HAVE_CONFIG_H *\/ */
30
31/* #if HAVE___ATTRIBUTE__ */
32/* # define __UNUSED__ __attribute__((unused)) */
33/* #else */
34/* # define __UNUSED__ */
35/* #endif /\* HAVE___ATTRIBUTE__ *\/ */
36
37/* #include "Evil.h" */
4 38
5#include <stdlib.h>
6#include <stdio.h>
7
8#ifndef __CEGCC__
9# include <errno.h>
10# include <sys/locking.h>
11# include <io.h>
12# include <shlobj.h>
13# include <objidl.h>
14#else
15# include <sys/syslimits.h>
16#endif /* __CEGCC__ */
17
18#ifdef UNICODE
19# include <wchar.h>
20#endif /* UNICODE */
21
22#include <sys/types.h>
23#include <sys/timeb.h>
24#include <fcntl.h>
25#include <sys/stat.h>
26
27#ifdef HAVE_CONFIG_H
28# include "config.h"
29#endif /* HAVE_CONFIG_H */
30
31#if HAVE___ATTRIBUTE__
32# define __UNUSED__ __attribute__((unused))
33#else
34# define __UNUSED__
35#endif /* HAVE___ATTRIBUTE__ */
36
37#include "Evil.h"
38
39
40#ifndef __CEGCC__
41
42int fcntl(int fd, int cmd, ...)
43{
44 va_list va;
45 HANDLE h;
46 int res = -1;
47
48 va_start (va, cmd);
49
50 h = (HANDLE)_get_osfhandle(fd);
51 if (h == INVALID_HANDLE_VALUE)
52 return -1;
53
54 if (cmd == F_SETFD)
55 {
56 long flag;
57
58 flag = va_arg(va, long);
59 if (flag == FD_CLOEXEC)
60 {
61 if (SetHandleInformation(h, HANDLE_FLAG_INHERIT, 0))
62 res = 0;
63 }
64 }
65 else if ((cmd == F_SETLK) || (cmd == F_SETLKW))
66 {
67 struct flock fl;
68 off_t length = 0;
69 long pos;
70
71 fl = va_arg(va, struct flock);
72
73 if (fl.l_len == 0)
74 {
75 length = _lseek(fd, 0L, SEEK_END);
76 if (length != -1L)
77 res = 0;
78 }
79 fl.l_len = length - fl.l_start - 1;
80
81 pos = _lseek(fd, fl.l_start, fl.l_whence);
82 if (pos != -1L)
83 res = 0;
84
85 if ((fl.l_type == F_RDLCK) || (fl.l_type == F_WRLCK))
86 {
87 if (cmd == F_SETLK)
88 res = _locking(fd, _LK_NBLCK, fl.l_len); /* if cannot be locked, we return immediatly */
89 else /* F_SETLKW */
90 res = _locking(fd, _LK_LOCK, fl.l_len); /* otherwise, we try several times */
91 }
92
93 if (fl.l_type == F_UNLCK)
94 res = _locking(fd, _LK_UNLCK, fl.l_len);
95 }
96
97 va_end(va);
98
99 return res;
100}
101
102#endif /* ! __CEGCC__ */
103
104static char *
105replace(char *prev, char *value)
106{
107 if (value == NULL)
108 return prev;
109
110 if (prev)
111 free (prev);
112 return strdup (value);
113}
114
115char *
116nl_langinfo(nl_item index)
117{
118 static char *result = NULL;
119 static char *nothing = "";
120
121 switch (index)
122 {
123 case CODESET:
124 {
125 char *p;
126 result = replace(result, setlocale(LC_CTYPE, NULL));
127 if ((p = strrchr(result, '.' )) == NULL)
128 return nothing;
129
130 if ((++p - result) > 2)
131 strcpy(result, "cp");
132 else
133 *result = '\0';
134 strcat(result, p);
135
136 return result;
137 }
138 }
139
140 return nothing;
141}
diff --git a/legacy/evil/src/lib/evil_fcntl.c b/legacy/evil/src/lib/evil_fcntl.c
new file mode 100644
index 0000000000..1cd61eddb2
--- /dev/null
+++ b/legacy/evil/src/lib/evil_fcntl.c
@@ -0,0 +1,82 @@
1
2#include <stdio.h>
3
4#ifndef __CEGCC__
5# include <sys/locking.h>
6#endif /* __CEGCC__ */
7
8#ifdef HAVE_CONFIG_H
9# include "config.h"
10#endif /* HAVE_CONFIG_H */
11
12#include "Evil.h"
13
14
15/*
16 * port of fcntl function
17 *
18 */
19
20#ifndef __CEGCC__
21
22int fcntl(int fd, int cmd, ...)
23{
24 va_list va;
25 HANDLE h;
26 int res = -1;
27
28 va_start (va, cmd);
29
30 h = (HANDLE)_get_osfhandle(fd);
31 if (h == INVALID_HANDLE_VALUE)
32 return -1;
33
34 if (cmd == F_SETFD)
35 {
36 long flag;
37
38 flag = va_arg(va, long);
39 if (flag == FD_CLOEXEC)
40 {
41 if (SetHandleInformation(h, HANDLE_FLAG_INHERIT, 0))
42 res = 0;
43 }
44 }
45 else if ((cmd == F_SETLK) || (cmd == F_SETLKW))
46 {
47 struct flock fl;
48 off_t length = 0;
49 long pos;
50
51 fl = va_arg(va, struct flock);
52
53 if (fl.l_len == 0)
54 {
55 length = _lseek(fd, 0L, SEEK_END);
56 if (length != -1L)
57 res = 0;
58 }
59 fl.l_len = length - fl.l_start - 1;
60
61 pos = _lseek(fd, fl.l_start, fl.l_whence);
62 if (pos != -1L)
63 res = 0;
64
65 if ((fl.l_type == F_RDLCK) || (fl.l_type == F_WRLCK))
66 {
67 if (cmd == F_SETLK)
68 res = _locking(fd, _LK_NBLCK, fl.l_len); /* if cannot be locked, we return immediatly */
69 else /* F_SETLKW */
70 res = _locking(fd, _LK_LOCK, fl.l_len); /* otherwise, we try several times */
71 }
72
73 if (fl.l_type == F_UNLCK)
74 res = _locking(fd, _LK_UNLCK, fl.l_len);
75 }
76
77 va_end(va);
78
79 return res;
80}
81
82#endif /* ! __CEGCC__ */
diff --git a/legacy/evil/src/lib/evil_fcntl.h b/legacy/evil/src/lib/evil_fcntl.h
new file mode 100644
index 0000000000..cedeffb6e8
--- /dev/null
+++ b/legacy/evil/src/lib/evil_fcntl.h
@@ -0,0 +1,106 @@
1#ifndef __EVIL_FCNTL_H__
2#define __EVIL_FCNTL_H__
3
4
5#ifndef __CEGCC__
6
7# include <sys/types.h>
8
9/**
10 * @def FD_CLOEXEC
11 * Specifies that the file descriptor should be closed when an exec()
12 * function is invoked.
13 */
14# define FD_CLOEXEC 1
15
16/**
17 * @def F_SETFD
18 * Specifies that fcntl() should set the file descriptor flags
19 * associated with the filedes argument.
20 */
21
22/**
23 * @def F_SETLK
24 * Specifies that fcntl() should set or clear a file segment lock
25 * according to the lock description pointed to by the third argument.
26 */
27
28/**
29 * @def F_SETLKW
30 * Equivalent to F_SETLK except that if a shared or exclusive lock
31 * is blocked by other locks, the thread shall wait until the request
32 * can be satisfied.
33 */
34
35# define F_SETFD 2
36# define F_SETLK 6
37# define F_SETLKW 7
38
39/**
40 * @def F_RDLCK
41 * Read (or shared) lock
42 */
43
44/**
45 * @def F_WRLCK
46 * Write (or exclusive) lock
47 */
48
49/**
50 * @def F_UNLCK
51 * Remove lock
52 */
53
54# ifndef F_RDLCK
55# define F_RDLCK 0
56# define F_WRLCK 1
57# define F_UNLCK 2
58# endif /* ! F_RDLCK */
59
60/**
61 * @struct flock
62 * @brief A structure that control the lock of a file descriptor.
63 */
64struct flock
65{
66 short int l_type; /**< lock type: read, write, ... */
67 short int l_whence; /**< type of l_start */
68 off_t l_start; /**< starting offset */
69 off_t l_len; /**< 0 means end of the file */
70 pid_t l_pid; /**< lock owner */
71};
72
73
74/**
75 * @brief Provide control over file descriptors.
76 *
77 * @param fd The file descriptor.
78 * @param cmd The type of control.
79 * @return 0 on success, -1 otherwise.
80 *
81 * Performs one of various miscellaneous operations on @p fd.
82 * The operation in question is determined by @p cmd:
83 *
84 * - F_SETFD: Set the close-on-exec flag to the value specified
85 * by the argument after command (only the least significant
86 * bit is used).
87 * - F_SETLK and F_SETLKW: used to manage discretionary file locks.
88 * The third argument must be a pointer to a struct flock (that
89 * may be overwritten by this call).
90 *
91 * This function returns 0 on success, -1 otherwise.
92 *
93 * Conformity: None.
94 *
95 * Supported OS: Windows Vista, Windows XP or Windows 2000
96 * Professional.
97 *
98 * @ingroup Evil
99 */
100EAPI int fcntl(int fd, int cmd, ...);
101
102
103#endif /* ! __CEGCC__ */
104
105
106#endif /* __EVIL_FCNTL_H__ */
diff --git a/legacy/evil/src/lib/evil_langinfo.c b/legacy/evil/src/lib/evil_langinfo.c
new file mode 100644
index 0000000000..d478b0d028
--- /dev/null
+++ b/legacy/evil/src/lib/evil_langinfo.c
@@ -0,0 +1,50 @@
1
2#ifdef HAVE_CONFIG_H
3# include "config.h"
4#endif /* HAVE_CONFIG_H */
5
6#include "Evil.h"
7
8
9#ifndef __CEGCC__
10
11static char *
12replace(char *prev, char *value)
13{
14 if (value == NULL)
15 return prev;
16
17 if (prev)
18 free (prev);
19 return strdup (value);
20}
21
22char *
23nl_langinfo(nl_item index)
24{
25 static char *result = NULL;
26 static char *nothing = "";
27
28 switch (index)
29 {
30 case CODESET:
31 {
32 char *p;
33 result = replace(result, setlocale(LC_CTYPE, NULL));
34 if ((p = strrchr(result, '.' )) == NULL)
35 return nothing;
36
37 if ((++p - result) > 2)
38 strcpy(result, "cp");
39 else
40 *result = '\0';
41 strcat(result, p);
42
43 return result;
44 }
45 }
46
47 return nothing;
48}
49
50#endif /* ! __CEGCC__ */
diff --git a/legacy/evil/src/lib/evil_langinfo.h b/legacy/evil/src/lib/evil_langinfo.h
new file mode 100644
index 0000000000..6cfcaa45a7
--- /dev/null
+++ b/legacy/evil/src/lib/evil_langinfo.h
@@ -0,0 +1,39 @@
1#ifndef __EVIL_LANGINFO_H__
2#define __EVIL_LANGINFO_H__
3
4
5#ifndef __CEGCC__
6
7#include <locale.h>
8
9
10typedef int nl_item;
11
12#define __NL_ITEM( CATEGORY, INDEX ) ((CATEGORY << 16) | INDEX)
13#define __NL_ITEM_CATEGORY( ITEM ) (ITEM >> 16)
14#define __NL_ITEM_INDEX( ITEM ) (ITEM & 0xffff)
15
16enum {
17 /*
18 * LC_CTYPE category...
19 * Character set classification items.
20 */
21 _NL_CTYPE_CODESET = __NL_ITEM( LC_CTYPE, 0 ),
22
23 /*
24 * Dummy entry, to terminate the list.
25 */
26 _NL_ITEM_CLASSIFICATION_END
27};
28
29/*
30 * Define the public aliases for the enumerated classification indices...
31 */
32# define CODESET _NL_CTYPE_CODESET
33
34EAPI char *nl_langinfo(nl_item index);
35
36#endif /* ! __CEGCC__ */
37
38
39#endif /*__EVIL_LANGINFO_H__ */
diff --git a/legacy/evil/src/lib/evil_mman.c b/legacy/evil/src/lib/evil_mman.c
index b196de435b..313e185c2e 100644
--- a/legacy/evil/src/lib/evil_mman.c
+++ b/legacy/evil/src/lib/evil_mman.c
@@ -10,8 +10,6 @@
10# include <io.h> 10# include <io.h>
11#endif /* ! __CEGCC__ */ 11#endif /* ! __CEGCC__ */
12 12
13#include "Evil.h"
14
15#ifdef HAVE_CONFIG_H 13#ifdef HAVE_CONFIG_H
16# include "config.h" 14# include "config.h"
17#endif /* HAVE_CONFIG_H */ 15#endif /* HAVE_CONFIG_H */
diff --git a/legacy/evil/src/lib/evil_pwd.c b/legacy/evil/src/lib/evil_pwd.c
index 45d7380e60..d8977eda44 100644
--- a/legacy/evil/src/lib/evil_pwd.c
+++ b/legacy/evil/src/lib/evil_pwd.c
@@ -7,10 +7,10 @@
7#include "pwd.h" 7#include "pwd.h"
8 8
9 9
10static struct passwd pw; 10#ifndef __CEGCC__
11 11
12 12
13#ifndef __CEGCC__ 13static struct passwd pw;
14 14
15struct passwd * 15struct passwd *
16getpwuid (uid_t uid) 16getpwuid (uid_t uid)
@@ -39,4 +39,5 @@ getpwuid (uid_t uid)
39 return &pw; 39 return &pw;
40} 40}
41 41
42
42#endif /* ! __CEGCC__ */ 43#endif /* ! __CEGCC__ */
diff --git a/legacy/evil/src/lib/evil_stdlib.c b/legacy/evil/src/lib/evil_stdlib.c
index 4d1d136293..84a4c51c4c 100644
--- a/legacy/evil/src/lib/evil_stdlib.c
+++ b/legacy/evil/src/lib/evil_stdlib.c
@@ -26,7 +26,7 @@ _evil_stdlib_error_display(const char *fct,
26 char *error; 26 char *error;
27 27
28 error = evil_format_message(res); 28 error = evil_format_message(res);
29 fprintf(stderr, "[Evil] [%s] ERROR: %ld\n", fct, error); 29 fprintf(stderr, "[Evil] [%s] ERROR: %s\n", fct, error);
30 free(error); 30 free(error);
31} 31}
32 32
@@ -191,11 +191,11 @@ setenv(const char *name,
191 if (!overwrite && (disposition == REG_OPENED_EXISTING_KEY)) 191 if (!overwrite && (disposition == REG_OPENED_EXISTING_KEY))
192 return 0; 192 return 0;
193 193
194 if ((res = RegSetValueEx (key, 194 if ((res = RegSetValueEx(key,
195 (LPCWSTR)name, 195 (LPCWSTR)name,
196 0, REG_SZ, 196 0, REG_SZ,
197 value, 197 (const BYTE *)value,
198 strlen(value) + 1)) != ERROR_SUCCESS) 198 strlen(value) + 1)) != ERROR_SUCCESS)
199 { 199 {
200 _evil_stdlib_error_display("setenv", res); 200 _evil_stdlib_error_display("setenv", res);
201 if ((res = RegCloseKey (key)) != ERROR_SUCCESS) 201 if ((res = RegCloseKey (key)) != ERROR_SUCCESS)
@@ -219,7 +219,7 @@ setenv(const char *name,
219int 219int
220unsetenv(const char *name) 220unsetenv(const char *name)
221{ 221{
222 setenv(name, NULL, 1); 222 return setenv(name, NULL, 1);
223} 223}
224 224
225#endif /* ! __CEGCC__ */ 225#endif /* ! __CEGCC__ */
diff --git a/legacy/evil/src/lib/evil_unistd.c b/legacy/evil/src/lib/evil_unistd.c
index 866b15aa8e..e6b2238dd7 100644
--- a/legacy/evil/src/lib/evil_unistd.c
+++ b/legacy/evil/src/lib/evil_unistd.c
@@ -2,10 +2,11 @@
2#include <winsock2.h> 2#include <winsock2.h>
3#undef WIN32_LEAN_AND_MEAN 3#undef WIN32_LEAN_AND_MEAN
4 4
5#ifdef _MSC_VER 5#if defined(_MSC_VER) || \
6# include <shobjidl.h> 6 (defined(__MINGW32__) && ! defined(__MINGW32CE__))
7# include <shlobj.h>
8# include <objidl.h>
7# include <errno.h> 9# include <errno.h>
8# include <shlguid.h>
9#endif 10#endif
10 11
11#ifdef HAVE_CONFIG_H 12#ifdef HAVE_CONFIG_H
@@ -31,6 +32,20 @@ getpid(void)
31 * 32 *
32 */ 33 */
33 34
35#if defined(__CEGCC__) || defined(__MINGW32CE__)
36
37DWORD SHCreateShortcutEx(LPTSTR lpszDir,
38 LPTSTR lpszTarget,
39 LPTSTR szShortcut,
40 LPDWORD lpcbShortcut);
41
42BOOL SHGetShortcutTarget(LPTSTR szShortcut,
43 LPTSTR szTarget,
44 int cbMax );
45
46#endif /* __CEGCC__ || __MINGW32CE__ */
47
48
34/* REMARK: Windows has no symbolic link. */ 49/* REMARK: Windows has no symbolic link. */
35/* Nevertheless, it can create and read .lnk files */ 50/* Nevertheless, it can create and read .lnk files */
36int 51int
diff --git a/legacy/evil/src/lib/evil_unistd.h b/legacy/evil/src/lib/evil_unistd.h
index c99d5e246d..b1907eeaf1 100644
--- a/legacy/evil/src/lib/evil_unistd.h
+++ b/legacy/evil/src/lib/evil_unistd.h
@@ -2,13 +2,6 @@
2#define __EVIL_UNISTD_H__ 2#define __EVIL_UNISTD_H__
3 3
4 4
5#ifdef _MSC_VER
6
7typedef int pid_t;
8
9#endif /* _MSC_VER */
10
11
12/* 5/*
13 * Process identifer related functions 6 * Process identifer related functions
14 * 7 *
diff --git a/legacy/evil/src/lib/evil_util.c b/legacy/evil/src/lib/evil_util.c
index 1c53252171..fdd1fac61b 100644
--- a/legacy/evil/src/lib/evil_util.c
+++ b/legacy/evil/src/lib/evil_util.c
@@ -1,6 +1,7 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <stdio.h> 2#include <stdio.h>
3#include <string.h> 3#include <string.h>
4#include <wchar.h>
4 5
5#define WIN32_LEAN_AND_MEAN 6#define WIN32_LEAN_AND_MEAN
6#include <windows.h> 7#include <windows.h>
@@ -84,7 +85,7 @@ evil_format_message(long err)
84 return NULL; 85 return NULL;
85 86
86 snprintf(disp, strlen(str) + strlen("(00000) ") + 1, 87 snprintf(disp, strlen(str) + strlen("(00000) ") + 1,
87 "(%5d) %s", err, str); 88 "(%5ld) %s", err, str);
88 89
89 free(str); 90 free(str);
90 91
diff --git a/legacy/evil/src/lib/pwd.h b/legacy/evil/src/lib/pwd.h
index cfd211a83b..4a6b832a9a 100644
--- a/legacy/evil/src/lib/pwd.h
+++ b/legacy/evil/src/lib/pwd.h
@@ -7,28 +7,14 @@
7#include <Evil.h> 7#include <Evil.h>
8 8
9 9
10#ifdef EAPI
11# undef EAPI
12#endif /* EAPI */
13
14#ifdef _WIN32
15# ifdef EFL_EVIL_PWD_BUILD
16# ifdef DLL_EXPORT
17# define EAPI __declspec(dllexport)
18# else
19# define EAPI
20# endif /* ! DLL_EXPORT */
21# else
22# define EAPI __declspec(dllimport)
23# endif /* ! EFL_EVIL_PWD_BUILD */
24#endif /* _WIN32 */
25
26
27#ifdef __cplusplus 10#ifdef __cplusplus
28extern "C" { 11extern "C" {
29#endif 12#endif
30 13
31 14
15#ifndef __CEGCC__
16
17
32struct passwd { 18struct passwd {
33 char *pw_name; /* user name */ 19 char *pw_name; /* user name */
34 char *pw_passwd; /* encrypted password */ 20 char *pw_passwd; /* encrypted password */
@@ -46,6 +32,9 @@ struct passwd {
46EAPI struct passwd * getpwuid (uid_t uid); 32EAPI struct passwd * getpwuid (uid_t uid);
47 33
48 34
35#endif /* ! __CEGCC__ */
36
37
49#ifdef __cplusplus 38#ifdef __cplusplus
50} 39}
51#endif 40#endif
diff --git a/legacy/evil/src/lib/sys/mman.h b/legacy/evil/src/lib/sys/mman.h
index 40c0859dcb..885d8a6bc3 100644
--- a/legacy/evil/src/lib/sys/mman.h
+++ b/legacy/evil/src/lib/sys/mman.h
@@ -1,22 +1,8 @@
1#ifndef __EVIL_SYS_MMAN_H__ 1#ifndef __EVIL_SYS_MMAN_H__
2#define __EVIL_SYS_MMAN_H__ 2#define __EVIL_SYS_MMAN_H__
3 3
4#include <Evil.h>
4 5
5#ifdef EAPI
6# undef EAPI
7#endif /* EAPI */
8
9#ifdef _WIN32
10# ifdef EFL_EVIL_MMAN_BUILD
11# ifdef DLL_EXPORT
12# define EAPI __declspec(dllexport)
13# else
14# define EAPI
15# endif /* ! DLL_EXPORT */
16# else
17# define EAPI __declspec(dllimport)
18# endif /* ! EFL_EVIL_MMAN_BUILD */
19#endif /* _WIN32 */
20 6
21#ifdef __cplusplus 7#ifdef __cplusplus
22extern "C" { 8extern "C" {
diff --git a/legacy/evil/win32/common/fnmatch.c b/legacy/evil/win32/common/fnmatch.c
index 1211fd5391..d8f8b862df 100644
--- a/legacy/evil/win32/common/fnmatch.c
+++ b/legacy/evil/win32/common/fnmatch.c
@@ -59,12 +59,14 @@ fnmatch_match_class(const char *class,
59 char c) 59 char c)
60{ 60{
61 const size_t complement = fnmatch_complement_class(class + 1); 61 const size_t complement = fnmatch_complement_class(class + 1);
62 enum fnmatch_status status;
63 size_t pos;
62 64
63 if (complement == FNM_SYNTAXERR) 65 if (complement == FNM_SYNTAXERR)
64 return FNM_SYNTAXERR; 66 return FNM_SYNTAXERR;
65 67
66 enum fnmatch_status status = fnmatch_not_found; 68 status = fnmatch_not_found;
67 size_t pos = 1 + complement; 69 pos = 1 + complement;
68 70
69 do 71 do
70 pos += fnmatch_match_class_token(&status, class + pos, c); 72 pos += fnmatch_match_class_token(&status, class + pos, c);
@@ -136,11 +138,12 @@ size_t
136fnmatch_check_finals(const char *pattern, 138fnmatch_check_finals(const char *pattern,
137 const struct list_of_states *states) 139 const struct list_of_states *states)
138{ 140{
139 for (size_t i = 0; i < states->size; ++i) 141 size_t i, j;
142 for (i = 0; i < states->size; ++i)
140 { 143 {
141 _Bool match = 1; 144 _Bool match = 1;
142 145
143 for (size_t j = states->states[i]; pattern[j]; ++j) 146 for (j = states->states[i]; pattern[j]; ++j)
144 if (pattern[j] != '*') 147 if (pattern[j] != '*')
145 { 148 {
146 match = 0; 149 match = 0;
@@ -158,24 +161,29 @@ fnmatch(const char *pattern,
158 const char *string, 161 const char *string,
159 int flags) 162 int flags)
160{ 163{
164 struct list_of_states *states;
165 struct list_of_states *new_states;
166 _Bool leading = 1;
167 char* c;
168 size_t r;
169
161 assert(pattern); 170 assert(pattern);
162 assert(string); 171 assert(string);
163 172
164 struct list_of_states *states = 173 states = fnmatch_list_of_states_alloc(2, strlen(pattern));
165 fnmatch_list_of_states_alloc(2, strlen(pattern)); 174 new_states = states + 1;
166 struct list_of_states *new_states = states + 1;
167 175
168 if (! states) 176 if (! states)
169 return FNM_NOMEM; 177 return FNM_NOMEM;
170 fnmatch_init_states(states); 178 fnmatch_init_states(states);
171 179
172 _Bool leading = 1;
173 180
174 for (const char* c = string; *c && states->size; ++c) 181 for (c = string; *c && states->size; ++c)
175 { 182 {
183 size_t i;
176 fnmatch_list_of_states_clear(new_states); 184 fnmatch_list_of_states_clear(new_states);
177 185
178 for (size_t i = 0; i < states->size; ++i) 186 for (i = 0; i < states->size; ++i)
179 { 187 {
180 const size_t pos = states->states[i]; 188 const size_t pos = states->states[i];
181 189
@@ -212,7 +220,7 @@ fnmatch(const char *pattern,
212 leading = *c == '/' && (flags & FNM_PATHNAME); 220 leading = *c == '/' && (flags & FNM_PATHNAME);
213 } 221 }
214 222
215 const size_t r = fnmatch_check_finals(pattern, states); 223 r = fnmatch_check_finals(pattern, states);
216 fnmatch_list_of_states_free(states < new_states ? states : new_states, 2); 224 fnmatch_list_of_states_free(states < new_states ? states : new_states, 2);
217 return r; 225 return r;
218} 226}
diff --git a/legacy/evil/win32/common/fnmatch.h b/legacy/evil/win32/common/fnmatch.h
index d44a15467e..ec916faf9b 100644
--- a/legacy/evil/win32/common/fnmatch.h
+++ b/legacy/evil/win32/common/fnmatch.h
@@ -1,5 +1,5 @@
1#ifndef _FNMATCH_H 1#ifndef _FNMATCH_H
2#define _FNMATCH_H 2#define _FNMATCH_H
3 3
4#ifdef EVIL_COMMON_API 4#ifdef EVIL_COMMON_API
5# undef EVIL_COMMON_API 5# undef EVIL_COMMON_API
@@ -37,7 +37,9 @@ extern "C" {
37#endif 37#endif
38 38
39/* Value returned by `fnmatch' if STRING does not match PATTERN. */ 39/* Value returned by `fnmatch' if STRING does not match PATTERN. */
40#define FNM_NOMATCH 1 40#define FNM_NOMATCH 1
41#define FNM_SYNTAXERR 2
42#define FNM_NOMEM 3
41 43
42/* Match STRING against the filename pattern PATTERN, 44/* Match STRING against the filename pattern PATTERN,
43 returning zero if it matches, FNM_NOMATCH if not. */ 45 returning zero if it matches, FNM_NOMATCH if not. */
diff --git a/legacy/evil/win32/common/fnmatch_list_of_states.c b/legacy/evil/win32/common/fnmatch_list_of_states.c
index 3400a9b95f..cfb3fa5911 100644
--- a/legacy/evil/win32/common/fnmatch_list_of_states.c
+++ b/legacy/evil/win32/common/fnmatch_list_of_states.c
@@ -1,7 +1,6 @@
1#include <assert.h> 1#include <assert.h>
2#include <stdlib.h> 2#include <stdlib.h>
3#include <string.h> 3#include <string.h>
4#include <stdint.h>
5 4
6#include "fnmatch_private.h" 5#include "fnmatch_private.h"
7 6
@@ -16,14 +15,14 @@ fnmatch_list_of_states_alloc(size_t n, size_t pattern_len)
16 const size_t states_has_size = states_size + has_size; 15 const size_t states_has_size = states_size + has_size;
17 const size_t struct_size = sizeof (*l) + states_has_size; 16 const size_t struct_size = sizeof (*l) + states_has_size;
18 17
19 uint8_t *states; 18 unsigned char *states;
20 uint8_t *has; 19 unsigned char *has;
21 size_t i; 20 size_t i;
22 21
23 if (! (l = malloc(n * struct_size))) 22 if (! (l = malloc(n * struct_size)))
24 return 0; 23 return 0;
25 24
26 states = (uint8_t *) (l + n); 25 states = (unsigned char *) (l + n);
27 has = states + states_size; 26 has = states + states_size;
28 27
29 for (i = 0; i < n; ++i) 28 for (i = 0; i < n; ++i)
diff --git a/legacy/evil/win32/vs8/evil.sln b/legacy/evil/win32/vs8/evil.sln
index 51f2c99233..578246f5a4 100644
--- a/legacy/evil/win32/vs8/evil.sln
+++ b/legacy/evil/win32/vs8/evil.sln
@@ -4,8 +4,9 @@ Microsoft Visual Studio Solution File, Format Version 9.00
4Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libevil", "libevil.vcproj", "{689B4F2B-666D-439F-9BF3-1203D813DE3F}" 4Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libevil", "libevil.vcproj", "{689B4F2B-666D-439F-9BF3-1203D813DE3F}"
5EndProject 5EndProject
6Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdlfcn", "libdlfcn.vcproj", "{2DAB1902-38E3-4F58-8403-C1BC7C077E1F}" 6Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdlfcn", "libdlfcn.vcproj", "{2DAB1902-38E3-4F58-8403-C1BC7C077E1F}"
7EndProject 7 ProjectSection(ProjectDependencies) = postProject
8Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmman", "libmman.vcproj", "{799E26AA-26BC-4C21-B65F-0DF8F02E8F5F}" 8 {689B4F2B-666D-439F-9BF3-1203D813DE3F} = {689B4F2B-666D-439F-9BF3-1203D813DE3F}
9 EndProjectSection
9EndProject 10EndProject
10Global 11Global
11 GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -21,10 +22,6 @@ Global
21 {2DAB1902-38E3-4F58-8403-C1BC7C077E1F}.Debug|Win32.Build.0 = Debug|Win32 22 {2DAB1902-38E3-4F58-8403-C1BC7C077E1F}.Debug|Win32.Build.0 = Debug|Win32
22 {2DAB1902-38E3-4F58-8403-C1BC7C077E1F}.Release|Win32.ActiveCfg = Release|Win32 23 {2DAB1902-38E3-4F58-8403-C1BC7C077E1F}.Release|Win32.ActiveCfg = Release|Win32
23 {2DAB1902-38E3-4F58-8403-C1BC7C077E1F}.Release|Win32.Build.0 = Release|Win32 24 {2DAB1902-38E3-4F58-8403-C1BC7C077E1F}.Release|Win32.Build.0 = Release|Win32
24 {799E26AA-26BC-4C21-B65F-0DF8F02E8F5F}.Debug|Win32.ActiveCfg = Debug|Win32
25 {799E26AA-26BC-4C21-B65F-0DF8F02E8F5F}.Debug|Win32.Build.0 = Debug|Win32
26 {799E26AA-26BC-4C21-B65F-0DF8F02E8F5F}.Release|Win32.ActiveCfg = Release|Win32
27 {799E26AA-26BC-4C21-B65F-0DF8F02E8F5F}.Release|Win32.Build.0 = Release|Win32
28 EndGlobalSection 25 EndGlobalSection
29 GlobalSection(SolutionProperties) = preSolution 26 GlobalSection(SolutionProperties) = preSolution
30 HideSolutionNode = FALSE 27 HideSolutionNode = FALSE