X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdata-io%2Fget-data.c;h=e4ab76a9992739c78a36f6ad2a98c4f6e0b48d83;hb=9e0e4996fad6563f0a1ce628b80db5c23ef8279e;hp=bc09715bd81bdf056d3f5e382933ee79a4a8a32a;hpb=89a1e7f479414c1a2345e33210d69e91e61b33ac;p=pspp diff --git a/src/language/data-io/get-data.c b/src/language/data-io/get-data.c index bc09715bd8..e4ab76a999 100644 --- a/src/language/data-io/get-data.c +++ b/src/language/data-io/get-data.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 2009 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 @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -33,6 +34,8 @@ #include #include +#include "xalloc.h" + #include "gettext.h" #define _(msgid) gettext (msgid) #define N_(msgid) (msgid) @@ -82,7 +85,7 @@ parse_get_psql (struct lexer *lexer, struct dataset *ds) if (!lex_force_string (lexer)) goto error; - psql.conninfo = strdup (ds_cstr (lex_tokstr (lexer))); + psql.conninfo = xstrdup (ds_cstr (lex_tokstr (lexer))); lex_get (lexer); @@ -150,7 +153,7 @@ parse_get_gnm (struct lexer *lexer, struct dataset *ds) if (!lex_force_string (lexer)) goto error; - gri.file_name = strdup (ds_cstr (lex_tokstr (lexer))); + gri.file_name = xstrdup (ds_cstr (lex_tokstr (lexer))); lex_get (lexer); @@ -169,7 +172,7 @@ parse_get_gnm (struct lexer *lexer, struct dataset *ds) if ( ! lex_force_string (lexer) ) goto error; - gri.sheet_name = strdup (ds_cstr (lex_tokstr (lexer))); + gri.sheet_name = xstrdup (ds_cstr (lex_tokstr (lexer))); gri.sheet_index = -1; } else if (lex_match_id (lexer, "INDEX")) @@ -193,7 +196,7 @@ parse_get_gnm (struct lexer *lexer, struct dataset *ds) if ( ! lex_force_string (lexer) ) goto error; - gri.cell_range = strdup (ds_cstr (lex_tokstr (lexer))); + gri.cell_range = xstrdup (ds_cstr (lex_tokstr (lexer))); } else goto error; @@ -429,18 +432,29 @@ parse_get_txt (struct lexer *lexer, struct dataset *ds) lex_get (lexer); } - else if (lex_match_id (lexer, "QUALIFIER")) + else if (lex_match_id (lexer, "QUALIFIERS")) { - if (!set_type (parser, "QUALIFIER", DP_DELIMITED, &has_type)) + if (!set_type (parser, "QUALIFIERS", DP_DELIMITED, &has_type)) goto error; lex_match (lexer, '='); if (!lex_force_string (lexer)) goto error; + if (settings_get_syntax () == COMPATIBLE + && ds_length (lex_tokstr (lexer)) != 1) + { + msg (SE, _("In compatible syntax mode, the QUALIFIER string " + "must contain exactly one character.")); + goto error; + } + data_parser_set_quotes (parser, ds_ss (lex_tokstr (lexer))); lex_get (lexer); } + else if (settings_get_syntax () == ENHANCED + && lex_match_id (lexer, "ESCAPE")) + data_parser_set_quote_escape (parser, true); else if (lex_match_id (lexer, "VARIABLES")) break; else