diff options
Diffstat (limited to '')
-rw-r--r-- | src/Makefile_Evil.am | 1 | ||||
-rw-r--r-- | src/bin/edje/edje_cc_out.c | 1 | ||||
-rw-r--r-- | src/lib/ecore_con/ecore_con_local.c | 1 | ||||
-rw-r--r-- | src/lib/ecore_con/ecore_con_url.c | 1 | ||||
-rw-r--r-- | src/lib/ecore_file/ecore_file.c | 7 | ||||
-rw-r--r-- | src/lib/eio/eio_model.c | 1 | ||||
-rw-r--r-- | src/lib/evil/evil_libgen.c | 100 | ||||
-rw-r--r-- | src/lib/evil/evil_libgen.h | 89 | ||||
-rw-r--r-- | src/tests/elementary/elm_code_file_test_load.c | 2 | ||||
-rw-r--r-- | src/tests/evil/evil_suite.c | 1 | ||||
-rw-r--r-- | src/tests/evil/evil_suite.h | 1 |
11 files changed, 11 insertions, 194 deletions
diff --git a/src/Makefile_Evil.am b/src/Makefile_Evil.am index f93b226f9c..39baaef671 100644 --- a/src/Makefile_Evil.am +++ b/src/Makefile_Evil.am | |||
@@ -126,6 +126,7 @@ tests_evil_evil_suite_SOURCES = \ | |||
126 | tests/evil/evil_suite.c \ | 126 | tests/evil/evil_suite.c \ |
127 | tests/evil/evil_suite.h \ | 127 | tests/evil/evil_suite.h \ |
128 | tests/evil/evil_test_dlfcn.c \ | 128 | tests/evil/evil_test_dlfcn.c \ |
129 | tests/evil/evil_test_libgen.c \ | ||
129 | tests/evil/evil_test_main.c \ | 130 | tests/evil/evil_test_main.c \ |
130 | tests/evil/evil_test_stdio.c \ | 131 | tests/evil/evil_test_stdio.c \ |
131 | tests/evil/evil_test_stdlib.c | 132 | tests/evil/evil_test_stdlib.c |
diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c index da36943c4c..63d5a61dd8 100644 --- a/src/bin/edje/edje_cc_out.c +++ b/src/bin/edje/edje_cc_out.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <limits.h> | 15 | #include <limits.h> |
16 | #include <unistd.h> | 16 | #include <unistd.h> |
17 | #include <sys/stat.h> | 17 | #include <sys/stat.h> |
18 | #include <libgen.h> | ||
18 | 19 | ||
19 | #include <Ecore_Evas.h> | 20 | #include <Ecore_Evas.h> |
20 | 21 | ||
diff --git a/src/lib/ecore_con/ecore_con_local.c b/src/lib/ecore_con/ecore_con_local.c index 2e83774ec1..874fd7b2c7 100644 --- a/src/lib/ecore_con/ecore_con_local.c +++ b/src/lib/ecore_con/ecore_con_local.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <sys/types.h> | 11 | #include <sys/types.h> |
12 | #include <sys/stat.h> | 12 | #include <sys/stat.h> |
13 | #include <pwd.h> | 13 | #include <pwd.h> |
14 | #include <libgen.h> | ||
14 | 15 | ||
15 | #ifdef HAVE_SYSTEMD | 16 | #ifdef HAVE_SYSTEMD |
16 | # include <systemd/sd-daemon.h> | 17 | # include <systemd/sd-daemon.h> |
diff --git a/src/lib/ecore_con/ecore_con_url.c b/src/lib/ecore_con/ecore_con_url.c index 39412d7f83..a05866f750 100644 --- a/src/lib/ecore_con/ecore_con_url.c +++ b/src/lib/ecore_con/ecore_con_url.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <sys/types.h> | 17 | #include <sys/types.h> |
18 | #include <unistd.h> | 18 | #include <unistd.h> |
19 | #include <fcntl.h> | 19 | #include <fcntl.h> |
20 | #include <libgen.h> | ||
20 | 21 | ||
21 | #include "Ecore.h" | 22 | #include "Ecore.h" |
22 | #include "ecore_private.h" | 23 | #include "ecore_private.h" |
diff --git a/src/lib/ecore_file/ecore_file.c b/src/lib/ecore_file/ecore_file.c index 14c1934853..15d96edb6e 100644 --- a/src/lib/ecore_file/ecore_file.c +++ b/src/lib/ecore_file/ecore_file.c | |||
@@ -5,11 +5,8 @@ | |||
5 | #include <stdlib.h> | 5 | #include <stdlib.h> |
6 | #include <stdio.h> | 6 | #include <stdio.h> |
7 | #include <string.h> | 7 | #include <string.h> |
8 | 8 | #include <unistd.h> | |
9 | #ifndef _MSC_VER | 9 | #include <libgen.h> |
10 | # include <unistd.h> | ||
11 | # include <libgen.h> | ||
12 | #endif | ||
13 | 10 | ||
14 | #ifdef _WIN32 | 11 | #ifdef _WIN32 |
15 | # include <direct.h> | 12 | # include <direct.h> |
diff --git a/src/lib/eio/eio_model.c b/src/lib/eio/eio_model.c index e9b6bfb85a..5ab4deb86f 100644 --- a/src/lib/eio/eio_model.c +++ b/src/lib/eio/eio_model.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | #include <stdint.h> | 5 | #include <stdint.h> |
6 | #include <libgen.h> | ||
6 | 7 | ||
7 | #include <Efl.h> | 8 | #include <Efl.h> |
8 | #include <Eina.h> | 9 | #include <Eina.h> |
diff --git a/src/lib/evil/evil_libgen.c b/src/lib/evil/evil_libgen.c deleted file mode 100644 index d96ba5bae8..0000000000 --- a/src/lib/evil/evil_libgen.c +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include "config.h" | ||
3 | #endif /* HAVE_CONFIG_H */ | ||
4 | |||
5 | #include <string.h> | ||
6 | |||
7 | #include "evil_macro.h" | ||
8 | #include "evil_libgen.h" | ||
9 | |||
10 | char _evil_basename_buf[PATH_MAX]; | ||
11 | char _evil_dirname_buf[PATH_MAX]; | ||
12 | |||
13 | char * | ||
14 | evil_basename(char *path) | ||
15 | { | ||
16 | char *p1; | ||
17 | char *p2; | ||
18 | size_t length; | ||
19 | |||
20 | /* path must begin by "?:\" or "?:/" */ | ||
21 | if ((!path) || !evil_path_is_absolute(path)) | ||
22 | { | ||
23 | memcpy(_evil_basename_buf, "C:\\", 4); | ||
24 | return _evil_basename_buf; | ||
25 | } | ||
26 | |||
27 | /* '/' --> '\\' */ | ||
28 | length = strlen(path); | ||
29 | p1 = strdup(path); | ||
30 | if (!p1) | ||
31 | { | ||
32 | memcpy(_evil_basename_buf, "C:\\", 4); | ||
33 | return _evil_basename_buf; | ||
34 | } | ||
35 | |||
36 | EVIL_PATH_SEP_UNIX_TO_WIN32(p1); | ||
37 | |||
38 | /* remove trailing backslashes */ | ||
39 | p2 = p1 + (length - 1); | ||
40 | if (*p2 == '\\') | ||
41 | { | ||
42 | while (*p2 == '\\') | ||
43 | p2--; | ||
44 | } | ||
45 | *(p2 + 1) = '\0'; | ||
46 | |||
47 | p2 = strrchr(p1, '\\'); | ||
48 | memcpy(_evil_basename_buf, p2 + 1, (p1 + length + 1) - p2); | ||
49 | |||
50 | free(p1); | ||
51 | |||
52 | return _evil_basename_buf; | ||
53 | } | ||
54 | |||
55 | char * | ||
56 | evil_dirname(char *path) | ||
57 | { | ||
58 | char *p1; | ||
59 | char *p2; | ||
60 | size_t length; | ||
61 | |||
62 | /* path must begin by "?:\" or "?:/" */ | ||
63 | if ((!path) || !evil_path_is_absolute(path)) | ||
64 | { | ||
65 | memcpy(_evil_dirname_buf, "C:\\", 4); | ||
66 | return _evil_dirname_buf; | ||
67 | } | ||
68 | |||
69 | /* '/' --> '\\' */ | ||
70 | length = strlen(path); | ||
71 | p1 = strdup(path); | ||
72 | if (!p1) | ||
73 | { | ||
74 | memcpy(_evil_dirname_buf, "C:\\", 4); | ||
75 | return _evil_dirname_buf; | ||
76 | } | ||
77 | p2 = p1; | ||
78 | while (*p2) | ||
79 | { | ||
80 | if (*p2 == '/') *p2 = '\\'; | ||
81 | p2++; | ||
82 | } | ||
83 | |||
84 | /* remove trailing backslashes */ | ||
85 | p2 = p1 + (length - 1); | ||
86 | if (*p2 == '\\') | ||
87 | { | ||
88 | while (*p2 == '\\') | ||
89 | p2--; | ||
90 | } | ||
91 | *(p2 + 1) = '\0'; | ||
92 | |||
93 | p2 = strrchr(p1, '\\'); | ||
94 | *p2 = '\0'; | ||
95 | memcpy(_evil_dirname_buf, p1, strlen(p1) + 1); | ||
96 | |||
97 | free(p1); | ||
98 | |||
99 | return _evil_dirname_buf; | ||
100 | } | ||
diff --git a/src/lib/evil/evil_libgen.h b/src/lib/evil/evil_libgen.h deleted file mode 100644 index b832d620ed..0000000000 --- a/src/lib/evil/evil_libgen.h +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | #ifndef __EVIL_LIBGEN_H__ | ||
2 | #define __EVIL_LIBGEN_H__ | ||
3 | |||
4 | |||
5 | /** | ||
6 | * @file evil_libgen.h | ||
7 | * @brief The file that provides functions ported from Unix in libgen.h. | ||
8 | * @defgroup Evil_Libgen_Group Libgen.h functions. | ||
9 | * @ingroup Evil | ||
10 | * | ||
11 | * This header provides functions ported from Unix in libgen.h. | ||
12 | * | ||
13 | * @{ | ||
14 | */ | ||
15 | |||
16 | /** | ||
17 | * @brief Parse the base name component of a path. | ||
18 | * | ||
19 | * @param path The path to parse. | ||
20 | * @return The component following the final '/'. | ||
21 | * | ||
22 | * This function parses @p path and returns its component following | ||
23 | * the final '\'. Trailing '\' are not taken into account. On Windows | ||
24 | * XP, @p path must beginning by a drive letter followed by ':/' or | ||
25 | * ':\', otherwise "C:\" is returned. All characters '/' are replaced by '\'. On | ||
26 | * error (memory allocation failure), "C:\" is returned, otherwise the | ||
27 | * component following the final '\' is returned as a statically | ||
28 | * allocated memory. Hence the returns value must not be freed. | ||
29 | * | ||
30 | * Concatenating the string returned by dirname(), a "\", and the | ||
31 | * string returned by basename() yields a complete pathname. | ||
32 | * | ||
33 | * @see evil_dirname() | ||
34 | * @see dirname() | ||
35 | * | ||
36 | * Conformity: Non applicable. | ||
37 | * | ||
38 | * Supported OS: Windows XP. | ||
39 | */ | ||
40 | EAPI char *evil_basename(char *path); | ||
41 | |||
42 | /** | ||
43 | * @def basename(p) | ||
44 | * | ||
45 | * Wrapper around evil_basename(). | ||
46 | */ | ||
47 | #define basename(p) evil_basename(p) | ||
48 | |||
49 | /** | ||
50 | * @brief Parse the dir name component of a path. | ||
51 | * | ||
52 | * @param path The path to parse. | ||
53 | * @return The component up to, but not including, the final '/'. | ||
54 | * | ||
55 | * This function parses @p path and returns its component up to, but | ||
56 | * not including, the final '/'. Trailing '\' are not taken into | ||
57 | * account. On Windows XP, @p path must beginning by a drive letter | ||
58 | * followed by ':/' or ':\', otherwise "C:\" is returned. All | ||
59 | * characters '/' are replaced by '\'. On error (memory allocation | ||
60 | * failure), "C:\" is returned, otherwise, the component up to, but | ||
61 | * not including, the final '/' is returned as a statically allocated | ||
62 | * memory. Hence the returns value must not be freed. | ||
63 | * | ||
64 | * Concatenating the string returned by dirname(), a "\", and the | ||
65 | * string returned by basename() yields a complete pathname. | ||
66 | * | ||
67 | * @see evil_basename() | ||
68 | * @see basename() | ||
69 | * | ||
70 | * Conformity: Non applicable. | ||
71 | * | ||
72 | * Supported OS: Windows XP. | ||
73 | */ | ||
74 | EAPI char *evil_dirname(char *path); | ||
75 | |||
76 | /** | ||
77 | * @def dirname(p) | ||
78 | * | ||
79 | * Wrapper around evil_dirname(). | ||
80 | */ | ||
81 | #define dirname(p) evil_dirname(p) | ||
82 | |||
83 | |||
84 | /** | ||
85 | * @} | ||
86 | */ | ||
87 | |||
88 | |||
89 | #endif /* __EVIL_LIBGEN_H__ */ | ||
diff --git a/src/tests/elementary/elm_code_file_test_load.c b/src/tests/elementary/elm_code_file_test_load.c index 30cd30e534..b731f66b0d 100644 --- a/src/tests/elementary/elm_code_file_test_load.c +++ b/src/tests/elementary/elm_code_file_test_load.c | |||
@@ -2,6 +2,8 @@ | |||
2 | # include "elementary_config.h" | 2 | # include "elementary_config.h" |
3 | #endif | 3 | #endif |
4 | 4 | ||
5 | #include <libgen.h> | ||
6 | |||
5 | #define ELM_INTERNAL_API_ARGESFSDFEFC | 7 | #define ELM_INTERNAL_API_ARGESFSDFEFC |
6 | 8 | ||
7 | #include "elm_suite.h" | 9 | #include "elm_suite.h" |
diff --git a/src/tests/evil/evil_suite.c b/src/tests/evil/evil_suite.c index d8fc492a9a..454a217e64 100644 --- a/src/tests/evil/evil_suite.c +++ b/src/tests/evil/evil_suite.c | |||
@@ -34,6 +34,7 @@ static const Efl_Test_Case etc[] = { | |||
34 | /* { "Inet", evil_test_inet }, */ | 34 | /* { "Inet", evil_test_inet }, */ |
35 | /* { "Langinfo", evil_test_langinfo }, */ | 35 | /* { "Langinfo", evil_test_langinfo }, */ |
36 | /* { "Link", evil_test_link }, */ | 36 | /* { "Link", evil_test_link }, */ |
37 | { "Libgen", evil_test_libgen }, | ||
37 | { "Main", evil_test_main }, | 38 | { "Main", evil_test_main }, |
38 | /* { "Mman", evil_test_mman }, */ | 39 | /* { "Mman", evil_test_mman }, */ |
39 | /* { "Pwd", evil_test_pwd }, */ | 40 | /* { "Pwd", evil_test_pwd }, */ |
diff --git a/src/tests/evil/evil_suite.h b/src/tests/evil/evil_suite.h index c7220e0b80..20f8d03a60 100644 --- a/src/tests/evil/evil_suite.h +++ b/src/tests/evil/evil_suite.h | |||
@@ -28,6 +28,7 @@ void evil_test_dlfcn(TCase *tc); | |||
28 | /* void evil_test_inet(TCase *tc); */ | 28 | /* void evil_test_inet(TCase *tc); */ |
29 | /* void evil_test_langinfo(TCase *tc); */ | 29 | /* void evil_test_langinfo(TCase *tc); */ |
30 | /* void evil_test_link(TCase *tc); */ | 30 | /* void evil_test_link(TCase *tc); */ |
31 | void evil_test_libgen(TCase *tc); | ||
31 | void evil_test_main(TCase *tc); | 32 | void evil_test_main(TCase *tc); |
32 | /* void evil_test_mman(TCase *tc); */ | 33 | /* void evil_test_mman(TCase *tc); */ |
33 | /* void evil_test_pwd(TCase *tc); */ | 34 | /* void evil_test_pwd(TCase *tc); */ |