X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Futilities%2Ftitle.c;h=8ad6a4acb30b5723ea27e1ad0fc698f667c0b758;hb=ea34fc3d157ce3038ea8cfe8c5e0ca21944762a7;hp=686774463eb952fd271f2807fdec54726b495ece;hpb=b561da06cecf48556e94b4e033bd749eeba3bef7;p=pspp diff --git a/src/language/utilities/title.c b/src/language/utilities/title.c index 686774463e..8ad6a4acb3 100644 --- a/src/language/utilities/title.c +++ b/src/language/utilities/title.c @@ -24,11 +24,13 @@ #include "data/variable.h" #include "language/command.h" #include "language/lexer/lexer.h" +#include "language/lexer/token.h" #include "libpspp/message.h" #include "libpspp/start-date.h" #include "libpspp/version.h" #include "output/driver.h" +#include "gl/c-ctype.h" #include "gl/xalloc.h" #include "gettext.h" @@ -37,10 +39,24 @@ static int parse_title (struct lexer *lexer, void (*set_title) (const char *)) { - if (!lex_force_string (lexer)) - return CMD_FAILURE; - set_title (lex_tokcstr (lexer)); - lex_get (lexer); + if (lex_token (lexer) == T_STRING) + { + set_title (lex_tokcstr (lexer)); + lex_get (lexer); + } + else + { + int start_ofs = lex_ofs (lexer); + while (lex_token (lexer) != T_ENDCMD) + lex_get (lexer); + + /* Get the raw representation of all the tokens, including any space + between them, and use it as the title. */ + char *title = lex_ofs_representation (lexer, start_ofs, + lex_ofs (lexer) - 1); + set_title (title); + free (title); + } return CMD_SUCCESS; }