From eda2f093c8e4696b46c40f4f0fc47f6f230923a0 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Sun, 23 Feb 2014 06:46:14 +0100 Subject: Dump Postleitzahl and Ort as well --- src/export/extract_version_1.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/export') diff --git a/src/export/extract_version_1.c b/src/export/extract_version_1.c index d81abd3..ae81dc5 100644 --- a/src/export/extract_version_1.c +++ b/src/export/extract_version_1.c @@ -36,7 +36,7 @@ static char cp437_to_iso8859_1_table[] = { }; static struct { - int outfiles[13]; + int outfiles[15]; char * vorwahl; char * ort; char * zip; @@ -64,12 +64,16 @@ void split_to_files( uint8_t *entries, int num_entries ) { /* mimic flags from telefonbuch v3 */ write( g_state.outfiles[0], entry ? "02\n" : ( num_entries > 1 ? "01\n" : "00\n" ), 3 ); + dprintf( g_state.outfiles[12], "%s\n", g_state.ort ); + /* Only part of zip code, Zustellpostamt or eastern German code in column 5 (06_unknown) */ + dprintf( g_state.outfiles[13], "%s\n", g_state.zip ); for( column = 0; column < 11; ++column ) { char * end = strchr( e, '\t' ); if( end ) { *end = '\n'; + if( column == 9 ) write( g_state.outfiles[column+1], "0", 1 ); /* Augment Vorwahl */ write( g_state.outfiles[column+1], e, end - e + 1); e = end + 1; } else @@ -153,7 +157,7 @@ int main( int args, char **argv ) MAP f; int i; - for( i=0; i<12; ++i ) + for( i=0; i<14; ++i ) { sprintf( filename, "%02d_unknown", i+1 ); g_state.outfiles[i] = open( filename, O_WRONLY | O_APPEND | O_CREAT, 0644 ); @@ -167,7 +171,7 @@ int main( int args, char **argv ) unmap_file( &f ); } - for( i=0; i<13; ++i ) + for( i=0; i<14; ++i ) close( g_state.outfiles[i] ); return 0; -- cgit v1.2.3