X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fdictionary%2Fsys-file-info.c;h=51b3cae4952933cf7baddaf5d4203a65e3db3cd6;hb=9ade26c8349b4434008c46cf09bc7473ec743972;hp=952930b5bad39332d0b1f70d5e76e706568ba930;hpb=afdf3096926b561f4e6511c10fcf73fc6796b9d2;p=pspp-builds.git diff --git a/src/language/dictionary/sys-file-info.c b/src/language/dictionary/sys-file-info.c index 952930b5..51b3cae4 100644 --- a/src/language/dictionary/sys-file-info.c +++ b/src/language/dictionary/sys-file-info.c @@ -37,6 +37,7 @@ #include "libpspp/array.h" #include "libpspp/message.h" #include "libpspp/misc.h" +#include "libpspp/string-array.h" #include "output/tab.h" #include "gl/minmax.h" @@ -163,7 +164,7 @@ cmd_sysfile_info (struct lexer *lexer, struct dataset *ds UNUSED) dict_destroy (d); fh_unref (h); - return lex_end_of_command (lexer); + return CMD_SUCCESS; } /* DISPLAY utility. */ @@ -210,7 +211,7 @@ cmd_display (struct lexer *lexer, struct dataset *ds) if (lex_match_id (lexer, "VECTORS")) { display_vectors (dataset_dict(ds), sorted); - return lex_end_of_command (lexer); + return CMD_SUCCESS; } else if (lex_match_id (lexer, "SCRATCH")) { @@ -280,7 +281,7 @@ cmd_display (struct lexer *lexer, struct dataset *ds) flags); } - return lex_end_of_command (lexer); + return CMD_SUCCESS; } static void @@ -292,24 +293,19 @@ display_macros (void) static void display_documents (const struct dictionary *dict) { - const char *documents = dict_get_documents (dict); + const struct string_array *documents = dict_get_documents (dict); - if (documents == NULL) + if (string_array_is_empty (documents)) tab_output_text (TAB_LEFT, _("The active file dictionary does not " "contain any documents.")); else { - struct string line = DS_EMPTY_INITIALIZER; size_t i; tab_output_text (TAB_LEFT | TAT_TITLE, _("Documents in the active file:")); for (i = 0; i < dict_get_document_line_cnt (dict); i++) - { - dict_get_document_line (dict, i, &line); - tab_output_text (TAB_LEFT | TAB_FIX, ds_cstr (&line)); - } - ds_destroy (&line); + tab_output_text (TAB_LEFT | TAB_FIX, dict_get_document_line (dict, i)); } }