summaryrefslogtreecommitdiff
path: root/src/export
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2014-02-23 06:46:14 +0100
committerDirk Engling <erdgeist@erdgeist.org>2014-02-23 06:46:14 +0100
commiteda2f093c8e4696b46c40f4f0fc47f6f230923a0 (patch)
tree1cca65f947ded92c73d81b1774727c867d188437 /src/export
parent1ed87df0b05ea96092286dfe7ed05d5f2304c3dc (diff)
Dump Postleitzahl and Ort as well
Diffstat (limited to 'src/export')
-rw-r--r--src/export/extract_version_1.c10
1 files changed, 7 insertions, 3 deletions
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[] = {
36}; 36};
37 37
38static struct { 38static struct {
39 int outfiles[13]; 39 int outfiles[15];
40 char * vorwahl; 40 char * vorwahl;
41 char * ort; 41 char * ort;
42 char * zip; 42 char * zip;
@@ -64,12 +64,16 @@ void split_to_files( uint8_t *entries, int num_entries )
64 { 64 {
65 /* mimic flags from telefonbuch v3 */ 65 /* mimic flags from telefonbuch v3 */
66 write( g_state.outfiles[0], entry ? "02\n" : ( num_entries > 1 ? "01\n" : "00\n" ), 3 ); 66 write( g_state.outfiles[0], entry ? "02\n" : ( num_entries > 1 ? "01\n" : "00\n" ), 3 );
67 dprintf( g_state.outfiles[12], "%s\n", g_state.ort );
68 /* Only part of zip code, Zustellpostamt or eastern German code in column 5 (06_unknown) */
69 dprintf( g_state.outfiles[13], "%s\n", g_state.zip );
67 70
68 for( column = 0; column < 11; ++column ) 71 for( column = 0; column < 11; ++column )
69 { 72 {
70 char * end = strchr( e, '\t' ); 73 char * end = strchr( e, '\t' );
71 if( end ) { 74 if( end ) {
72 *end = '\n'; 75 *end = '\n';
76 if( column == 9 ) write( g_state.outfiles[column+1], "0", 1 ); /* Augment Vorwahl */
73 write( g_state.outfiles[column+1], e, end - e + 1); 77 write( g_state.outfiles[column+1], e, end - e + 1);
74 e = end + 1; 78 e = end + 1;
75 } else 79 } else
@@ -153,7 +157,7 @@ int main( int args, char **argv )
153 MAP f; 157 MAP f;
154 int i; 158 int i;
155 159
156 for( i=0; i<12; ++i ) 160 for( i=0; i<14; ++i )
157 { 161 {
158 sprintf( filename, "%02d_unknown", i+1 ); 162 sprintf( filename, "%02d_unknown", i+1 );
159 g_state.outfiles[i] = open( filename, O_WRONLY | O_APPEND | O_CREAT, 0644 ); 163 g_state.outfiles[i] = open( filename, O_WRONLY | O_APPEND | O_CREAT, 0644 );
@@ -167,7 +171,7 @@ int main( int args, char **argv )
167 unmap_file( &f ); 171 unmap_file( &f );
168 } 172 }
169 173
170 for( i=0; i<13; ++i ) 174 for( i=0; i<14; ++i )
171 close( g_state.outfiles[i] ); 175 close( g_state.outfiles[i] );
172 176
173 return 0; 177 return 0;