fixed glob.c to use qse_stat_t instead of struct stat.
fixed other minor problems
This commit is contained in:
parent
947f5a8d8d
commit
44129510dc
@ -841,7 +841,7 @@ $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\awk-
|
|||||||
@%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc option caseexact
|
@%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc option caseexact
|
||||||
@%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc $(__DEBUG_INFO_1_6) $(LDFLAGS)
|
@%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc $(__DEBUG_INFO_1_6) $(LDFLAGS)
|
||||||
@for %i in ($(MODQSEAWKMATH_OBJECTS)) do @%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc file %i
|
@for %i in ($(MODQSEAWKMATH_OBJECTS)) do @%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc file %i
|
||||||
@for %i in ( $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qsecmn.lib $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk.lib) do @%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc library %i
|
@for %i in ( $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qsecmn.lib $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk.lib ) do @%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc library %i
|
||||||
@%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc
|
@%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc
|
||||||
@%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc system os2v2 dll
|
@%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc system os2v2 dll
|
||||||
wlink @$(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc
|
wlink @$(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc
|
||||||
|
@ -433,6 +433,8 @@
|
|||||||
<library>libqsecmn</library>
|
<library>libqsecmn</library>
|
||||||
<library>libqseawk</library>
|
<library>libqseawk</library>
|
||||||
<depends>dllqseawk</depends>
|
<depends>dllqseawk</depends>
|
||||||
|
<sys-lib>$(SYSLIB_1)</sys-lib>
|
||||||
|
<sys-lib>$(SYSLIB_2)</sys-lib>
|
||||||
</dll>
|
</dll>
|
||||||
|
|
||||||
<dll id="modqseawksed" template="base" cond="ENABLE_STATIC_MODULE=='0'">
|
<dll id="modqseawksed" template="base" cond="ENABLE_STATIC_MODULE=='0'">
|
||||||
|
@ -870,7 +870,7 @@ $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qsea
|
|||||||
!if "$(SHARED)" == "on"
|
!if "$(SHARED)" == "on"
|
||||||
$(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk-math.dll: $(MODQSEAWKMATH_OBJECTS) $(__libqsecmn___depname) $(__libqseawk___depname) $(__dllqseawk___depname)
|
$(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk-math.dll: $(MODQSEAWKMATH_OBJECTS) $(__libqsecmn___depname) $(__libqseawk___depname) $(__dllqseawk___depname)
|
||||||
ilink32 -Tpd -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUG_INFO) $(LDFLAGS) @&&|
|
ilink32 -Tpd -q -L$(BCCDIR)\lib -L$(BCCDIR)\lib\psdk $(__DEBUG_INFO) $(LDFLAGS) @&&|
|
||||||
c0d32.obj $(MODQSEAWKMATH_OBJECTS),$@,, $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qsecmn.lib $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk.lib import32.lib cw32mt.lib,,
|
c0d32.obj $(MODQSEAWKMATH_OBJECTS),$@,, $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qsecmn.lib $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk.lib kernel32.lib user32.lib import32.lib cw32mt.lib,,
|
||||||
|
|
|
|
||||||
implib -f $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk-math $@
|
implib -f $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk-math $@
|
||||||
!endif
|
!endif
|
||||||
|
@ -958,7 +958,7 @@ $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qsea
|
|||||||
!if "$(SHARED)" == "on"
|
!if "$(SHARED)" == "on"
|
||||||
$(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk-math.dll: $(MODQSEAWKMATH_OBJECTS) $(__libqsecmn___depname) $(__libqseawk___depname) $(__dllqseawk___depname)
|
$(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk-math.dll: $(MODQSEAWKMATH_OBJECTS) $(__libqsecmn___depname) $(__libqseawk___depname) $(__dllqseawk___depname)
|
||||||
link /DLL /NOLOGO /OUT:$@ $(__DEBUG_INFO_24) /pdb:"$(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk-math.pdb" $(__DEBUG_INFO_104) $(LDFLAGS) @<<
|
link /DLL /NOLOGO /OUT:$@ $(__DEBUG_INFO_24) /pdb:"$(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk-math.pdb" $(__DEBUG_INFO_104) $(LDFLAGS) @<<
|
||||||
$(MODQSEAWKMATH_OBJECTS) $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qsecmn.lib $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk.lib /IMPLIB:$(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk-math.lib
|
$(MODQSEAWKMATH_OBJECTS) $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qsecmn.lib $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk.lib kernel32.lib user32.lib /IMPLIB:$(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk-math.lib
|
||||||
<<
|
<<
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
@ -830,7 +830,7 @@ $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qsea
|
|||||||
@%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc option caseexact
|
@%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc option caseexact
|
||||||
@%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc $(__DEBUG_INFO_1_6) $(LDFLAGS)
|
@%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc $(__DEBUG_INFO_1_6) $(LDFLAGS)
|
||||||
@for %i in ($(MODQSEAWKMATH_OBJECTS)) do @%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc file %i
|
@for %i in ($(MODQSEAWKMATH_OBJECTS)) do @%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc file %i
|
||||||
@for %i in ( $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qsecmn.lib $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk.lib) do @%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc library %i
|
@for %i in ( $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qsecmn.lib $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\qseawk.lib kernel32.lib user32.lib) do @%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc library %i
|
||||||
@%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc
|
@%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc
|
||||||
@%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc system nt_dll
|
@%append $(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc system nt_dll
|
||||||
wlink @$(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc
|
wlink @$(BUILDDIR_BUILD)-$(BUILDDIR_CHAR)-$(BUILDDIR_SHARED)$(BUILDDIR_TCPV40HDRS)\modqseawkmath.lbc
|
||||||
|
@ -61,8 +61,8 @@ 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;
|
case ERROR_DIR_NOT_EMPTY:
|
||||||
return QSE_FS_ENOTEMPTY;
|
return QSE_FS_ENOTVOID;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return QSE_FS_ESYSERR;
|
return QSE_FS_ESYSERR;
|
||||||
|
@ -44,6 +44,16 @@ static int make_directory_in_fs (qse_fs_t* fs, const qse_fs_char_t* fspath)
|
|||||||
rc = DosMkDir (fspath, QSE_NULL);
|
rc = DosMkDir (fspath, QSE_NULL);
|
||||||
if (rc != NO_ERROR)
|
if (rc != NO_ERROR)
|
||||||
{
|
{
|
||||||
|
FILESTATUS3L ffb;
|
||||||
|
if (DosQueryPathInfo (fspath, FIL_STANDARDL, &ffb, QSE_SIZEOF(ffb)) == NO_ERROR)
|
||||||
|
{
|
||||||
|
if (ffb.attrFile & FILE_DIRECTORY)
|
||||||
|
{
|
||||||
|
fs->errnum = QSE_FS_EEXIST;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fs->errnum = qse_fs_syserrtoerrnum (fs, rc);
|
fs->errnum = qse_fs_syserrtoerrnum (fs, rc);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -52,6 +62,16 @@ static int make_directory_in_fs (qse_fs_t* fs, const qse_fs_char_t* fspath)
|
|||||||
|
|
||||||
if (mkdir (fspath) <= -1)
|
if (mkdir (fspath) <= -1)
|
||||||
{
|
{
|
||||||
|
struct stat st;
|
||||||
|
if (errno != EEXIST && stat (fspath, &st) >= 0)
|
||||||
|
{
|
||||||
|
if (S_ISDIR(st.st_mode))
|
||||||
|
{
|
||||||
|
fs->errnum = QSE_FS_EEXIST;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
fs->errnum = qse_fs_syserrtoerrnum (fs, errno);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -73,24 +93,44 @@ static int make_directory_in_fs (qse_fs_t* fs, const qse_fs_char_t* fspath)
|
|||||||
|
|
||||||
static int make_directory_chain (qse_fs_t* fs, qse_fs_char_t* fspath)
|
static int make_directory_chain (qse_fs_t* fs, qse_fs_char_t* fspath)
|
||||||
{
|
{
|
||||||
qse_fs_char_t* p, c;
|
qse_fs_char_t* core, * p, c;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
p = get_fspath_core (fspath);
|
core = get_fspath_core (fspath);
|
||||||
canon_fspath (p, p, 0);
|
canon_fspath (core, core, 0);
|
||||||
|
|
||||||
|
if (*core == QSE_FS_T('\0'))
|
||||||
|
{
|
||||||
|
fs->errnum = QSE_FS_EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = core;
|
||||||
|
if (IS_FSPATHSEP(*p)) p++;
|
||||||
for (; *p; p++)
|
for (; *p; p++)
|
||||||
{
|
{
|
||||||
if (IS_FSPATHSEP(*p))
|
if (IS_FSPATHSEP(*p))
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32) || defined(__DOS__) || defined(__OS2__)
|
||||||
|
/* exclude the separtor from the path name */
|
||||||
|
c = *p;
|
||||||
|
*p = QSE_FS_T('\0');
|
||||||
|
#else
|
||||||
|
/* include the separater in the path name */
|
||||||
c = *(p + 1);
|
c = *(p + 1);
|
||||||
*(p + 1) = QSE_FS_T('\0');
|
*(p + 1) = QSE_FS_T('\0');
|
||||||
|
#endif
|
||||||
ret = make_directory_in_fs (fs, fspath);
|
ret = make_directory_in_fs (fs, fspath);
|
||||||
if (ret <= -1 && fs->errnum != QSE_FS_EEXIST)
|
if (ret <= -1 && fs->errnum != QSE_FS_EEXIST)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
goto done; /* abort */
|
goto done; /* abort */
|
||||||
}
|
}
|
||||||
|
#if defined(_WIN32) || defined(__DOS__) || defined(__OS2__)
|
||||||
|
*p = c;
|
||||||
|
#else
|
||||||
*(p + 1) = c;
|
*(p + 1) = c;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,8 +183,6 @@ int qse_fs_setopt (qse_fs_t* fs, qse_fs_opt_t id, const void* value)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static QSE_INLINE info_t* get_info (qse_fs_t* fs)
|
static QSE_INLINE info_t* get_info (qse_fs_t* fs)
|
||||||
{
|
{
|
||||||
info_t* info;
|
info_t* info;
|
||||||
@ -454,7 +452,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_ENOENT; /* TODO: is this correct? */
|
||||||
return QSE_NULL;
|
return QSE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -757,7 +755,7 @@ qse_fs_char_t* qse_fs_makefspathformbs (qse_fs_t* fs, const qse_mchar_t* path)
|
|||||||
#if defined(QSE_FS_CHAR_IS_MCHAR)
|
#if defined(QSE_FS_CHAR_IS_MCHAR)
|
||||||
fspath = path;
|
fspath = path;
|
||||||
#else
|
#else
|
||||||
fspath = qse_mbstowcsdupwithcmgr (path, QSE_NULL, fs->mmgrm fs->cmgr);
|
fspath = qse_mbstowcsdupwithcmgr (path, QSE_NULL, fs->mmgr, fs->cmgr);
|
||||||
if (!fspath) fs->errnum = QSE_FS_ENOMEM;
|
if (!fspath) fs->errnum = QSE_FS_ENOMEM;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -785,7 +783,7 @@ qse_fs_char_t* qse_fs_dupfspathformbs (qse_fs_t* fs, const qse_mchar_t* path)
|
|||||||
#if defined(QSE_FS_CHAR_IS_MCHAR)
|
#if defined(QSE_FS_CHAR_IS_MCHAR)
|
||||||
fspath = qse_mbsdup (path, fs->mmgr);
|
fspath = qse_mbsdup (path, fs->mmgr);
|
||||||
#else
|
#else
|
||||||
fspath = qse_mbstowcsdupwithcmgr (path, QSE_NULL, fs->mmgrm fs->cmgr);
|
fspath = qse_mbstowcsdupwithcmgr (path, QSE_NULL, fs->mmgr, fs->cmgr);
|
||||||
if (!fspath) fs->errnum = QSE_FS_ENOMEM;
|
if (!fspath) fs->errnum = QSE_FS_ENOMEM;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -808,10 +806,10 @@ qse_fs_char_t* qse_fs_dupfspathforwcs (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_freefspathformbs (qse_fs_t* fs, const qse_mchar_t* path, qse_fs_char_t* fspath)
|
||||||
{
|
{
|
||||||
if (path != fspath) QSE_MMGR_FREE (fs->mmgr, fspath);
|
if (path != (const qse_mchar_t*)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)
|
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);
|
if (path != (const qse_wchar_t*)fspath) QSE_MMGR_FREE (fs->mmgr, fspath);
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
typedef DWORD qse_fs_syserr_t;
|
typedef DWORD qse_fs_syserr_t;
|
||||||
#elif defined(__OS2__)
|
#elif defined(__OS2__)
|
||||||
# define INCL_DOSERRORS
|
# define INCL_DOSERRORS
|
||||||
|
# define INCL_DOSFILEMGR
|
||||||
# include <os2.h>
|
# include <os2.h>
|
||||||
typedef APIRET qse_fs_syserr_t;
|
typedef APIRET qse_fs_syserr_t;
|
||||||
#elif defined(__DOS__)
|
#elif defined(__DOS__)
|
||||||
|
@ -182,7 +182,11 @@ static int path_exists (glob_t* g, const qse_char_t* name)
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
/* ------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------- */
|
||||||
struct stat st;
|
#if defined(HAVE_LSTAT)
|
||||||
|
qse_lstat_t st;
|
||||||
|
#else
|
||||||
|
qse_stat_t st;
|
||||||
|
#endif
|
||||||
const qse_mchar_t* mptr;
|
const qse_mchar_t* mptr;
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
#if defined(QSE_CHAR_IS_MCHAR)
|
||||||
@ -193,10 +197,10 @@ static int path_exists (glob_t* g, const qse_char_t* name)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_LSTAT)
|
#if defined(HAVE_LSTAT)
|
||||||
return (QSE_LSTAT (mptr, &st) == 0)? 1: 0;
|
return (QSE_LSTAT (mptr, &st) <= -1)? 0: 1;
|
||||||
#else
|
#else
|
||||||
/* use stat() if no lstat() is available. */
|
/* use stat() if no lstat() is available. */
|
||||||
return (QSE_STAT (mptr, &st) == 0)? 1: 0;
|
return (QSE_STAT (mptr, &st) <= -1)? 0: 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------- */
|
||||||
@ -353,7 +357,6 @@ static int handle_non_wild_segments (glob_t* g, segment_t* seg)
|
|||||||
QSE_ASSERT (seg->type != NONE && !seg->wild);
|
QSE_ASSERT (seg->type != NONE && !seg->wild);
|
||||||
|
|
||||||
if (seg->sep && qse_str_ccat (&g->path, seg->sep) == (qse_size_t)-1) return -1;
|
if (seg->sep && qse_str_ccat (&g->path, seg->sep) == (qse_size_t)-1) return -1;
|
||||||
|
|
||||||
if (seg->esc)
|
if (seg->esc)
|
||||||
{
|
{
|
||||||
/* if the segment contains escape sequences,
|
/* if the segment contains escape sequences,
|
||||||
|
@ -83,20 +83,20 @@ int qse_ismbsdrivecurpath (const qse_mchar_t* path)
|
|||||||
qse_mchar_t* qse_getmbspathcore (const qse_mchar_t* path)
|
qse_mchar_t* qse_getmbspathcore (const qse_mchar_t* path)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
||||||
if (IS_MDRIVE(path)) return path + 2;
|
if (IS_MDRIVE(path)) return (qse_mchar_t*)path + 2;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
else if (IS_MSEP(*ptr) && IS_MSEP(*(ptr + 1)) && !IS_MSEP_OR_MNIL(*(ptr + 2)))
|
else if (IS_MSEP(*path) && IS_MSEP(*(path + 1)) && !IS_MSEP_OR_MNIL(*(path + 2)))
|
||||||
{
|
{
|
||||||
/* UNC Path */
|
/* UNC Path */
|
||||||
ptr += 2;
|
path += 2;
|
||||||
do { ptr++; } while (!IS_MSEP_OR_MNIL(*ptr));
|
do { path++; } while (!IS_MSEP_OR_MNIL(*path));
|
||||||
if (IS_MSEP(*ptr)) return ptr;
|
if (IS_MSEP(*path)) return (qse_mchar_t*)path;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* TOOD: \\server\XXX \\.\XXX \\?\XXX \\?\UNC\server\XXX */
|
/* TOOD: \\server\XXX \\.\XXX \\?\XXX \\?\UNC\server\XXX */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return path;
|
return (qse_mchar_t*)path;
|
||||||
}
|
}
|
||||||
|
|
||||||
qse_size_t qse_canonmbspath (const qse_mchar_t* path, qse_mchar_t* canon, int flags)
|
qse_size_t qse_canonmbspath (const qse_mchar_t* path, qse_mchar_t* canon, int flags)
|
||||||
@ -417,18 +417,18 @@ int qse_iswcsdrivecurpath (const qse_wchar_t* path)
|
|||||||
qse_wchar_t* qse_getwcspathcore (const qse_wchar_t* path)
|
qse_wchar_t* qse_getwcspathcore (const qse_wchar_t* path)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
||||||
if (IS_WDRIVE(path)) return path + 2;
|
if (IS_WDRIVE(path)) return (qse_wchar_t*)path + 2;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
else if (IS_WSEP(*ptr) && IS_WSEP(*(ptr + 1)) && !IS_WSEP_OR_WNIL(*(ptr + 2)))
|
else if (IS_WSEP(*path) && IS_WSEP(*(path + 1)) && !IS_WSEP_OR_WNIL(*(path + 2)))
|
||||||
{
|
{
|
||||||
/* UNC Path */
|
/* UNC Path */
|
||||||
ptr += 2;
|
path += 2;
|
||||||
do { ptr++; } while (!IS_WSEP_OR_WNIL(*ptr));
|
do { path++; } while (!IS_WSEP_OR_WNIL(*path));
|
||||||
if (IS_WSEP(*ptr)) return ptr;
|
if (IS_WSEP(*path)) return (qse_wchar_t*)path;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return path;
|
return (qse_wchar_t*)path;
|
||||||
}
|
}
|
||||||
|
|
||||||
qse_size_t qse_canonwcspath (const qse_wchar_t* path, qse_wchar_t* canon, int flags)
|
qse_size_t qse_canonwcspath (const qse_wchar_t* path, qse_wchar_t* canon, int flags)
|
||||||
|
@ -18,7 +18,7 @@ static int fs_del (qse_fs_t* fs, const qse_char_t* path)
|
|||||||
static void print_usage (const qse_char_t* argv0)
|
static void print_usage (const qse_char_t* argv0)
|
||||||
{
|
{
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("Usage: %s command filename\n"), qse_basename(argv0));
|
qse_fprintf (QSE_STDERR, QSE_T("Usage: %s command filename\n"), qse_basename(argv0));
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("Command is one of delfile | delfile-r | deldir | deldir-r | mkdir | mkdir-p\n"));
|
qse_fprintf (QSE_STDERR, QSE_T("Command is one of rmfile | rmfile-r | rmdir | rmdir-r | mkdir | mkdir-p\n"));
|
||||||
qse_fprintf (QSE_STDERR, QSE_T("Filename is a pattern for delXXX\n"));
|
qse_fprintf (QSE_STDERR, QSE_T("Filename is a pattern for delXXX\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ static int fs_main (int argc, qse_char_t* argv[])
|
|||||||
cbs.del = fs_del;
|
cbs.del = fs_del;
|
||||||
qse_fs_setopt (fs, QSE_FS_CBS, &cbs);
|
qse_fs_setopt (fs, QSE_FS_CBS, &cbs);
|
||||||
|
|
||||||
if (qse_strcmp(argv[1], QSE_T("delfile")) == 0)
|
if (qse_strcmp(argv[1], QSE_T("rmfile")) == 0)
|
||||||
{
|
{
|
||||||
if (qse_fs_delfile (fs, argv[2], QSE_FS_DELFILEMBS_GLOB) <= -1)
|
if (qse_fs_delfile (fs, argv[2], QSE_FS_DELFILEMBS_GLOB) <= -1)
|
||||||
{
|
{
|
||||||
@ -47,7 +47,7 @@ static int fs_main (int argc, qse_char_t* argv[])
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (qse_strcmp(argv[1], QSE_T("delfile-r")) == 0)
|
else if (qse_strcmp(argv[1], QSE_T("rmfile-r")) == 0)
|
||||||
{
|
{
|
||||||
if (qse_fs_delfile (fs, argv[2], QSE_FS_DELFILE_GLOB | QSE_FS_DELFILE_RECURSIVE) <= -1)
|
if (qse_fs_delfile (fs, argv[2], QSE_FS_DELFILE_GLOB | QSE_FS_DELFILE_RECURSIVE) <= -1)
|
||||||
{
|
{
|
||||||
@ -55,7 +55,7 @@ static int fs_main (int argc, qse_char_t* argv[])
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (qse_strcmp (argv[1], QSE_T("deldir")) == 0)
|
else if (qse_strcmp (argv[1], QSE_T("rmdir")) == 0)
|
||||||
{
|
{
|
||||||
if (qse_fs_deldir (fs, argv[2], QSE_FS_DELDIR_GLOB) <= -1)
|
if (qse_fs_deldir (fs, argv[2], QSE_FS_DELDIR_GLOB) <= -1)
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ static int fs_main (int argc, qse_char_t* argv[])
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (qse_strcmp (argv[1], QSE_T("deldir-r")) == 0)
|
else if (qse_strcmp (argv[1], QSE_T("rmdir-r")) == 0)
|
||||||
{
|
{
|
||||||
if (qse_fs_deldir (fs, argv[2], QSE_FS_DELDIR_GLOB | QSE_FS_DELDIR_RECURSIVE) <= -1)
|
if (qse_fs_deldir (fs, argv[2], QSE_FS_DELDIR_GLOB | QSE_FS_DELDIR_RECURSIVE) <= -1)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user