Eliminated global variable current_dataset.
[pspp-builds.git] / src / language / dictionary / variable-label.c
index bc171a296ebb8c02c65db2843a3569d77633b836..c3bb4c2242b73d4553e00bfbe5cc50dd49ae2cfd 100644 (file)
    02110-1301, USA. */
 
 #include <config.h>
+
 #include <stdio.h>
 #include <stdlib.h>
-#include <libpspp/alloc.h>
+
+#include <data/procedure.h>
+#include <data/variable.h>
 #include <language/command.h>
-#include <libpspp/message.h>
 #include <language/lexer/lexer.h>
+#include <language/lexer/variable-parser.h>
+#include <libpspp/alloc.h>
+#include <libpspp/message.h>
 #include <libpspp/str.h>
-#include <data/variable.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
-#include <libpspp/debug-print.h>
-
 int
-cmd_variable_labels (void)
+cmd_variable_labels (struct dataset *ds)
 {
   do
     {
@@ -42,14 +44,14 @@ cmd_variable_labels (void)
 
       size_t i;
 
-      if (!parse_variables (default_dict, &v, &nv, PV_NONE))
-        return CMD_PART_SUCCESS_MAYBE;
+      if (!parse_variables (dataset_dict (ds), &v, &nv, PV_NONE))
+        return CMD_FAILURE;
 
       if (token != T_STRING)
        {
          msg (SE, _("String expected for variable label."));
          free (v);
-         return CMD_PART_SUCCESS_MAYBE;
+         return CMD_FAILURE;
        }
       if (ds_length (&tokstr) > 255)
        {
@@ -60,7 +62,7 @@ cmd_variable_labels (void)
        {
          if (v[i]->label)
            free (v[i]->label);
-         v[i]->label = xstrdup (ds_c_str (&tokstr));
+         v[i]->label = ds_xstrdup (&tokstr);
        }
 
       lex_get ();