renamed qse_tmr_remove() to qse_tmr_delete().
removed qse_fs_delete() and added qse_fs_delfile()/qse_fs_deldir() with some new options
This commit is contained in:
parent
8678660b82
commit
7d21e90ce2
@ -51,7 +51,7 @@ POST_UNINSTALL = :
|
|||||||
build_triplet = @build@
|
build_triplet = @build@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
subdir = .
|
subdir = .
|
||||||
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
|
DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
|
||||||
$(srcdir)/Makefile.in $(srcdir)/README.in \
|
$(srcdir)/Makefile.in $(srcdir)/README.in \
|
||||||
$(top_srcdir)/configure ac/config.guess ac/config.sub \
|
$(top_srcdir)/configure ac/config.guess ac/config.sub \
|
||||||
ac/depcomp ac/install-sh ac/ltmain.sh ac/missing
|
ac/depcomp ac/install-sh ac/ltmain.sh ac/missing
|
||||||
|
@ -919,7 +919,7 @@ static int sed_main (int argc, qse_char_t* argv[])
|
|||||||
|
|
||||||
if (tmpl_tmpfile)
|
if (tmpl_tmpfile)
|
||||||
{
|
{
|
||||||
qse_fs_delete (fs, tmpl_tmpfile);
|
qse_fs_delfile (fs, tmpl_tmpfile, 0);
|
||||||
QSE_MMGR_FREE (qse_sed_getmmgr(sed), tmpl_tmpfile);
|
QSE_MMGR_FREE (qse_sed_getmmgr(sed), tmpl_tmpfile);
|
||||||
}
|
}
|
||||||
print_exec_error (sed);
|
print_exec_error (sed);
|
||||||
|
@ -160,7 +160,7 @@ available for the native makefile for Watcom C/C++ for OS/2 only.
|
|||||||
|
|
||||||
- If /usr/include/netinet and /usr/include/net are missing,
|
- If /usr/include/netinet and /usr/include/net are missing,
|
||||||
check if there are /usr/include/sys/netinet and /usr/include/sys/net.
|
check if there are /usr/include/sys/netinet and /usr/include/sys/net.
|
||||||
f they exists, you can make these symbolic links.
|
if they exists, you can make symbolic links.
|
||||||
|
|
||||||
cd /usr/include
|
cd /usr/include
|
||||||
ln -sf sys/netinet netinet
|
ln -sf sys/netinet netinet
|
||||||
@ -173,9 +173,10 @@ available for the native makefile for Watcom C/C++ for OS/2 only.
|
|||||||
for dificiency of the bundled make utility.
|
for dificiency of the bundled make utility.
|
||||||
- Do not include -g in CFLAGS.
|
- Do not include -g in CFLAGS.
|
||||||
|
|
||||||
./configure GREP=/bin/grep RANLIB=/bin/true CFLAGS=""
|
./configure GREP=/bin/grep RANLIB=/bin/true CFLAGS="" RAN
|
||||||
|
|
||||||
- Change RANLIB from "ranlib" to "true" in libltdl/libtool.
|
- Remove $(LIBLTDL) from LIBADD_LIB_COMMON in lib/awk/Makefile
|
||||||
|
- Remove $(LIBLTDL) from libqsehttp_la_LIBADD in lib/http/Makefile
|
||||||
|
|
||||||
make
|
make
|
||||||
|
|
||||||
|
@ -101,6 +101,11 @@ QSE_EXPORT int qse_dir_reset (
|
|||||||
const qse_char_t* path
|
const qse_char_t* path
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_dir_read() function reads a directory entry and
|
||||||
|
* stores it in memory pointed to by \a ent.
|
||||||
|
* \return -1 on failure, 0 upon no more entry, 1 on success
|
||||||
|
*/
|
||||||
QSE_EXPORT int qse_dir_read (
|
QSE_EXPORT int qse_dir_read (
|
||||||
qse_dir_t* dir,
|
qse_dir_t* dir,
|
||||||
qse_dir_ent_t* ent
|
qse_dir_ent_t* ent
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include <qse/types.h>
|
#include <qse/types.h>
|
||||||
#include <qse/macros.h>
|
#include <qse/macros.h>
|
||||||
|
|
||||||
/** @file
|
/** \file
|
||||||
* This file defines data types and functions that you can use to build
|
* This file defines data types and functions that you can use to build
|
||||||
* an environment block.
|
* an environment block.
|
||||||
*/
|
*/
|
||||||
@ -44,9 +44,11 @@
|
|||||||
#if defined(_WIN32) && defined(QSE_CHAR_IS_WCHAR)
|
#if defined(_WIN32) && defined(QSE_CHAR_IS_WCHAR)
|
||||||
typedef qse_wchar_t qse_env_char_t;
|
typedef qse_wchar_t qse_env_char_t;
|
||||||
# define QSE_ENV_CHAR_IS_WCHAR
|
# define QSE_ENV_CHAR_IS_WCHAR
|
||||||
|
# define QSE_SIZEOF_ENV_CHAR_T QSE_SIZEOF_WCHAR_T
|
||||||
#else
|
#else
|
||||||
typedef qse_mchar_t qse_env_char_t;
|
typedef qse_mchar_t qse_env_char_t;
|
||||||
# define QSE_ENV_CHAR_IS_MCHAR
|
# define QSE_ENV_CHAR_IS_MCHAR
|
||||||
|
# define QSE_SIZEOF_ENV_CHAR_T QSE_SIZEOF_MCHAR_T
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -120,10 +122,10 @@ QSE_EXPORT qse_env_char_t** qse_env_getarr (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_env_insertwcs() function adds a new environment variable
|
* The qse_env_insertwcs() function adds a new environment variable
|
||||||
* @a name with the @a value. If the @a value is #QSE_NULL, it takes
|
* \a name with the \a value. If the \a value is #QSE_NULL, it takes
|
||||||
* the actual value from the system environment
|
* the actual value from the system environment
|
||||||
*
|
*
|
||||||
* @return 0 on success, -1 on failure
|
* \return 0 on success, -1 on failure
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT int qse_env_insertwcs (
|
QSE_EXPORT int qse_env_insertwcs (
|
||||||
qse_env_t* env,
|
qse_env_t* env,
|
||||||
|
@ -27,10 +27,26 @@
|
|||||||
#ifndef _QSE_CMN_FS_H_
|
#ifndef _QSE_CMN_FS_H_
|
||||||
#define _QSE_CMN_FS_H_
|
#define _QSE_CMN_FS_H_
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* This file defines data types and functions for manipulating files and
|
||||||
|
* directories on a file system.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <qse/types.h>
|
#include <qse/types.h>
|
||||||
#include <qse/macros.h>
|
#include <qse/macros.h>
|
||||||
#include <qse/cmn/time.h>
|
#include <qse/cmn/time.h>
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(_WIN32) && defined(QSE_CHAR_IS_WCHAR)
|
||||||
|
typedef qse_wchar_t qse_fs_char_t;
|
||||||
|
# define QSE_FS_CHAR_IS_WCHAR
|
||||||
|
# define QSE_SIZEOF_FS_CHAR_T QSE_SIZEOF_WCHAR_T
|
||||||
|
#else
|
||||||
|
typedef qse_mchar_t qse_fs_char_t;
|
||||||
|
# define QSE_FS_CHAR_IS_MCHAR
|
||||||
|
# define QSE_SIZEOF_FS_CHAR_T QSE_SIZEOF_MCHAR_T
|
||||||
|
#endif
|
||||||
|
|
||||||
enum qse_fs_errnum_t
|
enum qse_fs_errnum_t
|
||||||
{
|
{
|
||||||
QSE_FS_ENOERR = 0,
|
QSE_FS_ENOERR = 0,
|
||||||
@ -42,12 +58,14 @@ enum qse_fs_errnum_t
|
|||||||
QSE_FS_ENOMEM, /**< out of memory */
|
QSE_FS_ENOMEM, /**< out of memory */
|
||||||
QSE_FS_EINVAL, /**< invalid parameter */
|
QSE_FS_EINVAL, /**< invalid parameter */
|
||||||
QSE_FS_EACCES, /**< access denied */
|
QSE_FS_EACCES, /**< access denied */
|
||||||
QSE_FS_ENOENT, /**< no such file */
|
QSE_FS_ENOENT, /**< no such file or directory */
|
||||||
QSE_FS_EEXIST, /**< already exist */
|
QSE_FS_EEXIST, /**< already exist */
|
||||||
QSE_FS_EINTR, /**< interrupted */
|
QSE_FS_EINTR, /**< interrupted */
|
||||||
QSE_FS_ENODIR,
|
QSE_FS_EISDIR, /**< is a directory */
|
||||||
QSE_FS_EISDIR,
|
QSE_FS_ENOTDIR, /**< not a directory */
|
||||||
QSE_FS_EXDEV
|
QSE_FS_ENOTVOID, /**< directory not empty */
|
||||||
|
QSE_FS_EXDEV, /**< cross device */
|
||||||
|
QSE_FS_EGLOB /**< glob error */
|
||||||
};
|
};
|
||||||
typedef enum qse_fs_errnum_t qse_fs_errnum_t;
|
typedef enum qse_fs_errnum_t qse_fs_errnum_t;
|
||||||
|
|
||||||
@ -58,6 +76,7 @@ enum qse_fs_ent_flag_t
|
|||||||
QSE_FS_ENT_SIZE = (1 << 2),
|
QSE_FS_ENT_SIZE = (1 << 2),
|
||||||
QSE_FS_ENT_TIME = (1 << 3)
|
QSE_FS_ENT_TIME = (1 << 3)
|
||||||
};
|
};
|
||||||
|
typedef enum qse_fs_ent_flag_t qse_fs_ent_flag_t;
|
||||||
|
|
||||||
enum qse_fs_ent_type_t
|
enum qse_fs_ent_type_t
|
||||||
{
|
{
|
||||||
@ -98,6 +117,8 @@ typedef struct qse_fs_ent_t qse_fs_ent_t;
|
|||||||
struct qse_fs_t
|
struct qse_fs_t
|
||||||
{
|
{
|
||||||
qse_mmgr_t* mmgr;
|
qse_mmgr_t* mmgr;
|
||||||
|
qse_cmgr_t* cmgr; /* for name conversion */
|
||||||
|
|
||||||
qse_fs_errnum_t errnum;
|
qse_fs_errnum_t errnum;
|
||||||
qse_fs_ent_t ent;
|
qse_fs_ent_t ent;
|
||||||
qse_char_t* curdir;
|
qse_char_t* curdir;
|
||||||
@ -114,6 +135,30 @@ enum qse_fs_option_t
|
|||||||
/**< check directories against file system in qse_fs_chdir() */
|
/**< check directories against file system in qse_fs_chdir() */
|
||||||
QSE_FS_REALPATH = (1 << 2)
|
QSE_FS_REALPATH = (1 << 2)
|
||||||
};
|
};
|
||||||
|
typedef enum qse_fs_option_t qse_fs_option_t;
|
||||||
|
|
||||||
|
|
||||||
|
enum qse_fs_delfile_flag_t
|
||||||
|
{
|
||||||
|
QSE_FS_DELFILE_GLOB = (1 << 0),
|
||||||
|
|
||||||
|
QSE_FS_DELFILEMBS_GLOB = QSE_FS_DELFILE_GLOB,
|
||||||
|
QSE_FS_DELFILEWCS_GLOB = QSE_FS_DELFILE_GLOB
|
||||||
|
};
|
||||||
|
typedef enum qse_fs_delfile_flag_t qse_fs_delfile_flag_t;
|
||||||
|
|
||||||
|
enum qse_fs_deldir_flag_t
|
||||||
|
{
|
||||||
|
QSE_FS_DELDIR_GLOB = (1 << 0),
|
||||||
|
QSE_FS_DELDIR_RECURSIVE = (1 << 1),
|
||||||
|
|
||||||
|
QSE_FS_DELDIRMBS_GLOB = QSE_FS_DELDIR_GLOB,
|
||||||
|
QSE_FS_DELDIRMBS_RECURSIVE = QSE_FS_DELDIR_RECURSIVE,
|
||||||
|
|
||||||
|
QSE_FS_DELDIRWCS_GLOB = QSE_FS_DELDIR_GLOB,
|
||||||
|
QSE_FS_DELDIRWCS_RECURSIVE = QSE_FS_DELDIR_RECURSIVE
|
||||||
|
};
|
||||||
|
typedef enum qse_fs_deldir_flag_t qse_fs_deldir_flag_t;
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -175,11 +220,51 @@ QSE_EXPORT int qse_fs_move (
|
|||||||
const qse_char_t* newpath
|
const qse_char_t* newpath
|
||||||
);
|
);
|
||||||
|
|
||||||
QSE_EXPORT int qse_fs_delete (
|
|
||||||
|
QSE_EXPORT int qse_fs_mkdirmbs (
|
||||||
qse_fs_t* fs,
|
qse_fs_t* fs,
|
||||||
const qse_char_t* path
|
const qse_mchar_t* path
|
||||||
);
|
);
|
||||||
|
|
||||||
|
QSE_EXPORT int qse_fs_mkdirwcs (
|
||||||
|
qse_fs_t* fs,
|
||||||
|
const qse_mchar_t* path
|
||||||
|
);
|
||||||
|
|
||||||
|
QSE_EXPORT int qse_fs_delfilembs (
|
||||||
|
qse_fs_t* fs,
|
||||||
|
const qse_mchar_t* path,
|
||||||
|
int flags
|
||||||
|
);
|
||||||
|
|
||||||
|
QSE_EXPORT int qse_fs_delfilewcs (
|
||||||
|
qse_fs_t* fs,
|
||||||
|
const qse_wchar_t* path,
|
||||||
|
int flags
|
||||||
|
);
|
||||||
|
|
||||||
|
QSE_EXPORT int qse_fs_deldirmbs (
|
||||||
|
qse_fs_t* fs,
|
||||||
|
const qse_mchar_t* path,
|
||||||
|
int flags
|
||||||
|
);
|
||||||
|
|
||||||
|
QSE_EXPORT int qse_fs_deldirwcs (
|
||||||
|
qse_fs_t* fs,
|
||||||
|
const qse_wchar_t* path,
|
||||||
|
int flags
|
||||||
|
);
|
||||||
|
|
||||||
|
#if defined(QSE_CHAR_IS_MCHAR)
|
||||||
|
# define qse_fs_mkdir(fs,path) qse_fs_mkdirmbs(fs,path)
|
||||||
|
# define qse_fs_delfile(fs,path,flags) qse_fs_delfilembs(fs,path,flags)
|
||||||
|
# define qse_fs_deldir(fs,path,flags) qse_fs_deldirmbs(fs,path,flags)
|
||||||
|
#else
|
||||||
|
# define qse_fs_mkdir(fs,path) qse_fs_mkdirwcs(fs,path)
|
||||||
|
# define qse_fs_delfile(fs,path,flags) qse_fs_delfilewcs(fs,path,flags)
|
||||||
|
# define qse_fs_deldir(fs,path,flags) qse_fs_deldirwcs(fs,path,flags)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include <qse/types.h>
|
#include <qse/types.h>
|
||||||
#include <qse/macros.h>
|
#include <qse/macros.h>
|
||||||
|
|
||||||
/** @file
|
/** \file
|
||||||
* This file provides functions, types, macros for wildcard expansion
|
* This file provides functions, types, macros for wildcard expansion
|
||||||
* in a path name.
|
* in a path name.
|
||||||
*/
|
*/
|
||||||
@ -62,10 +62,10 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_glob() function finds path names matchin the @a pattern.
|
* The qse_glob() function finds path names matchin the \a pattern.
|
||||||
* It calls the call-back function @a cbimpl for each path name found.
|
* It calls the call-back function \a cbimpl for each path name found.
|
||||||
*
|
*
|
||||||
* @return -1 on failure, 0 on no match, 1 if matches are found.
|
* \return -1 on failure, 0 on no match, 1 if matches are found.
|
||||||
*/
|
*/
|
||||||
QSE_EXPORT int qse_glob (
|
QSE_EXPORT int qse_glob (
|
||||||
const qse_char_t* pattern,
|
const qse_char_t* pattern,
|
||||||
|
@ -123,7 +123,7 @@ QSE_EXPORT qse_size_t qse_tmr_update (
|
|||||||
const qse_tmr_event_t* event
|
const qse_tmr_event_t* event
|
||||||
);
|
);
|
||||||
|
|
||||||
QSE_EXPORT void qse_tmr_remove (
|
QSE_EXPORT void qse_tmr_delete (
|
||||||
qse_tmr_t* tmr,
|
qse_tmr_t* tmr,
|
||||||
qse_tmr_index_t index
|
qse_tmr_index_t index
|
||||||
);
|
);
|
||||||
|
@ -45,6 +45,7 @@ libqsecmn_la_SOURCES = \
|
|||||||
fmt-intmax.c \
|
fmt-intmax.c \
|
||||||
fmt-out.c \
|
fmt-out.c \
|
||||||
fs.c \
|
fs.c \
|
||||||
|
fs-delete.c \
|
||||||
fs-err.c \
|
fs-err.c \
|
||||||
fs-move.c \
|
fs-move.c \
|
||||||
glob.c \
|
glob.c \
|
||||||
|
@ -107,36 +107,38 @@ libqsecmn_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
|
|||||||
$(am__DEPENDENCIES_1)
|
$(am__DEPENDENCIES_1)
|
||||||
am__libqsecmn_la_SOURCES_DIST = alg-base64.c alg-rand.c alg-search.c \
|
am__libqsecmn_la_SOURCES_DIST = alg-base64.c alg-rand.c alg-search.c \
|
||||||
alg-sort.c assert.c chr.c dir.c dll.c env.c gdl.c htb.c fio.c \
|
alg-sort.c assert.c chr.c dir.c dll.c env.c gdl.c htb.c fio.c \
|
||||||
fma.c fmt-intmax.c fmt-out.c fs.c fs-err.c fs-move.c glob.c \
|
fma.c fmt-intmax.c fmt-out.c fs.c fs-delete.c fs-err.c \
|
||||||
hton.c ipad.c lda.c main.c mb8.c mbwc.c mbwc-str.c mem.c mux.c \
|
fs-move.c glob.c hton.c ipad.c lda.c main.c mb8.c mbwc.c \
|
||||||
nwad.c nwad-skad.c nwif.c nwif-cfg.c nwio.c oht.c opt.c \
|
mbwc-str.c mem.c mux.c nwad.c nwad-skad.c nwif.c nwif-cfg.c \
|
||||||
path-base.c path-canon.c pio.c pma.c rbt.c rex.c sck.c sio.c \
|
nwio.c oht.c opt.c path-base.c path-canon.c pio.c pma.c rbt.c \
|
||||||
sll.c slmb.c str-beg.c str-cat.c str-chr.c str-cnv.c str-cmp.c \
|
rex.c sck.c sio.c sll.c slmb.c str-beg.c str-cat.c str-chr.c \
|
||||||
str-cpy.c str-del.c str-dup.c str-dyn.c str-end.c str-excl.c \
|
str-cnv.c str-cmp.c str-cpy.c str-del.c str-dup.c str-dyn.c \
|
||||||
str-fcpy.c str-fmt.c str-fnmat.c str-incl.c str-join.c \
|
str-end.c str-excl.c str-fcpy.c str-fmt.c str-fnmat.c \
|
||||||
str-len.c str-pac.c str-pbrk.c str-put.c str-rev.c str-rot.c \
|
str-incl.c str-join.c str-len.c str-pac.c str-pbrk.c str-put.c \
|
||||||
str-set.c str-spl.c str-spn.c str-str.c str-subst.c str-tok.c \
|
str-rev.c str-rot.c str-set.c str-spl.c str-spn.c str-str.c \
|
||||||
str-trm.c str-word.c task.c time.c tio.c tmr.c tre.c tre-ast.c \
|
str-subst.c str-tok.c str-trm.c str-word.c task.c time.c tio.c \
|
||||||
tre-compile.c tre-match-bt.c tre-match-pa.c tre-parse.c \
|
tmr.c tre.c tre-ast.c tre-compile.c tre-match-bt.c \
|
||||||
tre-stack.c uri.c utf8.c xma.c uni.c cp949.c cp950.c
|
tre-match-pa.c tre-parse.c tre-stack.c uri.c utf8.c xma.c \
|
||||||
|
uni.c cp949.c cp950.c
|
||||||
@ENABLE_BUNDLED_UNICODE_TRUE@am__objects_1 = uni.lo
|
@ENABLE_BUNDLED_UNICODE_TRUE@am__objects_1 = uni.lo
|
||||||
@ENABLE_XCMGRS_TRUE@am__objects_2 = cp949.lo cp950.lo
|
@ENABLE_XCMGRS_TRUE@am__objects_2 = cp949.lo cp950.lo
|
||||||
am_libqsecmn_la_OBJECTS = alg-base64.lo alg-rand.lo alg-search.lo \
|
am_libqsecmn_la_OBJECTS = alg-base64.lo alg-rand.lo alg-search.lo \
|
||||||
alg-sort.lo assert.lo chr.lo dir.lo dll.lo env.lo gdl.lo \
|
alg-sort.lo assert.lo chr.lo dir.lo dll.lo env.lo gdl.lo \
|
||||||
htb.lo fio.lo fma.lo fmt-intmax.lo fmt-out.lo fs.lo fs-err.lo \
|
htb.lo fio.lo fma.lo fmt-intmax.lo fmt-out.lo fs.lo \
|
||||||
fs-move.lo glob.lo hton.lo ipad.lo lda.lo main.lo mb8.lo \
|
fs-delete.lo fs-err.lo fs-move.lo glob.lo hton.lo ipad.lo \
|
||||||
mbwc.lo mbwc-str.lo mem.lo mux.lo nwad.lo nwad-skad.lo nwif.lo \
|
lda.lo main.lo mb8.lo mbwc.lo mbwc-str.lo mem.lo mux.lo \
|
||||||
nwif-cfg.lo nwio.lo oht.lo opt.lo path-base.lo path-canon.lo \
|
nwad.lo nwad-skad.lo nwif.lo nwif-cfg.lo nwio.lo oht.lo opt.lo \
|
||||||
pio.lo pma.lo rbt.lo rex.lo sck.lo sio.lo sll.lo slmb.lo \
|
path-base.lo path-canon.lo pio.lo pma.lo rbt.lo rex.lo sck.lo \
|
||||||
str-beg.lo str-cat.lo str-chr.lo str-cnv.lo str-cmp.lo \
|
sio.lo sll.lo slmb.lo str-beg.lo str-cat.lo str-chr.lo \
|
||||||
str-cpy.lo str-del.lo str-dup.lo str-dyn.lo str-end.lo \
|
str-cnv.lo str-cmp.lo str-cpy.lo str-del.lo str-dup.lo \
|
||||||
str-excl.lo str-fcpy.lo str-fmt.lo str-fnmat.lo str-incl.lo \
|
str-dyn.lo str-end.lo str-excl.lo str-fcpy.lo str-fmt.lo \
|
||||||
str-join.lo str-len.lo str-pac.lo str-pbrk.lo str-put.lo \
|
str-fnmat.lo str-incl.lo str-join.lo str-len.lo str-pac.lo \
|
||||||
str-rev.lo str-rot.lo str-set.lo str-spl.lo str-spn.lo \
|
str-pbrk.lo str-put.lo str-rev.lo str-rot.lo str-set.lo \
|
||||||
str-str.lo str-subst.lo str-tok.lo str-trm.lo str-word.lo \
|
str-spl.lo str-spn.lo str-str.lo str-subst.lo str-tok.lo \
|
||||||
task.lo time.lo tio.lo tmr.lo tre.lo tre-ast.lo tre-compile.lo \
|
str-trm.lo str-word.lo task.lo time.lo tio.lo tmr.lo tre.lo \
|
||||||
tre-match-bt.lo tre-match-pa.lo tre-parse.lo tre-stack.lo \
|
tre-ast.lo tre-compile.lo tre-match-bt.lo tre-match-pa.lo \
|
||||||
uri.lo utf8.lo xma.lo $(am__objects_1) $(am__objects_2)
|
tre-parse.lo tre-stack.lo uri.lo utf8.lo xma.lo \
|
||||||
|
$(am__objects_1) $(am__objects_2)
|
||||||
libqsecmn_la_OBJECTS = $(am_libqsecmn_la_OBJECTS)
|
libqsecmn_la_OBJECTS = $(am_libqsecmn_la_OBJECTS)
|
||||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||||
@ -412,18 +414,19 @@ noinst_HEADERS = \
|
|||||||
|
|
||||||
libqsecmn_la_SOURCES = alg-base64.c alg-rand.c alg-search.c alg-sort.c \
|
libqsecmn_la_SOURCES = alg-base64.c alg-rand.c alg-search.c alg-sort.c \
|
||||||
assert.c chr.c dir.c dll.c env.c gdl.c htb.c fio.c fma.c \
|
assert.c chr.c dir.c dll.c env.c gdl.c htb.c fio.c fma.c \
|
||||||
fmt-intmax.c fmt-out.c fs.c fs-err.c fs-move.c glob.c hton.c \
|
fmt-intmax.c fmt-out.c fs.c fs-delete.c fs-err.c fs-move.c \
|
||||||
ipad.c lda.c main.c mb8.c mbwc.c mbwc-str.c mem.c mux.c nwad.c \
|
glob.c hton.c ipad.c lda.c main.c mb8.c mbwc.c mbwc-str.c \
|
||||||
nwad-skad.c nwif.c nwif-cfg.c nwio.c oht.c opt.c path-base.c \
|
mem.c mux.c nwad.c nwad-skad.c nwif.c nwif-cfg.c nwio.c oht.c \
|
||||||
path-canon.c pio.c pma.c rbt.c rex.c sck.c sio.c sll.c slmb.c \
|
opt.c path-base.c path-canon.c pio.c pma.c rbt.c rex.c sck.c \
|
||||||
str-beg.c str-cat.c str-chr.c str-cnv.c str-cmp.c str-cpy.c \
|
sio.c sll.c slmb.c str-beg.c str-cat.c str-chr.c str-cnv.c \
|
||||||
str-del.c str-dup.c str-dyn.c str-end.c str-excl.c str-fcpy.c \
|
str-cmp.c str-cpy.c str-del.c str-dup.c str-dyn.c str-end.c \
|
||||||
str-fmt.c str-fnmat.c str-incl.c str-join.c str-len.c \
|
str-excl.c str-fcpy.c str-fmt.c str-fnmat.c str-incl.c \
|
||||||
str-pac.c str-pbrk.c str-put.c str-rev.c str-rot.c str-set.c \
|
str-join.c str-len.c str-pac.c str-pbrk.c str-put.c str-rev.c \
|
||||||
str-spl.c str-spn.c str-str.c str-subst.c str-tok.c str-trm.c \
|
str-rot.c str-set.c str-spl.c str-spn.c str-str.c str-subst.c \
|
||||||
str-word.c task.c time.c tio.c tmr.c tre.c tre-ast.c \
|
str-tok.c str-trm.c str-word.c task.c time.c tio.c tmr.c tre.c \
|
||||||
tre-compile.c tre-match-bt.c tre-match-pa.c tre-parse.c \
|
tre-ast.c tre-compile.c tre-match-bt.c tre-match-pa.c \
|
||||||
tre-stack.c uri.c utf8.c xma.c $(am__append_1) $(am__append_2)
|
tre-parse.c tre-stack.c uri.c utf8.c xma.c $(am__append_1) \
|
||||||
|
$(am__append_2)
|
||||||
libqsecmn_la_LDFLAGS = -version-info 1:0:0 -no-undefined
|
libqsecmn_la_LDFLAGS = -version-info 1:0:0 -no-undefined
|
||||||
libqsecmn_la_LIBADD = $(SOCKET_LIBS) $(QUADMATH_LIBS)
|
libqsecmn_la_LIBADD = $(SOCKET_LIBS) $(QUADMATH_LIBS)
|
||||||
@ENABLE_CXX_TRUE@libqsecmnxx_la_SOURCES = \
|
@ENABLE_CXX_TRUE@libqsecmnxx_la_SOURCES = \
|
||||||
@ -525,6 +528,7 @@ distclean-compile:
|
|||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fma.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fma.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fmt-intmax.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fmt-intmax.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fmt-out.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fmt-out.Plo@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs-delete.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs-err.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs-err.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs-move.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs-move.Plo@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs.Plo@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fs.Plo@am__quote@
|
||||||
|
@ -317,7 +317,6 @@ static qse_char_t* make_dos_path (qse_dir_t* dir, const qse_char_t* path)
|
|||||||
return QSE_STR_PTR(&dir->tbuf);
|
return QSE_STR_PTR(&dir->tbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static qse_mchar_t* mkdospath (qse_dir_t* dir, const qse_char_t* path)
|
static qse_mchar_t* mkdospath (qse_dir_t* dir, const qse_char_t* path)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -716,15 +715,14 @@ static int read_ahead_and_sort (qse_dir_t* dir, const qse_char_t* path)
|
|||||||
{
|
{
|
||||||
qse_size_t size;
|
qse_size_t size;
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
#if defined(QSE_CHAR_IS_MCHAR)
|
||||||
size = (qse_mbslen(name) + 1) * QSE_SIZEOF(qse_mchar_t);
|
size = (qse_mbslen(name) + 1) * QSE_SIZEOF(qse_mchar_t);
|
||||||
#else
|
#else
|
||||||
if (dir->flags & QSE_DIR_MBSPATH)
|
if (dir->flags & QSE_DIR_MBSPATH)
|
||||||
size = (qse_mbslen(name) + 1) * QSE_SIZEOF(qse_mchar_t);
|
size = (qse_mbslen(name) + 1) * QSE_SIZEOF(qse_mchar_t);
|
||||||
else
|
else
|
||||||
size = (qse_wcslen(name) + 1) * QSE_SIZEOF(qse_wchar_t);
|
size = (qse_wcslen(name) + 1) * QSE_SIZEOF(qse_wchar_t);
|
||||||
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
if (qse_lda_pushheap (dir->stab, name, size) == (qse_size_t)-1)
|
if (qse_lda_pushheap (dir->stab, name, size) == (qse_size_t)-1)
|
||||||
{
|
{
|
||||||
|
461
qse/lib/cmn/fs-delete.c
Normal file
461
qse/lib/cmn/fs-delete.c
Normal file
@ -0,0 +1,461 @@
|
|||||||
|
/*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
Copyright (c) 2006-2014 Chung, Hyung-Hwan. All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
1. Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
||||||
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "fs.h"
|
||||||
|
|
||||||
|
static int delete_file (qse_fs_t* fs, const qse_fs_char_t* fspath)
|
||||||
|
{
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
|
||||||
|
if (DeleteFile (fspath) == FALSE)
|
||||||
|
{
|
||||||
|
fs->errnum = qse_fs_syserrtoerrnum (fs, GetLastError());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(__OS2__)
|
||||||
|
|
||||||
|
APIRET rc;
|
||||||
|
|
||||||
|
rc = DosDelete (fspath);
|
||||||
|
if (rc != NO_ERROR)
|
||||||
|
{
|
||||||
|
fs->errnum = qse_fs_syserrtoerrnum (fs, rc);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(__DOS__)
|
||||||
|
|
||||||
|
if (unlink (fspath) <= -1)
|
||||||
|
{
|
||||||
|
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
if (QSE_UNLINK (fspath) <= -1)
|
||||||
|
{
|
||||||
|
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int delete_directory (qse_fs_t* fs, const qse_fs_char_t* fspath)
|
||||||
|
{
|
||||||
|
#if defined(_WIN32)
|
||||||
|
|
||||||
|
if (RemoveDirectory (fspath) == FALSE)
|
||||||
|
{
|
||||||
|
fs->errnum = qse_fs_syserrtoerrnum (fs, GetLastError());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(__OS2__)
|
||||||
|
|
||||||
|
APIRET rc;
|
||||||
|
|
||||||
|
rc = DosRmDir (fspath);
|
||||||
|
if (rc != NO_ERROR)
|
||||||
|
{
|
||||||
|
fs->errnum = qse_fs_syserrtoerrnum (fs, rc);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(__DOS__)
|
||||||
|
|
||||||
|
if (rmdir (fspath) <= -1)
|
||||||
|
{
|
||||||
|
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
if (QSE_RMDIR (fspath) <= -1)
|
||||||
|
{
|
||||||
|
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int purge_path (qse_fs_t* fs, const qse_char_t* path)
|
||||||
|
{
|
||||||
|
qse_dir_t* dir;
|
||||||
|
qse_dir_errnum_t errnum;
|
||||||
|
qse_dir_ent_t ent;
|
||||||
|
qse_fs_char_t* fspath;
|
||||||
|
int ret, x;
|
||||||
|
|
||||||
|
dir = qse_dir_open (fs->mmgr, 0, path, 0, &errnum);
|
||||||
|
if (!dir)
|
||||||
|
{
|
||||||
|
/* not a directory. attempt to delete it as a file */
|
||||||
|
fspath = qse_fs_makefspath(fs, path);
|
||||||
|
if (!fspath) return -1;
|
||||||
|
|
||||||
|
/*TODO query: */
|
||||||
|
/*if (fs->cb.delete) fs->cb.delete (path);*/
|
||||||
|
ret = delete_file (fs, fspath);
|
||||||
|
qse_fs_freefspath (fs, path, fspath);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* it must be a directory. delete all entries under it */
|
||||||
|
const qse_char_t* seg[4];
|
||||||
|
qse_char_t* joined_path;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
x = qse_dir_read (dir, &ent);
|
||||||
|
if (x <= -1)
|
||||||
|
{
|
||||||
|
/* TODO: CONVERT dir->errnum to fs errnum */
|
||||||
|
goto oops;
|
||||||
|
}
|
||||||
|
if (x == 0) break; /* no more entries */
|
||||||
|
|
||||||
|
/* skip . and .. */
|
||||||
|
if (IS_CURDIR(ent.name) || IS_PREVDIR(ent.name)) continue;
|
||||||
|
|
||||||
|
seg[0] = path;
|
||||||
|
seg[1] = DEFAULT_PATH_SEPARATOR;
|
||||||
|
seg[2] = ent.name;
|
||||||
|
seg[3] = QSE_NULL;
|
||||||
|
|
||||||
|
joined_path = qse_stradup (seg, QSE_NULL, fs->mmgr);
|
||||||
|
if (!joined_path)
|
||||||
|
{
|
||||||
|
fs->errnum = QSE_FS_ENOMEM;
|
||||||
|
goto oops;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* join path and ent->name.... */
|
||||||
|
fspath = qse_fs_makefspath(fs, joined_path);
|
||||||
|
if (!fspath) goto oops;
|
||||||
|
/*TODO query: */
|
||||||
|
/*if (fs->cb.delete) fs->cb.delete (path);*/
|
||||||
|
ret = delete_file (fs, fspath);
|
||||||
|
qse_fs_freefspath (fs, ent.name, fspath);
|
||||||
|
if (ret <= -1) ret = purge_path(fs, joined_path);
|
||||||
|
|
||||||
|
QSE_MMGR_FREE (fs->mmgr, joined_path);
|
||||||
|
if (ret <= -1) goto oops;
|
||||||
|
}
|
||||||
|
|
||||||
|
qse_dir_close (dir);
|
||||||
|
|
||||||
|
fspath = qse_fs_makefspath (fs, path);
|
||||||
|
if (!fspath) goto oops;
|
||||||
|
|
||||||
|
ret = delete_directory (fs, fspath);
|
||||||
|
|
||||||
|
qse_fs_freefspath (fs, path, fspath);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
oops:
|
||||||
|
qse_dir_close (dir);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
static int delete_file_for_glob (const qse_cstr_t* path, void* ctx)
|
||||||
|
{
|
||||||
|
qse_fs_t* fs = (qse_fs_t*)ctx;
|
||||||
|
qse_fs_char_t* fspath;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/* skip . and .. */
|
||||||
|
if (IS_CURDIR(path->ptr) || IS_PREVDIR(path->ptr)) return 0;
|
||||||
|
|
||||||
|
fspath = qse_fs_makefspath (fs, path->ptr);
|
||||||
|
if (!fspath) return -1;
|
||||||
|
|
||||||
|
/*TODO query: */
|
||||||
|
/*if (fs->cb.delete) fs->cb.delete (path);*/
|
||||||
|
ret = delete_file (fs, fspath);
|
||||||
|
|
||||||
|
qse_fs_freefspath (fs, path->ptr, fspath);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int qse_fs_delfilembs (qse_fs_t* fs, const qse_mchar_t* path, int flags)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (flags & QSE_FS_DELFILEMBS_GLOB)
|
||||||
|
{
|
||||||
|
qse_char_t* xpath;
|
||||||
|
|
||||||
|
xpath = (qse_char_t*)make_str_with_mbs (fs, path);
|
||||||
|
if (!xpath)
|
||||||
|
{
|
||||||
|
fs->errnum = QSE_FS_ENOMEM;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = qse_glob (xpath, delete_file_for_glob, fs, DEFAULT_GLOB_FLAGS, fs->mmgr);
|
||||||
|
|
||||||
|
free_str_with_mbs (fs, path, xpath);
|
||||||
|
|
||||||
|
if (ret <= -1)
|
||||||
|
{
|
||||||
|
fs->errnum = QSE_FS_EGLOB;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qse_fs_char_t* fspath;
|
||||||
|
|
||||||
|
fspath = qse_fs_makefspathformbs (fs, path);
|
||||||
|
if (!fspath) return -1;
|
||||||
|
|
||||||
|
/* TODO: query */
|
||||||
|
/*if (fs->cb.delete) fs->cb.delete (path);*/
|
||||||
|
ret = delete_file (fs, fspath);
|
||||||
|
|
||||||
|
qse_fs_freefspathformbs (fs, path, fspath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int qse_fs_delfilewcs (qse_fs_t* fs, const qse_wchar_t* path, int flags)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (flags & QSE_FS_DELFILEWCS_GLOB)
|
||||||
|
{
|
||||||
|
qse_char_t* xpath;
|
||||||
|
|
||||||
|
xpath = (qse_char_t*)make_str_with_wcs (fs, path);
|
||||||
|
if (!xpath)
|
||||||
|
{
|
||||||
|
fs->errnum = QSE_FS_ENOMEM;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = qse_glob (xpath, delete_file_for_glob, fs, DEFAULT_GLOB_FLAGS, fs->mmgr);
|
||||||
|
|
||||||
|
free_str_with_wcs (fs, path, xpath);
|
||||||
|
|
||||||
|
if (ret <= -1)
|
||||||
|
{
|
||||||
|
fs->errnum = QSE_FS_EGLOB;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qse_fs_char_t* fspath;
|
||||||
|
|
||||||
|
fspath = qse_fs_makefspathforwcs (fs, path);
|
||||||
|
if (!fspath) return -1;
|
||||||
|
|
||||||
|
/* TODO: query */
|
||||||
|
/*if (fs->cb.delete) fs->cb.delete (path);*/
|
||||||
|
ret = delete_file (fs, fspath);
|
||||||
|
|
||||||
|
qse_fs_freefspathforwcs (fs, path, fspath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
static int delete_directory_for_glob (const qse_cstr_t* path, void* ctx)
|
||||||
|
{
|
||||||
|
qse_fs_t* fs = (qse_fs_t*)ctx;
|
||||||
|
qse_fs_char_t* fspath;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/* skip . and .. */
|
||||||
|
if (IS_CURDIR(path->ptr) || IS_PREVDIR(path->ptr)) return 0;
|
||||||
|
|
||||||
|
fspath = qse_fs_makefspath (fs, path->ptr);
|
||||||
|
if (!fspath) return -1;
|
||||||
|
|
||||||
|
/*TODO query: */
|
||||||
|
/*if (fs->cb.delete) fs->cb.delete (path);*/
|
||||||
|
ret = delete_directory (fs, fspath);
|
||||||
|
|
||||||
|
qse_fs_freefspath (fs, path->ptr, fspath);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int purge_path_for_glob (const qse_cstr_t* path, void* ctx)
|
||||||
|
{
|
||||||
|
qse_fs_t* fs = (qse_fs_t*)ctx;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/* skip . and .. */
|
||||||
|
if (IS_CURDIR(path->ptr) || IS_PREVDIR(path->ptr)) return 0;
|
||||||
|
|
||||||
|
/*TODO query: */
|
||||||
|
/*if (fs->cb.delete) fs->cb.delete (joined_path);*/
|
||||||
|
return purge_path (fs, path->ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int qse_fs_deldirmbs (qse_fs_t* fs, const qse_mchar_t* path, int flags)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (flags & QSE_FS_DELDIRMBS_GLOB)
|
||||||
|
{
|
||||||
|
qse_char_t* xpath;
|
||||||
|
|
||||||
|
xpath = (qse_char_t*)make_str_with_mbs (fs, path);
|
||||||
|
if (!xpath)
|
||||||
|
{
|
||||||
|
fs->errnum = QSE_FS_ENOMEM;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags & QSE_FS_DELDIRMBS_RECURSIVE)
|
||||||
|
{
|
||||||
|
ret = qse_glob (xpath, purge_path_for_glob, fs, DEFAULT_GLOB_FLAGS, fs->mmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = qse_glob (xpath, delete_directory_for_glob, fs, DEFAULT_GLOB_FLAGS, fs->mmgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
free_str_with_mbs (fs, path, xpath);
|
||||||
|
|
||||||
|
if (ret <= -1) fs->errnum = QSE_FS_EGLOB;
|
||||||
|
}
|
||||||
|
else if (flags & QSE_FS_DELDIRMBS_RECURSIVE)
|
||||||
|
{
|
||||||
|
qse_char_t* xpath;
|
||||||
|
|
||||||
|
xpath = (qse_char_t*)make_str_with_mbs (fs, path);
|
||||||
|
if (!xpath)
|
||||||
|
{
|
||||||
|
fs->errnum = QSE_FS_ENOMEM;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = purge_path (fs, xpath);
|
||||||
|
|
||||||
|
free_str_with_mbs (fs, path, xpath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qse_fs_char_t* fspath;
|
||||||
|
|
||||||
|
fspath = qse_fs_makefspathformbs (fs, path);
|
||||||
|
if (!fspath) return -1;
|
||||||
|
|
||||||
|
/* TODO: query */
|
||||||
|
/*if (fs->cb.delete) fs->cb.delete (path);*/
|
||||||
|
ret = delete_directory (fs, fspath);
|
||||||
|
|
||||||
|
qse_fs_freefspathformbs (fs, path, fspath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int qse_fs_deldirwcs (qse_fs_t* fs, const qse_wchar_t* path, int flags)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (flags & QSE_FS_DELDIRWCS_GLOB)
|
||||||
|
{
|
||||||
|
qse_char_t* xpath;
|
||||||
|
|
||||||
|
xpath = (qse_char_t*)make_str_with_wcs (fs, path);
|
||||||
|
if (!xpath)
|
||||||
|
{
|
||||||
|
fs->errnum = QSE_FS_ENOMEM;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags & QSE_FS_DELDIRWCS_RECURSIVE)
|
||||||
|
{
|
||||||
|
ret = qse_glob (xpath, purge_path_for_glob, fs, DEFAULT_GLOB_FLAGS, fs->mmgr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = qse_glob (xpath, delete_directory_for_glob, fs, DEFAULT_GLOB_FLAGS, fs->mmgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
free_str_with_wcs (fs, path, xpath);
|
||||||
|
|
||||||
|
if (ret <= -1) fs->errnum = QSE_FS_EGLOB;
|
||||||
|
}
|
||||||
|
else if (flags & QSE_FS_DELDIRWCS_RECURSIVE)
|
||||||
|
{
|
||||||
|
qse_char_t* xpath;
|
||||||
|
|
||||||
|
xpath = (qse_char_t*)make_str_with_wcs (fs, path);
|
||||||
|
if (!xpath)
|
||||||
|
{
|
||||||
|
fs->errnum = QSE_FS_ENOMEM;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = purge_path (fs, xpath);
|
||||||
|
|
||||||
|
free_str_with_wcs (fs, path, xpath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qse_fs_char_t* fspath;
|
||||||
|
|
||||||
|
fspath = qse_fs_makefspathforwcs (fs, path);
|
||||||
|
if (!fspath) return -1;
|
||||||
|
|
||||||
|
/* TODO: query */
|
||||||
|
/*if (fs->cb.delete) fs->cb.delete (path);*/
|
||||||
|
ret = delete_directory (fs, fspath);
|
||||||
|
|
||||||
|
qse_fs_freefspathforwcs (fs, path, fspath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
@ -61,6 +61,9 @@ qse_fs_errnum_t qse_fs_syserrtoerrnum (qse_fs_t* fs, qse_fs_syserr_t e)
|
|||||||
case ERROR_NOT_SAME_DEVICE:
|
case ERROR_NOT_SAME_DEVICE:
|
||||||
return QSE_FS_EXDEV;
|
return QSE_FS_EXDEV;
|
||||||
|
|
||||||
|
case ERROR_DIR_NOT_EMPTY;
|
||||||
|
return QSE_FS_ENOTEMPTY;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return QSE_FS_ESYSERR;
|
return QSE_FS_ESYSERR;
|
||||||
}
|
}
|
||||||
@ -109,7 +112,6 @@ qse_fs_errnum_t qse_fs_syserrtoerrnum (qse_fs_t* fs, qse_fs_syserr_t e)
|
|||||||
return QSE_FS_EACCES;
|
return QSE_FS_EACCES;
|
||||||
|
|
||||||
case ENOENT:
|
case ENOENT:
|
||||||
case ENOTDIR:
|
|
||||||
return QSE_FS_ENOENT;
|
return QSE_FS_ENOENT;
|
||||||
|
|
||||||
case EEXIST:
|
case EEXIST:
|
||||||
@ -118,6 +120,9 @@ qse_fs_errnum_t qse_fs_syserrtoerrnum (qse_fs_t* fs, qse_fs_syserr_t e)
|
|||||||
case EISDIR:
|
case EISDIR:
|
||||||
return QSE_FS_EISDIR;
|
return QSE_FS_EISDIR;
|
||||||
|
|
||||||
|
case ENOTDIR:
|
||||||
|
return QSE_FS_ENOTDIR;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return QSE_FS_ESYSERR;
|
return QSE_FS_ESYSERR;
|
||||||
}
|
}
|
||||||
@ -136,7 +141,6 @@ qse_fs_errnum_t qse_fs_syserrtoerrnum (qse_fs_t* fs, qse_fs_syserr_t e)
|
|||||||
return QSE_FS_EACCES;
|
return QSE_FS_EACCES;
|
||||||
|
|
||||||
case ENOENT:
|
case ENOENT:
|
||||||
case ENOTDIR:
|
|
||||||
return QSE_FS_ENOENT;
|
return QSE_FS_ENOENT;
|
||||||
|
|
||||||
case EEXIST:
|
case EEXIST:
|
||||||
@ -148,6 +152,12 @@ qse_fs_errnum_t qse_fs_syserrtoerrnum (qse_fs_t* fs, qse_fs_syserr_t e)
|
|||||||
case EISDIR:
|
case EISDIR:
|
||||||
return QSE_FS_EISDIR;
|
return QSE_FS_EISDIR;
|
||||||
|
|
||||||
|
case ENOTDIR:
|
||||||
|
return QSE_FS_ENOTDIR;
|
||||||
|
|
||||||
|
case ENOTEMPTY:
|
||||||
|
return QSE_FS_ENOTVOID;
|
||||||
|
|
||||||
case EXDEV:
|
case EXDEV:
|
||||||
return QSE_FS_EXDEV;
|
return QSE_FS_EXDEV;
|
||||||
|
|
||||||
|
@ -378,150 +378,15 @@ struct del_op_t
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
int qse_fs_delete (qse_fs_t* fs, const qse_char_t* path)
|
/*
|
||||||
{
|
int qse_cpfile
|
||||||
/* TODO: improve this function to support fs->curdir ... etc
|
int qse_mvfile
|
||||||
* delete directory ... etc */
|
*
|
||||||
|
int qse_rmdir
|
||||||
#if defined(_WIN32)
|
qse_mkdir
|
||||||
|
|
||||||
if (DeleteFile (path) == FALSE)
|
|
||||||
{
|
|
||||||
fs->errnum = qse_fs_syserrtoerrnum (fs, GetLastError());
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
|
|
||||||
#elif defined(__OS2__)
|
qse_statfile
|
||||||
|
|
||||||
/* ------------------------------------------------------ */
|
qse_rm...????
|
||||||
|
*/
|
||||||
APIRET rc;
|
|
||||||
del_op_t dop;
|
|
||||||
|
|
||||||
|
|
||||||
QSE_MEMSET (&dop, 0, QSE_SIZEOF(dop));
|
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
|
||||||
dop.path = path;
|
|
||||||
#else
|
|
||||||
dop.path = qse_wcstombsdup (path, QSE_NULL, fs->mmgr);
|
|
||||||
if (dop.path == QSE_NULL)
|
|
||||||
{
|
|
||||||
fs->errnum = QSE_FS_ENOMEM;
|
|
||||||
goto oops;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
rc = DosDelete (dop.path);
|
|
||||||
if (rc != NO_ERROR)
|
|
||||||
{
|
|
||||||
fs->errnum = qse_fs_syserrtoerrnum (fs, rc);
|
|
||||||
goto oops;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
|
||||||
/* nothing to do */
|
|
||||||
#else
|
|
||||||
QSE_MMGR_FREE (fs->mmgr, dop.path);
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* ------------------------------------------------------ */
|
|
||||||
|
|
||||||
oops:
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
|
||||||
/* nothing to do */
|
|
||||||
#else
|
|
||||||
if (dop.path) QSE_MMGR_FREE (fs->mmgr, dop.path);
|
|
||||||
#endif
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
#elif defined(__DOS__)
|
|
||||||
|
|
||||||
/* ------------------------------------------------------ */
|
|
||||||
|
|
||||||
del_op_t dop;
|
|
||||||
|
|
||||||
QSE_MEMSET (&dop, 0, QSE_SIZEOF(dop));
|
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
|
||||||
dop.path = path;
|
|
||||||
#else
|
|
||||||
dop.path = qse_wcstombsdup (path, QSE_NULL, fs->mmgr);
|
|
||||||
if (dop.path == QSE_NULL)
|
|
||||||
{
|
|
||||||
fs->errnum = QSE_FS_ENOMEM;
|
|
||||||
goto oops;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (unlink (dop.path) <= -1)
|
|
||||||
{
|
|
||||||
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
|
||||||
goto oops;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
|
||||||
/* nothing to do */
|
|
||||||
#else
|
|
||||||
QSE_MMGR_FREE (fs->mmgr, dop.path);
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
oops:
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
|
||||||
/* nothing to do */
|
|
||||||
#else
|
|
||||||
if (dop.path) QSE_MMGR_FREE (fs->mmgr, dop.path);
|
|
||||||
#endif
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* ------------------------------------------------------ */
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* ------------------------------------------------------ */
|
|
||||||
|
|
||||||
del_op_t dop;
|
|
||||||
|
|
||||||
QSE_MEMSET (&dop, 0, QSE_SIZEOF(dop));
|
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
|
||||||
dop.path = path;
|
|
||||||
#else
|
|
||||||
dop.path = qse_wcstombsdup (path, QSE_NULL, fs->mmgr);
|
|
||||||
if (dop.path == QSE_NULL)
|
|
||||||
{
|
|
||||||
fs->errnum = QSE_FS_ENOMEM;
|
|
||||||
goto oops;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (QSE_UNLINK (dop.path) <= -1)
|
|
||||||
{
|
|
||||||
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
|
||||||
goto oops;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
|
||||||
/* nothing to do */
|
|
||||||
#else
|
|
||||||
QSE_MMGR_FREE (fs->mmgr, dop.path);
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
oops:
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
|
||||||
/* nothing to do */
|
|
||||||
#else
|
|
||||||
if (dop.path) QSE_MMGR_FREE (fs->mmgr, dop.path);
|
|
||||||
#endif
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* ------------------------------------------------------ */
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
@ -85,6 +85,7 @@ int qse_fs_init (qse_fs_t* fs, qse_mmgr_t* mmgr)
|
|||||||
{
|
{
|
||||||
QSE_MEMSET (fs, 0, QSE_SIZEOF(*fs));
|
QSE_MEMSET (fs, 0, QSE_SIZEOF(*fs));
|
||||||
fs->mmgr = mmgr;
|
fs->mmgr = mmgr;
|
||||||
|
fs->cmgr = qse_getdflcmgr();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -554,7 +555,7 @@ qse_fs_ent_t* qse_fs_read (qse_fs_t* fs, int flags)
|
|||||||
info = fs->info;
|
info = fs->info;
|
||||||
if (info == QSE_NULL)
|
if (info == QSE_NULL)
|
||||||
{
|
{
|
||||||
fs->errnum = QSE_FS_ENODIR;
|
fs->errnum = QSE_FS_ENOTDIR;
|
||||||
return QSE_NULL;
|
return QSE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -710,3 +711,41 @@ int qse_fs_rewind (qse_fs_t* fs)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
qse_fs_char_t* qse_fs_makefspathformbs (qse_fs_t* fs, const qse_mchar_t* path)
|
||||||
|
{
|
||||||
|
qse_fs_char_t* fspath;
|
||||||
|
|
||||||
|
#if defined(QSE_FS_CHAR_IS_MCHAR)
|
||||||
|
fspath = path;
|
||||||
|
#else
|
||||||
|
fspath = qse_mbstowcsdupwithcmgr (path, QSE_NULL, fs->mmgrm fs->cmgr);
|
||||||
|
if (!fspath) fs->errnum = QSE_FS_ENOMEM;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return fspath;
|
||||||
|
}
|
||||||
|
|
||||||
|
qse_fs_char_t* qse_fs_makefspathforwcs (qse_fs_t* fs, const qse_wchar_t* path)
|
||||||
|
{
|
||||||
|
qse_fs_char_t* fspath;
|
||||||
|
|
||||||
|
#if defined(QSE_FS_CHAR_IS_MCHAR)
|
||||||
|
fspath = qse_wcstombsdupwithcmgr (path, QSE_NULL, fs->mmgr, fs->cmgr);
|
||||||
|
if (!fspath) fs->errnum = QSE_FS_ENOMEM;
|
||||||
|
#else
|
||||||
|
fspath = path;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return fspath;
|
||||||
|
}
|
||||||
|
|
||||||
|
void qse_fs_freefspathformbs (qse_fs_t* fs, const qse_mchar_t* path, qse_fs_char_t* fspath)
|
||||||
|
{
|
||||||
|
if (path != fspath) QSE_MMGR_FREE (fs->mmgr, fspath);
|
||||||
|
}
|
||||||
|
|
||||||
|
void qse_fs_freefspathforwcs (qse_fs_t* fs, const qse_wchar_t* path, qse_fs_char_t* fspath)
|
||||||
|
{
|
||||||
|
if (path != fspath) QSE_MMGR_FREE (fs->mmgr, fspath);
|
||||||
|
}
|
||||||
|
@ -25,6 +25,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <qse/cmn/fs.h>
|
#include <qse/cmn/fs.h>
|
||||||
|
#include <qse/cmn/mbwc.h>
|
||||||
|
#include <qse/cmn/glob.h>
|
||||||
|
#include <qse/cmn/dir.h>
|
||||||
|
#include <qse/cmn/mem.h>
|
||||||
|
#include <qse/cmn/str.h>
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
@ -43,6 +48,29 @@
|
|||||||
typedef int qse_fs_syserr_t;
|
typedef int qse_fs_syserr_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
||||||
|
# define DEFAULT_GLOB_FLAGS (QSE_GLOB_PERIOD | QSE_GLOB_NOESCAPE | QSE_GLOB_IGNORECASE)
|
||||||
|
# define DEFAULT_PATH_SEPARATOR QSE_T("\\")
|
||||||
|
#else
|
||||||
|
# define DEFAULT_GLOB_FLAGS (QSE_GLOB_PERIOD)
|
||||||
|
# define DEFAULT_PATH_SEPARATOR QSE_T("/")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define IS_CURDIR(x) ((x)[0] == QSE_T('.') && (x)[1] == QSE_T('\0'))
|
||||||
|
#define IS_PREVDIR(x) ((x)[0] == QSE_T('.') && (x)[1] == QSE_T('.') && (x)[2] == QSE_T('\0'))
|
||||||
|
|
||||||
|
#if defined(QSE_CHAR_IS_MCHAR)
|
||||||
|
# define make_str_with_wcs(fs,wcs) qse_wcstombsdupwithcmgr(wcs,QSE_NULL,(fs)->mmgr,(fs)->cmgr)
|
||||||
|
# define make_str_with_mbs(fs,mbs) (mbs)
|
||||||
|
# define free_str_with_wcs(fs,wcs,str) QSE_MMGR_FREE((fs)->mmgr,str)
|
||||||
|
# define free_str_with_mbs(fs,mbs,str)
|
||||||
|
#else
|
||||||
|
# define make_str_with_wcs(fs,wcs) (wcs)
|
||||||
|
# define make_str_with_mbs(fs,mbs) qse_mbstowcsdupwithcmgr(mbs,QSE_NULL,(fs)->mmgr,(fs)->cmgr)
|
||||||
|
# define free_str_with_wcs(fs,wcs,str)
|
||||||
|
# define free_str_with_mbs(fs,mbs,str) QSE_MMGR_FREE((fs)->mmgr,str)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
@ -52,6 +80,36 @@ qse_fs_errnum_t qse_fs_syserrtoerrnum (
|
|||||||
qse_fs_syserr_t e
|
qse_fs_syserr_t e
|
||||||
);
|
);
|
||||||
|
|
||||||
|
qse_fs_char_t* qse_fs_makefspathformbs (
|
||||||
|
qse_fs_t* fs,
|
||||||
|
const qse_mchar_t* path
|
||||||
|
);
|
||||||
|
|
||||||
|
qse_fs_char_t* qse_fs_makefspathforwcs (
|
||||||
|
qse_fs_t* fs,
|
||||||
|
const qse_wchar_t* path
|
||||||
|
);
|
||||||
|
|
||||||
|
void qse_fs_freefspathformbs (
|
||||||
|
qse_fs_t* fs,
|
||||||
|
const qse_mchar_t* path,
|
||||||
|
qse_fs_char_t* fspath
|
||||||
|
);
|
||||||
|
|
||||||
|
void qse_fs_freefspathforwcs (
|
||||||
|
qse_fs_t* fs,
|
||||||
|
const qse_wchar_t* path,
|
||||||
|
qse_fs_char_t* fspath
|
||||||
|
);
|
||||||
|
|
||||||
|
#if defined(QSE_CHAR_IS_MCHAR)
|
||||||
|
# define qse_fs_makefspath(fs,path) qse_fs_makefspathformbs(fs,path)
|
||||||
|
# define qse_fs_freefspath(fs,path,fspath) qse_fs_freefspathformbs(fs,path,fspath);
|
||||||
|
#else
|
||||||
|
# define qse_fs_makefspath(fs,path) qse_fs_makefspathforwcs(fs,path)
|
||||||
|
# define qse_fs_freefspath(fs,path,fspath) qse_fs_freefspathforwcs(fs,path,fspath);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -242,7 +242,7 @@ static int get_next_segment (glob_t* g, segment_t* seg)
|
|||||||
seg->wild = 0;
|
seg->wild = 0;
|
||||||
seg->esc = 0;
|
seg->esc = 0;
|
||||||
}
|
}
|
||||||
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
||||||
else if (IS_DRIVE(seg->ptr))
|
else if (IS_DRIVE(seg->ptr))
|
||||||
{
|
{
|
||||||
seg->type = ROOT;
|
seg->type = ROOT;
|
||||||
@ -253,7 +253,7 @@ static int get_next_segment (glob_t* g, segment_t* seg)
|
|||||||
seg->wild = 0;
|
seg->wild = 0;
|
||||||
seg->esc = 0;
|
seg->esc = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int escaped = 0;
|
int escaped = 0;
|
||||||
@ -463,7 +463,7 @@ entry:
|
|||||||
{
|
{
|
||||||
if (seg->next)
|
if (seg->next)
|
||||||
{
|
{
|
||||||
#if defined(NO_RECURSION)
|
#if defined(NO_RECURSION)
|
||||||
if (g->free)
|
if (g->free)
|
||||||
{
|
{
|
||||||
r = g->free;
|
r = g->free;
|
||||||
@ -492,7 +492,7 @@ entry:
|
|||||||
resume:
|
resume:
|
||||||
;
|
;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
segment_t save;
|
segment_t save;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ entry:
|
|||||||
x = search (g, seg);
|
x = search (g, seg);
|
||||||
*seg = save;
|
*seg = save;
|
||||||
if (x <= -1) goto oops;
|
if (x <= -1) goto oops;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -95,7 +95,7 @@ void* qse_tmr_getxtn (qse_tmr_t* tmr)
|
|||||||
|
|
||||||
void qse_tmr_clear (qse_tmr_t* tmr)
|
void qse_tmr_clear (qse_tmr_t* tmr)
|
||||||
{
|
{
|
||||||
while (tmr->size > 0) qse_tmr_remove (tmr, 0);
|
while (tmr->size > 0) qse_tmr_delete (tmr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static qse_tmr_index_t sift_up (qse_tmr_t* tmr, qse_tmr_index_t index, int notify)
|
static qse_tmr_index_t sift_up (qse_tmr_t* tmr, qse_tmr_index_t index, int notify)
|
||||||
@ -179,7 +179,7 @@ static qse_tmr_index_t sift_down (qse_tmr_t* tmr, qse_tmr_index_t index, int not
|
|||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qse_tmr_remove (qse_tmr_t* tmr, qse_tmr_index_t index)
|
void qse_tmr_delete (qse_tmr_t* tmr, qse_tmr_index_t index)
|
||||||
{
|
{
|
||||||
qse_tmr_event_t item;
|
qse_tmr_event_t item;
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ qse_size_t qse_tmr_fire (qse_tmr_t* tmr, const qse_ntime_t* tm)
|
|||||||
if (qse_cmptime(&tmr->event[0].when, &now) > 0) break;
|
if (qse_cmptime(&tmr->event[0].when, &now) > 0) break;
|
||||||
|
|
||||||
event = tmr->event[0];
|
event = tmr->event[0];
|
||||||
qse_tmr_remove (tmr, 0); /* remove the registered event structure */
|
qse_tmr_delete (tmr, 0); /* remove the registered event structure */
|
||||||
|
|
||||||
fire_count++;
|
fire_count++;
|
||||||
event.handler (tmr, &now, &event); /* then fire the event */
|
event.handler (tmr, &now, &event); /* then fire the event */
|
||||||
|
@ -2202,7 +2202,7 @@ int qse_httpd_inserttimerevent (qse_httpd_t* httpd, const qse_httpd_timer_event_
|
|||||||
|
|
||||||
void qse_httpd_removetimerevent (qse_httpd_t* httpd, qse_httpd_timer_index_t index)
|
void qse_httpd_removetimerevent (qse_httpd_t* httpd, qse_httpd_timer_index_t index)
|
||||||
{
|
{
|
||||||
qse_tmr_remove (httpd->tmr, index);
|
qse_tmr_delete (httpd->tmr, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* qse_httpd_insert_timer_event() is a lighter-weight version of
|
/* qse_httpd_insert_timer_event() is a lighter-weight version of
|
||||||
@ -2222,7 +2222,7 @@ int qse_httpd_insert_timer_event (qse_httpd_t* httpd, const qse_tmr_event_t* eve
|
|||||||
}
|
}
|
||||||
void qse_httpd_remove_timer_event (qse_httpd_t* httpd, qse_tmr_index_t index)
|
void qse_httpd_remove_timer_event (qse_httpd_t* httpd, qse_tmr_index_t index)
|
||||||
{
|
{
|
||||||
qse_tmr_remove (httpd->tmr, index);
|
qse_tmr_delete (httpd->tmr, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user