aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
Diffstat (limited to 'archival')
-rw-r--r--archival/gunzip.c170
-rw-r--r--archival/gzip.c191
-rw-r--r--archival/tar.c6
3 files changed, 184 insertions, 183 deletions
diff --git a/archival/gunzip.c b/archival/gunzip.c
index 7aa896469..1a5cdba88 100644
--- a/archival/gunzip.c
+++ b/archival/gunzip.c
@@ -1,13 +1,33 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* zcat : stripped version based on gzip sources 2/*
3 Sven Rudolph <sr1@inf.tu-dresden.de> 3 * Gzip implementation for busybox
4 */ 4 *
5 * Based on GNU gzip Copyright (C) 1992-1993 Jean-loup Gailly.
6 *
7 * Originally adjusted for busybox by Sven Rudolph <sr1@inf.tu-dresden.de>
8 * based on gzip sources
9 *
10 * Adjusted further by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
11 * to support files as well as stdin/stdout, and to generally behave itself wrt
12 * command line handling.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 *
28 */
5 29
6#include "internal.h" 30#include "internal.h"
7#define bb_need_name_too_long
8#define BB_DECLARE_EXTERN
9#include "messages.c"
10
11static const char gunzip_usage[] = 31static const char gunzip_usage[] =
12 "gunzip [OPTION]... FILE\n\n" 32 "gunzip [OPTION]... FILE\n\n"
13 "Uncompress FILE (or standard input if FILE is '-').\n\n" 33 "Uncompress FILE (or standard input if FILE is '-').\n\n"
@@ -16,6 +36,18 @@ static const char gunzip_usage[] =
16 "\t-c\tWrite output to standard output\n" 36 "\t-c\tWrite output to standard output\n"
17 "\t-t\tTest compressed file integrity\n"; 37 "\t-t\tTest compressed file integrity\n";
18 38
39
40 /* These defines are very important for BusyBox. Without these,
41 * huge chunks of ram are pre-allocated making the BusyBox bss
42 * size Freaking Huge(tm), which is a bad thing.*/
43#define SMALL_MEM
44#define DYN_ALLOC
45
46#define bb_need_name_too_long
47#define BB_DECLARE_EXTERN
48#include "messages.c"
49
50
19/* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface 51/* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
20 * Copyright (C) 1992-1993 Jean-loup Gailly 52 * Copyright (C) 1992-1993 Jean-loup Gailly
21 * The unzip code was written and put in the public domain by Mark Adler. 53 * The unzip code was written and put in the public domain by Mark Adler.
@@ -89,25 +121,6 @@ static char *license_msg[] = {
89#define get_char() get_byte() 121#define get_char() get_byte()
90#define put_char(c) put_byte(c) 122#define put_char(c) put_byte(c)
91 123
92/* #include "gzip.h" */
93
94/* gzip.h -- common declarations for all gzip modules
95 * Copyright (C) 1992-1993 Jean-loup Gailly.
96 * This is free software; you can redistribute it and/or modify it under the
97 * terms of the GNU General Public License, see the file COPYING.
98 */
99
100#if defined(__STDC__) || defined(PROTO)
101# define OF(args) args
102#else
103# define OF(args) ()
104#endif
105
106#ifdef __STDC__
107typedef void *voidp;
108#else
109typedef char *voidp;
110#endif
111 124
112/* I don't like nested includes, but the string and io functions are used 125/* I don't like nested includes, but the string and io functions are used
113 * too often 126 * too often
@@ -118,7 +131,7 @@ typedef char *voidp;
118# if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__) 131# if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__)
119# include <memory.h> 132# include <memory.h>
120# endif 133# endif
121# define memzero(s, n) memset ((voidp)(s), 0, (n)) 134# define memzero(s, n) memset ((void *)(s), 0, (n))
122#else 135#else
123# include <strings.h> 136# include <strings.h>
124# define strchr index 137# define strchr index
@@ -329,49 +342,46 @@ extern int save_orig_name; /* set if original name must be saved */
329#define WARN(msg) {fprintf msg ; \ 342#define WARN(msg) {fprintf msg ; \
330 if (exit_code == OK) exit_code = WARNING;} 343 if (exit_code == OK) exit_code = WARNING;}
331 344
332#define do_exit(c) exit(c)
333
334
335 /* in unzip.c */ 345 /* in unzip.c */
336extern int unzip OF((int in, int out)); 346extern int unzip (int in, int out);
337 347
338 /* in gzip.c */ 348 /* in gzip.c */
339RETSIGTYPE abort_gzip OF((void)); 349RETSIGTYPE abort_gzip (void);
340 350
341 /* in deflate.c */ 351 /* in deflate.c */
342void lm_init OF((int pack_level, ush * flags)); 352void lm_init (int pack_level, ush * flags);
343ulg deflate OF((void)); 353ulg deflate (void);
344 354
345 /* in trees.c */ 355 /* in trees.c */
346void ct_init OF((ush * attr, int *method)); 356void ct_init (ush * attr, int *method);
347int ct_tally OF((int dist, int lc)); 357int ct_tally (int dist, int lc);
348ulg flush_block OF((char *buf, ulg stored_len, int eof)); 358ulg flush_block (char *buf, ulg stored_len, int eof);
349 359
350 /* in bits.c */ 360 /* in bits.c */
351void bi_init OF((file_t zipfile)); 361void bi_init (file_t zipfile);
352void send_bits OF((int value, int length)); 362void send_bits (int value, int length);
353unsigned bi_reverse OF((unsigned value, int length)); 363unsigned bi_reverse (unsigned value, int length);
354void bi_windup OF((void)); 364void bi_windup (void);
355void copy_block OF((char *buf, unsigned len, int header)); 365void copy_block (char *buf, unsigned len, int header);
356extern int (*read_buf) OF((char *buf, unsigned size)); 366extern int (*read_buf) (char *buf, unsigned size);
357 367
358 /* in util.c: */ 368 /* in util.c: */
359extern int copy OF((int in, int out)); 369extern int copy (int in, int out);
360extern ulg updcrc OF((uch * s, unsigned n)); 370extern ulg updcrc (uch * s, unsigned n);
361extern void clear_bufs OF((void)); 371extern void clear_bufs (void);
362extern int fill_inbuf OF((int eof_ok)); 372extern int fill_inbuf (int eof_ok);
363extern void flush_outbuf OF((void)); 373extern void flush_outbuf (void);
364extern void flush_window OF((void)); 374extern void flush_window (void);
365extern void write_buf OF((int fd, voidp buf, unsigned cnt)); 375extern void write_buf (int fd, void * buf, unsigned cnt);
366 376
367#ifndef __linux__ 377#ifndef __linux__
368extern char *basename OF((char *fname)); 378extern char *basename (char *fname);
369#endif /* not __linux__ */ 379#endif /* not __linux__ */
370extern void read_error OF((void)); 380extern void read_error (void);
371extern void write_error OF((void)); 381extern void write_error (void);
372 382
373 /* in inflate.c */ 383 /* in inflate.c */
374extern int inflate OF((void)); 384extern int inflate (void);
375 385
376/* #include "lzw.h" */ 386/* #include "lzw.h" */
377 387
@@ -415,8 +425,8 @@ extern int inflate OF((void));
415extern int maxbits; /* max bits per code for LZW */ 425extern int maxbits; /* max bits per code for LZW */
416extern int block_mode; /* block compress mode -C compatible with 2.0 */ 426extern int block_mode; /* block compress mode -C compatible with 2.0 */
417 427
418extern int lzw OF((int in, int out)); 428extern int lzw (int in, int out);
419extern int unlzw OF((int in, int out)); 429extern int unlzw (int in, int out);
420 430
421 431
422/* #include "revision.h" */ 432/* #include "revision.h" */
@@ -605,7 +615,7 @@ typedef struct direct dir_type;
605#if !defined(S_ISREG) && defined(S_IFREG) 615#if !defined(S_ISREG) && defined(S_IFREG)
606# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 616# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
607#endif 617#endif
608typedef RETSIGTYPE(*sig_type) OF((int)); 618typedef RETSIGTYPE(*sig_type) (int);
609 619
610#ifndef O_BINARY 620#ifndef O_BINARY
611# define O_BINARY 0 /* creation mode for open() */ 621# define O_BINARY 0 /* creation mode for open() */
@@ -644,7 +654,7 @@ typedef RETSIGTYPE(*sig_type) OF((int));
644 654
645#ifdef NO_OFF_T 655#ifdef NO_OFF_T
646typedef long off_t; 656typedef long off_t;
647off_t lseek OF((int fd, off_t offset, int whence)); 657off_t lseek (int fd, off_t offset, int whence);
648#endif 658#endif
649 659
650 660
@@ -687,7 +697,7 @@ long header_bytes; /* number of bytes in gzip header */
687 697
688/* local functions */ 698/* local functions */
689 699
690local int get_method OF((int in)); 700local int get_method (int in);
691 701
692#define strequ(s1, s2) (strcmp((s1),(s2)) == 0) 702#define strequ(s1, s2) (strcmp((s1),(s2)) == 0)
693 703
@@ -773,7 +783,7 @@ int gunzip_main(int argc, char **argv)
773 usage(gunzip_usage); 783 usage(gunzip_usage);
774 if (strlen(*argv) > MAX_PATH_LEN) { 784 if (strlen(*argv) > MAX_PATH_LEN) {
775 fprintf(stderr, name_too_long, "gunzip"); 785 fprintf(stderr, name_too_long, "gunzip");
776 do_exit(WARNING); 786 exit(WARNING);
777 } 787 }
778 strcpy(ifname, *argv); 788 strcpy(ifname, *argv);
779 789
@@ -781,13 +791,13 @@ int gunzip_main(int argc, char **argv)
781 inFileNum = open(ifname, O_RDONLY); 791 inFileNum = open(ifname, O_RDONLY);
782 if (inFileNum < 0) { 792 if (inFileNum < 0) {
783 perror(ifname); 793 perror(ifname);
784 do_exit(WARNING); 794 exit(WARNING);
785 } 795 }
786 /* Get the time stamp on the input file. */ 796 /* Get the time stamp on the input file. */
787 result = stat(ifname, &statBuf); 797 result = stat(ifname, &statBuf);
788 if (result < 0) { 798 if (result < 0) {
789 perror(ifname); 799 perror(ifname);
790 do_exit(WARNING); 800 exit(WARNING);
791 } 801 }
792 ifile_size = statBuf.st_size; 802 ifile_size = statBuf.st_size;
793 } 803 }
@@ -812,7 +822,7 @@ int gunzip_main(int argc, char **argv)
812 /* And get to work */ 822 /* And get to work */
813 if (strlen(ifname) > MAX_PATH_LEN - 4) { 823 if (strlen(ifname) > MAX_PATH_LEN - 4) {
814 fprintf(stderr, name_too_long, "gunzip"); 824 fprintf(stderr, name_too_long, "gunzip");
815 do_exit(WARNING); 825 exit(WARNING);
816 } 826 }
817 strcpy(ofname, ifname); 827 strcpy(ofname, ifname);
818 pos = strstr(ofname, ".gz"); 828 pos = strstr(ofname, ".gz");
@@ -836,7 +846,7 @@ int gunzip_main(int argc, char **argv)
836#endif 846#endif
837 if (outFileNum < 0) { 847 if (outFileNum < 0) {
838 perror(ofname); 848 perror(ofname);
839 do_exit(WARNING); 849 exit(WARNING);
840 } 850 }
841 /* Set permissions on the file */ 851 /* Set permissions on the file */
842 fchmod(outFileNum, statBuf.st_mode); 852 fchmod(outFileNum, statBuf.st_mode);
@@ -860,7 +870,7 @@ int gunzip_main(int argc, char **argv)
860 exit(FALSE); 870 exit(FALSE);
861 } 871 }
862 } 872 }
863 do_exit(exit_code); 873 exit(exit_code);
864} 874}
865 875
866 876
@@ -953,7 +963,7 @@ int in; /* input file descriptor */
953 */ 963 */
954RETSIGTYPE abort_gzip() 964RETSIGTYPE abort_gzip()
955{ 965{
956 do_exit(ERROR); 966 exit(ERROR);
957} 967}
958 968
959/* unzip.c -- decompress files in gzip or pkzip format. 969/* unzip.c -- decompress files in gzip or pkzip format.
@@ -1027,7 +1037,7 @@ int in, out; /* input and output file descriptors */
1027 ofd = out; 1037 ofd = out;
1028 method = get_method(ifd); 1038 method = get_method(ifd);
1029 if (method < 0) { 1039 if (method < 0) {
1030 do_exit(exit_code); /* error message already emitted */ 1040 exit(exit_code); /* error message already emitted */
1031 } 1041 }
1032 1042
1033 updcrc(NULL, 0); /* initialize crc */ 1043 updcrc(NULL, 0); /* initialize crc */
@@ -1218,7 +1228,7 @@ void flush_window()
1218 */ 1228 */
1219void write_buf(fd, buf, cnt) 1229void write_buf(fd, buf, cnt)
1220int fd; 1230int fd;
1221voidp buf; 1231void * buf;
1222unsigned cnt; 1232unsigned cnt;
1223{ 1233{
1224 unsigned n; 1234 unsigned n;
@@ -1228,7 +1238,7 @@ unsigned cnt;
1228 write_error(); 1238 write_error();
1229 } 1239 }
1230 cnt -= n; 1240 cnt -= n;
1231 buf = (voidp) ((char *) buf + n); 1241 buf = (void *) ((char *) buf + n);
1232 } 1242 }
1233} 1243}
1234 1244
@@ -1240,8 +1250,8 @@ unsigned cnt;
1240# define const 1250# define const
1241# endif 1251# endif
1242 1252
1243int strspn OF((const char *s, const char *accept)); 1253int strspn (const char *s, const char *accept);
1244int strcspn OF((const char *s, const char *reject)); 1254int strcspn (const char *s, const char *reject);
1245 1255
1246/* ======================================================================== 1256/* ========================================================================
1247 * Return the length of the maximum initial segment 1257 * Return the length of the maximum initial segment
@@ -1493,15 +1503,15 @@ struct huft {
1493 1503
1494 1504
1495/* Function prototypes */ 1505/* Function prototypes */
1496int huft_build OF((unsigned *, unsigned, unsigned, ush *, ush *, 1506int huft_build (unsigned *, unsigned, unsigned, ush *, ush *,
1497 struct huft **, int *)); 1507 struct huft **, int *);
1498int huft_free OF((struct huft *)); 1508int huft_free (struct huft *);
1499int inflate_codes OF((struct huft *, struct huft *, int, int)); 1509int inflate_codes (struct huft *, struct huft *, int, int);
1500int inflate_stored OF((void)); 1510int inflate_stored (void);
1501int inflate_fixed OF((void)); 1511int inflate_fixed (void);
1502int inflate_dynamic OF((void)); 1512int inflate_dynamic (void);
1503int inflate_block OF((int *)); 1513int inflate_block (int *);
1504int inflate OF((void)); 1514int inflate (void);
1505 1515
1506 1516
1507/* The inflate algorithm uses a sliding 32K byte window on the uncompressed 1517/* The inflate algorithm uses a sliding 32K byte window on the uncompressed
diff --git a/archival/gzip.c b/archival/gzip.c
index 0a969d8db..55ec5bc4e 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -1,16 +1,42 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* gzip.c -- this is a stripped down version of gzip I put into busybox, it does 2/*
3 * only standard in to standard out with -9 compression. It also requires the 3 * Gzip implementation for busybox
4 * zcat module for some important functions. 4 *
5 * Based on GNU gzip Copyright (C) 1992-1993 Jean-loup Gailly.
6 *
7 * Originally adjusted for busybox by Charles P. Wright <cpw@unix.asb.com>
8 * "this is a stripped down version of gzip I put into busybox, it does
9 * only standard in to standard out with -9 compression. It also requires
10 * the zcat module for some important functions."
11 *
12 * Adjusted further by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
13 * to support files as well as stdin/stdout, and to generally behave itself wrt
14 * command line handling.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24 * General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
5 * 29 *
6 * Charles P. Wright <cpw@unix.asb.com>
7 */ 30 */
31
8#include "internal.h" 32#include "internal.h"
9#ifdef BB_GZIP
10 33
11//#ifndef BB_ZCAT 34/* These defines are very important for BusyBox. Without these,
12//#error you need zcat to have gzip support! 35 * huge chunks of ram are pre-allocated making the BusyBox bss
13//#endif 36 * size Freaking Huge(tm), which is a bad thing.*/
37#define SMALL_MEM
38#define DYN_ALLOC
39
14 40
15static const char gzip_usage[] = 41static const char gzip_usage[] =
16 "gzip [OPTION]... FILE\n\n" 42 "gzip [OPTION]... FILE\n\n"
@@ -21,42 +47,12 @@ static const char gzip_usage[] =
21 "\t-c\tWrite output to standard output instead of FILE.gz\n"; 47 "\t-c\tWrite output to standard output instead of FILE.gz\n";
22 48
23 49
24/* gzip.h -- common declarations for all gzip modules
25 * Copyright (C) 1992-1993 Jean-loup Gailly.
26 * This is free software; you can redistribute it and/or modify it under the
27 * terms of the GNU General Public License, see the file COPYING.
28 */
29
30#if defined(__STDC__) || defined(PROTO)
31# define OF(args) args
32#else
33# define OF(args) ()
34#endif
35
36#ifdef __STDC__
37typedef void *voidp;
38#else
39typedef char *voidp;
40#endif
41
42/* I don't like nested includes, but the string and io functions are used 50/* I don't like nested includes, but the string and io functions are used
43 * too often 51 * too often
44 */ 52 */
45#include <stdio.h> 53#include <stdio.h>
46#if !defined(NO_STRING_H) || defined(STDC_HEADERS) 54#include <string.h>
47# include <string.h> 55#define memzero(s, n) memset ((void *)(s), 0, (n))
48# if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__)
49# include <memory.h>
50# endif
51# define memzero(s, n) memset ((voidp)(s), 0, (n))
52#else
53# include <strings.h>
54# define strchr index
55# define strrchr rindex
56# define memcpy(d, s, n) bcopy((s), (d), (n))
57# define memcmp(s1, s2, n) bcmp((s1), (s2), (n))
58# define memzero(s, n) bzero((s), (n))
59#endif
60 56
61#ifndef RETSIGTYPE 57#ifndef RETSIGTYPE
62# define RETSIGTYPE void 58# define RETSIGTYPE void
@@ -121,13 +117,13 @@ extern int method; /* compression method */
121#endif 117#endif
122 118
123#ifdef DYN_ALLOC 119#ifdef DYN_ALLOC
124# define EXTERN(type, array) extern type * near array 120# define EXTERN(type, array) extern type * array
125# define DECLARE(type, array, size) type * near array 121# define DECLARE(type, array, size) type * array
126# define ALLOC(type, array, size) { \ 122# define ALLOC(type, array, size) { \
127 array = (type*)fcalloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \ 123 array = (type*)calloc((size_t)(((size)+1L)/2), 2*sizeof(type)); \
128 if (array == NULL) errorMsg("insufficient memory"); \ 124 if (array == NULL) errorMsg("insufficient memory"); \
129 } 125 }
130# define FREE(array) {if (array != NULL) fcfree(array), array=NULL;} 126# define FREE(array) {if (array != NULL) free(array), array=NULL;}
131#else 127#else
132# define EXTERN(type, array) extern type array[] 128# define EXTERN(type, array) extern type array[]
133# define DECLARE(type, array, size) type array[size] 129# define DECLARE(type, array, size) type array[size]
@@ -284,55 +280,55 @@ extern int save_orig_name; /* set if original name must be saved */
284 280
285 281
286 /* in zip.c: */ 282 /* in zip.c: */
287extern int zip OF((int in, int out)); 283extern int zip (int in, int out);
288extern int file_read OF((char *buf, unsigned size)); 284extern int file_read (char *buf, unsigned size);
289 285
290 /* in unzip.c */ 286 /* in unzip.c */
291extern int unzip OF((int in, int out)); 287extern int unzip (int in, int out);
292extern int check_zipfile OF((int in)); 288extern int check_zipfile (int in);
293 289
294 /* in unpack.c */ 290 /* in unpack.c */
295extern int unpack OF((int in, int out)); 291extern int unpack (int in, int out);
296 292
297 /* in unlzh.c */ 293 /* in unlzh.c */
298extern int unlzh OF((int in, int out)); 294extern int unlzh (int in, int out);
299 295
300 /* in gzip.c */ 296 /* in gzip.c */
301RETSIGTYPE abort_gzip OF((void)); 297RETSIGTYPE abort_gzip (void);
302 298
303 /* in deflate.c */ 299 /* in deflate.c */
304void lm_init OF((ush * flags)); 300void lm_init (ush * flags);
305ulg deflate OF((void)); 301ulg deflate (void);
306 302
307 /* in trees.c */ 303 /* in trees.c */
308void ct_init OF((ush * attr, int *method)); 304void ct_init (ush * attr, int *method);
309int ct_tally OF((int dist, int lc)); 305int ct_tally (int dist, int lc);
310ulg flush_block OF((char *buf, ulg stored_len, int eof)); 306ulg flush_block (char *buf, ulg stored_len, int eof);
311 307
312 /* in bits.c */ 308 /* in bits.c */
313void bi_init OF((file_t zipfile)); 309void bi_init (file_t zipfile);
314void send_bits OF((int value, int length)); 310void send_bits (int value, int length);
315unsigned bi_reverse OF((unsigned value, int length)); 311unsigned bi_reverse (unsigned value, int length);
316void bi_windup OF((void)); 312void bi_windup (void);
317void copy_block OF((char *buf, unsigned len, int header)); 313void copy_block (char *buf, unsigned len, int header);
318extern int (*read_buf) OF((char *buf, unsigned size)); 314extern int (*read_buf) (char *buf, unsigned size);
319 315
320 /* in util.c: */ 316 /* in util.c: */
321extern int copy OF((int in, int out)); 317extern int copy (int in, int out);
322extern ulg updcrc OF((uch * s, unsigned n)); 318extern ulg updcrc (uch * s, unsigned n);
323extern void clear_bufs OF((void)); 319extern void clear_bufs (void);
324extern int fill_inbuf OF((int eof_ok)); 320extern int fill_inbuf (int eof_ok);
325extern void flush_outbuf OF((void)); 321extern void flush_outbuf (void);
326extern void flush_window OF((void)); 322extern void flush_window (void);
327extern void write_buf OF((int fd, voidp buf, unsigned cnt)); 323extern void write_buf (int fd, void * buf, unsigned cnt);
328extern char *strlwr OF((char *s)); 324extern char *strlwr (char *s);
329extern char *add_envopt OF((int *argcp, char ***argvp, char *env)); 325extern char *add_envopt (int *argcp, char ***argvp, char *env);
330extern void read_error OF((void)); 326extern void read_error (void);
331extern void write_error OF((void)); 327extern void write_error (void);
332extern void display_ratio OF((long num, long den, FILE * file)); 328extern void display_ratio (long num, long den, FILE * file);
333 329
334 /* in inflate.c */ 330 /* in inflate.c */
335extern int inflate OF((void)); 331extern int inflate (void);
336 332
337/* lzw.h -- define the lzw functions. 333/* lzw.h -- define the lzw functions.
338 * Copyright (C) 1992-1993 Jean-loup Gailly. 334 * Copyright (C) 1992-1993 Jean-loup Gailly.
@@ -795,7 +791,7 @@ local int bi_valid;
795 * are always zero. 791 * are always zero.
796 */ 792 */
797 793
798int (*read_buf) OF((char *buf, unsigned size)); 794int (*read_buf) (char *buf, unsigned size);
799 795
800/* Current input function. Set to mem_read for in-memory compression */ 796/* Current input function. Set to mem_read for in-memory compression */
801 797
@@ -1148,16 +1144,16 @@ local config configuration_table =
1148/* =========================================================================== 1144/* ===========================================================================
1149 * Prototypes for local functions. 1145 * Prototypes for local functions.
1150 */ 1146 */
1151local void fill_window OF((void)); 1147local void fill_window (void);
1152 1148
1153int longest_match OF((IPos cur_match)); 1149int longest_match (IPos cur_match);
1154 1150
1155#ifdef ASMV 1151#ifdef ASMV
1156void match_init OF((void)); /* asm code initialization */ 1152void match_init (void); /* asm code initialization */
1157#endif 1153#endif
1158 1154
1159#ifdef DEBUG 1155#ifdef DEBUG
1160local void check_match OF((IPos start, IPos match, int length)); 1156local void check_match (IPos start, IPos match, int length);
1161#endif 1157#endif
1162 1158
1163/* =========================================================================== 1159/* ===========================================================================
@@ -1708,7 +1704,7 @@ struct utimbuf {
1708# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) 1704# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
1709#endif 1705#endif
1710 1706
1711typedef RETSIGTYPE(*sig_type) OF((int)); 1707typedef RETSIGTYPE(*sig_type) (int);
1712 1708
1713#ifndef O_BINARY 1709#ifndef O_BINARY
1714# define O_BINARY 0 /* creation mode for open() */ 1710# define O_BINARY 0 /* creation mode for open() */
@@ -1743,7 +1739,7 @@ typedef RETSIGTYPE(*sig_type) OF((int));
1743 1739
1744#ifdef NO_OFF_T 1740#ifdef NO_OFF_T
1745typedef long off_t; 1741typedef long off_t;
1746off_t lseek OF((int fd, off_t offset, int whence)); 1742off_t lseek (int fd, off_t offset, int whence);
1747#endif 1743#endif
1748 1744
1749/* Separator for file name parts (see shorten_name()) */ 1745/* Separator for file name parts (see shorten_name()) */
@@ -2246,17 +2242,17 @@ extern unsigned near strstart; /* window offset of current string */
2246 * Local (static) routines in this file. 2242 * Local (static) routines in this file.
2247 */ 2243 */
2248 2244
2249local void init_block OF((void)); 2245local void init_block (void);
2250local void pqdownheap OF((ct_data near * tree, int k)); 2246local void pqdownheap (ct_data near * tree, int k);
2251local void gen_bitlen OF((tree_desc near * desc)); 2247local void gen_bitlen (tree_desc near * desc);
2252local void gen_codes OF((ct_data near * tree, int max_code)); 2248local void gen_codes (ct_data near * tree, int max_code);
2253local void build_tree OF((tree_desc near * desc)); 2249local void build_tree (tree_desc near * desc);
2254local void scan_tree OF((ct_data near * tree, int max_code)); 2250local void scan_tree (ct_data near * tree, int max_code);
2255local void send_tree OF((ct_data near * tree, int max_code)); 2251local void send_tree (ct_data near * tree, int max_code);
2256local int build_bl_tree OF((void)); 2252local int build_bl_tree (void);
2257local void send_all_trees OF((int lcodes, int dcodes, int blcodes)); 2253local void send_all_trees (int lcodes, int dcodes, int blcodes);
2258local void compress_block OF((ct_data near * ltree, ct_data near * dtree)); 2254local void compress_block (ct_data near * ltree, ct_data near * dtree);
2259local void set_file_type OF((void)); 2255local void set_file_type (void);
2260 2256
2261 2257
2262#ifndef DEBUG 2258#ifndef DEBUG
@@ -3161,12 +3157,8 @@ char *s;
3161 3157
3162/* Provide missing strspn and strcspn functions. */ 3158/* Provide missing strspn and strcspn functions. */
3163 3159
3164# ifndef __STDC__ 3160int strspn (const char *s, const char *accept);
3165# define const 3161int strcspn (const char *s, const char *reject);
3166# endif
3167
3168int strspn OF((const char *s, const char *accept));
3169int strcspn OF((const char *s, const char *reject));
3170 3162
3171/* ======================================================================== 3163/* ========================================================================
3172 * Return the length of the maximum initial segment 3164 * Return the length of the maximum initial segment
@@ -3398,4 +3390,3 @@ unsigned size;
3398 isize += (ulg) len; 3390 isize += (ulg) len;
3399 return (int) len; 3391 return (int) len;
3400} 3392}
3401#endif
diff --git a/archival/tar.c b/archival/tar.c
index 732f26ddc..4eda4c61a 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -2,9 +2,9 @@
2/* 2/*
3 * Mini tar implementation for busybox 3 * Mini tar implementation for busybox
4 * 4 *
5 * Note, that as of BusyBox 0.43 tar has been completely rewritten from the 5 * Note, that as of BusyBox-0.43, tar has been completely rewritten from the
6 * ground up. It still has remnents of the old code lying about, but it pretty 6 * ground up. It still has remnents of the old code lying about, but it is
7 * different (i.e. cleaner, less global variables, etc) 7 * very different now (i.e. cleaner, less global variables, etc)
8 * 8 *
9 * Copyright (C) 2000 by Lineo, inc. 9 * Copyright (C) 2000 by Lineo, inc.
10 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 10 * Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>