+
+/* Parses and performs the DROP subcommand of GET and SAVE.
+ Returns true if successful, false on failure.*/
+static bool
+drop_variables (struct dictionary *dict)
+{
+ struct variable **v;
+ int nv;
+
+ lex_match ('=');
+ if (!parse_variables (dict, &v, &nv, PV_NONE))
+ return false;
+ dict_delete_vars (dict, v, nv);
+ free (v);
+
+ if (dict_get_var_cnt (dict) == 0)
+ {
+ msg (SE, _("Cannot DROP all variables from dictionary."));
+ return false;
+ }
+ return true;
+}
+
+/* Parses and performs the KEEP subcommand of GET and SAVE.
+ Returns true if successful, false on failure.*/
+static bool
+keep_variables (struct dictionary *dict)
+{
+ struct variable **v;
+ int nv;
+ int i;
+
+ lex_match ('=');
+ if (!parse_variables (dict, &v, &nv, PV_NONE))
+ return false;
+
+ /* Move the specified variables to the beginning. */
+ dict_reorder_vars (dict, v, nv);
+
+ /* Delete the remaining variables. */
+ v = xrealloc (v, (dict_get_var_cnt (dict) - nv) * sizeof *v);
+ for (i = nv; i < dict_get_var_cnt (dict); i++)
+ v[i - nv] = dict_get_var (dict, i);
+ dict_delete_vars (dict, v, dict_get_var_cnt (dict) - nv);
+ free (v);
+
+ return true;
+}