From: John Darrington Date: Sun, 29 Mar 2009 23:57:30 +0000 (+0800) Subject: Add code to read character encoding to dissect-sysfile. X-Git-Tag: v0.7.3~189 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4fdb8d1a601d45340fc29f0af38f0aef151fb0b;p=pspp-builds.git Add code to read character encoding to dissect-sysfile. --- diff --git a/tests/dissect-sysfile.c b/tests/dissect-sysfile.c index 25d01158..1c81c72c 100644 --- a/tests/dissect-sysfile.c +++ b/tests/dissect-sysfile.c @@ -66,6 +66,9 @@ static void read_datafile_attributes (struct sfm_reader *r, size_t size, size_t count); static void read_variable_attributes (struct sfm_reader *r, size_t size, size_t count); +static void read_character_encoding (struct sfm_reader *r, + size_t size, size_t count); + static struct text_record *open_text_record ( struct sfm_reader *, size_t size); @@ -510,6 +513,10 @@ read_extension_record (struct sfm_reader *r) read_variable_attributes (r, size, count); return; + case 20: + read_character_encoding (r, size, count); + return; + default: sys_warn (r, _("Unrecognized record type 7, subtype %d."), subtype); break; @@ -712,6 +719,17 @@ read_datafile_attributes (struct sfm_reader *r, size_t size, size_t count) close_text_record (text); } +static void +read_character_encoding (struct sfm_reader *r, size_t size, size_t count) +{ + const unsigned long int posn = ftell (r->file); + char *encoding = calloc (size, count + 1); + read_string (r, encoding, count + 1); + + printf ("%08lx: Character Encoding: %s\n", posn, encoding); +} + + static void read_variable_attributes (struct sfm_reader *r, size_t size, size_t count) {