enhanced qse_glob() to handle win/dos/os2 driver letters.

fixed a bug in qse_tio_writembs()
This commit is contained in:
2012-09-02 08:48:05 +00:00
parent 78f6f709ee
commit f0e03cb4ca
14 changed files with 212 additions and 104 deletions

View File

@ -11,8 +11,10 @@ LDFLAGS = -L../../lib/awk -L../../lib/cmn
LDADD = -lqseawk -lqsecmn $(LIBM)
if WIN32
if WCHAR
LDADD += $(UNICOWS_LIBS)
endif
endif
awk01_SOURCES = awk01.c
awk02_SOURCES = awk02.c

View File

@ -37,7 +37,7 @@ host_triplet = @host@
bin_PROGRAMS = awk01$(EXEEXT) awk02$(EXEEXT) awk03$(EXEEXT) \
awk04$(EXEEXT) awk09$(EXEEXT) awk10$(EXEEXT) awk11$(EXEEXT) \
$(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
subdir = samples/awk
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
@ -62,7 +62,7 @@ am_awk01_OBJECTS = awk01.$(OBJEXT)
awk01_OBJECTS = $(am_awk01_OBJECTS)
awk01_LDADD = $(LDADD)
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)
am_awk02_OBJECTS = awk02.$(OBJEXT)
awk02_OBJECTS = $(am_awk02_OBJECTS)

View File

@ -45,8 +45,10 @@ LDFLAGS = -L../../lib/cmn
LDADD = -lqsecmn
if WIN32
if WCHAR
LDADD += $(UNICOWS_LIBS)
endif
endif
chr01_SOURCES = chr01.c
env_SOURCES = env.c

View File

@ -43,7 +43,7 @@ bin_PROGRAMS = chr01$(EXEEXT) env$(EXEEXT) dll$(EXEEXT) fio01$(EXEEXT) \
sio01$(EXEEXT) sio02$(EXEEXT) sio03$(EXEEXT) sll$(EXEEXT) \
slmb01$(EXEEXT) str01$(EXEEXT) time$(EXEEXT) tre01$(EXEEXT) \
xma$(EXEEXT)
@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
@WCHAR_TRUE@@WIN32_TRUE@am__append_1 = $(UNICOWS_LIBS)
subdir = samples/cmn
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@ -64,7 +64,7 @@ am_chr01_OBJECTS = chr01.$(OBJEXT)
chr01_OBJECTS = $(am_chr01_OBJECTS)
chr01_LDADD = $(LDADD)
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)
am_dll_OBJECTS = dll.$(OBJEXT)
dll_OBJECTS = $(am_dll_OBJECTS)

View File

