From fa3757222a9d3f2b4ef0dd98d0bf8ef4108082ce Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 3 Mar 2014 15:36:30 +0000 Subject: [PATCH] fixed some sample files --- qse/samples/awk/awk01.c | 4 +++- qse/samples/awk/awk02.c | 9 ++++++--- qse/samples/awk/awk03.c | 7 +++++-- qse/samples/awk/awk04.c | 7 +++++-- qse/samples/awk/awk05.c | 7 +++++-- qse/samples/awk/awk06.c | 7 +++++-- qse/samples/awk/awk07.c | 7 +++++-- qse/samples/cmn/path01.c | 12 +++++++++--- 8 files changed, 43 insertions(+), 17 deletions(-) diff --git a/qse/samples/awk/awk01.c b/qse/samples/awk/awk01.c index 3a30d29b..7078c678 100644 --- a/qse/samples/awk/awk01.c +++ b/qse/samples/awk/awk01.c @@ -1,5 +1,4 @@ #include -#include static const qse_char_t* script = QSE_T("BEGIN { print \"hello, world\"; }"); @@ -11,6 +10,8 @@ int main () qse_awk_parsestd_t psin[2]; int ret = -1; + qse_openstdsios (); + /* create an awk object */ awk = qse_awk_openstd (0); if (awk == QSE_NULL) @@ -69,5 +70,6 @@ oops: /* destroy the awk object */ if (awk) qse_awk_close (awk); + qse_closestdsios (); return ret; } diff --git a/qse/samples/awk/awk02.c b/qse/samples/awk/awk02.c index c3eec9c5..4dfebb1d 100644 --- a/qse/samples/awk/awk02.c +++ b/qse/samples/awk/awk02.c @@ -1,7 +1,6 @@ #include #include #include -#include #include "awk00.h" /* i'll print records with the second field grater than 4. @@ -154,7 +153,11 @@ oops: int qse_main (int argc, qse_achar_t* argv[]) { - extern void init_awk_sample_locale (void); + int x; + + qse_openstdsios (); init_awk_sample_locale (); - return qse_runmain (argc, argv, awk_main); + x = qse_runmain (argc, argv, awk_main); + qse_closestdsios (); + return x; } diff --git a/qse/samples/awk/awk03.c b/qse/samples/awk/awk03.c index 4f287c7c..abe0763a 100644 --- a/qse/samples/awk/awk03.c +++ b/qse/samples/awk/awk03.c @@ -1,7 +1,6 @@ #include #include #include -#include #include "awk00.h" /* i'll print records with the second field grater than 4. @@ -170,6 +169,10 @@ oops: int qse_main (int argc, qse_achar_t* argv[]) { + int x; + qse_openstdsios (); init_awk_sample_locale (); - return qse_runmain (argc, argv, awk_main); + x = qse_runmain (argc, argv, awk_main); + qse_closestdsios (); + return x; } diff --git a/qse/samples/awk/awk04.c b/qse/samples/awk/awk04.c index 40ad687c..57c9bc3c 100644 --- a/qse/samples/awk/awk04.c +++ b/qse/samples/awk/awk04.c @@ -1,6 +1,5 @@ #include #include -#include #include "awk00.h" static const qse_char_t* src = QSE_T( @@ -119,6 +118,10 @@ oops: int qse_main (int argc, qse_achar_t* argv[]) { + int x; init_awk_sample_locale (); - return qse_runmain (argc, argv, awk_main); + qse_openstdsios (); + x = qse_runmain (argc, argv, awk_main); + qse_closestdsios (); + return x; } diff --git a/qse/samples/awk/awk05.c b/qse/samples/awk/awk05.c index 83788b41..8d807874 100644 --- a/qse/samples/awk/awk05.c +++ b/qse/samples/awk/awk05.c @@ -1,6 +1,5 @@ #include #include -#include #include "awk00.h" static const qse_char_t* src = QSE_T( @@ -124,7 +123,11 @@ oops: int qse_main (int argc, qse_achar_t* argv[]) { + int x; + qse_openstdsios (); init_awk_sample_locale (); - return qse_runmain (argc, argv, awk_main); + x = qse_runmain (argc, argv, awk_main); + qse_closestdsios (); + return x; } diff --git a/qse/samples/awk/awk06.c b/qse/samples/awk/awk06.c index 08ca1b12..c87475c9 100644 --- a/qse/samples/awk/awk06.c +++ b/qse/samples/awk/awk06.c @@ -1,6 +1,5 @@ #include #include -#include #include "awk00.h" static const qse_char_t* src = QSE_T( @@ -133,7 +132,11 @@ oops: int qse_main (int argc, qse_achar_t* argv[]) { + int x; + qse_openstdsios (); init_awk_sample_locale (); - return qse_runmain (argc, argv, awk_main); + x = qse_runmain (argc, argv, awk_main); + qse_closestdsios (); + return x; } diff --git a/qse/samples/awk/awk07.c b/qse/samples/awk/awk07.c index cb0d3b28..4cd5fc74 100644 --- a/qse/samples/awk/awk07.c +++ b/qse/samples/awk/awk07.c @@ -1,6 +1,5 @@ #include #include -#include #include "awk00.h" static const qse_char_t* src = QSE_T( @@ -158,7 +157,11 @@ oops: int qse_main (int argc, qse_achar_t* argv[]) { + int x; + qse_openstdsios (); init_awk_sample_locale (); - return qse_runmain (argc, argv, awk_main); + x = qse_runmain (argc, argv, awk_main); + qse_closestdsios (); + return x; } diff --git a/qse/samples/cmn/path01.c b/qse/samples/cmn/path01.c index 2e55c92d..8d280ba8 100644 --- a/qse/samples/cmn/path01.c +++ b/qse/samples/cmn/path01.c @@ -1,9 +1,9 @@ #include -#include #include #include #include #include +#include #include #if defined(_WIN32) @@ -65,6 +65,8 @@ static int path_main (int argc, qse_char_t* argv[]) int qse_main (int argc, qse_achar_t* argv[]) { + int x; + #if defined(_WIN32) char locale[100]; UINT codepage = GetConsoleOutputCP(); @@ -80,9 +82,13 @@ int qse_main (int argc, qse_achar_t* argv[]) qse_setdflcmgrbyid (QSE_CMGR_SLMB); } #else - setlocale (LC_ALL, ""); + setlocale (LC_ALL, ""); qse_setdflcmgrbyid (QSE_CMGR_SLMB); #endif - return qse_runmain (argc, argv, path_main); + + qse_openstdsios (); + x = qse_runmain (argc, argv, path_main); + qse_closestdsios (); + return x; }