removed stdio.h stdio.c

This commit is contained in:
2013-11-03 16:48:20 +00:00
parent 91c9182ad7
commit be129e743b
24 changed files with 258 additions and 964 deletions

View File

@ -59,9 +59,6 @@
# define USE_LTDL
#endif
#define QSE_STDOUT qse_getstdout()
#define QSE_STDERR qse_getstderr()
static qse_awk_rtx_t* app_rtx = QSE_NULL;
static int app_debug = 0;
@ -358,14 +355,14 @@ static void on_statement (qse_awk_rtx_t* rtx, qse_awk_nde_t* nde)
static void print_version (void)
{
qse_sio_putstrf (QSE_STDOUT, QSE_T("QSEAWK version %hs\n"), QSE_PACKAGE_VERSION);
qse_fprintf (QSE_STDOUT, QSE_T("QSEAWK version %hs\n"), QSE_PACKAGE_VERSION);
}
static void print_error (const qse_char_t* fmt, ...)
{
va_list va;
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: "));
qse_fprintf (QSE_STDERR, QSE_T("ERROR: "));
va_start (va, fmt);
qse_sio_putstrvf (QSE_STDERR, fmt, va);
va_end (va);
@ -401,35 +398,35 @@ static void print_usage (qse_sio_t* out, const qse_char_t* argv0)
int j;
const qse_char_t* b = qse_basename (argv0);
qse_sio_putstrf (out, QSE_T("USAGE: %s [options] -f sourcefile [ -- ] [datafile]*\n"), b);
qse_sio_putstrf (out, QSE_T(" %s [options] [ -- ] sourcestring [datafile]*\n"), b);
qse_sio_putstrf (out, QSE_T("Where options are:\n"));
qse_sio_putstrf (out, QSE_T(" -h/--help print this message\n"));
qse_sio_putstrf (out, QSE_T(" --version print version\n"));
qse_sio_putstrf (out, QSE_T(" -D show extra information\n"));
qse_sio_putstrf (out, QSE_T(" -c/--call name call a function instead of entering\n"));
qse_sio_putstrf (out, QSE_T(" the pattern-action loop. [datafile]* is\n"));
qse_sio_putstrf (out, QSE_T(" passed to the function as parameters\n"));
qse_sio_putstrf (out, QSE_T(" -f/--file sourcefile set the source script file\n"));
qse_sio_putstrf (out, QSE_T(" -d/--deparsed-file deparsedfile set the deparsing output file\n"));
qse_sio_putstrf (out, QSE_T(" -F/--field-separator string set a field separator(FS)\n"));
qse_sio_putstrf (out, QSE_T(" -v/--assign var=value add a global variable with a value\n"));
qse_sio_putstrf (out, QSE_T(" -m/--memory-limit number limit the memory usage (bytes)\n"));
qse_sio_putstrf (out, QSE_T(" -w expand datafile wildcards\n"));
qse_fprintf (out, QSE_T("USAGE: %s [options] -f sourcefile [ -- ] [datafile]*\n"), b);
qse_fprintf (out, QSE_T(" %s [options] [ -- ] sourcestring [datafile]*\n"), b);
qse_fprintf (out, QSE_T("Where options are:\n"));
qse_fprintf (out, QSE_T(" -h/--help print this message\n"));
qse_fprintf (out, QSE_T(" --version print version\n"));
qse_fprintf (out, QSE_T(" -D show extra information\n"));
qse_fprintf (out, QSE_T(" -c/--call name call a function instead of entering\n"));
qse_fprintf (out, QSE_T(" the pattern-action loop. [datafile]* is\n"));
qse_fprintf (out, QSE_T(" passed to the function as parameters\n"));
qse_fprintf (out, QSE_T(" -f/--file sourcefile set the source script file\n"));
qse_fprintf (out, QSE_T(" -d/--deparsed-file deparsedfile set the deparsing output file\n"));
qse_fprintf (out, QSE_T(" -F/--field-separator string set a field separator(FS)\n"));
qse_fprintf (out, QSE_T(" -v/--assign var=value add a global variable with a value\n"));
qse_fprintf (out, QSE_T(" -m/--memory-limit number limit the memory usage (bytes)\n"));
qse_fprintf (out, QSE_T(" -w expand datafile wildcards\n"));
#if defined(QSE_BUILD_DEBUG)
qse_sio_putstrf (out, QSE_T(" -X number fail the number'th memory allocation\n"));
qse_fprintf (out, QSE_T(" -X number fail the number'th memory allocation\n"));
#endif
#if defined(QSE_CHAR_IS_WCHAR)
qse_sio_putstrf (out, QSE_T(" --script-encoding string specify script file encoding name\n"));
qse_sio_putstrf (out, QSE_T(" --console-encoding string specify console encoding name\n"));
qse_fprintf (out, QSE_T(" --script-encoding string specify script file encoding name\n"));
qse_fprintf (out, QSE_T(" --console-encoding string specify console encoding name\n"));
#endif
qse_sio_putstrf (out, QSE_T(" --modern run in the modern mode(default)\n"));
qse_sio_putstrf (out, QSE_T(" --classic run in the classic mode\n"));
qse_fprintf (out, QSE_T(" --modern run in the modern mode(default)\n"));
qse_fprintf (out, QSE_T(" --classic run in the classic mode\n"));
for (j = 0; opttab[j].name; j++)
{
qse_sio_putstrf (out,
qse_fprintf (out,
QSE_T(" --%-18s on/off %s\n"),
opttab[j].name, opttab[j].desc);
}
@ -1016,7 +1013,7 @@ static int awk_main (int argc, qse_char_t* argv[])
xma_mmgr.ctx = qse_xma_open (QSE_MMGR_GETDFL(), 0, arg.memlimit);
if (xma_mmgr.ctx == QSE_NULL)
{
qse_putstrf (QSE_T("ERROR: cannot open memory heap\n"));
qse_printf (QSE_T("ERROR: cannot open memory heap\n"));
goto oops;
}
mmgr = &xma_mmgr;
@ -1026,7 +1023,7 @@ static int awk_main (int argc, qse_char_t* argv[])
/*awk = qse_awk_openstd (0);*/
if (awk == QSE_NULL)
{
qse_putstrf (QSE_T("ERROR: cannot open awk\n"));
qse_printf (QSE_T("ERROR: cannot open awk\n"));
goto oops;
}
@ -1122,13 +1119,13 @@ oops:
#if defined(QSE_BUILD_DEBUG)
if (arg.failmalloc > 0)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("\n"));
qse_sio_putstrf (QSE_STDERR, QSE_T("-[MALLOC COUNTS]---------------------------------------\n"));
qse_sio_putstrf (QSE_STDERR, QSE_T("ALLOC: %lu FREE: %lu: REALLOC: %lu\n"),
qse_fprintf (QSE_STDERR, QSE_T("\n"));
qse_fprintf (QSE_STDERR, QSE_T("-[MALLOC COUNTS]---------------------------------------\n"));
qse_fprintf (QSE_STDERR, QSE_T("ALLOC: %lu FREE: %lu: REALLOC: %lu\n"),
(unsigned long)debug_mmgr_alloc_count,
(unsigned long)debug_mmgr_free_count,
(unsigned long)debug_mmgr_realloc_count);
qse_sio_putstrf (QSE_STDERR, QSE_T("-------------------------------------------------------\n"));
qse_fprintf (QSE_STDERR, QSE_T("-------------------------------------------------------\n"));
}
#endif

View File

@ -47,9 +47,6 @@
# include <sys/resource.h>
#endif
#define QSE_STDOUT qse_getstdout()
#define QSE_STDERR qse_getstderr()
/* --------------------------------------------------------------------- */
static qse_httpd_t* g_httpd = QSE_NULL;
@ -855,8 +852,8 @@ static int load_loccfg (qse_httpd_t* httpd, qse_xli_list_t* list, loccfg_t* cfg)
cfg->xcfg[i] = qse_httpd_strntombsdup (httpd, ((qse_xli_str_t*)pair->val)->ptr, ((qse_xli_str_t*)pair->val)->len);
if (cfg->xcfg[i] == QSE_NULL)
{
/*qse_putstrf (QSE_T("ERROR in copying - %s\n"), qse_httpd_geterrmsg (httpd));*/
qse_putstrf (QSE_T("ERROR in copying\n"));
/*qse_printf (QSE_T("ERROR in copying - %s\n"), qse_httpd_geterrmsg (httpd));*/
qse_printf (QSE_T("ERROR in copying\n"));
return -1;
}
}
@ -872,7 +869,7 @@ static int load_loccfg (qse_httpd_t* httpd, qse_xli_list_t* list, loccfg_t* cfg)
duptmp = qse_xli_dupflatstr (httpd_xtn->xli, (qse_xli_str_t*)pair->val, &duplen, &count);
if (duptmp == QSE_NULL)
{
qse_putstrf (QSE_T("ERROR: memory failure in copying index\n"));
qse_printf (QSE_T("ERROR: memory failure in copying index\n"));
return -1;
}
@ -881,7 +878,7 @@ static int load_loccfg (qse_httpd_t* httpd, qse_xli_list_t* list, loccfg_t* cfg)
if (cfg->index.files == QSE_NULL)
{
qse_putstrf (QSE_T("ERROR: memory failure in copying index\n"));
qse_printf (QSE_T("ERROR: memory failure in copying index\n"));
return -1;
}
@ -910,7 +907,7 @@ static int load_loccfg (qse_httpd_t* httpd, qse_xli_list_t* list, loccfg_t* cfg)
cgi = qse_httpd_callocmem (httpd, QSE_SIZEOF(*cgi));
if (cgi == QSE_NULL)
{
qse_putstrf (QSE_T("ERROR: memory failure in copying cgi\n"));
qse_printf (QSE_T("ERROR: memory failure in copying cgi\n"));
return -1;
}
@ -919,7 +916,7 @@ static int load_loccfg (qse_httpd_t* httpd, qse_xli_list_t* list, loccfg_t* cfg)
if (!cgi->spec)
{
qse_httpd_freemem (httpd, cgi);
qse_putstrf (QSE_T("ERROR: memory failure in copying cgi name\n"));
qse_printf (QSE_T("ERROR: memory failure in copying cgi name\n"));
return -1;
}
if (pair->val->type == QSE_XLI_STR)
@ -942,7 +939,7 @@ static int load_loccfg (qse_httpd_t* httpd, qse_xli_list_t* list, loccfg_t* cfg)
{
qse_httpd_freemem (httpd, cgi->spec);
qse_httpd_freemem (httpd, cgi);
qse_putstrf (QSE_T("ERROR: memory failure in copying cgi shebang\n"));
qse_printf (QSE_T("ERROR: memory failure in copying cgi shebang\n"));
return -1;
}
}
@ -984,7 +981,7 @@ static int load_loccfg (qse_httpd_t* httpd, qse_xli_list_t* list, loccfg_t* cfg)
auth_rule = qse_httpd_callocmem (httpd, QSE_SIZEOF(*auth_rule));
if (auth_rule == QSE_NULL)
{
qse_putstrf (QSE_T("ERROR: memory failure in copying auth-rule\n"));
qse_printf (QSE_T("ERROR: memory failure in copying auth-rule\n"));
return -1;
}
@ -995,7 +992,7 @@ static int load_loccfg (qse_httpd_t* httpd, qse_xli_list_t* list, loccfg_t* cfg)
if (!auth_rule->spec)
{
qse_httpd_freemem (httpd, auth_rule);
qse_putstrf (QSE_T("ERROR: memory failure in copying auth-rule\n"));
qse_printf (QSE_T("ERROR: memory failure in copying auth-rule\n"));
return -1;
}
}
@ -1034,7 +1031,7 @@ static int load_loccfg (qse_httpd_t* httpd, qse_xli_list_t* list, loccfg_t* cfg)
mime = qse_httpd_callocmem (httpd, QSE_SIZEOF(*mime));
if (mime == QSE_NULL)
{
qse_putstrf (QSE_T("ERROR: memory failure in copying mime\n"));
qse_printf (QSE_T("ERROR: memory failure in copying mime\n"));
return -1;
}
@ -1043,7 +1040,7 @@ static int load_loccfg (qse_httpd_t* httpd, qse_xli_list_t* list, loccfg_t* cfg)
if (!mime->spec)
{
qse_httpd_freemem (httpd, mime);
qse_putstrf (QSE_T("ERROR: memory failure in copying mime\n"));
qse_printf (QSE_T("ERROR: memory failure in copying mime\n"));
return -1;
}
@ -1052,7 +1049,7 @@ static int load_loccfg (qse_httpd_t* httpd, qse_xli_list_t* list, loccfg_t* cfg)
{
qse_httpd_freemem (httpd, mime->spec);
qse_httpd_freemem (httpd, mime);
qse_putstrf (QSE_T("ERROR: memory failure in copying mime\n"));
qse_printf (QSE_T("ERROR: memory failure in copying mime\n"));
return -1;
}
@ -1099,7 +1096,7 @@ static int load_loccfg (qse_httpd_t* httpd, qse_xli_list_t* list, loccfg_t* cfg)
acc = qse_httpd_callocmem (httpd, QSE_SIZEOF(*acc));
if (acc == QSE_NULL)
{
qse_putstrf (QSE_T("ERROR: memory failure in copying acc\n"));
qse_printf (QSE_T("ERROR: memory failure in copying acc\n"));
return -1;
}
@ -1110,7 +1107,7 @@ static int load_loccfg (qse_httpd_t* httpd, qse_xli_list_t* list, loccfg_t* cfg)
if (!acc->spec)
{
qse_httpd_freemem (httpd, acc);
qse_putstrf (QSE_T("ERROR: memory failure in copying access\n"));
qse_printf (QSE_T("ERROR: memory failure in copying access\n"));
return -1;
}
}
@ -1131,7 +1128,7 @@ static int load_loccfg (qse_httpd_t* httpd, qse_xli_list_t* list, loccfg_t* cfg)
/* TODO: perform more sanity check */
if (qse_mbschr (cfg->xcfg[XCFG_AUTH], QSE_MT(':')) == QSE_NULL)
{
qse_putstrf (QSE_T("WARNING: no colon in the auth string - [%hs]\n"), cfg->xcfg[XCFG_AUTH]);
qse_printf (QSE_T("WARNING: no colon in the auth string - [%hs]\n"), cfg->xcfg[XCFG_AUTH]);
}
#endif
@ -1207,8 +1204,8 @@ static int load_server_config (qse_httpd_t* httpd, qse_httpd_server_t* server, q
server_xtn->scfg[i] = qse_httpd_strntombsdup (httpd, ((qse_xli_str_t*)pair->val)->ptr, ((qse_xli_str_t*)pair->val)->len);
if (server_xtn->scfg[i] == QSE_NULL)
{
/*qse_putstrf (QSE_T("ERROR in copying - %s\n"), qse_httpd_geterrmsg (httpd));*/
qse_putstrf (QSE_T("ERROR in copying\n"));
/*qse_printf (QSE_T("ERROR in copying - %s\n"), qse_httpd_geterrmsg (httpd));*/
qse_printf (QSE_T("ERROR in copying\n"));
return -1;
}
}
@ -1331,7 +1328,7 @@ static qse_httpd_server_t* attach_server (qse_httpd_t* httpd, int num, qse_xli_l
if (pair == QSE_NULL || pair->val->type != QSE_XLI_STR)
{
/* TOOD: logging */
qse_putstrf (QSE_T("WARNING: no value or invalid value specified for bind\n"));
qse_printf (QSE_T("WARNING: no value or invalid value specified for bind\n"));
return QSE_NULL;
}
@ -1339,7 +1336,7 @@ static qse_httpd_server_t* attach_server (qse_httpd_t* httpd, int num, qse_xli_l
if (qse_strntonwad (((qse_xli_str_t*)pair->val)->ptr, ((qse_xli_str_t*)pair->val)->len, &dope.nwad) <= -1)
{
/* TOOD: logging */
qse_putstrf (QSE_T("WARNING: invalid value for bind - %s\n"), ((qse_xli_str_t*)pair->val)->ptr);
qse_printf (QSE_T("WARNING: invalid value for bind - %s\n"), ((qse_xli_str_t*)pair->val)->ptr);
return QSE_NULL;
}
@ -1353,7 +1350,7 @@ static qse_httpd_server_t* attach_server (qse_httpd_t* httpd, int num, qse_xli_l
if (xserver == QSE_NULL)
{
/* TODO: logging */
qse_putstrf (QSE_T("WARNING: failed to attach server\n"));
qse_printf (QSE_T("WARNING: failed to attach server\n"));
return QSE_NULL;
}
@ -1476,7 +1473,7 @@ static int open_config_file (qse_httpd_t* httpd)
httpd_xtn->xli = qse_xli_openstd (0, 0);
if (httpd_xtn->xli == QSE_NULL)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("Cannot open xli\n"));
qse_fprintf (QSE_STDERR, QSE_T("Cannot open xli\n"));
return -1;
}
@ -1488,7 +1485,7 @@ static int open_config_file (qse_httpd_t* httpd)
{
if (qse_xli_definepair (httpd_xtn->xli, defs[i].name, &defs[i].scm) <= -1)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("Cannot define %s - %s\n"), defs[i].name, qse_xli_geterrmsg(httpd_xtn->xli));
qse_fprintf (QSE_STDERR, QSE_T("Cannot define %s - %s\n"), defs[i].name, qse_xli_geterrmsg(httpd_xtn->xli));
qse_xli_close (httpd_xtn->xli);
httpd_xtn->xli = QSE_NULL;
return -1;
@ -1507,12 +1504,12 @@ static int open_config_file (qse_httpd_t* httpd)
if (errloc->line > 0 || errloc->colm > 0)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("Cannot load %s at line %lu column %lu - %s\n"),
qse_fprintf (QSE_STDERR, QSE_T("Cannot load %s at line %lu column %lu - %s\n"),
xli_in.u.file.path, (unsigned long int)errloc->line, (unsigned long int)errloc->colm, qse_xli_geterrmsg(httpd_xtn->xli));
}
else
{
qse_sio_putstrf (QSE_STDERR, QSE_T("Cannot load %s - %s\n"), xli_in.u.file.path, qse_xli_geterrmsg(httpd_xtn->xli));
qse_fprintf (QSE_STDERR, QSE_T("Cannot load %s - %s\n"), xli_in.u.file.path, qse_xli_geterrmsg(httpd_xtn->xli));
}
qse_xli_close (httpd_xtn->xli);
@ -1611,7 +1608,7 @@ static int load_config (qse_httpd_t* httpd)
if (pair->val->type != QSE_XLI_LIST)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("WARNING: non-list value for server\n"));
qse_fprintf (QSE_STDERR, QSE_T("WARNING: non-list value for server\n"));
}
else
{
@ -1622,7 +1619,7 @@ static int load_config (qse_httpd_t* httpd)
{
if (load_server_config (httpd, server, (qse_xli_list_t*)pair->val) <= -1)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("failed to load configuration from %s\n"), httpd_xtn->cfgfile);
qse_fprintf (QSE_STDERR, QSE_T("failed to load configuration from %s\n"), httpd_xtn->cfgfile);
goto oops;
}
}
@ -1631,7 +1628,7 @@ static int load_config (qse_httpd_t* httpd)
if (i == 0)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("No valid server specified in %s\n"), httpd_xtn->cfgfile);
qse_fprintf (QSE_STDERR, QSE_T("No valid server specified in %s\n"), httpd_xtn->cfgfile);
goto oops;
}
@ -1641,7 +1638,7 @@ static int load_config (qse_httpd_t* httpd)
{
if (load_loccfg (httpd, (qse_xli_list_t*)pair->val, &httpd_xtn->dflcfg) <= -1)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("failed to load configuration from %s\n"), httpd_xtn->cfgfile);
qse_fprintf (QSE_STDERR, QSE_T("failed to load configuration from %s\n"), httpd_xtn->cfgfile);
goto oops;
}
}
@ -1715,27 +1712,27 @@ static void logact_httpd (qse_httpd_t* httpd, const qse_httpd_act_t* act)
switch (act->code)
{
case QSE_HTTPD_CATCH_MERRMSG:
qse_putstrf (QSE_T("ERROR: %hs\n"), act->u.merrmsg);
qse_printf (QSE_T("ERROR: %hs\n"), act->u.merrmsg);
break;
case QSE_HTTPD_CATCH_MDBGMSG:
qse_putstrf (QSE_T("DEBUG: %hs\n"), act->u.mdbgmsg);
qse_printf (QSE_T("DEBUG: %hs\n"), act->u.mdbgmsg);
break;
case QSE_HTTPD_ACCEPT_CLIENT:
qse_nwadtostr (&act->u.client->local_addr, tmp, QSE_COUNTOF(tmp), QSE_NWADTOSTR_ALL);
qse_nwadtostr (&act->u.client->orgdst_addr, tmp2, QSE_COUNTOF(tmp2), QSE_NWADTOSTR_ALL);
qse_nwadtostr (&act->u.client->remote_addr, tmp3, QSE_COUNTOF(tmp3), QSE_NWADTOSTR_ALL);
qse_putstrf (QSE_T("accepted client %s(%s) from %s\n"), tmp, tmp2, tmp3);
qse_printf (QSE_T("accepted client %s(%s) from %s\n"), tmp, tmp2, tmp3);
case QSE_HTTPD_PURGE_CLIENT:
qse_nwadtostr (&act->u.client->remote_addr, tmp, QSE_COUNTOF(tmp), QSE_NWADTOSTR_ALL);
qse_putstrf (QSE_T("purged client - %s\n"), tmp);
qse_printf (QSE_T("purged client - %s\n"), tmp);
break;
case QSE_HTTPD_READERR_CLIENT:
qse_nwadtostr (&act->u.client->remote_addr, tmp, QSE_COUNTOF(tmp), QSE_NWADTOSTR_ALL);
qse_putstrf (QSE_T("failed to read client - %s\n"), tmp);
qse_printf (QSE_T("failed to read client - %s\n"), tmp);
break;
}
}
@ -1743,23 +1740,23 @@ static void logact_httpd (qse_httpd_t* httpd, const qse_httpd_act_t* act)
/* --------------------------------------------------------------------- */
static void print_version (void)
{
qse_putstrf (QSE_T("QSEHTTPD version %hs\n"), QSE_PACKAGE_VERSION);
qse_printf (QSE_T("QSEHTTPD version %hs\n"), QSE_PACKAGE_VERSION);
}
static void print_usage (qse_sio_t* out, int argc, qse_char_t* argv[])
{
const qse_char_t* b = qse_basename (argv[0]);
qse_sio_putstrf (out, QSE_T("USAGE: %s [options] -c file\n"), b);
qse_sio_putstrf (out, QSE_T(" %s [options] --config-file file\n"), b);
qse_fprintf (out, QSE_T("USAGE: %s [options] -c file\n"), b);
qse_fprintf (out, QSE_T(" %s [options] --config-file file\n"), b);
qse_sio_putstrf (out, QSE_T("options as follows:\n"));
qse_sio_putstrf (out, QSE_T(" -h/--help show this message\n"));
qse_sio_putstrf (out, QSE_T(" --version show version\n"));
qse_sio_putstrf (out, QSE_T(" -c/--config-file file specify a configuration file\n"));
qse_sio_putstrf (out, QSE_T(" -d/--daemon run in the background\n"));
qse_sio_putstrf (out, QSE_T(" -n string specify a process name if supported\n"));
qse_sio_putstrf (out, QSE_T(" -x output debugging messages\n"));
qse_fprintf (out, QSE_T("options as follows:\n"));
qse_fprintf (out, QSE_T(" -h/--help show this message\n"));
qse_fprintf (out, QSE_T(" --version show version\n"));
qse_fprintf (out, QSE_T(" -c/--config-file file specify a configuration file\n"));
qse_fprintf (out, QSE_T(" -d/--daemon run in the background\n"));
qse_fprintf (out, QSE_T(" -n string specify a process name if supported\n"));
qse_fprintf (out, QSE_T(" -x output debugging messages\n"));
}
static int handle_args (int argc, qse_char_t* argv[])
@ -1787,14 +1784,14 @@ static int handle_args (int argc, qse_char_t* argv[])
goto wrongusage;
case QSE_T('?'):
qse_sio_putstrf (QSE_STDERR,
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: bad option - %c\n"),
opt.opt
);
goto wrongusage;
case QSE_T(':'):
qse_sio_putstrf (QSE_STDERR,
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: bad parameter for %c\n"),
opt.opt
);
@ -1882,7 +1879,7 @@ static int httpd_main (int argc, qse_char_t* argv[])
httpd = qse_httpd_openstd (QSE_SIZEOF(httpd_xtn_t));
if (httpd == QSE_NULL)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: Cannot open httpd\n"));
qse_fprintf (QSE_STDERR, QSE_T("ERROR: Cannot open httpd\n"));
goto oops;
}
@ -1898,7 +1895,7 @@ static int httpd_main (int argc, qse_char_t* argv[])
{
if (daemonize (1) <= -1)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: Cannot daemonize\n"));
qse_fprintf (QSE_STDERR, QSE_T("ERROR: Cannot daemonize\n"));
goto oops;
}
}
@ -1929,7 +1926,7 @@ static int httpd_main (int argc, qse_char_t* argv[])
restore_signal_handlers ();
g_httpd = QSE_NULL;
if (ret <= -1) qse_sio_putstrf (QSE_STDERR, QSE_T("Httpd error - %d\n"), qse_httpd_geterrnum (httpd));
if (ret <= -1) qse_fprintf (QSE_STDERR, QSE_T("Httpd error - %d\n"), qse_httpd_geterrnum (httpd));
oops:
if (httpd) qse_httpd_close (httpd);
@ -1969,7 +1966,7 @@ int qse_main (int argc, qse_achar_t* argv[])
if (WSAStartup (MAKEWORD(2,0), &wsadata) != 0)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("Failed to start up winsock\n"));
qse_fprintf (QSE_STDERR, QSE_T("Failed to start up winsock\n"));
return -1;
}

