forked from enlightenment/efl
* AUTHORS:
mention Tor's contribution * configure.ac: mention m4 directory, check errno header file, add conditionnal when mingw32ce is used, minor formatting * m4/efl_doxygen.m4: fix comments * src/lib/Makefile.am: include fnmatch files only when mingw32ce is used * src/lib/evil_fcntl.c: define correctly _get_osfhandle on mingw32ce * src/lib/evil_pwd.c: fix getpwuid() when cegcc or mingw32ce are used * src/lib/evil_stdlib.c: fix mkstemp() on all Windows platform, guard errno stuff * src/lib/evil_stdlib.h: template -> __template because 'template ' is a c++ keyword. * src/lib/evil_unistd.c: guard errno stuff * src/lib/evil_fnmatch.c: * src/lib/evil_fnmatch_list_of_states.c: * src/lib/evil_fnmatch_private.h: * src/lib/fnmatch.h: added files * win32/common/fnmatch.c: * win32/common/fnmatch.h: * win32/common/fnmatch_list_of_states.c: * win32/common/fnmatch_private.h: removed files SVN revision: 36555
This commit is contained in:
parent
82e185693f
commit
85ffa791af
|
@ -1,4 +1,4 @@
|
||||||
Main Authors:
|
Main Authors:
|
||||||
Vincent Torri <vtorri at univ-evry dot fr>
|
Vincent Torri <vtorri at univ-evry dot fr>
|
||||||
Tor Lillqvist <tml at iki dot fi>
|
Tor Lillqvist <tml at iki dot fi> (pipe function)
|
||||||
ashikase
|
ashikase
|
||||||
|
|
|
@ -1,3 +1,46 @@
|
||||||
|
2008-10-09 Vincent Torri <doursse at users dot sf dot net>
|
||||||
|
|
||||||
|
* AUTHORS:
|
||||||
|
mention Tor's contribution
|
||||||
|
|
||||||
|
* configure.ac:
|
||||||
|
mention m4 directory, check errno header file,
|
||||||
|
add conditionnal when mingw32ce is used, minor
|
||||||
|
formatting
|
||||||
|
|
||||||
|
* m4/efl_doxygen.m4:
|
||||||
|
fix comments
|
||||||
|
|
||||||
|
* src/lib/Makefile.am:
|
||||||
|
include fnmatch files only when mingw32ce is used
|
||||||
|
|
||||||
|
* src/lib/evil_fcntl.c:
|
||||||
|
define correctly _get_osfhandle on mingw32ce
|
||||||
|
|
||||||
|
* src/lib/evil_pwd.c:
|
||||||
|
fix getpwuid() when cegcc or mingw32ce are used
|
||||||
|
|
||||||
|
* src/lib/evil_stdlib.c:
|
||||||
|
fix mkstemp() on all Windows platform, guard errno stuff
|
||||||
|
|
||||||
|
* src/lib/evil_stdlib.h:
|
||||||
|
template -> __template because 'template ' is a c++ keyword.
|
||||||
|
|
||||||
|
* src/lib/evil_unistd.c:
|
||||||
|
guard errno stuff
|
||||||
|
|
||||||
|
* src/lib/evil_fnmatch.c:
|
||||||
|
* src/lib/evil_fnmatch_list_of_states.c:
|
||||||
|
* src/lib/evil_fnmatch_private.h:
|
||||||
|
* src/lib/fnmatch.h:
|
||||||
|
added files
|
||||||
|
|
||||||
|
* win32/common/fnmatch.c:
|
||||||
|
* win32/common/fnmatch.h:
|
||||||
|
* win32/common/fnmatch_list_of_states.c:
|
||||||
|
* win32/common/fnmatch_private.h:
|
||||||
|
removed files
|
||||||
|
|
||||||
2008-10-05 Vincent Torri <doursse at users dot sf dot net>
|
2008-10-05 Vincent Torri <doursse at users dot sf dot net>
|
||||||
|
|
||||||
* m4:
|
* m4:
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
AC_INIT([evil], [0.0.1], [enlightenment-devel@lists.sourceforge.net])
|
AC_INIT([evil], [0.0.1], [enlightenment-devel@lists.sourceforge.net])
|
||||||
AC_PREREQ([2.52])
|
AC_PREREQ([2.52])
|
||||||
AC_CONFIG_SRCDIR([configure.ac])
|
AC_CONFIG_SRCDIR([configure.ac])
|
||||||
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
|
|
||||||
|
@ -36,10 +37,10 @@ case "$host_os" in
|
||||||
mingw | mingw32 | mingw32msvc)
|
mingw | mingw32 | mingw32msvc)
|
||||||
win32_libs="-lole32 -luuid -lws2_32"
|
win32_libs="-lole32 -luuid -lws2_32"
|
||||||
;;
|
;;
|
||||||
cegcc)
|
cegcc*)
|
||||||
win32_libs="-lws2"
|
win32_libs="-lws2"
|
||||||
;;
|
;;
|
||||||
mingw32ce)
|
mingw32ce*)
|
||||||
win32_libs="-lws2"
|
win32_libs="-lws2"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -49,6 +50,7 @@ EFL_CHECK_MPATROL([have_mpatrol="yes"], [have_mpatrol="no"])
|
||||||
|
|
||||||
|
|
||||||
### Checks for header files
|
### Checks for header files
|
||||||
|
AC_CHECK_HEADERS_ONCE([errno.h])
|
||||||
|
|
||||||
|
|
||||||
### Checks for programs
|
### Checks for programs
|
||||||
|
@ -73,13 +75,16 @@ AC_C_CONST
|
||||||
AC_C___ATTRIBUTE__
|
AC_C___ATTRIBUTE__
|
||||||
|
|
||||||
win32_cflags=""
|
win32_cflags=""
|
||||||
|
have_wince="no"
|
||||||
|
have_mingw32ce="no"
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
cegcc)
|
cegcc*)
|
||||||
have_wince="yes"
|
have_wince="yes"
|
||||||
win32_cflags="-mwin32"
|
win32_cflags="-mwin32"
|
||||||
;;
|
;;
|
||||||
mingw32ce)
|
mingw32ce*)
|
||||||
have_wince="yes"
|
have_wince="yes"
|
||||||
|
have_mingw32ce="yes"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
have_wince="no"
|
have_wince="no"
|
||||||
|
@ -92,6 +97,7 @@ if test "x${have_wince}" = "xyes" ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AM_CONDITIONAL(EVIL_HAVE_WINCE, test "x${have_wince}" = "xyes")
|
AM_CONDITIONAL(EVIL_HAVE_WINCE, test "x${have_wince}" = "xyes")
|
||||||
|
AM_CONDITIONAL(EVIL_HAVE_MINGW32CE, test "x${have_mingw32ce}" = "xyes")
|
||||||
|
|
||||||
|
|
||||||
### Checks for linker characteristics
|
### Checks for linker characteristics
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
dnl Configure script for doxygen
|
dnl Copyright (C) 2008 Vincent Torri <vtorri at univ-evry dot fr>
|
||||||
dnl Vincent Torri 2008-08-25
|
dnl That code is public domain and can be freely used or copied.
|
||||||
dnl
|
|
||||||
|
dnl Macro that check if doxygen is available or not.
|
||||||
|
|
||||||
dnl EFL_CHECK_DOXYGEN([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
dnl EFL_CHECK_DOXYGEN([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
|
||||||
dnl Test for the doxygen program, and define DOXYGEN.
|
dnl Test for the doxygen program
|
||||||
|
dnl Defines DOXYGEN
|
||||||
|
dnl Defines the automake conditionnal EFL_BUILD_DOC
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN([EFL_CHECK_DOXYGEN],
|
AC_DEFUN([EFL_CHECK_DOXYGEN],
|
||||||
[
|
[
|
||||||
|
|
|
@ -15,6 +15,12 @@ evil_util.h
|
||||||
|
|
||||||
nobase_include_HEADERS = pwd.h sys/mman.h
|
nobase_include_HEADERS = pwd.h sys/mman.h
|
||||||
|
|
||||||
|
if EVIL_HAVE_MINGW32CE
|
||||||
|
|
||||||
|
nobase_include_HEADERS += fnmatch.h
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
libevil_la_SOURCES = \
|
libevil_la_SOURCES = \
|
||||||
evil.c \
|
evil.c \
|
||||||
evil_fcntl.c \
|
evil_fcntl.c \
|
||||||
|
@ -25,7 +31,13 @@ evil_stdlib.c \
|
||||||
evil_unistd.c \
|
evil_unistd.c \
|
||||||
evil_util.c
|
evil_util.c
|
||||||
|
|
||||||
libevil_la_CPPFLAGS = -DEFL_EVIL_BUILD
|
if EVIL_HAVE_MINGW32CE
|
||||||
|
|
||||||
|
libevil_la_SOURCES += evil_fnmatch.c evil_fnmatch_list_of_states.c
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
libevil_la_CPPFLAGS = -DEFL_EVIL_BUILD -D_WIN32_WCE=0x0420
|
||||||
libevil_la_CFLAGS = @win32_cflags@
|
libevil_la_CFLAGS = @win32_cflags@
|
||||||
libevil_la_LIBADD = @win32_libs@ $(EFL_MPATROL_LIBS)
|
libevil_la_LIBADD = @win32_libs@ $(EFL_MPATROL_LIBS)
|
||||||
libevil_la_LDFLAGS = -no-undefined -Wl,--enable-auto-import -version-info @version_info@
|
libevil_la_LDFLAGS = -no-undefined -Wl,--enable-auto-import -version-info @version_info@
|
||||||
|
|
|
@ -12,12 +12,19 @@
|
||||||
#include "Evil.h"
|
#include "Evil.h"
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__CEGCC__)
|
||||||
|
# define _get_osfhandle get_osfhandle
|
||||||
|
# elif defined (__MINGW32CE__)
|
||||||
|
# define _get_osfhandle(FILEDES) ((HANDLE)FILEDES)
|
||||||
|
#endif /* ! __CEGCC__ && ! __MINGW32CE__ */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* port of fcntl function
|
* port of fcntl function
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CEGCC__
|
#if ! ( defined(__CEGCC__) || defined(__MINGW32CE__) )
|
||||||
|
|
||||||
int fcntl(int fd, int cmd, ...)
|
int fcntl(int fd, int cmd, ...)
|
||||||
{
|
{
|
||||||
|
@ -79,4 +86,4 @@ int fcntl(int fd, int cmd, ...)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ! __CEGCC__ */
|
#endif /* __CEGCC__ || __MINGW32CE__ */
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "fnmatch.h"
|
#include "fnmatch.h"
|
||||||
#include "fnmatch_private.h"
|
#include "evil_fnmatch_private.h"
|
||||||
|
|
||||||
enum fnmatch_status
|
enum fnmatch_status
|
||||||
{
|
{
|
||||||
fnmatch_not_found = 0,
|
fnmatch_not_found = 0,
|
||||||
fnmatch_found = 1,
|
fnmatch_found = 1,
|
||||||
fnmatch_syntax_error = 2
|
fnmatch_syntax_error = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
static
|
static
|
||||||
size_t
|
size_t
|
||||||
|
@ -83,7 +83,8 @@ fnmatch_match_class(const char *class,
|
||||||
|
|
||||||
static
|
static
|
||||||
size_t
|
size_t
|
||||||
fnmatch_chrcasecmp(char a, char b)
|
fnmatch_chrcasecmp(char a,
|
||||||
|
char b)
|
||||||
{
|
{
|
||||||
if ('A' <= a && a <= 'Z')
|
if ('A' <= a && a <= 'Z')
|
||||||
a += 'a' - 'A';
|
a += 'a' - 'A';
|
||||||
|
@ -96,7 +97,7 @@ static
|
||||||
size_t
|
size_t
|
||||||
fnmatch_match_token(const char *token,
|
fnmatch_match_token(const char *token,
|
||||||
char c,
|
char c,
|
||||||
_Bool leading,
|
e_bool leading,
|
||||||
int flags)
|
int flags)
|
||||||
{
|
{
|
||||||
if (*token == '\\' && !(flags & FNM_NOESCAPE))
|
if (*token == '\\' && !(flags & FNM_NOESCAPE))
|
||||||
|
@ -141,7 +142,7 @@ fnmatch_check_finals(const char *pattern,
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
for (i = 0; i < states->size; ++i)
|
for (i = 0; i < states->size; ++i)
|
||||||
{
|
{
|
||||||
_Bool match = 1;
|
e_bool match = 1;
|
||||||
|
|
||||||
for (j = states->states[i]; pattern[j]; ++j)
|
for (j = states->states[i]; pattern[j]; ++j)
|
||||||
if (pattern[j] != '*')
|
if (pattern[j] != '*')
|
||||||
|
@ -163,8 +164,8 @@ fnmatch(const char *pattern,
|
||||||
{
|
{
|
||||||
struct list_of_states *states;
|
struct list_of_states *states;
|
||||||
struct list_of_states *new_states;
|
struct list_of_states *new_states;
|
||||||
_Bool leading = 1;
|
e_bool leading = 1;
|
||||||
char* c;
|
char *c;
|
||||||
size_t r;
|
size_t r;
|
||||||
|
|
||||||
assert(pattern);
|
assert(pattern);
|
|
@ -2,10 +2,11 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "fnmatch_private.h"
|
#include "evil_fnmatch_private.h"
|
||||||
|
|
||||||
struct list_of_states*
|
struct list_of_states*
|
||||||
fnmatch_list_of_states_alloc(size_t n, size_t pattern_len)
|
fnmatch_list_of_states_alloc(size_t n,
|
||||||
|
size_t pattern_len)
|
||||||
{
|
{
|
||||||
struct list_of_states *l;
|
struct list_of_states *l;
|
||||||
|
|
||||||
|
@ -29,7 +30,7 @@ fnmatch_list_of_states_alloc(size_t n, size_t pattern_len)
|
||||||
{
|
{
|
||||||
l[i].reserved = reserved;
|
l[i].reserved = reserved;
|
||||||
l[i].states = (size_t *) states;
|
l[i].states = (size_t *) states;
|
||||||
l[i].has = (_Bool *) has;
|
l[i].has = (e_bool *) has;
|
||||||
states += states_has_size;
|
states += states_has_size;
|
||||||
has += states_has_size;
|
has += states_has_size;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +39,8 @@ fnmatch_list_of_states_alloc(size_t n, size_t pattern_len)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fnmatch_list_of_states_free(struct list_of_states *lists, size_t n)
|
fnmatch_list_of_states_free(struct list_of_states *lists,
|
||||||
|
size_t n)
|
||||||
{
|
{
|
||||||
assert(lists);
|
assert(lists);
|
||||||
|
|
||||||
|
@ -47,7 +49,8 @@ fnmatch_list_of_states_free(struct list_of_states *lists, size_t n)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fnmatch_list_of_states_insert(struct list_of_states *list, size_t state)
|
fnmatch_list_of_states_insert(struct list_of_states *list,
|
||||||
|
size_t state)
|
||||||
{
|
{
|
||||||
assert(list);
|
assert(list);
|
||||||
assert(state < list->reserved);
|
assert(state < list->reserved);
|
|
@ -0,0 +1,24 @@
|
||||||
|
#ifndef __EVIL_FNMATCH_PRIVATE_H__
|
||||||
|
#define __EVIL_FNMATCH_PRIVATE_H__
|
||||||
|
|
||||||
|
|
||||||
|
typedef int e_bool;
|
||||||
|
|
||||||
|
struct list_of_states
|
||||||
|
{
|
||||||
|
size_t reserved;
|
||||||
|
size_t size;
|
||||||
|
size_t *states;
|
||||||
|
e_bool *has;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct list_of_states *fnmatch_list_of_states_alloc(size_t n, size_t pattern_len);
|
||||||
|
|
||||||
|
void fnmatch_list_of_states_free(struct list_of_states *lists, size_t n);
|
||||||
|
|
||||||
|
void fnmatch_list_of_states_insert(struct list_of_states *list, size_t state);
|
||||||
|
|
||||||
|
void fnmatch_list_of_states_clear(struct list_of_states *list);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __EVIL_FNMATCH_PRIVATE_H__ */
|
|
@ -4,6 +4,10 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif /* HAVE_CONFIG_H */
|
#endif /* HAVE_CONFIG_H */
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
#include <security.h>
|
||||||
|
|
||||||
|
#include "Evil.h"
|
||||||
#include "pwd.h"
|
#include "pwd.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,12 +20,35 @@ struct passwd *
|
||||||
getpwuid (uid_t uid)
|
getpwuid (uid_t uid)
|
||||||
{
|
{
|
||||||
static char user_name[PATH_MAX];
|
static char user_name[PATH_MAX];
|
||||||
DWORD length;
|
TCHAR name[PATH_MAX];
|
||||||
BOOL res;
|
ULONG length;
|
||||||
|
BOOLEAN res;
|
||||||
|
#ifdef UNICODE
|
||||||
|
char *a_name;
|
||||||
|
# endif /* UNICODE */
|
||||||
|
|
||||||
length = PATH_MAX;
|
length = PATH_MAX;
|
||||||
/* get from USERPROFILE for win 98 ? */
|
/* get from USERPROFILE for win 98 ? */
|
||||||
res = GetUserName(user_name, &length);
|
res = GetUserNameEx(NameUnknown, name, &length);
|
||||||
|
#ifdef UNICODE
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
a_name = evil_wchar_to_char(name);
|
||||||
|
if (a_name)
|
||||||
|
{
|
||||||
|
int length;
|
||||||
|
|
||||||
|
length = strlen(a_name);
|
||||||
|
if (length >= PATH_MAX)
|
||||||
|
length = PATH_MAX;
|
||||||
|
memcpy(user_name, a_name, length);
|
||||||
|
user_name[length] = '\0';
|
||||||
|
free(a_name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
res = 0;
|
||||||
|
}
|
||||||
|
#endif /* UNICODE */
|
||||||
pw.pw_name = (res ? user_name : NULL);
|
pw.pw_name = (res ? user_name : NULL);
|
||||||
pw.pw_passwd = NULL;
|
pw.pw_passwd = NULL;
|
||||||
pw.pw_uid = uid;
|
pw.pw_uid = uid;
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif /* HAVE_CONFIG_H */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#ifndef __CEGCC__
|
#ifndef __CEGCC__
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
#endif /* ! __CEGCC__ */
|
#endif /* ! __CEGCC__ */
|
||||||
#ifndef __MINGW32CE__
|
#ifdef HAVE_ERRNO_H
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#endif /* ! __MINGW32CE__ */
|
#endif /* HAVE_ERRNO_H */
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif /* HAVE_CONFIG_H */
|
|
||||||
|
|
||||||
#include "Evil.h"
|
#include "Evil.h"
|
||||||
|
|
||||||
/*** Local ***/
|
/*** Local ***/
|
||||||
|
@ -137,7 +137,9 @@ setenv(const char *name,
|
||||||
/* if '=' is found, return EINVAL */
|
/* if '=' is found, return EINVAL */
|
||||||
if (strchr (name, '='))
|
if (strchr (name, '='))
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_ERRNO_H
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
|
#endif /* HAVE_ERRNO_H */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +152,9 @@ setenv(const char *name,
|
||||||
str = (char *)malloc(length);
|
str = (char *)malloc(length);
|
||||||
if (!str)
|
if (!str)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_ERRNO_H
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
|
#endif /* HAVE_ERRNO_H */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!value)
|
if (!value)
|
||||||
|
@ -230,22 +234,65 @@ unsetenv(const char *name)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __CEGCC__
|
|
||||||
|
|
||||||
int
|
int
|
||||||
mkstemp(char *template)
|
mkstemp(char *template)
|
||||||
{
|
{
|
||||||
|
const char lookup[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||||
|
char *suffix;
|
||||||
|
DWORD val;
|
||||||
|
int length;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (!template)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
length = strlen(template);
|
||||||
|
if ((length < 6) ||
|
||||||
|
(strncmp (template + length - 6, "XXXXXX", 6)))
|
||||||
|
{
|
||||||
|
#ifdef HAVE_ERRNO_H
|
||||||
|
errno = EINVAL;
|
||||||
|
#endif /* HAVE_ERRNO_H */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
suffix = template + length - 6;
|
||||||
|
|
||||||
|
val = GetTickCount();
|
||||||
|
val += GetCurrentProcessId();
|
||||||
|
|
||||||
|
for (i = 0; i < 32768; i++)
|
||||||
|
{
|
||||||
|
DWORD v;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (!_mktemp(template))
|
v = val;
|
||||||
return -1;
|
|
||||||
|
suffix[0] = lookup[v % 62];
|
||||||
|
v /= 62;
|
||||||
|
suffix[1] = lookup[v % 62];
|
||||||
|
v /= 62;
|
||||||
|
suffix[2] = lookup[v % 62];
|
||||||
|
v /= 62;
|
||||||
|
suffix[3] = lookup[v % 62];
|
||||||
|
v /= 62;
|
||||||
|
suffix[4] = lookup[v % 62];
|
||||||
|
v /= 62;
|
||||||
|
suffix[5] = lookup[v % 62];
|
||||||
|
v /= 62;
|
||||||
|
|
||||||
fd = _open(template, _O_RDWR | _O_BINARY | _O_CREAT | _O_EXCL, _S_IREAD | _S_IWRITE);
|
fd = _open(template, _O_RDWR | _O_BINARY | _O_CREAT | _O_EXCL, _S_IREAD | _S_IWRITE);
|
||||||
|
if (fd >= 0)
|
||||||
return fd;
|
return fd;
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* ! __CEGCC__ */
|
val += 7777;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_ERRNO_H
|
||||||
|
errno = EEXIST;
|
||||||
|
#endif /* HAVE_ERRNO_H */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
|
@ -99,11 +99,7 @@ EAPI int unsetenv(const char *name);
|
||||||
* temporary file. Otherwise, it returns -1 and errno is set to the
|
* temporary file. Otherwise, it returns -1 and errno is set to the
|
||||||
* following values:
|
* following values:
|
||||||
* - EINVAL: @p template has an invalid format.
|
* - EINVAL: @p template has an invalid format.
|
||||||
* - EACCESS: Given path is a directory, or file is read-only, but an
|
|
||||||
* open-for-writing operation was attempted.
|
|
||||||
* - EEXISTS: File name already exists.
|
* - EEXISTS: File name already exists.
|
||||||
* - EMFILE: No more file descriptors available.
|
|
||||||
* - ENOENT: File or path not found.
|
|
||||||
*
|
*
|
||||||
* Conformity: Should follow BSD conformity.
|
* Conformity: Should follow BSD conformity.
|
||||||
*
|
*
|
||||||
|
@ -112,7 +108,7 @@ EAPI int unsetenv(const char *name);
|
||||||
*
|
*
|
||||||
* @ingroup Evil
|
* @ingroup Evil
|
||||||
*/
|
*/
|
||||||
EAPI int mkstemp(char *template);
|
EAPI int mkstemp(char *__template);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return an absolute or full path name for a specified relative path name.
|
* @brief Return an absolute or full path name for a specified relative path name.
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif /* HAVE_CONFIG_H */
|
||||||
|
|
||||||
|
#ifdef HAVE_ERRNO_H
|
||||||
|
#include <errno.h>
|
||||||
|
#endif /* HAVE_ERRNO_H */
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
|
@ -6,13 +15,8 @@
|
||||||
(defined(__MINGW32__) && ! defined(__MINGW32CE__))
|
(defined(__MINGW32__) && ! defined(__MINGW32CE__))
|
||||||
# include <shlobj.h>
|
# include <shlobj.h>
|
||||||
# include <objidl.h>
|
# include <objidl.h>
|
||||||
# include <errno.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif /* HAVE_CONFIG_H */
|
|
||||||
|
|
||||||
#include "Evil.h"
|
#include "Evil.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -87,7 +91,9 @@ symlink(const char *oldpath, const char *newpath)
|
||||||
if (FAILED(res))
|
if (FAILED(res))
|
||||||
{
|
{
|
||||||
if (res == E_OUTOFMEMORY)
|
if (res == E_OUTOFMEMORY)
|
||||||
|
#ifdef HAVE_ERRNO_H
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
|
#endif /* HAVE_ERRNO_H */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +190,9 @@ readlink(const char *path, char *buf, size_t bufsiz)
|
||||||
if (FAILED(res))
|
if (FAILED(res))
|
||||||
{
|
{
|
||||||
if (res == E_OUTOFMEMORY)
|
if (res == E_OUTOFMEMORY)
|
||||||
|
#ifdef HAVE_ERRNO_H
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
|
#endif /* HAVE_ERRNO_H */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,21 @@
|
||||||
#ifndef _FNMATCH_H
|
#ifndef _FNMATCH_H
|
||||||
#define _FNMATCH_H
|
#define _FNMATCH_H
|
||||||
|
|
||||||
#ifdef EVIL_COMMON_API
|
#ifdef EAPI
|
||||||
# undef EVIL_COMMON_API
|
# undef EAPI
|
||||||
#endif /* EVIL_COMMON_API */
|
#endif /* EAPI */
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
# ifdef EFL_EVIL_BUILD
|
# ifdef EFL_EVIL_BUILD
|
||||||
# ifdef DLL_EXPORT
|
# ifdef DLL_EXPORT
|
||||||
# define EVIL_COMMON_API __declspec(dllexport)
|
# define EAPI __declspec(dllexport)
|
||||||
# else
|
# else
|
||||||
# define EVIL_COMMON_API
|
# define EAPI
|
||||||
# endif /* ! DLL_EXPORT */
|
# endif /* ! DLL_EXPORT */
|
||||||
# else
|
# else
|
||||||
# define EVIL_COMMON_API __declspec(dllimport)
|
# define EAPI __declspec(dllimport)
|
||||||
# endif /* ! EFL_EVIL_BUILD */
|
# endif /* ! EFL_EVIL_BUILD */
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -43,7 +45,7 @@ extern "C" {
|
||||||
|
|
||||||
/* Match STRING against the filename pattern PATTERN,
|
/* Match STRING against the filename pattern PATTERN,
|
||||||
returning zero if it matches, FNM_NOMATCH if not. */
|
returning zero if it matches, FNM_NOMATCH if not. */
|
||||||
EVIL_COMMON_API int fnmatch(const char *__pattern, const char *__string, int __flags);
|
EAPI int fnmatch(const char *__pattern, const char *__string, int __flags);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
|
@ -1,28 +0,0 @@
|
||||||
#ifndef FNMATCH_PRIVATE_H_
|
|
||||||
# define FNMATCH_PRIVATE_H_
|
|
||||||
|
|
||||||
# include <stddef.h>
|
|
||||||
|
|
||||||
typedef int _Bool;
|
|
||||||
|
|
||||||
struct list_of_states
|
|
||||||
{
|
|
||||||
size_t reserved;
|
|
||||||
size_t size;
|
|
||||||
size_t *states;
|
|
||||||
_Bool *has;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct list_of_states*
|
|
||||||
fnmatch_list_of_states_alloc(size_t n, size_t pattern_len);
|
|
||||||
|
|
||||||
void
|
|
||||||
fnmatch_list_of_states_free(struct list_of_states *lists, size_t n);
|
|
||||||
|
|
||||||
void
|
|
||||||
fnmatch_list_of_states_insert(struct list_of_states *list, size_t state);
|
|
||||||
|
|
||||||
void
|
|
||||||
fnmatch_list_of_states_clear(struct list_of_states *list);
|
|
||||||
|
|
||||||
#endif // ! FNMATCH_PRIVATE_H_
|
|
Loading…
Reference in New Issue