? skip.patch
Index: doc/data-io.texi
===================================================================
RCS file: /cvsroot/pspp/pspp/doc/data-io.texi,v
retrieving revision 1.9
diff -u -p -r1.9 data-io.texi
--- doc/data-io.texi	29 Oct 2006 00:01:52 -0000	1.9
+++ doc/data-io.texi	3 Nov 2006 04:58:17 -0000
@@ -138,9 +138,10 @@ Each form of @cmd{DATA LIST} is describe
 @display
 DATA LIST [FIXED]
         @{TABLE,NOTABLE@}
-        FILE='file-name'
-        RECORDS=record_count
-        END=end_var
+        [FILE='file-name']
+        [RECORDS=record_count]
+        [END=end_var]
+        [SKIP=record_count]
         /[line_no] var_spec@dots{}
 
 where each var_spec takes one of the forms
@@ -166,6 +167,10 @@ the list of variable specifications late
 The END subcommand is only useful in conjunction with @cmd{INPUT
 PROGRAM}.  @xref{INPUT PROGRAM}, for details.
 
+The optional SKIP subcommand specifies a number of lines to skip at
+the beginning of an input file.  It can be used to skip over a row
+that contains variable names, for example.
+
 @cmd{DATA LIST} can optionally output a table describing how the data file
 will be read.  The TABLE subcommand enables this output, and NOTABLE
 disables it.  The default is to output the table.
@@ -346,8 +351,9 @@ This example shows keywords abbreviated 
 DATA LIST FREE
         [(@{TAB,'c'@}, @dots{})]
         [@{NOTABLE,TABLE@}]
-        FILE='file-name'
-        END=end_var
+        [FILE='file-name']
+        [END=end_var]
+        [SKIP=record_cnt]
         /var_spec@dots{}
 
 where each var_spec takes one of the forms
@@ -376,7 +382,7 @@ of quoting is allowed.
 The NOTABLE and TABLE subcommands are as in @cmd{DATA LIST FIXED} above.
 NOTABLE is the default.
 
-The FILE and END subcommands are as in @cmd{DATA LIST FIXED} above.
+The FILE, END, and SKIP subcommands are as in @cmd{DATA LIST FIXED} above.
 
 The variables to be parsed are given as a single list of variable names.
 This list must be introduced by a single slash (@samp{/}).  The set of
@@ -398,8 +404,9 @@ on field width apply, but they are honor
 DATA LIST LIST
         [(@{TAB,'c'@}, @dots{})]
         [@{NOTABLE,TABLE@}]
-        FILE='file-name'
-        END=end_var
+        [FILE='file-name']
+        [END=end_var]
+        [SKIP=record_count]
         /var_spec@dots{}
 
 where each var_spec takes one of the forms
