forked from enlightenment/efl
* 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
This commit is contained in:
parent
9afd5b3f3f
commit
1c6ea6ff65
|
@ -1,3 +1,19 @@
|
|||
2012-01-20 Vincent Torri <doursse at users dot sf dot net>
|
||||
|
||||
* 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.
|
||||
|
||||
2011-12-02 Vincent Torri <doursse at users dot sf dot net>
|
||||
|
||||
Release Version 1.0.0.
|
||||
|
|
|
@ -29,7 +29,10 @@ EXTRA_DIST = \
|
|||
COPYING \
|
||||
COPYING-PLAIN \
|
||||
autogen.sh \
|
||||
evil.pc.in
|
||||
evil.pc.in \
|
||||
m4/common/efl_attribute.m4 \
|
||||
m4/common/efl_doxygen.m4 \
|
||||
m4/evil/evil_windows.m4
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = evil.pc
|
||||
|
|
|
@ -22,6 +22,7 @@ evil_test_memcpy.c \
|
|||
evil_test_mkstemp.c \
|
||||
evil_test_pipe.c \
|
||||
evil_test_realpath.c \
|
||||
evil_test_util.c \
|
||||
evil_suite.h \
|
||||
evil_test_dlfcn.h \
|
||||
evil_test_environment.h \
|
||||
|
@ -30,7 +31,8 @@ evil_test_link.h \
|
|||
evil_test_memcpy.h \
|
||||
evil_test_mkstemp.h \
|
||||
evil_test_pipe.h \
|
||||
evil_test_realpath.h
|
||||
evil_test_realpath.h \
|
||||
evil_test_util.h
|
||||
|
||||
if EVIL_HAVE_WINCE
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "evil_test_mkstemp.h"
|
||||
#include "evil_test_pipe.h"
|
||||
#include "evil_test_realpath.h"
|
||||
#include "evil_test_util.h"
|
||||
|
||||
|
||||
typedef int(*function)(suite *s);
|
||||
|
@ -185,6 +186,7 @@ main(void)
|
|||
{ "mkstemp ", test_mkstemp },
|
||||
{ "pipe ", test_pipe },
|
||||
{ "realpath ", test_realpath },
|
||||
{ "util ", test_util },
|
||||
/* { "memcpy ", test_memcpy }, */
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@ test_dlfcn_test_dlopen(void)
|
|||
{
|
||||
void *handle;
|
||||
|
||||
handle = dlopen("libevil-0.dll", 0);
|
||||
handle = dlopen("libevil-1.dll", 0);
|
||||
if (!handle)
|
||||
return 0;
|
||||
|
||||
|
@ -37,7 +37,7 @@ test_dlfcn_test_dlsym(void)
|
|||
_evil_init sym_init;
|
||||
_evil_shutdwon sym_shutdown;
|
||||
|
||||
handle = dlopen("libevil-0.dll", 0);
|
||||
handle = dlopen("libevil-1.dll", 0);
|
||||
if (!handle)
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -39,6 +39,5 @@ test_realpath_run(suite *s)
|
|||
int
|
||||
test_realpath(suite *s)
|
||||
{
|
||||
|
||||
return test_realpath_run(s);
|
||||
}
|
||||
|
|
|
@ -17,11 +17,7 @@ evil_basename(char *path)
|
|||
size_t length;
|
||||
|
||||
/* path must begin by "?:\" or "?:/" */
|
||||
if ((!path) ||
|
||||
(strlen(path) <= 3) ||
|
||||
((path[0] < 'a' || path[0] > 'z') && (path[0] < 'A' || path[0] > 'Z')) ||
|
||||
(path[1] != ':') ||
|
||||
((path[2] != '/') && (path[2] != '\\')))
|
||||
if ((!path) || !evil_path_is_absolute(path))
|
||||
{
|
||||
memcpy(_evil_basename_buf, "C:\\", 4);
|
||||
return _evil_basename_buf;
|
||||
|
@ -67,11 +63,7 @@ evil_dirname(char *path)
|
|||
size_t length;
|
||||
|
||||
/* path must begin by "?:\" or "?:/" */
|
||||
if ((!path) ||
|
||||
(strlen(path) <= 3) ||
|
||||
((path[0] < 'a' || path[0] > 'z') && (path[0] < 'A' || path[0] > 'Z')) ||
|
||||
(path[1] != ':') ||
|
||||
((path[2] != '/') && (path[2] != '\\')))
|
||||
if ((!path) || !evil_path_is_absolute(path))
|
||||
{
|
||||
memcpy(_evil_dirname_buf, "C:\\", 4);
|
||||
return _evil_dirname_buf;
|
||||
|
|
|
@ -216,3 +216,23 @@ evil_homedir_get(void)
|
|||
return homedir;
|
||||
#endif /* ! _WIN32_WCE */
|
||||
}
|
||||
|
||||
int
|
||||
evil_path_is_absolute(const char *path)
|
||||
{
|
||||
size_t length;
|
||||
|
||||
if (!path)
|
||||
return 0;
|
||||
|
||||
length = strlen(path);
|
||||
if (length < 3) return 0;
|
||||
|
||||
if ((((*path >= 'a') && (*path <= 'z')) ||
|
||||
((*path >= 'A') && (*path <= 'Z'))) &&
|
||||
(path[1] == ':') &&
|
||||
((path[2] == '/') || (path[2] == '\\')))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -108,5 +108,27 @@ EAPI const char *evil_tmpdir_get(void);
|
|||
*/
|
||||
EAPI const char *evil_homedir_get(void);
|
||||
|
||||
/**
|
||||
* @brief check if the given path is absolute.
|
||||
*
|
||||
* @param path The path to check.
|
||||
* @return 1 if the given path is absolute, 0 otherwise.
|
||||
*
|
||||
* Check if the path @p path is absolute or not. An absolute path must
|
||||
* begin with a letter (upper or lower case), followed by by the char
|
||||
* ':', followed by the char '/' or '\'. If @p path is absolute this
|
||||
* function returns 1, otherwise it returns 0. If @p path is @c NULL,
|
||||
* it returns 0.
|
||||
*
|
||||
* Conformity: Non applicable.
|
||||
*
|
||||
* Supported OS: Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000,
|
||||
* Windows XP, Windows CE.
|
||||
*
|
||||
* @since 1.1
|
||||
*
|
||||
* @ingroup Evil
|
||||
*/
|
||||
EAPI int evil_path_is_absolute(const char *path);
|
||||
|
||||
#endif /* __EVIL_UTIL_H__ */
|
||||
|
|
Loading…
Reference in New Issue