@ -44,7 +44,11 @@ static int test1 (void)
}
else
{
#if (QSE_SIZEOF_LONG_LONG > 0)
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);
@ -54,7 +58,11 @@ static int test1 (void)
}
else
{
#if (QSE_SIZEOF_LONG_LONG > 0)
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));
@ -68,14 +76,22 @@ static int test1 (void)
#endif
}
#if (QSE_SIZEOF_LONG_LONG > 0)
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)
{
qse_printf (QSE_T("failed to set file offset\n"));
}
else
{
#if (QSE_SIZEOF_LONG_LONG > 0)
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));
@ -130,7 +146,11 @@ static int test2 (void)
}
else
{
#if (QSE_SIZEOF_LONG_LONG > 0)
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);
@ -140,7 +160,11 @@ static int test2 (void)
}
else
{
#if (QSE_SIZEOF_LONG_LONG > 0)
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
}
#if (QSE_SIZEOF_LONG_LONG > 0)
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)
{
qse_printf (QSE_T("failed to set file offset\n"));
}
else
{
#if (QSE_SIZEOF_LONG_LONG > 0)
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));
@ -176,7 +208,11 @@ static int test2 (void)
}
else
{
#if (QSE_SIZEOF_LONG_LONG > 0)
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)
@ -194,7 +230,11 @@ static int test2 (void)
}
else
{
#if (QSE_SIZEOF_LONG_LONG > 0)
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

View File

@ -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/stdio.h>
#include <locale.h>
@ -14,10 +19,12 @@
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);
#else
#elif (QSE_SIZEOF_LONG_LONG > 0)
qse_printf (QSE_T("TIME: %lld\n"), (long long)nt);
#else
qse_printf (QSE_T("TIME: %ld\n"), (long)nt);
#endif
qse_printf (QSE_T("year: %d\n"), bt->year + QSE_BTIME_YEAR_BASE);
qse_printf (QSE_T("mon: %d\n"), bt->mon + 1);
@ -54,8 +61,10 @@ static int test1 (void)
{
#ifdef _WIN32
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);
#else
qse_printf (QSE_T("back to ntime: %ld\n"), (long)nt);
#endif
qse_gmtime (nt, &bt);
print_time (nt, &bt);
@ -68,8 +77,11 @@ static int test1 (void)
qse_printf (QSE_T("-------------------------------\n"));
for (nt = (qse_ntime_t)QSE_TYPE_MIN(int);
nt <= (qse_ntime_t)QSE_TYPE_MAX(int); nt += QSE_SECS_PER_DAY)
#if (QSE_SIZEOF_LONG_LONG > 0)
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
__time64_t t = (__time64_t)nt;
@ -92,8 +104,10 @@ static int test1 (void)
#ifdef _WIN32
qse_printf (QSE_T(">>> time %I64d: "), (__int64)qnt);
#else
#elif (QSE_SIZEOF_LONG_LONG > 0)
qse_printf (QSE_T(">>> time %lld: "), (long long)qnt);
#else
qse_printf (QSE_T(">>> time %ld: "), (long)qnt);
#endif
if (tm == QSE_NULL ||
@ -107,8 +121,10 @@ static int test1 (void)
{
#ifdef _WIN32
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);
#else
qse_printf (QSE_T("[GMTIME ERROR %ld]\n"), (long)t);
#endif
if (tm == QSE_NULL) qse_printf (QSE_T(">> GMTIME RETURNED NULL\n"));
print_time (qnt, &bt);
@ -133,8 +149,10 @@ static int test1 (void)
{
#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);
#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);
#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
}
}

View File

@ -11,8 +11,10 @@ LDFLAGS += -L../../lib/cmn -L../../lib/net
LDADD = -lqsenet -lqsecmn $(PTHREAD_LIBS) $(SOCKET_LIBS) $(SENDFILE_LIBS) -lssl
if WIN32
if WCHAR
LDADD += $(UNICOWS_LIBS)
endif
endif
http01_SOURCES = http01.c
upxd01_SOURCES = upxd01.c

View File

@ -35,7 +35,7 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
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
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@ -56,7 +56,7 @@ am_http01_OBJECTS = http01.$(OBJEXT)
http01_OBJECTS = $(am_http01_OBJECTS)
http01_LDADD = $(LDADD)
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) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
am_upxd01_OBJECTS = upxd01.$(OBJEXT)

View File

@ -10,8 +10,10 @@ LDFLAGS = -L../../lib/cmn -L../../lib/sed
LDADD = -lqsesed -lqsecmn
if WIN32
if WCHAR
LDADD += $(UNICOWS_LIBS)
endif
endif
bin_PROGRAMS = sed01

View File

@ -34,7 +34,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
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)
@ENABLE_CXX_TRUE@am__append_2 = sed02 sed03
subdir = samples/sed
@ -57,7 +57,7 @@ PROGRAMS = $(bin_PROGRAMS)
am_sed01_OBJECTS = sed01.$(OBJEXT)
sed01_OBJECTS = $(am_sed01_OBJECTS)
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)
sed01_DEPENDENCIES = $(am__DEPENDENCIES_3)
am__sed02_SOURCES_DIST = sed02.cpp