enhanced qse_glob() to handle win/dos/os2 driver letters.
fixed a bug in qse_tio_writembs()
This commit is contained in:
parent
78f6f709ee
commit
f0e03cb4ca
@ -644,7 +644,10 @@ static int expand (int argc, qse_char_t* argv[], xarg_t* xarg)
|
|||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
x = qse_glob (argv[i], collect, xarg, QSE_GLOB_PERIOD, xarg->mmgr);
|
x = qse_glob (argv[i], collect, xarg,
|
||||||
|
QSE_GLOB_NOESCAPE | QSE_GLOB_PERIOD | QSE_GLOB_IGNORECASE,
|
||||||
|
xarg->mmgr
|
||||||
|
);
|
||||||
|
|
||||||
if (x <= -1) return -1;
|
if (x <= -1) return -1;
|
||||||
|
|
||||||
|
@ -24,6 +24,11 @@
|
|||||||
#include <qse/types.h>
|
#include <qse/types.h>
|
||||||
#include <qse/macros.h>
|
#include <qse/macros.h>
|
||||||
|
|
||||||
|
/** @file
|
||||||
|
* This file provides functions, types, macros for wildcard expansion
|
||||||
|
* in a path name.
|
||||||
|
*/
|
||||||
|
|
||||||
typedef int (*qse_glob_cbfun_t) (
|
typedef int (*qse_glob_cbfun_t) (
|
||||||
const qse_cstr_t* path,
|
const qse_cstr_t* path,
|
||||||
void* cbctx
|
void* cbctx
|
||||||
@ -31,14 +36,28 @@ typedef int (*qse_glob_cbfun_t) (
|
|||||||
|
|
||||||
enum qse_glob_flags_t
|
enum qse_glob_flags_t
|
||||||
{
|
{
|
||||||
QSE_GLOB_NOESCAPE = (1 << 0),
|
/** Don't use the backslash as an escape charcter.
|
||||||
QSE_GLOB_PERIOD = (1 << 1)
|
* This option is on in Win32/OS2/DOS. */
|
||||||
|
QSE_GLOB_NOESCAPE = (1 << 0),
|
||||||
|
|
||||||
|
/** Match a leading period explicitly by a literal period in the pattern */
|
||||||
|
QSE_GLOB_PERIOD = (1 << 1),
|
||||||
|
|
||||||
|
/** Perform case-insensitive matching.
|
||||||
|
* This option is always on in Win32/OS2/DOS. */
|
||||||
|
QSE_GLOB_IGNORECASE = (1 << 2)
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The qse_glob() function finds path names matchin the @a pattern.
|
||||||
|
* It calls the call-back function @a cbfun for each path name found.
|
||||||
|
*
|
||||||
|
* @return -1 on failure, 0 on no match, 1 if matches are found.
|
||||||
|
*/
|
||||||
int qse_glob (
|
int qse_glob (
|
||||||
const qse_char_t* pattern,
|
const qse_char_t* pattern,
|
||||||
qse_glob_cbfun_t cbfun,
|
qse_glob_cbfun_t cbfun,
|
||||||
|
@ -39,6 +39,13 @@
|
|||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
||||||
|
/* i don't support escaping in these systems */
|
||||||
|
# define IS_ESC(c) (0)
|
||||||
|
#else
|
||||||
|
# define IS_ESC(c) ((c) == QSE_T('\\'))
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
||||||
# define SEPC QSE_T('\\')
|
# define SEPC QSE_T('\\')
|
||||||
#else
|
#else
|
||||||
@ -54,12 +61,11 @@
|
|||||||
#define IS_NIL(c) ((c) == QSE_T('\0'))
|
#define IS_NIL(c) ((c) == QSE_T('\0'))
|
||||||
#define IS_SEP_OR_NIL(c) (IS_SEP(c) || IS_NIL(c))
|
#define IS_SEP_OR_NIL(c) (IS_SEP(c) || IS_NIL(c))
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
/* only for win32/os2/dos */
|
||||||
/* i don't support escaping in these systems */
|
#define IS_DRIVE(s) \
|
||||||
# define IS_ESC(c) (0)
|
(((s[0] >= QSE_T('A') && s[0] <= QSE_T('Z')) || \
|
||||||
#else
|
(s[0] >= QSE_T('a') && s[0] <= QSE_T('z'))) && \
|
||||||
# define IS_ESC(c) ((c) == QSE_T('\\'))
|
s[1] == QSE_T(':'))
|
||||||
#endif
|
|
||||||
|
|
||||||
/* this macro only checks for top-level wild-cards among these.
|
/* this macro only checks for top-level wild-cards among these.
|
||||||
* *, ?, [], !, -
|
* *, ?, [], !, -
|
||||||
@ -82,7 +88,12 @@ struct glob_t
|
|||||||
qse_cmgr_t* cmgr;
|
qse_cmgr_t* cmgr;
|
||||||
|
|
||||||
qse_str_t path;
|
qse_str_t path;
|
||||||
qse_str_t segtmp;
|
qse_str_t tbuf; /* temporary buffer */
|
||||||
|
#if defined(QSE_CHAR_IS_MCHAR) || defined(_WIN32)
|
||||||
|
/* nothing */
|
||||||
|
#else
|
||||||
|
qse_mbs_t mbuf;
|
||||||
|
#endif
|
||||||
|
|
||||||
int expanded;
|
int expanded;
|
||||||
int fnmat_flags;
|
int fnmat_flags;
|
||||||
@ -95,6 +106,17 @@ struct glob_t
|
|||||||
|
|
||||||
typedef struct glob_t glob_t;
|
typedef struct glob_t glob_t;
|
||||||
|
|
||||||
|
static qse_mchar_t* wcs_to_mbuf (glob_t* g, const qse_wchar_t* wcs, qse_mbs_t* mbs)
|
||||||
|
{
|
||||||
|
qse_size_t ml, wl;
|
||||||
|
|
||||||
|
if (qse_wcstombswithcmgr (wcs, &wl, QSE_NULL, &ml, g->cmgr) <= -1 ||
|
||||||
|
qse_mbs_setlen (mbs, ml) == (qse_size_t)-1) return QSE_NULL;
|
||||||
|
|
||||||
|
qse_wcstombswithcmgr (wcs, &wl, QSE_MBS_PTR(mbs), &ml, g->cmgr);
|
||||||
|
return QSE_MBS_PTR(mbs);
|
||||||
|
}
|
||||||
|
|
||||||
static int path_exists (glob_t* g, const qse_char_t* name)
|
static int path_exists (glob_t* g, const qse_char_t* name)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
@ -108,22 +130,16 @@ static int path_exists (glob_t* g, const qse_char_t* name)
|
|||||||
/* ------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------- */
|
||||||
FILESTATUS3 fs;
|
FILESTATUS3 fs;
|
||||||
APIRET rc;
|
APIRET rc;
|
||||||
|
const qse_mchar_t* mptr;
|
||||||
qse_mchar_t* mptr;
|
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
#if defined(QSE_CHAR_IS_MCHAR)
|
||||||
mptr = name;
|
mptr = name;
|
||||||
#else
|
#else
|
||||||
mptr = qse_wcstombsdup (name, g->mmgr);
|
mptr = wcs_to_mbuf (g, name, &g->mbuf);
|
||||||
if (mptr == QSE_NULL) return -1;
|
if (mptr == QSE_NULL) return -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rc = DosQueryPathInfo (mptr, FIL_STANDARD, &fs, QSE_SIZEOF(fs));
|
rc = DosQueryPathInfo (mptr, FIL_STANDARD, &fs, QSE_SIZEOF(fs));
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
|
||||||
/* nothing to do */
|
|
||||||
#else
|
|
||||||
QSE_MMGR_FREE (g->mmgr, mptr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return (rc == NO_ERROR)? 1:
|
return (rc == NO_ERROR)? 1:
|
||||||
(rc == ERROR_PATH_NOT_FOUND)? 0: -1;
|
(rc == ERROR_PATH_NOT_FOUND)? 0: -1;
|
||||||
@ -133,21 +149,16 @@ static int path_exists (glob_t* g, const qse_char_t* name)
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------- */
|
||||||
unsigned int x, attr;
|
unsigned int x, attr;
|
||||||
|
const qse_mchar_t* mptr;
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
#if defined(QSE_CHAR_IS_MCHAR)
|
||||||
|
mptr = name;
|
||||||
x = _dos_getfileattr (name, &attr);
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
qse_mchar_t* mptr;
|
mptr = wcs_to_mbuf (g, name, &g->mbuf);
|
||||||
|
|
||||||
mptr = qse_wcstombsdup (name, g->mmgr);
|
|
||||||
if (mptr == QSE_NULL) return -1;
|
if (mptr == QSE_NULL) return -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
x = _dos_getfileattr (mptr, &attr);
|
x = _dos_getfileattr (mptr, &attr);
|
||||||
QSE_MMGR_FREE (g->mmgr, mptr);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
return (x == 0)? 1:
|
return (x == 0)? 1:
|
||||||
(errno == ENOENT)? 0: -1;
|
(errno == ENOENT)? 0: -1;
|
||||||
/* ------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------- */
|
||||||
@ -156,23 +167,16 @@ static int path_exists (glob_t* g, const qse_char_t* name)
|
|||||||
|
|
||||||
/* ------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------- */
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int x;
|
const qse_mchar_t* mptr;
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
#if defined(QSE_CHAR_IS_MCHAR)
|
||||||
|
mptr = name;
|
||||||
x = lstat (name, &st);
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
qse_mchar_t* mptr;
|
mptr = wcs_to_mbuf (g, name, &g->mbuf);
|
||||||
|
|
||||||
mptr = qse_wcstombsdup (name, g->mmgr);
|
|
||||||
if (mptr == QSE_NULL) return -1;
|
if (mptr == QSE_NULL) return -1;
|
||||||
|
|
||||||
x = lstat (mptr, &st);
|
|
||||||
QSE_MMGR_FREE (g->mmgr, mptr);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return (x == 0)? 1: 0;
|
|
||||||
|
return (lstat (mptr, &st) == 0)? 1: 0;
|
||||||
/* ------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------- */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -200,8 +204,6 @@ typedef struct segment_t segment_t;
|
|||||||
|
|
||||||
static int get_next_segment (glob_t* g, segment_t* seg)
|
static int get_next_segment (glob_t* g, segment_t* seg)
|
||||||
{
|
{
|
||||||
/* TODO: WIN32 X: drive letter segment... */
|
|
||||||
|
|
||||||
if (seg->type == NONE)
|
if (seg->type == NONE)
|
||||||
{
|
{
|
||||||
/* seg->ptr must point to the beginning of the pattern
|
/* seg->ptr must point to the beginning of the pattern
|
||||||
@ -219,6 +221,18 @@ 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__)
|
||||||
|
else if (IS_DRIVE(seg->ptr))
|
||||||
|
{
|
||||||
|
seg->type = ROOT;
|
||||||
|
seg->len = 2;
|
||||||
|
if (IS_SEP(seg->ptr[2])) seg->len++;
|
||||||
|
seg->next = IS_NIL(seg->ptr[seg->len])? 0: 1;
|
||||||
|
seg->sep = QSE_T('\0');
|
||||||
|
seg->wild = 0;
|
||||||
|
seg->esc = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int escaped = 0;
|
int escaped = 0;
|
||||||
@ -354,7 +368,7 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
|||||||
|
|
||||||
if (path->len <= 0)
|
if (path->len <= 0)
|
||||||
{
|
{
|
||||||
if (qse_str_cpy (&g->segtmp, QSE_T("*")) == (qse_size_t)-1)
|
if (qse_str_cpy (&g->tbuf, QSE_T("*")) == (qse_size_t)-1)
|
||||||
{
|
{
|
||||||
QSE_MMGR_FREE (g->mmgr, dp);
|
QSE_MMGR_FREE (g->mmgr, dp);
|
||||||
return QSE_NULL;
|
return QSE_NULL;
|
||||||
@ -362,18 +376,18 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (qse_str_cpy (&g->segtmp, path->ptr) == (qse_size_t)-1 ||
|
if (qse_str_cpy (&g->tbuf, path->ptr) == (qse_size_t)-1 ||
|
||||||
(!IS_SEP(path->ptr[path->len-1]) &&
|
(!IS_SEP(path->ptr[path->len-1]) &&
|
||||||
!qse_isdrivecurpath(path->ptr) &&
|
!qse_isdrivecurpath(path->ptr) &&
|
||||||
qse_str_ccat (&g->segtmp, QSE_T('\\')) == (qse_size_t)-1) ||
|
qse_str_ccat (&g->tbuf, QSE_T('\\')) == (qse_size_t)-1) ||
|
||||||
qse_str_ccat (&g->segtmp, QSE_T('*')) == (qse_size_t)-1)
|
qse_str_ccat (&g->tbuf, QSE_T('*')) == (qse_size_t)-1)
|
||||||
{
|
{
|
||||||
QSE_MMGR_FREE (g->mmgr, dp);
|
QSE_MMGR_FREE (g->mmgr, dp);
|
||||||
return QSE_NULL;
|
return QSE_NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dp->h = FindFirstFile (QSE_STR_PTR(&g->segtmp), &dp->wfd);
|
dp->h = FindFirstFile (QSE_STR_PTR(&g->tbuf), &dp->wfd);
|
||||||
if (dp->h == INVALID_HANDLE_VALUE)
|
if (dp->h == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
QSE_MMGR_FREE (g->mmgr, dp);
|
QSE_MMGR_FREE (g->mmgr, dp);
|
||||||
@ -395,7 +409,7 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
|||||||
|
|
||||||
if (path->len <= 0)
|
if (path->len <= 0)
|
||||||
{
|
{
|
||||||
if (qse_str_cpy (&g->segtmp, QSE_T("*.*")) == (qse_size_t)-1)
|
if (qse_str_cpy (&g->tbuf, QSE_T("*.*")) == (qse_size_t)-1)
|
||||||
{
|
{
|
||||||
QSE_MMGR_FREE (g->mmgr, dp);
|
QSE_MMGR_FREE (g->mmgr, dp);
|
||||||
return QSE_NULL;
|
return QSE_NULL;
|
||||||
@ -403,11 +417,11 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (qse_str_cpy (&g->segtmp, path->ptr) == (qse_size_t)-1 ||
|
if (qse_str_cpy (&g->tbuf, path->ptr) == (qse_size_t)-1 ||
|
||||||
(!IS_SEP(path->ptr[path->len-1]) &&
|
(!IS_SEP(path->ptr[path->len-1]) &&
|
||||||
!qse_isdrivecurpath(path->ptr) &&
|
!qse_isdrivecurpath(path->ptr) &&
|
||||||
qse_str_ccat (&g->segtmp, QSE_T('\\')) == (qse_size_t)-1) ||
|
qse_str_ccat (&g->tbuf, QSE_T('\\')) == (qse_size_t)-1) ||
|
||||||
qse_str_cat (&g->segtmp, QSE_T("*.*")) == (qse_size_t)-1)
|
qse_str_cat (&g->tbuf, QSE_T("*.*")) == (qse_size_t)-1)
|
||||||
{
|
{
|
||||||
QSE_MMGR_FREE (g->mmgr, dp);
|
QSE_MMGR_FREE (g->mmgr, dp);
|
||||||
return QSE_NULL;
|
return QSE_NULL;
|
||||||
@ -418,9 +432,9 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
|||||||
dp->count = 1;
|
dp->count = 1;
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
#if defined(QSE_CHAR_IS_MCHAR)
|
||||||
mptr = QSE_STR_PTR(&g->segtmp);
|
mptr = QSE_STR_PTR(&g->tbuf);
|
||||||
#else
|
#else
|
||||||
mptr = qse_wcstombsdup (QSE_STR_PTR(&g->segtmp), g->mmgr);
|
mptr = wcs_to_mbuf (g, QSE_STR_PTR(&g->tbuf), &g->mbuf);
|
||||||
if (mptr == QSE_NULL)
|
if (mptr == QSE_NULL)
|
||||||
{
|
{
|
||||||
QSE_MMGR_FREE (g->mmgr, dp);
|
QSE_MMGR_FREE (g->mmgr, dp);
|
||||||
@ -436,11 +450,7 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
|||||||
QSE_SIZEOF(dp->ffb),
|
QSE_SIZEOF(dp->ffb),
|
||||||
&dp->count,
|
&dp->count,
|
||||||
FIL_STANDARDL);
|
FIL_STANDARDL);
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
|
||||||
/* nothing to do */
|
|
||||||
#else
|
|
||||||
QSE_MMGR_FREE (g->mmgr, mptr);
|
|
||||||
#endif
|
|
||||||
if (rc != NO_ERROR)
|
if (rc != NO_ERROR)
|
||||||
{
|
{
|
||||||
QSE_MMGR_FREE (g->mmgr, dp);
|
QSE_MMGR_FREE (g->mmgr, dp);
|
||||||
@ -456,6 +466,7 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
|||||||
DIR* dp;
|
DIR* dp;
|
||||||
unsigned int rc;
|
unsigned int rc;
|
||||||
qse_mchar_t* mptr;
|
qse_mchar_t* mptr;
|
||||||
|
qse_size_t wl, ml;
|
||||||
|
|
||||||
dp = QSE_MMGR_ALLOC (g->mmgr, QSE_SIZEOF(*dp));
|
dp = QSE_MMGR_ALLOC (g->mmgr, QSE_SIZEOF(*dp));
|
||||||
if (dp == QSE_NULL) return QSE_NULL;
|
if (dp == QSE_NULL) return QSE_NULL;
|
||||||
@ -464,7 +475,7 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
|||||||
|
|
||||||
if (path->len <= 0)
|
if (path->len <= 0)
|
||||||
{
|
{
|
||||||
if (qse_str_cpy (&g->segtmp, QSE_T("*.*")) == (qse_size_t)-1)
|
if (qse_str_cpy (&g->tbuf, QSE_T("*.*")) == (qse_size_t)-1)
|
||||||
{
|
{
|
||||||
QSE_MMGR_FREE (g->mmgr, dp);
|
QSE_MMGR_FREE (g->mmgr, dp);
|
||||||
return QSE_NULL;
|
return QSE_NULL;
|
||||||
@ -472,11 +483,11 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (qse_str_cpy (&g->segtmp, path->ptr) == (qse_size_t)-1 ||
|
if (qse_str_cpy (&g->tbuf, path->ptr) == (qse_size_t)-1 ||
|
||||||
(!IS_SEP(path->ptr[path->len-1]) &&
|
(!IS_SEP(path->ptr[path->len-1]) &&
|
||||||
!qse_isdrivecurpath(path->ptr) &&
|
!qse_isdrivecurpath(path->ptr) &&
|
||||||
qse_str_ccat (&g->segtmp, QSE_T('\\')) == (qse_size_t)-1) ||
|
qse_str_ccat (&g->tbuf, QSE_T('\\')) == (qse_size_t)-1) ||
|
||||||
qse_str_cat (&g->segtmp, QSE_T("*.*")) == (qse_size_t)-1)
|
qse_str_cat (&g->tbuf, QSE_T("*.*")) == (qse_size_t)-1)
|
||||||
{
|
{
|
||||||
QSE_MMGR_FREE (g->mmgr, dp);
|
QSE_MMGR_FREE (g->mmgr, dp);
|
||||||
return QSE_NULL;
|
return QSE_NULL;
|
||||||
@ -484,10 +495,10 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
#if defined(QSE_CHAR_IS_MCHAR)
|
||||||
mptr = QSE_STR_PTR(&g->segtmp);
|
mptr = QSE_STR_PTR(&g->tbuf);
|
||||||
#else
|
#else
|
||||||
mptr = qse_wcstombsdup (QSE_STR_PTR(&g->segtmp), g->mmgr);
|
mptr = wcs_to_mbuf (g, QSE_STR_PTR(&g->tbuf), &g->mbuf);
|
||||||
if (mptr == QSE_NULL)
|
if (mptr == QSE_NULL)
|
||||||
{
|
{
|
||||||
QSE_MMGR_FREE (g->mmgr, dp);
|
QSE_MMGR_FREE (g->mmgr, dp);
|
||||||
return QSE_NULL;
|
return QSE_NULL;
|
||||||
@ -496,11 +507,6 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
|||||||
|
|
||||||
rc = _dos_findfirst (mptr, _A_NORMAL | _A_SUBDIR, &dp->f);
|
rc = _dos_findfirst (mptr, _A_NORMAL | _A_SUBDIR, &dp->f);
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
|
||||||
/* nothing to do */
|
|
||||||
#else
|
|
||||||
QSE_MMGR_FREE (g->mmgr, mptr);
|
|
||||||
#endif
|
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
{
|
{
|
||||||
QSE_MMGR_FREE (g->mmgr, dp);
|
QSE_MMGR_FREE (g->mmgr, dp);
|
||||||
@ -515,7 +521,7 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
|||||||
/* ------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------- */
|
||||||
|
|
||||||
#if defined(QSE_CHAR_IS_MCHAR)
|
#if defined(QSE_CHAR_IS_MCHAR)
|
||||||
return opendir ((path->len <= 0)? p = QSE_T("."): path->ptr);
|
return opendir ((path->len <= 0)? QSE_T("."): path->ptr);
|
||||||
#else
|
#else
|
||||||
if (path->len <= 0)
|
if (path->len <= 0)
|
||||||
{
|
{
|
||||||
@ -523,17 +529,12 @@ static DIR* xopendir (glob_t* g, const qse_cstr_t* path)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DIR* dp;
|
|
||||||
qse_mchar_t* mptr;
|
qse_mchar_t* mptr;
|
||||||
|
|
||||||
mptr = qse_wcstombsdup (path->ptr, g->mmgr);
|
mptr = wcs_to_mbuf (g, path->ptr, &g->mbuf);
|
||||||
if (mptr == QSE_NULL) return QSE_NULL;
|
if (mptr == QSE_NULL) return QSE_NULL;
|
||||||
|
|
||||||
dp = opendir (mptr);
|
return opendir (mptr);
|
||||||
|
|
||||||
QSE_MMGR_FREE (g->mmgr, mptr);
|
|
||||||
|
|
||||||
return dp;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* ------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------- */
|
||||||
@ -672,10 +673,10 @@ static int handle_non_wild_segments (glob_t* g, segment_t* seg)
|
|||||||
qse_size_t i;
|
qse_size_t i;
|
||||||
int escaped = 0;
|
int escaped = 0;
|
||||||
|
|
||||||
if (QSE_STR_CAPA(&g->segtmp) < seg->len &&
|
if (QSE_STR_CAPA(&g->tbuf) < seg->len &&
|
||||||
qse_str_setcapa (&g->segtmp, seg->len) == (qse_size_t)-1) return -1;
|
qse_str_setcapa (&g->tbuf, seg->len) == (qse_size_t)-1) return -1;
|
||||||
|
|
||||||
tmp.ptr = QSE_STR_PTR(&g->segtmp);
|
tmp.ptr = QSE_STR_PTR(&g->tbuf);
|
||||||
tmp.len = 0;
|
tmp.len = 0;
|
||||||
|
|
||||||
/* the following loop drops the last character
|
/* the following loop drops the last character
|
||||||
@ -886,18 +887,30 @@ int qse_globwithcmgr (const qse_char_t* pattern, qse_glob_cbfun_t cbfun, void* c
|
|||||||
g.cmgr = cmgr;
|
g.cmgr = cmgr;
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
#if defined(_WIN32) || defined(__OS2__) || defined(__DOS__)
|
||||||
g.fnmat_flags |= QSE_STRFNMAT_NOESCAPE | QSE_STRFNMAT_IGNORECASE;
|
g.fnmat_flags |= QSE_STRFNMAT_IGNORECASE;
|
||||||
|
g.fnmat_flags |= QSE_STRFNMAT_NOESCAPE;
|
||||||
#else
|
#else
|
||||||
|
if (flags & QSE_GLOB_IGNORECASE) g.fnmat_flags |= QSE_STRFNMAT_IGNORECASE;
|
||||||
if (flags & QSE_GLOB_NOESCAPE) g.fnmat_flags |= QSE_STRFNMAT_NOESCAPE;
|
if (flags & QSE_GLOB_NOESCAPE) g.fnmat_flags |= QSE_STRFNMAT_NOESCAPE;
|
||||||
#endif
|
#endif
|
||||||
if (flags & QSE_GLOB_PERIOD) g.fnmat_flags |= QSE_STRFNMAT_PERIOD;
|
if (flags & QSE_GLOB_PERIOD) g.fnmat_flags |= QSE_STRFNMAT_PERIOD;
|
||||||
|
|
||||||
if (qse_str_init (&g.path, mmgr, 512) <= -1) return -1;
|
if (qse_str_init (&g.path, mmgr, 512) <= -1) return -1;
|
||||||
if (qse_str_init (&g.segtmp, mmgr, 256) <= -1)
|
if (qse_str_init (&g.tbuf, mmgr, 256) <= -1)
|
||||||
{
|
{
|
||||||
qse_str_fini (&g.path);
|
qse_str_fini (&g.path);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
#if defined(QSE_CHAR_IS_MCHAR) || defined(_WIN32)
|
||||||
|
/* nothing */
|
||||||
|
#else
|
||||||
|
if (qse_mbs_init (&g.mbuf, mmgr, 512) <= -1)
|
||||||
|
{
|
||||||
|
qse_str_fini (&g.path);
|
||||||
|
qse_str_fini (&g.path);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QSE_MEMSET (&seg, 0, QSE_SIZEOF(seg));
|
QSE_MEMSET (&seg, 0, QSE_SIZEOF(seg));
|
||||||
seg.type = NONE;
|
seg.type = NONE;
|
||||||
@ -906,7 +919,12 @@ int qse_globwithcmgr (const qse_char_t* pattern, qse_glob_cbfun_t cbfun, void* c
|
|||||||
|
|
||||||
x = search (&g, &seg);
|
x = search (&g, &seg);
|
||||||
|
|
||||||
qse_str_fini (&g.segtmp);
|
#if defined(QSE_CHAR_IS_MCHAR) || defined(_WIN32)
|
||||||
|
/* nothing */
|
||||||
|
#else
|
||||||
|
qse_mbs_fini (&g.mbuf);
|
||||||
|
#endif
|
||||||
|
qse_str_fini (&g.tbuf);
|
||||||
qse_str_fini (&g.path);
|
qse_str_fini (&g.path);
|
||||||
|
|
||||||
if (x <= -1) return -1;
|
if (x <= -1) return -1;
|
||||||
|
@ -627,13 +627,16 @@ qse_ssize_t qse_tio_writembs (
|
|||||||
for (xend = xptr + mlen; xptr < xend; xptr++)
|
for (xend = xptr + mlen; xptr < xend; xptr++)
|
||||||
{
|
{
|
||||||
/* TODO: support different line terminating characeter */
|
/* TODO: support different line terminating characeter */
|
||||||
tio->out.buf.ptr[tio->outbuf_len++] = *xptr;
|
if (*xptr == QSE_MT('\n'))
|
||||||
if (*xptr == QSE_MT('\n'))
|
|
||||||
{
|
{
|
||||||
nl = 1;
|
nl = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tio->out.buf.ptr[tio->outbuf_len++] = *xptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* continue copying without checking for nl */
|
||||||
while (xptr < xend) tio->out.buf.ptr[tio->outbuf_len++] = *xptr++;
|
while (xptr < xend) tio->out.buf.ptr[tio->outbuf_len++] = *xptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -655,8 +658,7 @@ qse_ssize_t qse_tio_writewcs (
|
|||||||
if (tio->outbuf_len >= tio->out.buf.capa)
|
if (tio->outbuf_len >= tio->out.buf.capa)
|
||||||
{
|
{
|
||||||
/* maybe, previous flush operation has failed a few
|
/* maybe, previous flush operation has failed a few
|
||||||
* times previously. so the buffer is full.
|
* times previously. so the buffer is full. */
|
||||||
*/
|
|
||||||
tio->errnum = QSE_TIO_ENOSPC;
|
tio->errnum = QSE_TIO_ENOSPC;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,10 @@ LDFLAGS = -L../../lib/awk -L../../lib/cmn
|
|||||||
LDADD = -lqseawk -lqsecmn $(LIBM)
|
LDADD = -lqseawk -lqsecmn $(LIBM)
|
||||||
|
|
||||||
if WIN32
|
if WIN32
|
||||||
|
if WCHAR
|
||||||
LDADD += $(UNICOWS_LIBS)
|
LDADD += $(UNICOWS_LIBS)
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
awk01_SOURCES = awk01.c
|
awk01_SOURCES = awk01.c
|
||||||
awk02_SOURCES = awk02.c
|
awk02_SOURCES = awk02.c
|
||||||
|
@ -37,7 +37,7 @@ host_triplet = @host@
|
|||||||
bin_PROGRAMS = awk01$(EXEEXT) awk02$(EXEEXT) awk03$(EXEEXT) \
|
bin_PROGRAMS = awk01$(EXEEXT) awk02$(EXEEXT) awk03$(EXEEXT) \
|
||||||
awk04$(EXEEXT) awk09$(EXEEXT) awk10$(EXEEXT) awk11$(EXEEXT) \
|
awk04$(EXEEXT) awk09$(EXEEXT) awk10$(EXEEXT) awk11$(EXEEXT) \
|
||||||
$(am__EXEEXT_1)
|
$(am__EXEEXT_1)
|
||||||
@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
|
@WCHAR_TRUE@@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
|
||||||
@ENABLE_CXX_TRUE@am__append_2 = awk05 awk06 awk07 awk08 awk12 awk13 awk14
|
@ENABLE_CXX_TRUE@am__append_2 = awk05 awk06 awk07 awk08 awk12 awk13 awk14
|
||||||
subdir = samples/awk
|
subdir = samples/awk
|
||||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||||
@ -62,7 +62,7 @@ am_awk01_OBJECTS = awk01.$(OBJEXT)
|
|||||||
awk01_OBJECTS = $(am_awk01_OBJECTS)
|
awk01_OBJECTS = $(am_awk01_OBJECTS)
|
||||||
awk01_LDADD = $(LDADD)
|
awk01_LDADD = $(LDADD)
|
||||||
am__DEPENDENCIES_1 =
|
am__DEPENDENCIES_1 =
|
||||||
@WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
|
@WCHAR_TRUE@@WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
|
||||||
awk01_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
|
awk01_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
|
||||||
am_awk02_OBJECTS = awk02.$(OBJEXT)
|
am_awk02_OBJECTS = awk02.$(OBJEXT)
|
||||||
awk02_OBJECTS = $(am_awk02_OBJECTS)
|
awk02_OBJECTS = $(am_awk02_OBJECTS)
|
||||||
|
@ -45,8 +45,10 @@ LDFLAGS = -L../../lib/cmn
|
|||||||
LDADD = -lqsecmn
|
LDADD = -lqsecmn
|
||||||
|
|
||||||
if WIN32
|
if WIN32
|
||||||
|
if WCHAR
|
||||||
LDADD += $(UNICOWS_LIBS)
|
LDADD += $(UNICOWS_LIBS)
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
chr01_SOURCES = chr01.c
|
chr01_SOURCES = chr01.c
|
||||||
env_SOURCES = env.c
|
env_SOURCES = env.c
|
||||||
|
@ -43,7 +43,7 @@ bin_PROGRAMS = chr01$(EXEEXT) env$(EXEEXT) dll$(EXEEXT) fio01$(EXEEXT) \
|
|||||||
sio01$(EXEEXT) sio02$(EXEEXT) sio03$(EXEEXT) sll$(EXEEXT) \
|
sio01$(EXEEXT) sio02$(EXEEXT) sio03$(EXEEXT) sll$(EXEEXT) \
|
||||||
slmb01$(EXEEXT) str01$(EXEEXT) time$(EXEEXT) tre01$(EXEEXT) \
|
slmb01$(EXEEXT) str01$(EXEEXT) time$(EXEEXT) tre01$(EXEEXT) \
|
||||||
xma$(EXEEXT)
|
xma$(EXEEXT)
|
||||||
@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
|
@WCHAR_TRUE@@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
|
||||||
subdir = samples/cmn
|
subdir = samples/cmn
|
||||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
@ -64,7 +64,7 @@ am_chr01_OBJECTS = chr01.$(OBJEXT)
|
|||||||
chr01_OBJECTS = $(am_chr01_OBJECTS)
|
chr01_OBJECTS = $(am_chr01_OBJECTS)
|
||||||
chr01_LDADD = $(LDADD)
|
chr01_LDADD = $(LDADD)
|
||||||
am__DEPENDENCIES_1 =
|
am__DEPENDENCIES_1 =
|
||||||
@WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
|
@WCHAR_TRUE@@WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
|
||||||
chr01_DEPENDENCIES = $(am__DEPENDENCIES_2)
|
chr01_DEPENDENCIES = $(am__DEPENDENCIES_2)
|
||||||
am_dll_OBJECTS = dll.$(OBJEXT)
|
am_dll_OBJECTS = dll.$(OBJEXT)
|
||||||
dll_OBJECTS = $(am_dll_OBJECTS)
|
dll_OBJECTS = $(am_dll_OBJECTS)
|
||||||
|
@ -44,7 +44,11 @@ static int test1 (void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if (QSE_SIZEOF_LONG_LONG > 0)
|
||||||
qse_printf (QSE_T("file offset at %lld\n"), (long long)off);
|
qse_printf (QSE_T("file offset at %lld\n"), (long long)off);
|
||||||
|
#else
|
||||||
|
qse_printf (QSE_T("file offset at %ld\n"), (long)off);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
off = qse_fio_seek (fio, 0, QSE_FIO_BEGIN);
|
off = qse_fio_seek (fio, 0, QSE_FIO_BEGIN);
|
||||||
@ -54,7 +58,11 @@ static int test1 (void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if (QSE_SIZEOF_LONG_LONG > 0)
|
||||||
qse_printf (QSE_T("moved file offset to %lld\n"), (long long)off);
|
qse_printf (QSE_T("moved file offset to %lld\n"), (long long)off);
|
||||||
|
#else
|
||||||
|
qse_printf (QSE_T("moved file offset to %ld\n"), (long)off);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
n = qse_fio_read (fio, buf, sizeof(buf));
|
n = qse_fio_read (fio, buf, sizeof(buf));
|
||||||
@ -68,14 +76,22 @@ static int test1 (void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (QSE_SIZEOF_LONG_LONG > 0)
|
||||||
off = qse_fio_seek (fio, QSE_TYPE_MAX(int) * 3llu, QSE_FIO_BEGIN);
|
off = qse_fio_seek (fio, QSE_TYPE_MAX(int) * 3llu, QSE_FIO_BEGIN);
|
||||||
|
#else
|
||||||
|
off = qse_fio_seek (fio, QSE_TYPE_MAX(int), QSE_FIO_BEGIN);
|
||||||
|
#endif
|
||||||
if (off == (qse_fio_off_t)-1)
|
if (off == (qse_fio_off_t)-1)
|
||||||
{
|
{
|
||||||
qse_printf (QSE_T("failed to set file offset\n"));
|
qse_printf (QSE_T("failed to set file offset\n"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if (QSE_SIZEOF_LONG_LONG > 0)
|
||||||
qse_printf (QSE_T("moved file offset to %lld\n"), (long long)off);
|
qse_printf (QSE_T("moved file offset to %lld\n"), (long long)off);
|
||||||
|
#else
|
||||||
|
qse_printf (QSE_T("moved file offset to %ld\n"), (long)off);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
n = qse_fio_write (fio, x2, qse_mbslen(x2));
|
n = qse_fio_write (fio, x2, qse_mbslen(x2));
|
||||||
@ -130,7 +146,11 @@ static int test2 (void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if (QSE_SIZEOF_LONG_LONG > 0)
|
||||||
qse_printf (QSE_T("file offset at %lld\n"), (long long)off);
|
qse_printf (QSE_T("file offset at %lld\n"), (long long)off);
|
||||||
|
#else
|
||||||
|
qse_printf (QSE_T("file offset at %ld\n"), (long)off);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
off = qse_fio_seek (fio, 0, QSE_FIO_BEGIN);
|
off = qse_fio_seek (fio, 0, QSE_FIO_BEGIN);
|
||||||
@ -140,7 +160,11 @@ static int test2 (void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if (QSE_SIZEOF_LONG_LONG > 0)
|
||||||
qse_printf (QSE_T("moved file offset to %lld\n"), (long long)off);
|
qse_printf (QSE_T("moved file offset to %lld\n"), (long long)off);
|
||||||
|
#else
|
||||||
|
qse_printf (QSE_T("moved file offset to %ld\n"), (long)off);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,14 +180,22 @@ static int test2 (void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (QSE_SIZEOF_LONG_LONG > 0)
|
||||||
off = qse_fio_seek (fio, QSE_TYPE_MAX(int) * 2llu, QSE_FIO_BEGIN);
|
off = qse_fio_seek (fio, QSE_TYPE_MAX(int) * 2llu, QSE_FIO_BEGIN);
|
||||||
|
#else
|
||||||
|
off = qse_fio_seek (fio, QSE_TYPE_MAX(int) + 99999lu, QSE_FIO_BEGIN);
|
||||||
|
#endif
|
||||||
if (off == (qse_fio_off_t)-1)
|
if (off == (qse_fio_off_t)-1)
|
||||||
{
|
{
|
||||||
qse_printf (QSE_T("failed to set file offset\n"));
|
qse_printf (QSE_T("failed to set file offset\n"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if (QSE_SIZEOF_LONG_LONG > 0)
|
||||||
qse_printf (QSE_T("moved file offset to %lld\n"), (long long)off);
|
qse_printf (QSE_T("moved file offset to %lld\n"), (long long)off);
|
||||||
|
#else
|
||||||
|
qse_printf (QSE_T("moved file offset to %ld\n"), (long)off);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
n = qse_fio_write (fio, x2, qse_mbslen(x2));
|
n = qse_fio_write (fio, x2, qse_mbslen(x2));
|
||||||
@ -176,7 +208,11 @@ static int test2 (void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if (QSE_SIZEOF_LONG_LONG > 0)
|
||||||
qse_printf (QSE_T("file offset at %lld\n"), (long long)off);
|
qse_printf (QSE_T("file offset at %lld\n"), (long long)off);
|
||||||
|
#else
|
||||||
|
qse_printf (QSE_T("file offset at %ld\n"), (long)off);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qse_fio_truncate (fio, 20000) == -1)
|
if (qse_fio_truncate (fio, 20000) == -1)
|
||||||
@ -194,7 +230,11 @@ static int test2 (void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if (QSE_SIZEOF_LONG_LONG > 0)
|
||||||
qse_printf (QSE_T("file offset at %lld\n"), (long long)off);
|
qse_printf (QSE_T("file offset at %lld\n"), (long long)off);
|
||||||
|
#else
|
||||||
|
qse_printf (QSE_T("file offset at %ld\n"), (long)off);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* on _WIN32, this will fail as this file is opened without
|
/* on _WIN32, this will fail as this file is opened without
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* NOTE Targets without a 64-bit or bigger integer will suffer
|
||||||
|
* since milliseconds could be too large for a 32-bit integer.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <qse/cmn/time.h>
|
#include <qse/cmn/time.h>
|
||||||
#include <qse/cmn/stdio.h>
|
#include <qse/cmn/stdio.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
@ -14,10 +19,12 @@
|
|||||||
|
|
||||||
void print_time (qse_ntime_t nt, const qse_btime_t* bt)
|
void print_time (qse_ntime_t nt, const qse_btime_t* bt)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32)
|
||||||
qse_printf (QSE_T("TIME: %I64d\n"), (__int64)nt);
|
qse_printf (QSE_T("TIME: %I64d\n"), (__int64)nt);
|
||||||
#else
|
#elif (QSE_SIZEOF_LONG_LONG > 0)
|
||||||
qse_printf (QSE_T("TIME: %lld\n"), (long long)nt);
|
qse_printf (QSE_T("TIME: %lld\n"), (long long)nt);
|
||||||
|
#else
|
||||||
|
qse_printf (QSE_T("TIME: %ld\n"), (long)nt);
|
||||||
#endif
|
#endif
|
||||||
qse_printf (QSE_T("year: %d\n"), bt->year + QSE_BTIME_YEAR_BASE);
|
qse_printf (QSE_T("year: %d\n"), bt->year + QSE_BTIME_YEAR_BASE);
|
||||||
qse_printf (QSE_T("mon: %d\n"), bt->mon + 1);
|
qse_printf (QSE_T("mon: %d\n"), bt->mon + 1);
|
||||||
@ -54,8 +61,10 @@ static int test1 (void)
|
|||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
qse_printf (QSE_T("back to ntime: %I64d\n"), (__int64)nt);
|
qse_printf (QSE_T("back to ntime: %I64d\n"), (__int64)nt);
|
||||||
#else
|
#elif (QSE_SIZEOF_LONG_LONG > 0)
|
||||||
qse_printf (QSE_T("back to ntime: %lld\n"), (long long)nt);
|
qse_printf (QSE_T("back to ntime: %lld\n"), (long long)nt);
|
||||||
|
#else
|
||||||
|
qse_printf (QSE_T("back to ntime: %ld\n"), (long)nt);
|
||||||
#endif
|
#endif
|
||||||
qse_gmtime (nt, &bt);
|
qse_gmtime (nt, &bt);
|
||||||
print_time (nt, &bt);
|
print_time (nt, &bt);
|
||||||
@ -68,8 +77,11 @@ static int test1 (void)
|
|||||||
qse_printf (QSE_T("-------------------------------\n"));
|
qse_printf (QSE_T("-------------------------------\n"));
|
||||||
|
|
||||||
|
|
||||||
for (nt = (qse_ntime_t)QSE_TYPE_MIN(int);
|
#if (QSE_SIZEOF_LONG_LONG > 0)
|
||||||
nt <= (qse_ntime_t)QSE_TYPE_MAX(int); nt += QSE_SECS_PER_DAY)
|
for (nt = (qse_ntime_t)QSE_TYPE_MIN(int); nt <= (qse_ntime_t)QSE_TYPE_MAX(int); nt += QSE_SECS_PER_DAY)
|
||||||
|
#else
|
||||||
|
for (nt = QSE_TYPE_MIN(int); nt < (QSE_TYPE_MAX(int) - QSE_SECS_PER_DAY * 2); nt += QSE_SECS_PER_DAY)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
__time64_t t = (__time64_t)nt;
|
__time64_t t = (__time64_t)nt;
|
||||||
@ -92,8 +104,10 @@ static int test1 (void)
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
qse_printf (QSE_T(">>> time %I64d: "), (__int64)qnt);
|
qse_printf (QSE_T(">>> time %I64d: "), (__int64)qnt);
|
||||||
#else
|
#elif (QSE_SIZEOF_LONG_LONG > 0)
|
||||||
qse_printf (QSE_T(">>> time %lld: "), (long long)qnt);
|
qse_printf (QSE_T(">>> time %lld: "), (long long)qnt);
|
||||||
|
#else
|
||||||
|
qse_printf (QSE_T(">>> time %ld: "), (long)qnt);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (tm == QSE_NULL ||
|
if (tm == QSE_NULL ||
|
||||||
@ -107,8 +121,10 @@ static int test1 (void)
|
|||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
qse_printf (QSE_T("[GMTIME ERROR %I64d]\n"), (__int64)t);
|
qse_printf (QSE_T("[GMTIME ERROR %I64d]\n"), (__int64)t);
|
||||||
#else
|
#elif (QSE_SIZEOF_LONG_LONG > 0)
|
||||||
qse_printf (QSE_T("[GMTIME ERROR %lld]\n"), (long long)t);
|
qse_printf (QSE_T("[GMTIME ERROR %lld]\n"), (long long)t);
|
||||||
|
#else
|
||||||
|
qse_printf (QSE_T("[GMTIME ERROR %ld]\n"), (long)t);
|
||||||
#endif
|
#endif
|
||||||
if (tm == QSE_NULL) qse_printf (QSE_T(">> GMTIME RETURNED NULL\n"));
|
if (tm == QSE_NULL) qse_printf (QSE_T(">> GMTIME RETURNED NULL\n"));
|
||||||
print_time (qnt, &bt);
|
print_time (qnt, &bt);
|
||||||
@ -133,8 +149,10 @@ static int test1 (void)
|
|||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
qse_printf (QSE_T("[TIMEGM ERROR %I64d, %d/%d/%d %d:%d:%d]\n"), (__int64)xx, bt.year + QSE_BTIME_YEAR_BASE, bt.mon + 1, bt.mday, bt.hour, bt.min, bt.sec);
|
qse_printf (QSE_T("[TIMEGM ERROR %I64d, %d/%d/%d %d:%d:%d]\n"), (__int64)xx, bt.year + QSE_BTIME_YEAR_BASE, bt.mon + 1, bt.mday, bt.hour, bt.min, bt.sec);
|
||||||
#else
|
#elif (QSE_SIZEOF_LONG_LONG > 0)
|
||||||
qse_printf (QSE_T("[TIMEGM ERROR %lld, %d/%d/%d %d:%d:%d]\n"), (long long)xx, bt.year + QSE_BTIME_YEAR_BASE, bt.mon + 1, bt.mday, bt.hour, bt.min, bt.sec);
|
qse_printf (QSE_T("[TIMEGM ERROR %lld, %d/%d/%d %d:%d:%d]\n"), (long long)xx, bt.year + QSE_BTIME_YEAR_BASE, bt.mon + 1, bt.mday, bt.hour, bt.min, bt.sec);
|
||||||
|
#else
|
||||||
|
qse_printf (QSE_T("[TIMEGM ERROR %ld, %d/%d/%d %d:%d:%d]\n"), (long)xx, bt.year + QSE_BTIME_YEAR_BASE, bt.mon + 1, bt.mday, bt.hour, bt.min, bt.sec);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,10 @@ LDFLAGS += -L../../lib/cmn -L../../lib/net
|
|||||||
LDADD = -lqsenet -lqsecmn $(PTHREAD_LIBS) $(SOCKET_LIBS) $(SENDFILE_LIBS) -lssl
|
LDADD = -lqsenet -lqsecmn $(PTHREAD_LIBS) $(SOCKET_LIBS) $(SENDFILE_LIBS) -lssl
|
||||||
|
|
||||||
if WIN32
|
if WIN32
|
||||||
|
if WCHAR
|
||||||
LDADD += $(UNICOWS_LIBS)
|
LDADD += $(UNICOWS_LIBS)
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
http01_SOURCES = http01.c
|
http01_SOURCES = http01.c
|
||||||
upxd01_SOURCES = upxd01.c
|
upxd01_SOURCES = upxd01.c
|
||||||
|
@ -35,7 +35,7 @@ POST_UNINSTALL = :
|
|||||||
build_triplet = @build@
|
build_triplet = @build@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
bin_PROGRAMS = http01$(EXEEXT) upxd01$(EXEEXT)
|
bin_PROGRAMS = http01$(EXEEXT) upxd01$(EXEEXT)
|
||||||
@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
|
@WCHAR_TRUE@@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
|
||||||
subdir = samples/net
|
subdir = samples/net
|
||||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
@ -56,7 +56,7 @@ am_http01_OBJECTS = http01.$(OBJEXT)
|
|||||||
http01_OBJECTS = $(am_http01_OBJECTS)
|
http01_OBJECTS = $(am_http01_OBJECTS)
|
||||||
http01_LDADD = $(LDADD)
|
http01_LDADD = $(LDADD)
|
||||||
am__DEPENDENCIES_1 =
|
am__DEPENDENCIES_1 =
|
||||||
@WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
|
@WCHAR_TRUE@@WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
|
||||||
http01_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
http01_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
|
||||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
|
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
|
||||||
am_upxd01_OBJECTS = upxd01.$(OBJEXT)
|
am_upxd01_OBJECTS = upxd01.$(OBJEXT)
|
||||||
|
@ -10,8 +10,10 @@ LDFLAGS = -L../../lib/cmn -L../../lib/sed
|
|||||||
LDADD = -lqsesed -lqsecmn
|
LDADD = -lqsesed -lqsecmn
|
||||||
|
|
||||||
if WIN32
|
if WIN32
|
||||||
|
if WCHAR
|
||||||
LDADD += $(UNICOWS_LIBS)
|
LDADD += $(UNICOWS_LIBS)
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
bin_PROGRAMS = sed01
|
bin_PROGRAMS = sed01
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ PRE_UNINSTALL = :
|
|||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
build_triplet = @build@
|
build_triplet = @build@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
|
@WCHAR_TRUE@@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
|
||||||
bin_PROGRAMS = sed01$(EXEEXT) $(am__EXEEXT_1)
|
bin_PROGRAMS = sed01$(EXEEXT) $(am__EXEEXT_1)
|
||||||
@ENABLE_CXX_TRUE@am__append_2 = sed02 sed03
|
@ENABLE_CXX_TRUE@am__append_2 = sed02 sed03
|
||||||
subdir = samples/sed
|
subdir = samples/sed
|
||||||
@ -57,7 +57,7 @@ PROGRAMS = $(bin_PROGRAMS)
|
|||||||
am_sed01_OBJECTS = sed01.$(OBJEXT)
|
am_sed01_OBJECTS = sed01.$(OBJEXT)
|
||||||
sed01_OBJECTS = $(am_sed01_OBJECTS)
|
sed01_OBJECTS = $(am_sed01_OBJECTS)
|
||||||
am__DEPENDENCIES_1 =
|
am__DEPENDENCIES_1 =
|
||||||
@WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
|
@WCHAR_TRUE@@WIN32_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
|
||||||
am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2)
|
am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2)
|
||||||
sed01_DEPENDENCIES = $(am__DEPENDENCIES_3)
|
sed01_DEPENDENCIES = $(am__DEPENDENCIES_3)
|
||||||
am__sed02_SOURCES_DIST = sed02.cpp
|
am__sed02_SOURCES_DIST = sed02.cpp
|
||||||
|
Loading…
Reference in New Issue
Block a user