Index: trunk/Ohana/src/libfits/header/F_read_H.c
===================================================================
--- trunk/Ohana/src/libfits/header/F_read_H.c	(revision 38988)
+++ trunk/Ohana/src/libfits/header/F_read_H.c	(revision 38989)
@@ -85,5 +85,5 @@
   gfits_scan (header, "NAXIS10", OFF_T_FMT, 1,  &header[0].Naxis[9]);
 
-  if (!gfits_scan (header, "PCOUNT",  "%d", 1, &header[0].pcount)) {
+  if (!gfits_scan (header, "PCOUNT",  OFF_T_FMT, 1, &header[0].pcount)) {
     header[0].pcount = 0;
   }
Index: trunk/Ohana/src/libfits/include/gfitsio.h
===================================================================
--- trunk/Ohana/src/libfits/include/gfitsio.h	(revision 38988)
+++ trunk/Ohana/src/libfits/include/gfitsio.h	(revision 38989)
@@ -46,5 +46,5 @@
   off_t                   Naxis[FT_MAX_NAXES];
   off_t                   datasize;
-  int                     pcount;
+  off_t                   pcount;
   int                     gcount;
   double                  bzero;
Index: trunk/Ohana/src/libfits/matrix/F_uncompress_M.c
===================================================================
--- trunk/Ohana/src/libfits/matrix/F_uncompress_M.c	(revision 38988)
+++ trunk/Ohana/src/libfits/matrix/F_uncompress_M.c	(revision 38989)
@@ -161,10 +161,10 @@
 
     // we may have an uncompressed PCOUNT / GCOUNT value, otherwise set to 0,1
-    if (gfits_scan (header, "ZPCOUNT", "%d", 1, &header->pcount)) {
+    if (gfits_scan (header, "ZPCOUNT", OFF_T_FMT, 1, &header->pcount)) {
 	gfits_delete (header, "ZPCOUNT", 1);
-	gfits_modify (header, "PCOUNT", "%d", 1, header->pcount);
+	gfits_modify (header, "PCOUNT", OFF_T_FMT, 1, header->pcount);
     } else {
 	header->pcount = 0;
-	gfits_modify (header, "PCOUNT", "%d", 1, header->pcount);
+	gfits_modify (header, "PCOUNT", OFF_T_FMT, 1, header->pcount);
     }
     if (gfits_scan (header, "ZGCOUNT", "%d", 1, &header->gcount)) {
@@ -178,5 +178,5 @@
     header->pcount = 0;
     header->gcount = 1;
-    gfits_modify (header, "PCOUNT", "%d", 1, header->pcount);
+    gfits_modify (header, "PCOUNT", OFF_T_FMT, 1, header->pcount);
     gfits_modify (header, "GCOUNT", "%d", 1, header->gcount);
   }
Index: trunk/Ohana/src/libfits/table/F_create_TH.c
===================================================================
--- trunk/Ohana/src/libfits/table/F_create_TH.c	(revision 38988)
+++ trunk/Ohana/src/libfits/table/F_create_TH.c	(revision 38989)
@@ -31,5 +31,5 @@
   }
   
-  gfits_modify (header, "PCOUNT", "%d", 1, header[0].pcount);
+  gfits_modify (header, "PCOUNT", OFF_T_FMT, 1, header[0].pcount);
   gfits_modify (header, "GCOUNT", "%d", 1, header[0].gcount);
   if (!strcmp (type, "IMAGE")) {
Index: trunk/Ohana/src/opihi/cmd.data/read_vectors.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.data/read_vectors.c	(revision 38988)
+++ trunk/Ohana/src/opihi/cmd.data/read_vectors.c	(revision 38989)
@@ -190,4 +190,6 @@
   ALLOCATE (buffer, char, 0x10001);
   bzero (buffer, 0x10001);
+
+  /* 
   for (i = 0; i < Nskip; i++) {
     if (scan_line_maxlen (f, buffer, 0x10000) == EOF) {
@@ -197,8 +199,13 @@
     }
   }
+  */
+
+  int Nline_read = 0; // track number of lines read so far (use to skip lines as well)
 
   // we have a working buffer read from the file. we parse the lines in the working buffer
   // until we reach the last chunk without an EOL char.  at that point, we shift the start
   // of the last (partial) line to the start of the buffer and re-fill.
+
+  // we treat \n\r pair as a single EOL char to handle mac files:
 
   Nstart = 0; // location of the last valid byte in the buffer (start filling here)
@@ -218,7 +225,7 @@
     c0 = buffer; // c0 always marks the start of a line
     while (bufferStatus) {
-      c1 = strchr (c0, '\n'); // find the end of this current line
+      c1 = strchr (c0, '\n'); // find the end of this current line (also valid for a Mac: \r\n)
       if (!c1) {
-	c1 = strchr (c0, '\r'); // try \r for non-UNIX files (what do we do about a Mac? \n\r?)
+	c1 = strchr (c0, '\r'); // try \r for non-UNIX files
       }
       if (c1 == (char *) NULL) {
@@ -229,4 +236,7 @@
       }
       *c1 = 0; // mark the end of the line 
+      Nline_read ++;
+
+      if (Nline_read <= Nskip) { c0 = c1 + 1; continue; }
 
       if (*c0 == '#') {	c0 = c1 + 1; continue; }
