X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Flanguage%2Fdictionary%2Fsys-file-info.c;h=b2e016ae149d0288b12dc669b09009b00c40fe1b;hb=a1a4228b112a6aca97fef5aaaf9ffa21271a1f72;hp=97bf3df58a9c2035151f01cff8bcb27794e16f70;hpb=b0bf9b1b0f727fafac4296a048e3f45db5936f81;p=pspp diff --git a/src/language/dictionary/sys-file-info.c b/src/language/dictionary/sys-file-info.c index 97bf3df58a..b2e016ae14 100644 --- a/src/language/dictionary/sys-file-info.c +++ b/src/language/dictionary/sys-file-info.c @@ -24,13 +24,14 @@ #include #include -#include +#include #include #include #include #include #include #include +#include #include #include #include @@ -77,7 +78,7 @@ sysfile_info_dim (struct tab_table *t, struct outp_driver *d) /* SYSFILE INFO utility. */ int -cmd_sysfile_info (void) +cmd_sysfile_info (struct dataset *ds UNUSED) { struct file_handle *h; struct dictionary *d; @@ -175,12 +176,12 @@ cmd_sysfile_info (void) /* DISPLAY utility. */ static void display_macros (void); -static void display_documents (void); +static void display_documents (const struct dictionary *dict); static void display_variables (struct variable **, size_t, int); -static void display_vectors (int sorted); +static void display_vectors (const struct dictionary *dict, int sorted); int -cmd_display (void) +cmd_display (struct dataset *ds) { /* Whether to sort the list of variables alphabetically. */ int sorted; @@ -192,19 +193,19 @@ cmd_display (void) if (lex_match_id ("MACROS")) display_macros (); else if (lex_match_id ("DOCUMENTS")) - display_documents (); + display_documents (dataset_dict (ds)); else if (lex_match_id ("FILE")) { som_blank_line (); if (!lex_force_match_id ("LABEL")) return CMD_FAILURE; - if (dict_get_label (default_dict) == NULL) + if (dict_get_label (dataset_dict (ds)) == NULL) tab_output_text (TAB_LEFT, _("The active file does not have a file label.")); else { tab_output_text (TAB_LEFT | TAT_TITLE, _("File label:")); - tab_output_text (TAB_LEFT | TAB_FIX, dict_get_label (default_dict)); + tab_output_text (TAB_LEFT | TAB_FIX, dict_get_label (dataset_dict (ds))); } } else @@ -230,7 +231,7 @@ cmd_display (void) if (as == AS_VECTOR) { - display_vectors (sorted); + display_vectors (dataset_dict(ds), sorted); return CMD_SUCCESS; } @@ -240,7 +241,7 @@ cmd_display (void) if (token != '.') { - if (!parse_variables (default_dict, &vl, &n, PV_NONE)) + if (!parse_variables (dataset_dict (ds), &vl, &n, PV_NONE)) { free (vl); return CMD_FAILURE; @@ -248,7 +249,7 @@ cmd_display (void) as = AS_DICTIONARY; } else - dict_get_vars (default_dict, &vl, &n, 0); + dict_get_vars (dataset_dict (ds), &vl, &n, 0); if (as == AS_SCRATCH) { @@ -288,9 +289,9 @@ display_macros (void) } static void -display_documents (void) +display_documents (const struct dictionary *dict) { - const char *documents = dict_get_documents (default_dict); + const char *documents = dict_get_documents (dict); som_blank_line (); if (documents == NULL) @@ -482,11 +483,11 @@ describe_variable (struct variable *v, struct tab_table *t, int r, int as) double x, y; mv_pop_range (&mv, &x, &y); if (x == LOWEST) - cp += nsprintf (cp, "LOWEST THRU %g", y); + cp += sprintf (cp, "LOWEST THRU %g", y); else if (y == HIGHEST) - cp += nsprintf (cp, "%g THRU HIGHEST", x); + cp += sprintf (cp, "%g THRU HIGHEST", x); else - cp += nsprintf (cp, "%g THRU %g", x, y); + cp += sprintf (cp, "%g THRU %g", x, y); cnt++; } while (mv_has_value (&mv)) @@ -494,9 +495,9 @@ describe_variable (struct variable *v, struct tab_table *t, int r, int as) union value value; mv_pop_value (&mv, &value); if (cnt++ > 0) - cp += nsprintf (cp, "; "); + cp += sprintf (cp, "; "); if (v->type == NUMERIC) - cp += nsprintf (cp, "%g", value.f); + cp += sprintf (cp, "%g", value.f); else { *cp++ = '"'; @@ -566,14 +567,14 @@ compare_vectors_by_name (const void *a_, const void *b_) /* Display a list of vectors. If SORTED is nonzero then they are sorted alphabetically. */ static void -display_vectors (int sorted) +display_vectors (const struct dictionary *dict, int sorted) { const struct vector **vl; int i; struct tab_table *t; size_t nvec; - nvec = dict_get_vector_cnt (default_dict); + nvec = dict_get_vector_cnt (dict); if (nvec == 0) { msg (SW, _("No vectors defined.")); @@ -582,7 +583,7 @@ display_vectors (int sorted) vl = xnmalloc (nvec, sizeof *vl); for (i = 0; i < nvec; i++) - vl[i] = dict_get_vector (default_dict, i); + vl[i] = dict_get_vector (dict, i); if (sorted) qsort (vl, nvec, sizeof *vl, compare_vectors_by_name);