lexer: Use lex_is_string() more consistently.
[pspp] / src / language / data-io / file-handle.q
index af5fa3321fdfa2b25972cf0691bb3539bce2b689..71081b922ac0601835fec8b13a819aa4f2a17dc3 100644 (file)
@@ -15,6 +15,7 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #include <config.h>
+#include <limits.h>
 #include <language/data-io/file-handle.h>
 #include <libpspp/message.h>
 #include <errno.h>
@@ -101,7 +102,7 @@ cmd_file_handle (struct lexer *lexer, struct dataset *ds)
           properties.mode = FH_MODE_VARIABLE;
           break;
         case FH_360:
-          properties.encoding = LEGACY_EBCDIC;
+          properties.encoding = "EBCDIC-US";
           if (cmd.recform == FH_FIXED || cmd.recform == FH_F)
             properties.mode = FH_MODE_FIXED;
           else if (cmd.recform == FH_VARIABLE || cmd.recform == FH_V)
@@ -128,7 +129,7 @@ cmd_file_handle (struct lexer *lexer, struct dataset *ds)
         {
           if (cmd.n_lrecl[0] == LONG_MIN)
             msg (SE, _("The specified file mode requires LRECL.  "
-                       "Assuming %d-character records."),
+                       "Assuming %zu-character records."),
                  properties.record_width);
           else if (cmd.n_lrecl[0] < 1 || cmd.n_lrecl[0] >= (1UL << 31))
             msg (SE, _("Record length (%ld) must be between 1 and %lu bytes.  "
@@ -199,7 +200,7 @@ fh_parse (struct lexer *lexer, enum fh_referent referent_mask)
     handle = fh_inline_file ();
   else
     {
-      if (lex_token (lexer) != T_ID && lex_token (lexer) != T_STRING)
+      if (lex_token (lexer) != T_ID && !lex_is_string (lexer))
         {
           lex_error (lexer, _("expecting a file name or handle name"));
           return NULL;
@@ -210,7 +211,7 @@ fh_parse (struct lexer *lexer, enum fh_referent referent_mask)
         handle = fh_from_id (lex_tokid (lexer));
       if (handle == NULL)
         {
-          if (lex_token (lexer) != T_ID || lex_tokid (lexer)[0] != '#' || get_syntax () != ENHANCED)
+          if (lex_token (lexer) != T_ID || lex_tokid (lexer)[0] != '#' || settings_get_syntax () != ENHANCED)
             handle = fh_create_file (NULL, ds_cstr (lex_tokstr (lexer)),
                                      fh_default_properties ());
           else