aboutsummaryrefslogtreecommitdiff
path: root/archival/gzip.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-03-19 09:13:01 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-03-19 09:13:01 +0000
commitcad5364599eb5062d59e0c397ed638ddd61a8d5d (patch)
treea318d0f03aa076c74b576ea45dc543a5669e8e91 /archival/gzip.c
parente01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff)
downloadbusybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz
busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.bz2
busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip
Major coreutils update.
Diffstat (limited to 'archival/gzip.c')
-rw-r--r--archival/gzip.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/archival/gzip.c b/archival/gzip.c
index 971724d74..cabc4aa2f 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -187,7 +187,7 @@ typedef int file_t; /* Do not use stdio */
187 187
188/* Diagnostic functions */ 188/* Diagnostic functions */
189#ifdef DEBUG 189#ifdef DEBUG
190# define Assert(cond,msg) {if(!(cond)) error_msg(msg);} 190# define Assert(cond,msg) {if(!(cond)) bb_error_msg(msg);}
191# define Trace(x) fprintf x 191# define Trace(x) fprintf x
192# define Tracev(x) {if (verbose) fprintf x ;} 192# define Tracev(x) {if (verbose) fprintf x ;}
193# define Tracevv(x) {if (verbose>1) fprintf x ;} 193# define Tracevv(x) {if (verbose>1) fprintf x ;}
@@ -352,10 +352,10 @@ static void clear_bufs(void)
352 bytes_in = 0L; 352 bytes_in = 0L;
353} 353}
354 354
355static void write_error_msg(void) 355static void write_bb_error_msg(void)
356{ 356{
357 fputc('\n', stderr); 357 fputc('\n', stderr);
358 perror_msg(""); 358 bb_perror_nomsg();
359 abort_gzip(); 359 abort_gzip();
360} 360}
361 361
@@ -369,7 +369,7 @@ static void write_buf(int fd, void *buf, unsigned cnt)
369 369
370 while ((n = write(fd, buf, cnt)) != cnt) { 370 while ((n = write(fd, buf, cnt)) != cnt) {
371 if (n == (unsigned) (-1)) { 371 if (n == (unsigned) (-1)) {
372 write_error_msg(); 372 write_bb_error_msg();
373 } 373 }
374 cnt -= n; 374 cnt -= n;
375 buf = (void *) ((char *) buf + n); 375 buf = (void *) ((char *) buf + n);
@@ -977,11 +977,11 @@ static void check_match(IPos start, IPos match, int length)
977 /* check that the match is indeed a match */ 977 /* check that the match is indeed a match */
978 if (memcmp((char *) window + match, 978 if (memcmp((char *) window + match,
979 (char *) window + start, length) != EQUAL) { 979 (char *) window + start, length) != EQUAL) {
980 error_msg(" start %d, match %d, length %d", start, match, length); 980 bb_error_msg(" start %d, match %d, length %d", start, match, length);
981 error_msg("invalid match"); 981 bb_error_msg("invalid match");
982 } 982 }
983 if (verbose > 1) { 983 if (verbose > 1) {
984 error_msg("\\[%d,%d]", start - match, length); 984 bb_error_msg("\\[%d,%d]", start - match, length);
985 do { 985 do {
986 putc(window[start++], stderr); 986 putc(window[start++], stderr);
987 } while (--length != 0); 987 } while (--length != 0);
@@ -1232,7 +1232,7 @@ int gzip_main(int argc, char **argv)
1232 return gunzip_main(argc, argv); 1232 return gunzip_main(argc, argv);
1233#endif 1233#endif
1234 default: 1234 default:
1235 show_usage(); 1235 bb_show_usage();
1236 } 1236 }
1237 } 1237 }
1238 1238
@@ -1282,7 +1282,7 @@ int gzip_main(int argc, char **argv)
1282 } else { 1282 } else {
1283 inFileNum = open(argv[i], O_RDONLY); 1283 inFileNum = open(argv[i], O_RDONLY);
1284 if (inFileNum < 0 || fstat(inFileNum, &statBuf) < 0) 1284 if (inFileNum < 0 || fstat(inFileNum, &statBuf) < 0)
1285 perror_msg_and_die("%s", argv[i]); 1285 bb_perror_msg_and_die("%s", argv[i]);
1286 time_stamp = statBuf.st_ctime; 1286 time_stamp = statBuf.st_ctime;
1287 ifile_size = statBuf.st_size; 1287 ifile_size = statBuf.st_size;
1288 1288
@@ -1299,7 +1299,7 @@ int gzip_main(int argc, char **argv)
1299 outFileNum = open(path, O_RDWR | O_CREAT | O_EXCL); 1299 outFileNum = open(path, O_RDWR | O_CREAT | O_EXCL);
1300#endif 1300#endif
1301 if (outFileNum < 0) { 1301 if (outFileNum < 0) {
1302 perror_msg("%s", path); 1302 bb_perror_msg("%s", path);
1303 free(path); 1303 free(path);
1304 continue; 1304 continue;
1305 } 1305 }
@@ -1311,7 +1311,7 @@ int gzip_main(int argc, char **argv)
1311 } 1311 }
1312 1312
1313 if (path == NULL && isatty(outFileNum) && force == 0) { 1313 if (path == NULL && isatty(outFileNum) && force == 0) {
1314 error_msg 1314 bb_error_msg
1315 ("compressed data not written to a terminal. Use -f to force compression."); 1315 ("compressed data not written to a terminal. Use -f to force compression.");
1316 free(path); 1316 free(path);
1317 continue; 1317 continue;
@@ -1330,7 +1330,7 @@ int gzip_main(int argc, char **argv)
1330 delFileName = path; 1330 delFileName = path;
1331 1331
1332 if (unlink(delFileName) < 0) 1332 if (unlink(delFileName) < 0)
1333 perror_msg("%s", delFileName); 1333 bb_perror_msg("%s", delFileName);
1334 } 1334 }
1335 1335
1336 free(path); 1336 free(path);
@@ -1655,7 +1655,7 @@ static void set_file_type(void);
1655 1655
1656#else /* DEBUG */ 1656#else /* DEBUG */
1657# define send_code(c, tree) \ 1657# define send_code(c, tree) \
1658 { if (verbose>1) error_msg("\ncd %3d ",(c)); \ 1658 { if (verbose>1) bb_error_msg("\ncd %3d ",(c)); \
1659 send_bits(tree[c].Code, tree[c].Len); } 1659 send_bits(tree[c].Code, tree[c].Len); }
1660#endif 1660#endif
1661 1661
@@ -2035,7 +2035,7 @@ static void build_tree(tree_desc * desc)
2035 tree[n].Dad = tree[m].Dad = (ush) node; 2035 tree[n].Dad = tree[m].Dad = (ush) node;
2036#ifdef DUMP_BL_TREE 2036#ifdef DUMP_BL_TREE
2037 if (tree == bl_tree) { 2037 if (tree == bl_tree) {
2038 error_msg("\nnode %d(%d), sons %d(%d) %d(%d)", 2038 bb_error_msg("\nnode %d(%d), sons %d(%d) %d(%d)",
2039 node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); 2039 node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
2040 } 2040 }
2041#endif 2041#endif
@@ -2273,7 +2273,7 @@ static ulg flush_block(char *buf, ulg stored_len, int eof)
2273 if (stored_len <= opt_lenb && eof && compressed_len == 0L && seekable()) { 2273 if (stored_len <= opt_lenb && eof && compressed_len == 0L && seekable()) {
2274 /* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */ 2274 /* Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: */
2275 if (buf == (char *) 0) 2275 if (buf == (char *) 0)
2276 error_msg("block vanished"); 2276 bb_error_msg("block vanished");
2277 2277
2278 copy_block(buf, (unsigned) stored_len, 0); /* without header */ 2278 copy_block(buf, (unsigned) stored_len, 0); /* without header */
2279 compressed_len = stored_len << 3; 2279 compressed_len = stored_len << 3;
@@ -2442,7 +2442,7 @@ static void set_file_type()
2442 bin_freq += dyn_ltree[n++].Freq; 2442 bin_freq += dyn_ltree[n++].Freq;
2443 *file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII; 2443 *file_type = bin_freq > (ascii_freq >> 2) ? BINARY : ASCII;
2444 if (*file_type == BINARY && translate_eol) { 2444 if (*file_type == BINARY && translate_eol) {
2445 error_msg("-l used on binary file"); 2445 bb_error_msg("-l used on binary file");
2446 } 2446 }
2447} 2447}
2448 2448