added qse_httpd_entaskdir()
This commit is contained in:
@ -34,9 +34,7 @@
|
||||
# include <dos.h>
|
||||
# include <errno.h>
|
||||
#else
|
||||
# include <dirent.h>
|
||||
# include <sys/stat.h>
|
||||
# include <unistd.h>
|
||||
# include "syscall.h"
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
||||
@ -326,40 +324,41 @@ static int get_next_segment (glob_t* g, segment_t* seg)
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
struct DIR
|
||||
struct qse_dir_t
|
||||
{
|
||||
HANDLE h;
|
||||
WIN32_FIND_DATA wfd;
|
||||
int done;
|
||||
};
|
||||
typedef struct DIR DIR;
|
||||
typedef struct qse_dir_t qse_dir_t;
|
||||
|
||||
#elif defined(__OS2__)
|
||||
|
||||
struct DIR
|
||||
struct qse_dir_t
|
||||
{
|
||||
HDIR h;
|
||||
FILEFINDBUF3L ffb;
|
||||
ULONG count;
|
||||
};
|
||||
typedef struct DIR DIR;
|
||||
typedef struct qse_dir_t qse_dir_t;
|
||||
|
||||
#elif defined(__DOS__)
|
||||
struct DIR
|
||||
|
||||
struct qse_dir_t
|
||||
{
|
||||
struct find_t f;
|
||||
int done;
|
||||
};
|
||||
typedef struct DIR DIR;
|
||||
typedef struct qse_dir_t qse_dir_t;
|
||||
|
||||
#endif
|
||||
|
||||
static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
||||
static qse_dir_t* xopendir (glob_t* g, const qse_cstr_t* path)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
DIR* dp;
|
||||
qse_dir_t* dp;
|
||||
|
||||
dp = QSE_MMGR_ALLOC (g->mmgr, QSE_SIZEOF(*dp));
|
||||
if (dp == QSE_NULL) return QSE_NULL;
|
||||
@ -400,7 +399,7 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
||||
#elif defined(__OS2__)
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
DIR* dp;
|
||||
qse_dir_t* dp;
|
||||
APIRET rc;
|
||||
qse_mchar_t* mptr;
|
||||
|
||||
@ -463,7 +462,7 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
||||
#elif defined(__DOS__)
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
DIR* dp;
|
||||
qse_dir_t* dp;
|
||||
unsigned int rc;
|
||||
qse_mchar_t* mptr;
|
||||
qse_size_t wl, ml;
|
||||
@ -519,13 +518,12 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
||||
#else
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
return opendir ((path->len <= 0)? QSE_T("."): path->ptr);
|
||||
return QSE_OPENDIR ((path->len <= 0)? QSE_T("."): path->ptr);
|
||||
#else
|
||||
if (path->len <= 0)
|
||||
{
|
||||
return opendir (QSE_MT("."));
|
||||
return QSE_OPENDIR (QSE_MT("."));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -534,7 +532,7 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
||||
mptr = wcs_to_mbuf (g, path->ptr, &g->mbuf);
|
||||
if (mptr == QSE_NULL) return QSE_NULL;
|
||||
|
||||
return opendir (mptr);
|
||||
return QSE_OPENDIR (mptr);
|
||||
}
|
||||
#endif
|
||||
/* ------------------------------------------------------------------- */
|
||||
@ -542,7 +540,7 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int xreaddir (glob_t* g, DIR* dp, qse_str_t* path)
|
||||
static int xreaddir (glob_t* g, qse_dir_t* dp, qse_str_t* path)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
|
||||
@ -615,14 +613,14 @@ static int xreaddir (glob_t* g, DIR* dp, qse_str_t* path)
|
||||
#else
|
||||
|
||||
/* ------------------------------------------------------------------- */
|
||||
struct dirent* de;
|
||||
qse_dirent_t* de;
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
/* nothing */
|
||||
#else
|
||||
qse_size_t ml, wl, tmp;
|
||||
#endif
|
||||
|
||||
de = readdir (dp);
|
||||
de = QSE_READDIR (dp);
|
||||
if (de == NULL) return 0;
|
||||
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
@ -640,7 +638,7 @@ static int xreaddir (glob_t* g, DIR* dp, qse_str_t* path)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void xclosedir (glob_t* g, DIR* dp)
|
||||
static void xclosedir (glob_t* g, qse_dir_t* dp)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
FindClose (dp->h);
|
||||
@ -652,7 +650,7 @@ static void xclosedir (glob_t* g, DIR* dp)
|
||||
_dos_findclose (&dp->f);
|
||||
QSE_MMGR_FREE (g->mmgr, dp);
|
||||
#else
|
||||
closedir (dp);
|
||||
QSE_CLOSEDIR (dp);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -722,7 +720,7 @@ struct stack_node_t
|
||||
{
|
||||
qse_size_t tmp;
|
||||
qse_size_t tmp2;
|
||||
DIR* dp;
|
||||
qse_dir_t* dp;
|
||||
segment_t seg;
|
||||
|
||||
stack_node_t* next;
|
||||
@ -731,7 +729,7 @@ struct stack_node_t
|
||||
|
||||
static int search (glob_t* g, segment_t* seg)
|
||||
{
|
||||
DIR* dp;
|
||||
qse_dir_t* dp;
|
||||
qse_size_t tmp, tmp2;
|
||||
|
||||
#if defined(NO_RECURSION)
|
||||
|
@ -23,39 +23,42 @@
|
||||
|
||||
/* This file defines unix/linux system calls */
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#if defined(HAVE_SYS_TYPES_H)
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#if defined(HAVE_UNISTD_H)
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
#if defined(HAVE_SYS_WAIT_H)
|
||||
# include <sys/wait.h>
|
||||
#endif
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#if defined(HAVE_SIGNAL_H)
|
||||
# include <signal.h>
|
||||
#endif
|
||||
#ifdef HAVE_ERRNO_H
|
||||
#if defined(HAVE_ERRNO_H)
|
||||
# include <errno.h>
|
||||
#endif
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#if defined(HAVE_FCNTL_H)
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
#ifdef HAVE_TIME_H
|
||||
#if defined(HAVE_TIME_H)
|
||||
# include <time.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#if defined(HAVE_SYS_TIME_H)
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
#ifdef HAVE_UTIME_H
|
||||
#if defined(HAVE_UTIME_H)
|
||||
# include <utime.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
#if defined(HAVE_SYS_RESOURCE_H)
|
||||
# include <sys/resource.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#if defined(HAVE_SYS_STAT_H)
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
#if defined(HAVE_DIRENT_H)
|
||||
# include <dirent.h>
|
||||
#endif
|
||||
|
||||
#if defined(QSE_USE_SYSCALL) && defined(HAVE_SYS_SYSCALL_H)
|
||||
# include <sys/syscall.h>
|
||||
@ -355,6 +358,19 @@
|
||||
# define QSE_UTIMES(path,t) utimes(path,t)
|
||||
#endif
|
||||
|
||||
/* ===== DIRECTORY - not really system calls ===== */
|
||||
typedef DIR qse_dir_t;
|
||||
#define QSE_OPENDIR(name) opendir(name)
|
||||
#define QSE_CLOSEDIR(name) closedir(name)
|
||||
|
||||
#if defined(HAVE_READDIR64)
|
||||
typedef struct dirent64 qse_dirent_t;
|
||||
# define QSE_READDIR(x) readdir64(x)
|
||||
#else
|
||||
typedef struct dirent qse_dirent_t;
|
||||
# define QSE_READDIR(x) readdir(x)
|
||||
#endif
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
#if defined(__linux) && defined(__GNUC__) && defined(__x86_64)
|
||||
|
Reference in New Issue
Block a user