summaryrefslogtreecommitdiff
path: root/src/export
diff options
context:
space:
mode:
Diffstat (limited to 'src/export')
-rw-r--r--src/export/extract_version_1.c8
-rw-r--r--src/export/extract_version_3.c11
-rw-r--r--src/export/extract_version_4.c5
-rw-r--r--src/export/split_version_2.c7
-rw-r--r--src/export/split_version_3.c6
5 files changed, 26 insertions, 11 deletions
diff --git a/src/export/extract_version_1.c b/src/export/extract_version_1.c
index c727b4f..8ec199e 100644
--- a/src/export/extract_version_1.c
+++ b/src/export/extract_version_1.c
@@ -190,6 +190,7 @@ int main( )
190{ 190{
191 char filename[1024]; 191 char filename[1024];
192 MAP f; 192 MAP f;
193 ssize_t temp = 0;
193 int i; 194 int i;
194 195
195 for( i=0; i<14; ++i ) 196 for( i=0; i<14; ++i )
@@ -210,15 +211,16 @@ int main( )
210 /* Write out results */ 211 /* Write out results */
211 for( i=0; i<14; ++i ) { 212 for( i=0; i<14; ++i ) {
212 /* if( g_state.outfill[i] > 1024*1024*6 ) printf( "Large: %s %zd\n", g_state.ort, g_state.outfill[i] ); */ 213 /* if( g_state.outfill[i] > 1024*1024*6 ) printf( "Large: %s %zd\n", g_state.ort, g_state.outfill[i] ); */
213 (void)write( g_state.outfiles[i], g_state.outbuf[i], g_state.outfill[i] ); 214 temp += write( g_state.outfiles[i], g_state.outbuf[i], g_state.outfill[i] );
214 g_state.outfill[i] = 0; 215 g_state.outfill[i] = 0;
215 } 216 }
216 } 217 }
217 218
218 for( i=0; i<14; ++i ) { 219 for( i=0; i<14; ++i ) {
219 (void)write( g_state.outfiles[i], g_state.outbuf[i], g_state.outfill[i] ); 220 temp += write( g_state.outfiles[i], g_state.outbuf[i], g_state.outfill[i] );
220 close( g_state.outfiles[i] ); 221 close( g_state.outfiles[i] );
221 } 222 }
222 223 if( !temp )
224 exit(1);
223 return 0; 225 return 0;
224} 226}
diff --git a/src/export/extract_version_3.c b/src/export/extract_version_3.c
index 329c1a8..a291771 100644
--- a/src/export/extract_version_3.c
+++ b/src/export/extract_version_3.c
@@ -30,6 +30,7 @@ int main( int args, char **argv )
30{ 30{
31 int filenum = 0, run = 1, first_run = 1; 31 int filenum = 0, run = 1, first_run = 1;
32 size_t offset = 0, old_offset = 0, reported = 0, enc_len = 32; 32 size_t offset = 0, old_offset = 0, reported = 0, enc_len = 32;
33 ssize_t temp = 0;
33 uint8_t mantra[4], id0, id5, *mapped_file; 34 uint8_t mantra[4], id0, id5, *mapped_file;
34 MAP map; 35 MAP map;
35 36
@@ -113,11 +114,11 @@ int main( int args, char **argv )
113 /* Open file and dump our de-"crypted" header and then rest of file */ 114 /* Open file and dump our de-"crypted" header and then rest of file */
114 fh = open( filename, O_CREAT | O_TRUNC | O_WRONLY, 0644 ); 115 fh = open( filename, O_CREAT | O_TRUNC | O_WRONLY, 0644 );
115 if( enc_len > header_len ) { 116 if( enc_len > header_len ) {
116 (void)write( fh, df, enc_len ); 117 temp += write( fh, df, enc_len );
117 (void)write( fh, mf + enc_len, offset - old_offset - enc_len ); 118 temp += write( fh, mf + enc_len, offset - old_offset - enc_len );
118 } else { 119 } else {
119 (void)write( fh, df, header_len ); 120 temp += write( fh, df, header_len );
120 (void)write( fh, mf + header_len, offset - old_offset - header_len ); 121 temp += write( fh, mf + header_len, offset - old_offset - header_len );
121 } 122 }
122 close( fh ); 123 close( fh );
123 } 124 }
@@ -126,5 +127,7 @@ int main( int args, char **argv )
126 } 127 }
127 128
128 unmap_file( &map ); 129 unmap_file( &map );
130 if( !temp )
131 exit(1);
129 return 0; 132 return 0;
130} 133}
diff --git a/src/export/extract_version_4.c b/src/export/extract_version_4.c
index 252831a..1dbaf40 100644
--- a/src/export/extract_version_4.c
+++ b/src/export/extract_version_4.c
@@ -16,6 +16,7 @@ int main(int argc, char **argv) {
16 char respath[32]; /* file_XXXXX\0 */ 16 char respath[32]; /* file_XXXXX\0 */
17 int zres = 0, filenum = 0, resfile; 17 int zres = 0, filenum = 0, resfile;
18 size_t i, offs = 0, reported = 0; 18 size_t i, offs = 0, reported = 0;
19 ssize_t temp = 0;
19 MAP in; 20 MAP in;
20 21
21 if( argc != 2 ) exit(111); 22 if( argc != 2 ) exit(111);
@@ -50,7 +51,7 @@ error_continue:
50 fprintf( stderr, "Could not open output file %s\n", respath ); 51 fprintf( stderr, "Could not open output file %s\n", respath );
51 exit(1); 52 exit(1);
52 } 53 }
53 (void)write( resfile, output, z.total_out ); 54 temp += write( resfile, output, z.total_out );
54 close( resfile ); 55 close( resfile );
55 offs += z.total_in; 56 offs += z.total_in;
56 57
@@ -66,5 +67,7 @@ error_continue:
66 if( reported < 10 ) 67 if( reported < 10 )
67 printf( "100%% " ); 68 printf( "100%% " );
68 fflush( stdout ); 69 fflush( stdout );
70 if( !temp )
71 exit(1);
69 return 0; 72 return 0;
70} 73}
diff --git a/src/export/split_version_2.c b/src/export/split_version_2.c
index 6eafe55..c14da18 100644
--- a/src/export/split_version_2.c
+++ b/src/export/split_version_2.c
@@ -193,6 +193,7 @@ int main( int args, char **argv ) {
193 char filename[1024]; 193 char filename[1024];
194 MAP data, index; 194 MAP data, index;
195 uint32_t * indoff; 195 uint32_t * indoff;
196 ssize_t temp = 0;
196 size_t limit; 197 size_t limit;
197 int i; 198 int i;
198 199
@@ -237,17 +238,19 @@ int main( int args, char **argv ) {
237 if( g_state.outfill[0] > limit ) 238 if( g_state.outfill[0] > limit )
238 for( i=0; i<g_outfiles; ++i ) { 239 for( i=0; i<g_outfiles; ++i ) {
239 if( g_state.outfill[i] > 1024*1024*6 ) printf( "Large: %zd\n", g_state.outfill[i] ); 240 if( g_state.outfill[i] > 1024*1024*6 ) printf( "Large: %zd\n", g_state.outfill[i] );
240 (void)write( g_state.outfiles[i], g_state.outbuf[i], g_state.outfill[i] ); 241 temp += write( g_state.outfiles[i], g_state.outbuf[i], g_state.outfill[i] );
241 g_state.outfill[i] = 0; 242 g_state.outfill[i] = 0;
242 } 243 }
243 } 244 }
244 245
245 for( i=0; i<g_outfiles; ++i ) { 246 for( i=0; i<g_outfiles; ++i ) {
246 (void)write( g_state.outfiles[i], g_state.outbuf[i], g_state.outfill[i] ); 247 temp += write( g_state.outfiles[i], g_state.outbuf[i], g_state.outfill[i] );
247 close( g_state.outfiles[i] ); 248 close( g_state.outfiles[i] );
248 } 249 }
249 unmap_file( &data ); 250 unmap_file( &data );
250 unmap_file( &index ); 251 unmap_file( &index );
251 252
253 if( !temp )
254 exit(1);
252 return 0; 255 return 0;
253} 256}
diff --git a/src/export/split_version_3.c b/src/export/split_version_3.c
index 853d95d..8170a3a 100644
--- a/src/export/split_version_3.c
+++ b/src/export/split_version_3.c
@@ -8,6 +8,7 @@
8int main( int argc, char **args ) { 8int main( int argc, char **args ) {
9 char table[64], f[1024*1024]; 9 char table[64], f[1024*1024];
10 int outfiles[64], i, base = 0, fixed_columns = 0; 10 int outfiles[64], i, base = 0, fixed_columns = 0;
11 ssize_t temp = 0;
11 uint32_t *p = (uint32_t*)f; 12 uint32_t *p = (uint32_t*)f;
12 13
13 if( argc > 1 ) base = atoi( args[1] ); 14 if( argc > 1 ) base = atoi( args[1] );
@@ -49,10 +50,13 @@ int main( int argc, char **args ) {
49 off = p[file+1]; 50 off = p[file+1];
50 /* Look for end of this chunk, which is <count> strings long */ 51 /* Look for end of this chunk, which is <count> strings long */
51 for( strnr=0; strnr < count; ++strnr ) { while( f[off++] ) {}; f[off-1] = '\n'; } 52 for( strnr=0; strnr < count; ++strnr ) { while( f[off++] ) {}; f[off-1] = '\n'; }
52 (void)write( outfiles[file], f + p[file+1], off - p[file+1] ); 53 temp += write( outfiles[file], f + p[file+1], off - p[file+1] );
53 } 54 }
54 } 55 }
55 56
56 for( i=0; i<64; ++i ) close( outfiles[i] ); 57 for( i=0; i<64; ++i ) close( outfiles[i] );
58 if( !temp )
59 exit(1);
60
57 return 0; 61 return 0;
58} 62}