View File

@ -54,9 +54,6 @@
# include <signal.h>
#endif
#define QSE_STDOUT qse_getstdout()
#define QSE_STDERR qse_getstderr()
static struct
{
qse_sed_iostd_t* io;
@ -142,46 +139,46 @@ static qse_mmgr_t xma_mmgr =
static void print_version (void)
{
qse_putstrf (QSE_T("QSESED version %hs\n"), QSE_PACKAGE_VERSION);
qse_printf (QSE_T("QSESED version %hs\n"), QSE_PACKAGE_VERSION);
}
static void print_usage (qse_sio_t* out, int argc, qse_char_t* argv[])
{
const qse_char_t* b = qse_basename (argv[0]);
qse_sio_putstrf (out, QSE_T("USAGE: %s [options] script [file]\n"), b);
qse_sio_putstrf (out, QSE_T(" %s [options] -f script-file [file]\n"), b);
qse_sio_putstrf (out, QSE_T(" %s [options] -e script [file]\n"), b);
qse_fprintf (out, QSE_T("USAGE: %s [options] script [file]\n"), b);
qse_fprintf (out, QSE_T(" %s [options] -f script-file [file]\n"), b);
qse_fprintf (out, QSE_T(" %s [options] -e script [file]\n"), b);
qse_sio_putstrf (out, QSE_T("options as follows:\n"));
qse_sio_putstrf (out, QSE_T(" -h/--help show this message\n"));
qse_sio_putstrf (out, QSE_T(" --version show version\n"));
qse_sio_putstrf (out, QSE_T(" -n disable auto-print\n"));
qse_sio_putstrf (out, QSE_T(" -e script specify a script\n"));
qse_sio_putstrf (out, QSE_T(" -f file specify a script file\n"));
qse_sio_putstrf (out, QSE_T(" -o file specify an output file\n"));
qse_sio_putstrf (out, QSE_T(" -r use the extended regular expression\n"));
qse_sio_putstrf (out, QSE_T(" -R enable non-standard extensions to the regular\n"));
qse_sio_putstrf (out, QSE_T(" expression\n"));
qse_sio_putstrf (out, QSE_T(" -i perform in-place editing. imply -s\n"));
qse_sio_putstrf (out, QSE_T(" -s process input files separately\n"));
qse_sio_putstrf (out, QSE_T(" -a perform strict address and label check\n"));
qse_sio_putstrf (out, QSE_T(" -b allow extended address formats\n"));
qse_sio_putstrf (out, QSE_T(" <start~step>,<start,+line>,<start,~line>,<0,/regex/>\n"));
qse_sio_putstrf (out, QSE_T(" -x allow text on the same line as c, a, i\n"));
qse_sio_putstrf (out, QSE_T(" -y ensure a newline at text end\n"));
qse_sio_putstrf (out, QSE_T(" -m number specify the maximum amount of memory to use in bytes\n"));
qse_sio_putstrf (out, QSE_T(" -w expand file wildcards\n"));
qse_fprintf (out, QSE_T("options as follows:\n"));
qse_fprintf (out, QSE_T(" -h/--help show this message\n"));
qse_fprintf (out, QSE_T(" --version show version\n"));
qse_fprintf (out, QSE_T(" -n disable auto-print\n"));
qse_fprintf (out, QSE_T(" -e script specify a script\n"));
qse_fprintf (out, QSE_T(" -f file specify a script file\n"));
qse_fprintf (out, QSE_T(" -o file specify an output file\n"));
qse_fprintf (out, QSE_T(" -r use the extended regular expression\n"));
qse_fprintf (out, QSE_T(" -R enable non-standard extensions to the regular\n"));
qse_fprintf (out, QSE_T(" expression\n"));
qse_fprintf (out, QSE_T(" -i perform in-place editing. imply -s\n"));
qse_fprintf (out, QSE_T(" -s process input files separately\n"));
qse_fprintf (out, QSE_T(" -a perform strict address and label check\n"));
qse_fprintf (out, QSE_T(" -b allow extended address formats\n"));
qse_fprintf (out, QSE_T(" <start~step>,<start,+line>,<start,~line>,<0,/regex/>\n"));
qse_fprintf (out, QSE_T(" -x allow text on the same line as c, a, i\n"));
qse_fprintf (out, QSE_T(" -y ensure a newline at text end\n"));
qse_fprintf (out, QSE_T(" -m number specify the maximum amount of memory to use in bytes\n"));
qse_fprintf (out, QSE_T(" -w expand file wildcards\n"));
#if defined(QSE_ENABLE_SEDTRACER)
qse_sio_putstrf (out, QSE_T(" -t print command traces\n"));
qse_fprintf (out, QSE_T(" -t print command traces\n"));
#endif
#if defined(QSE_BUILD_DEBUG)
qse_sio_putstrf (out, QSE_T(" -X number fail the number'th memory allocation\n"));
qse_fprintf (out, QSE_T(" -X number fail the number'th memory allocation\n"));
#endif
#if defined(QSE_CHAR_IS_WCHAR)
qse_sio_putstrf (out, QSE_T(" --script-encoding string specify script file encoding name\n"));
qse_sio_putstrf (out, QSE_T(" --infile-encoding string specify input file encoding name\n"));
qse_sio_putstrf (out, QSE_T(" --outfile-encoding string specify output file encoding name\n"));
qse_fprintf (out, QSE_T(" --script-encoding string specify script file encoding name\n"));
qse_fprintf (out, QSE_T(" --infile-encoding string specify input file encoding name\n"));
qse_fprintf (out, QSE_T(" --outfile-encoding string specify output file encoding name\n"));
#endif
}
@ -197,7 +194,7 @@ static int add_script (const qse_char_t* str, int mem)
QSE_SIZEOF(*g_script.io) * (g_script.capa + 16 + 1));
if (tmp == QSE_NULL)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: out of memory while processing %s\n"), str);
qse_fprintf (QSE_STDERR, QSE_T("ERROR: out of memory while processing %s\n"), str);
return -1;
}
@ -268,7 +265,7 @@ static int handle_args (int argc, qse_char_t* argv[])
goto oops;
case QSE_T('?'):
qse_sio_putstrf (QSE_STDERR,
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: bad option - %c\n"),
opt.opt
);
@ -276,7 +273,7 @@ static int handle_args (int argc, qse_char_t* argv[])
goto oops;
case QSE_T(':'):
qse_sio_putstrf (QSE_STDERR,
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: bad parameter for %c\n"),
opt.opt
);
@ -370,7 +367,7 @@ static int handle_args (int argc, qse_char_t* argv[])
g_script_cmgr = qse_findcmgr (opt.arg);
if (g_script_cmgr == QSE_NULL)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: unknown script encoding - %s\n"), opt.arg);
qse_fprintf (QSE_STDERR, QSE_T("ERROR: unknown script encoding - %s\n"), opt.arg);
goto oops;
}
}
@ -379,7 +376,7 @@ static int handle_args (int argc, qse_char_t* argv[])
g_infile_cmgr = qse_findcmgr (opt.arg);
if (g_infile_cmgr == QSE_NULL)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: unknown input file encoding - %s\n"), opt.arg);
qse_fprintf (QSE_STDERR, QSE_T("ERROR: unknown input file encoding - %s\n"), opt.arg);
goto oops;
}
}
@ -388,7 +385,7 @@ static int handle_args (int argc, qse_char_t* argv[])
g_outfile_cmgr = qse_findcmgr (opt.arg);
if (g_outfile_cmgr == QSE_NULL)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: unknown output file encoding - %s\n"), opt.arg);
qse_fprintf (QSE_STDERR, QSE_T("ERROR: unknown output file encoding - %s\n"), opt.arg);
goto oops;
}
}
@ -427,7 +424,7 @@ void print_exec_error (qse_sed_t* sed)
const qse_sed_loc_t* errloc = qse_sed_geterrloc(sed);
if (errloc->line > 0 || errloc->colm > 0)
{
qse_sio_putstrf (QSE_STDERR,
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: cannot execute - %s at line %lu column %lu\n"),
qse_sed_geterrmsg(sed),
(unsigned long)errloc->line,
@ -436,7 +433,7 @@ void print_exec_error (qse_sed_t* sed)
}
else
{
qse_sio_putstrf (QSE_STDERR,
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: cannot execute - %s\n"),
qse_sed_geterrmsg(sed)
);
@ -569,16 +566,16 @@ static void trace_exec (qse_sed_t* sed, qse_sed_tracer_op_t op, const qse_sed_cm
switch (op)
{
case QSE_SED_TRACER_READ:
/*qse_sio_putstrf (QSE_STDERR, QSE_T("reading...\n"));*/
/*qse_fprintf (QSE_STDERR, QSE_T("reading...\n"));*/
break;
case QSE_SED_TRACER_WRITE:
/*qse_sio_putstrf (QSE_STDERR, QSE_T("wrting...\n"));*/
/*qse_fprintf (QSE_STDERR, QSE_T("wrting...\n"));*/
break;
/* TODO: use function to get hold space and pattern space and print them */
case QSE_SED_TRACER_MATCH:
qse_sio_putstrf (QSE_STDERR, QSE_T("%s:%lu [%c] MA\n"),
qse_fprintf (QSE_STDERR, QSE_T("%s:%lu [%c] MA\n"),
((cmd->lid && cmd->lid[0])? cmd->lid: QSE_T("<<UNKNOWN>>")),
(unsigned long)cmd->loc.line,
cmd->type
@ -586,7 +583,7 @@ static void trace_exec (qse_sed_t* sed, qse_sed_tracer_op_t op, const qse_sed_cm
break;
case QSE_SED_TRACER_EXEC:
qse_sio_putstrf (QSE_STDERR, QSE_T("%s:%lu [%c] EC\n"),
qse_fprintf (QSE_STDERR, QSE_T("%s:%lu [%c] EC\n"),
((cmd->lid && cmd->lid[0])? cmd->lid: QSE_T("<<UNKNOWN>>")),
(unsigned long)cmd->loc.line,
cmd->type
@ -711,7 +708,7 @@ static int sed_main (int argc, qse_char_t* argv[])
xma_mmgr.ctx = qse_xma_open (QSE_MMGR_GETDFL(), 0, g_memlimit);
if (xma_mmgr.ctx == QSE_NULL)
{
qse_putstrf (QSE_T("ERROR: cannot open memory heap\n"));
qse_printf (QSE_T("ERROR: cannot open memory heap\n"));
goto oops;
}
mmgr = &xma_mmgr;
@ -722,13 +719,13 @@ static int sed_main (int argc, qse_char_t* argv[])
fs = qse_fs_open (mmgr, 0);
if (fs == QSE_NULL)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: cannot open file system handler\n"));
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open file system handler\n"));
goto oops;
}
if (qse_fs_chdir (fs, QSE_T(".")) <= -1)
{
qse_sio_putstrf (QSE_STDERR,
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: cannot change direcotry in file system handler\n"));
goto oops;
}
@ -737,7 +734,7 @@ static int sed_main (int argc, qse_char_t* argv[])
sed = qse_sed_openstdwithmmgr (mmgr, 0);
if (sed == QSE_NULL)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: cannot open stream editor\n"));
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open stream editor\n"));
goto oops;
}
@ -766,7 +763,7 @@ static int sed_main (int argc, qse_char_t* argv[])
if (errloc->line > 0 || errloc->colm > 0)
{
qse_sio_putstrf (QSE_STDERR,
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: cannot compile %s - %s at line %lu column %lu\n"),
target,
qse_sed_geterrmsg(sed),
@ -776,7 +773,7 @@ static int sed_main (int argc, qse_char_t* argv[])
}
else
{
qse_sio_putstrf (QSE_STDERR,
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: cannot compile %s - %s\n"),
target,
qse_sed_geterrmsg(sed)
@ -819,7 +816,7 @@ static int sed_main (int argc, qse_char_t* argv[])
);
if (out_file.u.sio == QSE_NULL)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: cannot open %s\n"), g_output_file);
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open %s\n"), g_output_file);
goto oops;
}
@ -830,7 +827,7 @@ static int sed_main (int argc, qse_char_t* argv[])
/* perform wild-card expansions for non-unix platforms */
if (expand_wildcards (argc - g_infile_pos, &argv[g_infile_pos], g_wildcard, &xarg) <= -1)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: out of memory\n"));
qse_fprintf (QSE_STDERR, QSE_T("ERROR: out of memory\n"));
goto oops;
}
@ -852,7 +849,7 @@ static int sed_main (int argc, qse_char_t* argv[])
tmpl_tmpfile = qse_strdup2 (in[0].u.file.path, QSE_T(".XXXX"), qse_sed_getmmgr(sed));
if (tmpl_tmpfile == QSE_NULL)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: out of memory\n"));
qse_fprintf (QSE_STDERR, QSE_T("ERROR: out of memory\n"));
goto oops;
}
@ -872,7 +869,7 @@ static int sed_main (int argc, qse_char_t* argv[])
{
if (retried)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: cannot open %s\n"), tmpl_tmpfile);
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open %s\n"), tmpl_tmpfile);
QSE_MMGR_FREE (qse_sed_getmmgr(sed), tmpl_tmpfile);
goto oops;
}
@ -883,7 +880,7 @@ static int sed_main (int argc, qse_char_t* argv[])
tmpl_tmpfile = qse_strdup (QSE_T("TMP-XXXX"), qse_sed_getmmgr(sed));
if (tmpl_tmpfile == QSE_NULL)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: out of memory\n"));
qse_fprintf (QSE_STDERR, QSE_T("ERROR: out of memory\n"));
goto oops;
}
retried = 1;
@ -915,7 +912,7 @@ static int sed_main (int argc, qse_char_t* argv[])
if (qse_fs_move (fs, tmpl_tmpfile, in[0].u.file.path) <= -1)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: cannot rename %s to %s. not deleting %s\n"),
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot rename %s to %s. not deleting %s\n"),
tmpl_tmpfile, in[0].u.file.path, tmpl_tmpfile);
QSE_MMGR_FREE (qse_sed_getmmgr(sed), tmpl_tmpfile);
goto oops;
@ -945,14 +942,14 @@ static int sed_main (int argc, qse_char_t* argv[])
/* perform wild-card expansions for non-unix platforms */
if (expand_wildcards (argc - g_infile_pos, &argv[g_infile_pos], g_wildcard, &xarg) <= -1)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: out of memory\n"));
qse_fprintf (QSE_STDERR, QSE_T("ERROR: out of memory\n"));
goto oops;
}
in = QSE_MMGR_ALLOC (qse_sed_getmmgr(sed), QSE_SIZEOF(*in) * (xarg.size + 1));
if (in == QSE_NULL)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("ERROR: out of memory\n"));
qse_fprintf (QSE_STDERR, QSE_T("ERROR: out of memory\n"));
goto oops;
}
@ -1010,13 +1007,13 @@ oops:
#if defined(QSE_BUILD_DEBUG)
if (g_failmalloc > 0)
{
qse_sio_putstrf (QSE_STDERR, QSE_T("\n"));
qse_sio_putstrf (QSE_STDERR, QSE_T("-[MALLOC COUNTS]---------------------------------------\n"));
qse_sio_putstrf (QSE_STDERR, QSE_T("ALLOC: %lu FREE: %lu: REALLOC: %lu\n"),
qse_fprintf (QSE_STDERR, QSE_T("\n"));
qse_fprintf (QSE_STDERR, QSE_T("-[MALLOC COUNTS]---------------------------------------\n"));
qse_fprintf (QSE_STDERR, QSE_T("ALLOC: %lu FREE: %lu: REALLOC: %lu\n"),
(unsigned long)debug_mmgr_alloc_count,
(unsigned long)debug_mmgr_free_count,
(unsigned long)debug_mmgr_realloc_count);
qse_sio_putstrf (QSE_STDERR, QSE_T("-------------------------------------------------------\n"));
qse_fprintf (QSE_STDERR, QSE_T("-------------------------------------------------------\n"));
}
#endif
return ret;

View File

@ -116,38 +116,38 @@ static qse_mmgr_t xma_mmgr =
static void print_version (void)
{
qse_putstrf (QSE_T("QSEXLI version %hs\n"), QSE_PACKAGE_VERSION);
qse_printf (QSE_T("QSEXLI version %hs\n"), QSE_PACKAGE_VERSION);
}
static void print_usage (qse_sio_t* out, int argc, qse_char_t* argv[])
{
const qse_char_t* b = qse_basename (argv[0]);
qse_sio_putstrf (out, QSE_T("USAGE: %s [options] -i input-file [key]\n"), b);
qse_fprintf (out, QSE_T("USAGE: %s [options] -i input-file [key]\n"), b);
qse_sio_putstrf (out, QSE_T("options as follows:\n"));
qse_sio_putstrf (out, QSE_T(" -h/--help show this message\n"));
qse_sio_putstrf (out, QSE_T(" --version show version\n"));
qse_sio_putstrf (out, QSE_T(" -i file specify an input file\n"));
qse_sio_putstrf (out, QSE_T(" -o file specify an output file\n"));
qse_sio_putstrf (out, QSE_T(" -u disallow duplicate keys\n"));
qse_sio_putstrf (out, QSE_T(" -a allow a key alias\n"));
qse_sio_putstrf (out, QSE_T(" -f keep file inclusion info\n"));
qse_sio_putstrf (out, QSE_T(" -t keep comment text\n"));
qse_sio_putstrf (out, QSE_T(" -s allow multi-segmented strings\n"));
qse_sio_putstrf (out, QSE_T(" -d allow a leading digit in identifiers\n"));
qse_sio_putstrf (out, QSE_T(" -n disallow nil\n"));
qse_sio_putstrf (out, QSE_T(" -l disallow lists\n"));
qse_sio_putstrf (out, QSE_T(" -K allow key tags\n"));
qse_sio_putstrf (out, QSE_T(" -S allow string tags\n"));
qse_sio_putstrf (out, QSE_T(" -v perform validation\n"));
qse_sio_putstrf (out, QSE_T(" -m number specify the maximum amount of memory to use in bytes\n"));
qse_fprintf (out, QSE_T("options as follows:\n"));
qse_fprintf (out, QSE_T(" -h/--help show this message\n"));
qse_fprintf (out, QSE_T(" --version show version\n"));
qse_fprintf (out, QSE_T(" -i file specify an input file\n"));
qse_fprintf (out, QSE_T(" -o file specify an output file\n"));
qse_fprintf (out, QSE_T(" -u disallow duplicate keys\n"));
qse_fprintf (out, QSE_T(" -a allow a key alias\n"));
qse_fprintf (out, QSE_T(" -f keep file inclusion info\n"));
qse_fprintf (out, QSE_T(" -t keep comment text\n"));
qse_fprintf (out, QSE_T(" -s allow multi-segmented strings\n"));
qse_fprintf (out, QSE_T(" -d allow a leading digit in identifiers\n"));
qse_fprintf (out, QSE_T(" -n disallow nil\n"));
qse_fprintf (out, QSE_T(" -l disallow lists\n"));
qse_fprintf (out, QSE_T(" -K allow key tags\n"));
qse_fprintf (out, QSE_T(" -S allow string tags\n"));
qse_fprintf (out, QSE_T(" -v perform validation\n"));
qse_fprintf (out, QSE_T(" -m number specify the maximum amount of memory to use in bytes\n"));
#if defined(QSE_BUILD_DEBUG)
qse_sio_putstrf (out, QSE_T(" -X number fail the number'th memory allocation\n"));
qse_fprintf (out, QSE_T(" -X number fail the number'th memory allocation\n"));
#endif
#if defined(QSE_CHAR_IS_WCHAR)
qse_sio_putstrf (out, QSE_T(" --infile-encoding string specify input file encoding name\n"));
qse_sio_putstrf (out, QSE_T(" --outfile-encoding string specify output file encoding name\n"));
qse_fprintf (out, QSE_T(" --infile-encoding string specify input file encoding name\n"));
qse_fprintf (out, QSE_T(" --outfile-encoding string specify output file encoding name\n"));
#endif
}
@ -180,27 +180,27 @@ static int handle_args (int argc, qse_char_t* argv[])
switch (c)
{
default:
print_usage (qse_getstderr(), argc, argv);
print_usage (QSE_STDERR, argc, argv);
goto oops;
case QSE_T('?'):
qse_sio_putstrf (qse_getstderr(),
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: bad option - %c\n"),
opt.opt
);
print_usage (qse_getstderr(), argc, argv);
print_usage (QSE_STDERR, argc, argv);
goto oops;
case QSE_T(':'):
qse_sio_putstrf (qse_getstderr(),
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: bad parameter for %c\n"),
opt.opt
);
print_usage (qse_getstderr(), argc, argv);
print_usage (QSE_STDERR, argc, argv);
goto oops;
case QSE_T('h'):
print_usage (qse_getstdout(), argc, argv);
print_usage (QSE_STDOUT, argc, argv);
goto done;
case QSE_T('i'):
@ -277,7 +277,7 @@ static int handle_args (int argc, qse_char_t* argv[])
g_infile_cmgr = qse_findcmgr (opt.arg);
if (g_infile_cmgr == QSE_NULL)
{
qse_sio_putstrf (qse_getstderr(), QSE_T("ERROR: unknown input file encoding - %s\n"), opt.arg);
qse_fprintf (QSE_STDERR, QSE_T("ERROR: unknown input file encoding - %s\n"), opt.arg);
goto oops;
}
}
@ -286,7 +286,7 @@ static int handle_args (int argc, qse_char_t* argv[])
g_outfile_cmgr = qse_findcmgr (opt.arg);
if (g_outfile_cmgr == QSE_NULL)
{
qse_sio_putstrf (qse_getstderr(), QSE_T("ERROR: unknown output file encoding - %s\n"), opt.arg);
qse_fprintf (QSE_STDERR, QSE_T("ERROR: unknown output file encoding - %s\n"), opt.arg);
goto oops;
}
}
@ -298,7 +298,7 @@ static int handle_args (int argc, qse_char_t* argv[])
if (!g_input_file)
{
print_usage (qse_getstderr(), argc, argv);
print_usage (QSE_STDERR, argc, argv);
goto oops;
}
@ -306,7 +306,7 @@ static int handle_args (int argc, qse_char_t* argv[])
if (opt.ind < argc)
{
print_usage (qse_getstderr(), argc, argv);
print_usage (QSE_STDERR, argc, argv);
goto oops;
}
@ -325,7 +325,7 @@ void print_exec_error (qse_xli_t* xli)
const qse_xli_loc_t* errloc = qse_xli_geterrloc(xli);
if (errloc->line > 0 || errloc->colm > 0)
{
qse_sio_putstrf (qse_getstderr(),
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: cannot execute - %s at line %lu column %lu\n"),
qse_xli_geterrmsg(xli),
(unsigned long)errloc->line,
@ -334,7 +334,7 @@ void print_exec_error (qse_xli_t* xli)
}
else
{
qse_sio_putstrf (qse_getstderr(),
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: cannot execute - %s\n"),
qse_xli_geterrmsg(xli)
);
@ -368,7 +368,7 @@ static int xli_main (int argc, qse_char_t* argv[])
xma_mmgr.ctx = qse_xma_open (QSE_MMGR_GETDFL(), 0, g_memlimit);
if (xma_mmgr.ctx == QSE_NULL)
{
qse_sio_putstrf (qse_getstderr(), QSE_T("ERROR: cannot open memory heap\n"));
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open memory heap\n"));
goto oops;
}
mmgr = &xma_mmgr;
@ -377,7 +377,7 @@ static int xli_main (int argc, qse_char_t* argv[])
xli = qse_xli_openstdwithmmgr (mmgr, 0, 0);
if (xli == QSE_NULL)
{
qse_sio_putstrf (qse_getstderr(), QSE_T("ERROR: cannot open stream editor\n"));
qse_fprintf (QSE_STDERR, QSE_T("ERROR: cannot open stream editor\n"));
goto oops;
}
@ -494,7 +494,7 @@ for (i = 0; i < QSE_COUNTOF(defs); i++) qse_xli_definepair (xli, defs[i].name, &
if (errloc->line > 0 || errloc->colm > 0)
{
qse_sio_putstrf (qse_getstderr(),
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: cannot read %s - %s at line %lu column %lu%s%s\n"),
g_input_file,
qse_xli_geterrmsg(xli),
@ -506,7 +506,7 @@ for (i = 0; i < QSE_COUNTOF(defs); i++) qse_xli_definepair (xli, defs[i].name, &
}
else
{
qse_sio_putstrf (qse_getstderr(),
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: cannot read %s - %s\n"),
g_input_file,
qse_xli_geterrmsg(xli)
@ -525,7 +525,7 @@ for (i = 0; i < QSE_COUNTOF(defs); i++) qse_xli_definepair (xli, defs[i].name, &
if (qse_xli_insertpairwithstrs (xli, qse_xli_getroot(xli), QSE_NULL, QSE_T("test-key"), QSE_NULL, QSE_NULL, strs, QSE_COUNTOF(strs)) == QSE_NULL)
{
qse_sio_putstrf (qse_getstderr(),
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: cannot insert a string pair - %s \n"),
qse_xli_geterrmsg(xli)
);
@ -538,12 +538,12 @@ for (i = 0; i < QSE_COUNTOF(defs); i++) qse_xli_definepair (xli, defs[i].name, &
qse_size_t count;
count = qse_xli_countpairs (xli, QSE_NULL, g_lookup_key);
qse_putstrf (QSE_T("COUNT: %lu\n"), (unsigned long)count);
qse_printf (QSE_T("COUNT: %lu\n"), (unsigned long)count);
pair = qse_xli_findpair (xli, QSE_NULL, g_lookup_key);
if (pair == QSE_NULL)
{
qse_sio_putstrf (qse_getstderr(),
qse_fprintf (QSE_STDERR,
QSE_T("ERROR: cannot find %s - %s \n"),
g_lookup_key,
qse_xli_geterrmsg(xli)
@ -555,15 +555,15 @@ for (i = 0; i < QSE_COUNTOF(defs); i++) qse_xli_definepair (xli, defs[i].name, &
if (pair->val->type == QSE_XLI_STR)
{
qse_xli_str_t* str = (qse_xli_str_t*)pair->val;
qse_putstrf (QSE_T("[%.*s]\n"), (int)str->len, str->ptr);
qse_printf (QSE_T("[%.*s]\n"), (int)str->len, str->ptr);
}
else if (pair->val->type == QSE_XLI_NIL)
{
qse_putstrf (QSE_T("#NIL\n"));
qse_printf (QSE_T("#NIL\n"));
}
else
{
qse_putstrf (QSE_T("#LIST\n"));
qse_printf (QSE_T("#LIST\n"));
}
}
}
@ -581,13 +581,13 @@ oops:
#if defined(QSE_BUILD_DEBUG)
if (g_failmalloc > 0)
{
qse_sio_putstrf (qse_getstderr(), QSE_T("\n"));
qse_sio_putstrf (qse_getstderr(), QSE_T("-[MALLOC COUNTS]---------------------------------------\n"));
qse_sio_putstrf (qse_getstderr(), QSE_T("ALLOC: %lu FREE: %lu: REALLOC: %lu\n"),
qse_fprintf (QSE_STDERR, QSE_T("\n"));
qse_fprintf (QSE_STDERR, QSE_T("-[MALLOC COUNTS]---------------------------------------\n"));
qse_fprintf (QSE_STDERR, QSE_T("ALLOC: %lu FREE: %lu: REALLOC: %lu\n"),
(unsigned long)debug_mmgr_alloc_count,
(unsigned long)debug_mmgr_free_count,
(unsigned long)debug_mmgr_realloc_count);
qse_sio_putstrf (qse_getstderr(), QSE_T("-------------------------------------------------------\n"));
qse_fprintf (QSE_STDERR, QSE_T("-------------------------------------------------------\n"));
}
#endif