Index: src/language/data-io/ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/src/language/data-io/ChangeLog,v
retrieving revision 1.31
diff -u -p -r1.31 ChangeLog
--- src/language/data-io/ChangeLog	3 Nov 2006 04:53:51 -0000	1.31
+++ src/language/data-io/ChangeLog	3 Nov 2006 04:58:17 -0000
@@ -1,3 +1,11 @@
+Thu Nov  2 20:56:03 2006  Ben Pfaff  <blp@gnu.org>
+
+	Implement SKIP keyword on DATA LIST.  Fixes bug #17099.
+	
+	* data-list.c: (struct data_list_pgm) Add `skip_records' members.
+	(cmd_data_list) Set skip_records based on user input.
+	(data_list_source_read) Skip records requested by user.
+
 Tue Oct 31 20:04:06 2006  Ben Pfaff  <blp@gnu.org>
 
 	* placement-parser.c: (PRS_TYPE_T) Now that struct fmt_spec uses
@@ -12,7 +20,6 @@ Tue Oct 31 20:04:06 2006  Ben Pfaff  <bl
 	(fixed_parse_columns) Ditto.
 	(fixed_parse_fortran) Ditto.
 	
-
 Tue Oct 31 18:21:48 2006  Ben Pfaff  <blp@gnu.org>
 
 	* print-space.c (print_space_trns_proc): Let dfm_put_record add
Index: src/language/data-io/data-list.c
===================================================================
RCS file: /cvsroot/pspp/pspp/src/language/data-io/data-list.c,v
retrieving revision 1.23
diff -u -p -r1.23 data-list.c
--- src/language/data-io/data-list.c	3 Nov 2006 04:53:51 -0000	1.23
+++ src/language/data-io/data-list.c	3 Nov 2006 04:58:17 -0000
@@ -99,6 +99,7 @@ struct data_list_pgm
     struct variable *end;	/* Variable specified on END subcommand. */
     int record_cnt;             /* Number of records. */
     struct string delims;       /* Field delimiters. */
+    int skip_records;           /* Records to skip before first case. */
   };
 
 static const struct case_source_class data_list_source_class;
@@ -134,6 +135,7 @@ cmd_data_list (struct dataset *ds)
   dls->type = -1;
   dls->end = NULL;
   dls->record_cnt = 0;
+  dls->skip_records = 0;
   ds_init_empty (&dls->delims);
   ds_register_pool (&dls->delims, dls->pool);
 
@@ -158,6 +160,14 @@ cmd_data_list (struct dataset *ds)
 	  lex_get ();
 	  lex_match (')');
 	}
+      else if (lex_match_id ("SKIP"))
+	{
+	  lex_match ('=');
+	  if (!lex_force_int ())
+	    goto error;
+	  dls->skip_records = lex_integer ();
+	  lex_get ();
+	}
       else if (lex_match_id ("END"))
 	{
 	  if (dls->end)
@@ -819,6 +829,16 @@ data_list_source_read (struct case_sourc
 {
   struct data_list_pgm *dls = source->aux;
 
+  /* Skip the requested number of records before reading the
+     first case. */
+  while (dls->skip_records > 0) 
+    {
+      if (dfm_eof (dls->reader))
+        return false;
+      dfm_forward_record (dls->reader);
+      dls->skip_records--;
+    }
+  
   for (;;) 
     {
       bool ok;
Index: tests/ChangeLog
===================================================================
RCS file: /cvsroot/pspp/pspp/tests/ChangeLog,v
retrieving revision 1.63
diff -u -p -r1.63 ChangeLog
--- tests/ChangeLog	28 Oct 2006 04:01:55 -0000	1.63
+++ tests/ChangeLog	3 Nov 2006 04:58:18 -0000
@@ -1,3 +1,8 @@
+Thu Nov  2 20:58:12 2006  Ben Pfaff  <blp@gnu.org>
+
+	* command/data-list.sh: Test newly implement SKIP keyword on DATA
+	LIST.
+
 Thu Oct 26 20:20:39 2006  Ben Pfaff  <blp@gnu.org>
 
 	* automake.mk: Add tests/formats/float-format.sh.
Index: tests/command/data-list.sh
===================================================================
RCS file: /cvsroot/pspp/pspp/tests/command/data-list.sh,v
retrieving revision 1.10
diff -u -p -r1.10 data-list.sh
--- tests/command/data-list.sh	11 Mar 2006 07:16:40 -0000	1.10
+++ tests/command/data-list.sh	3 Nov 2006 04:58:18 -0000
@@ -64,8 +64,9 @@ end data.
 
 list.
 
-data list free/A B C D.
+data list free skip=1/A B C D.
 begin data.
+# This record is ignored.
 ,1,2,3
 ,4,,5
 6
@@ -81,8 +82,10 @@ begin data.
 end data.
 list.
 
-data list free (tab)/A B C D.
+data list free (tab) skip=2/A B C D.
 begin data.
+# These records
+# are skipped.
 1	2	3	4
 1	2	3	
 1	2		4
