pspp-dump-sav: Print a new-line following text record content.
[pspp] / utilities / pspp-dump-sav.c
index 7cdd7d9c5ecb93a826c4946a85cf1a1165240e6b..98cb6f3b22ed7ae6673081365fce531c52984069 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -227,7 +227,6 @@ read_header (struct sfm_reader *r)
   char eye_catcher[61];
   uint8_t raw_layout_code[4];
   int32_t layout_code;
-  int32_t nominal_case_size;
   int32_t compressed;
   int32_t weight_index;
   int32_t ncases;
@@ -254,7 +253,7 @@ read_header (struct sfm_reader *r)
   layout_code = integer_get (r->integer_format,
                              raw_layout_code, sizeof raw_layout_code);
 
-  nominal_case_size = read_int (r);
+  read_int (r);                 /* Nominal case size (not actually useful). */
   compressed = read_int (r);
   weight_index = read_int (r);
   ncases = read_int (r);
@@ -459,7 +458,7 @@ print_untyped_value (struct sfm_reader *r, char raw_value[8])
   double value;
 
   value = float_get_double (r->float_format, raw_value);
-  for (n_printable = 0; n_printable < sizeof raw_value; n_printable++)
+  for (n_printable = 0; n_printable < 8; n_printable++)
     if (!isprint (raw_value[n_printable]))
       break;
 
@@ -1071,17 +1070,20 @@ read_unknown_extension (struct sfm_reader *r, size_t size, size_t count)
       buffer = xmalloc (count);
       read_bytes (r, buffer, count);
       if (memchr (buffer, 0, count) == 0)
-        for (i = 0; i < count; i++)
-          {
-            unsigned char c = buffer[i];
-
-            if (c == '\\')
-              printf ("\\\\");
-            else if (c == '\n' || isprint (c))
-              putchar (c);
-            else
-              printf ("\\%02x", c);
-          }
+        {
+          for (i = 0; i < count; i++)
+            {
+              unsigned char c = buffer[i];
+
+              if (c == '\\')
+                printf ("\\\\");
+              else if (c == '\n' || isprint (c))
+                putchar (c);
+              else
+                printf ("\\%02x", c);
+            }
+          putchar ('\n');
+        }
       else
         hex_dump (0, buffer, count);
       free (buffer);