Delete trailing whitespace at end of lines.
[pspp-builds.git] / src / language / dictionary / delete-variables.c
index b9cbe70d68a2e34f8dbb6905ca52fe9d5bfa3932..5cee7035f8fb17a8b21de494fc687a19329dde0a 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - computes sample statistics.
-   Copyright (C) 2006 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
    Written by Ben Pfaff <blp@gnu.org>.
 
    This program is free software; you can redistribute it and/or
@@ -21,6 +21,7 @@
 
 #include <stdlib.h>
 
+#include <data/casereader.h>
 #include <data/dictionary.h>
 #include <data/procedure.h>
 #include <language/command.h>
@@ -36,12 +37,14 @@ cmd_delete_variables (struct lexer *lexer, struct dataset *ds)
 {
   struct variable **vars;
   size_t var_cnt;
+  bool ok;
 
   if (proc_make_temporary_transformations_permanent (ds))
     msg (SE, _("DELETE VARIABLES may not be used after TEMPORARY.  "
                "Temporary transformations will be made permanent."));
 
-  if (!parse_variables (lexer, dataset_dict (ds), &vars, &var_cnt, PV_NONE))
+  if (!parse_variables (lexer, dataset_dict (ds), &vars, &var_cnt,
+                             PV_NONE))
     goto error;
   if (var_cnt == dict_get_var_cnt (dataset_dict (ds)))
     {
@@ -50,12 +53,14 @@ cmd_delete_variables (struct lexer *lexer, struct dataset *ds)
       goto error;
     }
 
-  if (!procedure (ds, NULL, NULL))
+  ok = casereader_destroy (proc_open (ds));
+  ok = proc_commit (ds) && ok;
+  if (!ok)
     goto error;
-  
   dict_delete_vars (dataset_dict (ds), vars, var_cnt);
+
   free (vars);
-  
+
   return CMD_SUCCESS;
 
  error: