summaryrefslogtreecommitdiff
path: root/legacy/evil
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2012-01-20 12:44:05 +0000
committerVincent Torri <vincent.torri@gmail.com>2012-01-20 12:44:05 +0000
commit1c6ea6ff651e4179fd057414274a079a57924d6a (patch)
tree17b425680d764469653c3508f1a9abc1e1613463 /legacy/evil
parent9afd5b3f3fdf678c26898b33d03258c3f0f4e023 (diff)
* Makefile.am:
Fix EXTRA_DIST variable * src/bin/Makefile.am: * src/bin/evil_suite.c: * src/lib/evil_libgen.c: * src/lib/evil_util.c: * src/lib/evil_util.h: Add evil_path_is_absolute() API and use it. * src/bin/evil_test_dlfcn.c: * src/bin/evil_test_realpath.c: clean up. SVN revision: 67389
Diffstat (limited to 'legacy/evil')
-rw-r--r--legacy/evil/ChangeLog16
-rw-r--r--legacy/evil/Makefile.am5
-rw-r--r--legacy/evil/src/bin/Makefile.am4
-rw-r--r--legacy/evil/src/bin/evil_suite.c2
-rw-r--r--legacy/evil/src/bin/evil_test_dlfcn.c4
-rw-r--r--legacy/evil/src/bin/evil_test_realpath.c1
-rw-r--r--legacy/evil/src/lib/evil_libgen.c12
-rw-r--r--legacy/evil/src/lib/evil_util.c20
-rw-r--r--legacy/evil/src/lib/evil_util.h22
9 files changed, 71 insertions, 15 deletions
diff --git a/legacy/evil/ChangeLog b/legacy/evil/ChangeLog
index 80857745db..85d9569145 100644
--- a/legacy/evil/ChangeLog
+++ b/legacy/evil/ChangeLog
@@ -1,3 +1,19 @@
12012-01-20 Vincent Torri <doursse at users dot sf dot net>
2
3 * Makefile.am:
4 Fix EXTRA_DIST variable
5
6 * src/bin/Makefile.am:
7 * src/bin/evil_suite.c:
8 * src/lib/evil_libgen.c:
9 * src/lib/evil_util.c:
10 * src/lib/evil_util.h:
11 Add evil_path_is_absolute() API and use it.
12
13 * src/bin/evil_test_dlfcn.c:
14 * src/bin/evil_test_realpath.c:
15 clean up.
16
12011-12-02 Vincent Torri <doursse at users dot sf dot net> 172011-12-02 Vincent Torri <doursse at users dot sf dot net>
2 18
3 Release Version 1.0.0. 19 Release Version 1.0.0.
diff --git a/legacy/evil/Makefile.am b/legacy/evil/Makefile.am
index c4105134b1..6e86f8a3c9 100644
--- a/legacy/evil/Makefile.am
+++ b/legacy/evil/Makefile.am
@@ -29,7 +29,10 @@ EXTRA_DIST = \
29COPYING \ 29COPYING \
30COPYING-PLAIN \ 30COPYING-PLAIN \
31autogen.sh \ 31autogen.sh \
32evil.pc.in 32evil.pc.in \
33m4/common/efl_attribute.m4 \
34m4/common/efl_doxygen.m4 \
35m4/evil/evil_windows.m4
33 36
34pkgconfigdir = $(libdir)/pkgconfig 37pkgconfigdir = $(libdir)/pkgconfig
35pkgconfig_DATA = evil.pc 38pkgconfig_DATA = evil.pc
diff --git a/legacy/evil/src/bin/Makefile.am b/legacy/evil/src/bin/Makefile.am
index 9b974dc41b..f466365c94 100644
--- a/legacy/evil/src/bin/Makefile.am
+++ b/legacy/evil/src/bin/Makefile.am
@@ -22,6 +22,7 @@ evil_test_memcpy.c \
22evil_test_mkstemp.c \ 22evil_test_mkstemp.c \
23evil_test_pipe.c \ 23evil_test_pipe.c \
24evil_test_realpath.c \ 24evil_test_realpath.c \
25evil_test_util.c \
25evil_suite.h \ 26evil_suite.h \
26evil_test_dlfcn.h \ 27evil_test_dlfcn.h \
27evil_test_environment.h \ 28evil_test_environment.h \
@@ -30,7 +31,8 @@ evil_test_link.h \
30evil_test_memcpy.h \ 31evil_test_memcpy.h \
31evil_test_mkstemp.h \ 32evil_test_mkstemp.h \
32evil_test_pipe.h \ 33evil_test_pipe.h \
33evil_test_realpath.h 34evil_test_realpath.h \
35evil_test_util.h
34 36
35if EVIL_HAVE_WINCE 37if EVIL_HAVE_WINCE
36 38
diff --git a/legacy/evil/src/bin/evil_suite.c b/legacy/evil/src/bin/evil_suite.c
index 1912715dc6..429959c79a 100644
--- a/legacy/evil/src/bin/evil_suite.c
+++ b/legacy/evil/src/bin/evil_suite.c
@@ -19,6 +19,7 @@
19#include "evil_test_mkstemp.h" 19#include "evil_test_mkstemp.h"
20#include "evil_test_pipe.h" 20#include "evil_test_pipe.h"
21#include "evil_test_realpath.h" 21#include "evil_test_realpath.h"
22#include "evil_test_util.h"
22 23
23 24
24typedef int(*function)(suite *s); 25typedef int(*function)(suite *s);
@@ -185,6 +186,7 @@ main(void)
185 { "mkstemp ", test_mkstemp }, 186 { "mkstemp ", test_mkstemp },
186 { "pipe ", test_pipe }, 187 { "pipe ", test_pipe },
187 { "realpath ", test_realpath }, 188 { "realpath ", test_realpath },
189 { "util ", test_util },
188/* { "memcpy ", test_memcpy }, */ 190/* { "memcpy ", test_memcpy }, */
189 { NULL, NULL }, 191 { NULL, NULL },
190 }; 192 };
diff --git a/legacy/evil/src/bin/evil_test_dlfcn.c b/legacy/evil/src/bin/evil_test_dlfcn.c
index 47d999dc90..b84a9eb238 100644
--- a/legacy/evil/src/bin/evil_test_dlfcn.c
+++ b/legacy/evil/src/bin/evil_test_dlfcn.c
@@ -20,7 +20,7 @@ test_dlfcn_test_dlopen(void)
20{ 20{
21 void *handle; 21 void *handle;
22 22
23 handle = dlopen("libevil-0.dll", 0); 23 handle = dlopen("libevil-1.dll", 0);
24 if (!handle) 24 if (!handle)
25 return 0; 25 return 0;
26 26
@@ -37,7 +37,7 @@ test_dlfcn_test_dlsym(void)
37 _evil_init sym_init; 37 _evil_init sym_init;
38 _evil_shutdwon sym_shutdown; 38 _evil_shutdwon sym_shutdown;
39 39
40 handle = dlopen("libevil-0.dll", 0); 40 handle = dlopen("libevil-1.dll", 0);
41 if (!handle) 41 if (!handle)
42 return 0; 42 return 0;
43 43
diff --git a/legacy/evil/src/bin/evil_test_realpath.c b/legacy/evil/src/bin/evil_test_realpath.c
index 0821b904cb..01c390f10e 100644
--- a/legacy/evil/src/bin/evil_test_realpath.c
+++ b/legacy/evil/src/bin/evil_test_realpath.c
@@ -39,6 +39,5 @@ test_realpath_run(suite *s)
39int 39int
40test_realpath(suite *s) 40test_realpath(suite *s)
41{ 41{
42
43 return test_realpath_run(s); 42 return test_realpath_run(s);
44} 43}
diff --git a/legacy/evil/src/lib/evil_libgen.c b/legacy/evil/src/lib/evil_libgen.c
index 3913050237..7e98f74386 100644
--- a/legacy/evil/src/lib/evil_libgen.c
+++ b/legacy/evil/src/lib/evil_libgen.c
@@ -17,11 +17,7 @@ evil_basename(char *path)
17 size_t length; 17 size_t length;
18 18
19 /* path must begin by "?:\" or "?:/" */ 19 /* path must begin by "?:\" or "?:/" */
20 if ((!path) || 20 if ((!path) || !evil_path_is_absolute(path))
21 (strlen(path) <= 3) ||
22 ((path[0] < 'a' || path[0] > 'z') && (path[0] < 'A' || path[0] > 'Z')) ||
23 (path[1] != ':') ||
24 ((path[2] != '/') && (path[2] != '\\')))
25 { 21 {
26 memcpy(_evil_basename_buf, "C:\\", 4); 22 memcpy(_evil_basename_buf, "C:\\", 4);
27 return _evil_basename_buf; 23 return _evil_basename_buf;
@@ -67,11 +63,7 @@ evil_dirname(char *path)
67 size_t length; 63 size_t length;
68 64
69 /* path must begin by "?:\" or "?:/" */ 65 /* path must begin by "?:\" or "?:/" */
70 if ((!path) || 66 if ((!path) || !evil_path_is_absolute(path))
71 (strlen(path) <= 3) ||
72 ((path[0] < 'a' || path[0] > 'z') && (path[0] < 'A' || path[0] > 'Z')) ||
73 (path[1] != ':') ||
74 ((path[2] != '/') && (path[2] != '\\')))
75 { 67 {
76 memcpy(_evil_dirname_buf, "C:\\", 4); 68 memcpy(_evil_dirname_buf, "C:\\", 4);
77 return _evil_dirname_buf; 69 return _evil_dirname_buf;
diff --git a/legacy/evil/src/lib/evil_util.c b/legacy/evil/src/lib/evil_util.c
index cbf204a5e3..891efd27fa 100644
--- a/legacy/evil/src/lib/evil_util.c
+++ b/legacy/evil/src/lib/evil_util.c
@@ -216,3 +216,23 @@ evil_homedir_get(void)
216 return homedir; 216 return homedir;
217#endif /* ! _WIN32_WCE */ 217#endif /* ! _WIN32_WCE */
218} 218}
219
220int
221evil_path_is_absolute(const char *path)
222{
223 size_t length;
224
225 if (!path)
226 return 0;
227
228 length = strlen(path);
229 if (length < 3) return 0;
230
231 if ((((*path >= 'a') && (*path <= 'z')) ||
232 ((*path >= 'A') && (*path <= 'Z'))) &&
233 (path[1] == ':') &&
234 ((path[2] == '/') || (path[2] == '\\')))
235 return 1;
236
237 return 0;
238}
diff --git a/legacy/evil/src/lib/evil_util.h b/legacy/evil/src/lib/evil_util.h
index 0170dd0f2a..c3e9d5eb54 100644
--- a/legacy/evil/src/lib/evil_util.h
+++ b/legacy/evil/src/lib/evil_util.h
@@ -108,5 +108,27 @@ EAPI const char *evil_tmpdir_get(void);
108 */ 108 */
109EAPI const char *evil_homedir_get(void); 109EAPI const char *evil_homedir_get(void);
110 110
111/**
112 * @brief check if the given path is absolute.
113 *
114 * @param path The path to check.
115 * @return 1 if the given path is absolute, 0 otherwise.
116 *
117 * Check if the path @p path is absolute or not. An absolute path must
118 * begin with a letter (upper or lower case), followed by by the char
119 * ':', followed by the char '/' or '\'. If @p path is absolute this
120 * function returns 1, otherwise it returns 0. If @p path is @c NULL,
121 * it returns 0.
122 *
123 * Conformity: Non applicable.
124 *
125 * Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000,
126 * Windows XP, Windows CE.
127 *
128 * @since 1.1
129 *
130 * @ingroup Evil
131 */
132EAPI int evil_path_is_absolute(const char *path);
111 133
112#endif /* __EVIL_UTIL_H__ */ 134#endif /* __EVIL_UTIL_H__ */