X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdata-io%2Ffile-handle.q;h=81094a95d2e68d3d6959be3e8de51405700b4c1b;hb=84e4d346b557748b62d43158c1b50f655e357f9f;hp=09c180dc84135f944cb2ebbc6d6d3b0fbeca60ee;hpb=a19b858e0ac3c69e4a28c0ca6d8674427268a863;p=pspp diff --git a/src/language/data-io/file-handle.q b/src/language/data-io/file-handle.q index 09c180dc84..81094a95d2 100644 --- a/src/language/data-io/file-handle.q +++ b/src/language/data-io/file-handle.q @@ -23,10 +23,11 @@ #include #include #include -#include +#include #include #include #include +#include #include #include #include @@ -75,7 +76,7 @@ cmd_file_handle (void) if (!lex_force_match ('/')) return CMD_CASCADING_FAILURE; - if (!parse_file_handle (&cmd)) + if (!parse_file_handle (&cmd, NULL)) return CMD_CASCADING_FAILURE; if (lex_end_of_command () != CMD_SUCCESS) @@ -109,7 +110,7 @@ cmd_file_handle (void) properties.record_width = cmd.n_lrecl[0]; break; default: - assert (0); + NOT_REACHED (); } if (cmd.mode != FH_SCRATCH) @@ -154,11 +155,11 @@ referent_name (enum fh_referent referent) case FH_REF_SCRATCH: return _("scratch file"); default: - abort (); + NOT_REACHED (); } } -/* Parses a file handle name, which may be a filename as a string +/* Parses a file handle name, which may be a file name as a string or a file handle name as an identifier. The allowed types of file handle are restricted to those in REFERENT_MASK. Returns the file handle when successful, a null pointer on failure. */ @@ -181,14 +182,14 @@ fh_parse (enum fh_referent referent_mask) if (token == T_ID) handle = fh_from_name (tokid); if (handle == NULL) - handle = fh_from_filename (ds_c_str (&tokstr)); + handle = fh_from_file_name (ds_cstr (&tokstr)); if (handle == NULL) { if (token != T_ID || tokid[0] != '#' || get_syntax () != ENHANCED) { - char *filename = ds_c_str (&tokstr); - char *handle_name = xasprintf ("\"%s\"", filename); - handle = fh_create_file (handle_name, filename, + char *file_name = ds_cstr (&tokstr); + char *handle_name = xasprintf ("\"%s\"", file_name); + handle = fh_create_file (handle_name, file_name, fh_default_properties ()); free (handle_name); }