diff options
Diffstat (limited to 'src/export')
| -rw-r--r-- | src/export/extract_version_1.c | 10 |
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 | ||
| 38 | static struct { | 38 | static 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; |
