From 4274738e81ad12923c2ae5c769b3350c36cf1505 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 18 Feb 2010 17:18:41 -0200 Subject: new macro 'luai_writestringerror' --- lua.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'lua.c') diff --git a/lua.c b/lua.c index a454e9ec..3731b821 100644 --- a/lua.c +++ b/lua.c @@ -1,5 +1,5 @@ /* -** $Id: lua.c,v 1.185 2010/02/09 11:58:57 roberto Exp roberto $ +** $Id: lua.c,v 1.186 2010/02/11 17:12:27 roberto Exp roberto $ ** Lua stand-alone interpreter ** See Copyright Notice in lua.h */ @@ -103,11 +103,14 @@ static void laction (int i) { static void print_usage (const char *badoption) { - if (badoption[1] == 'e' || badoption[1] == 'l') - fprintf(stderr, "%s: '%s' needs argument\n", progname, badoption); - else - fprintf(stderr, "%s: unrecognized option '%s'\n", progname, badoption); - fprintf(stderr, + if (badoption[1] == 'e' || badoption[1] == 'l') { + luai_writestringerror("%s: ", progname); + luai_writestringerror("'%s' needs argument\n", badoption); + } else { + luai_writestringerror("%s: ", progname); + luai_writestringerror("unrecognized option '%s'\n", badoption); + } + luai_writestringerror( "usage: %s [options] [script [args]]\n" "Available options are:\n" " -e stat execute string " LUA_QL("stat") "\n" @@ -122,8 +125,8 @@ static void print_usage (const char *badoption) { static void l_message (const char *pname, const char *msg) { - if (pname) fprintf(stderr, "%s: ", pname); - fprintf(stderr, "%s\n", msg); + if (pname) luai_writestringerror("%s: ", pname); + luai_writestringerror("%s\n", msg); } -- cgit v1.2.3-55-g6feb