X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Futilities%2Fhost.c;h=b01e621bf14e9bf7133ec4249f72af5f99c5ca13;hb=094399e6d125a602ae195530306b95302fce4713;hp=86109574f61c84741735704589fb73049c06635a;hpb=691c25e36fd1ee722dd35419d6110e3876b99f9c;p=pspp diff --git a/src/language/utilities/host.c b/src/language/utilities/host.c index 86109574f6..b01e621bf1 100644 --- a/src/language/utilities/host.c +++ b/src/language/utilities/host.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2009, 2010, 2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,9 +30,11 @@ #include "language/lexer/lexer.h" #include "libpspp/assertion.h" #include "libpspp/compiler.h" +#include "libpspp/i18n.h" #include "libpspp/message.h" #include "libpspp/str.h" +#include "gl/localcharset.h" #include "gl/xalloc.h" #include "gl/xmalloca.h" @@ -125,7 +127,7 @@ cmd_host (struct lexer *lexer, struct dataset *ds UNUSED) { if (settings_get_safer_mode ()) { - msg (SE, _("This command not allowed when the SAFER option is set.")); + msg (SE, _("This command not allowed when the %s option is set."), "SAFER"); return CMD_FAILURE; } @@ -134,6 +136,7 @@ cmd_host (struct lexer *lexer, struct dataset *ds UNUSED) else if (lex_match_id (lexer, "COMMAND")) { struct string command; + char *locale_command; bool ok; lex_match (lexer, T_EQUALS); @@ -145,7 +148,7 @@ cmd_host (struct lexer *lexer, struct dataset *ds UNUSED) { if (!ds_is_empty (&command)) ds_put_byte (&command, '\n'); - ds_put_substring (&command, ds_ss (lex_tokstr (lexer))); + ds_put_substring (&command, lex_tokss (lexer)); lex_get (lexer); } if (!lex_force_match (lexer, T_RBRACK)) @@ -154,10 +157,15 @@ cmd_host (struct lexer *lexer, struct dataset *ds UNUSED) return CMD_FAILURE; } - ok = run_command (ds_cstr (&command)); + locale_command = recode_string (locale_charset (), "UTF-8", + ds_cstr (&command), + ds_length (&command)); ds_destroy (&command); - return ok ? lex_end_of_command (lexer) : CMD_FAILURE; + ok = run_command (locale_command); + free (locale_command); + + return ok ? CMD_SUCCESS : CMD_FAILURE; } else {