Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 1 | #include "libbb.h" |
| 2 | |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 3 | /* uncompress for busybox -- (c) 2002 Robert Griebl |
| 4 | * |
Eric Andersen | c7bda1c | 2004-03-15 08:29:22 +0000 | [diff] [blame] | 5 | * based on the original compress42.c source |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 6 | * (see disclaimer below) |
| 7 | */ |
| 8 | |
| 9 | |
| 10 | /* (N)compress42.c - File compression ala IEEE Computer, Mar 1992. |
| 11 | * |
| 12 | * Authors: |
| 13 | * Spencer W. Thomas (decvax!harpo!utah-cs!utah-gr!thomas) |
| 14 | * Jim McKie (decvax!mcvax!jim) |
| 15 | * Steve Davies (decvax!vax135!petsd!peora!srd) |
| 16 | * Ken Turkowski (decvax!decwrl!turtlevax!ken) |
| 17 | * James A. Woods (decvax!ihnp4!ames!jaw) |
| 18 | * Joe Orost (decvax!vax135!petsd!joe) |
| 19 | * Dave Mack (csu@alembic.acs.com) |
| 20 | * Peter Jannesen, Network Communication Systems |
| 21 | * (peter@ncs.nl) |
| 22 | * |
| 23 | * marc@suse.de : a small security fix for a buffer overflow |
| 24 | * |
| 25 | * [... History snipped ...] |
| 26 | * |
| 27 | */ |
Glenn L McGrath | 2e41d0c | 2002-09-27 06:46:02 +0000 | [diff] [blame] | 28 | #include <stdio.h> |
| 29 | #include <string.h> |
| 30 | #include <unistd.h> |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 31 | |
Eric Andersen | aff114c | 2004-04-14 17:51:38 +0000 | [diff] [blame] | 32 | /* Default input buffer size */ |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 33 | #define IBUFSIZ 2048 |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 34 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 35 | /* Default output buffer size */ |
| 36 | #define OBUFSIZ 2048 |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 37 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 38 | /* Defines for third byte of header */ |
| 39 | #define MAGIC_1 (char_type)'\037' /* First byte of compressed file */ |
| 40 | #define MAGIC_2 (char_type)'\235' /* Second byte of compressed file */ |
| 41 | #define BIT_MASK 0x1f /* Mask for 'number of compresssion bits' */ |
| 42 | /* Masks 0x20 and 0x40 are free. */ |
| 43 | /* I think 0x20 should mean that there is */ |
| 44 | /* a fourth header byte (for expansion). */ |
| 45 | #define BLOCK_MODE 0x80 /* Block compresssion if table is full and */ |
| 46 | /* compression rate is dropping flush tables */ |
| 47 | /* the next two codes should not be changed lightly, as they must not */ |
| 48 | /* lie within the contiguous general code space. */ |
| 49 | #define FIRST 257 /* first free entry */ |
| 50 | #define CLEAR 256 /* table clear output code */ |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 51 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 52 | #define INIT_BITS 9 /* initial number of bits/code */ |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 53 | |
| 54 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 55 | /* machine variants which require cc -Dmachine: pdp11, z8000, DOS */ |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 56 | #define FAST |
| 57 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 58 | #define HBITS 17 /* 50% occupancy */ |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 59 | #define HSIZE (1<<HBITS) |
| 60 | #define HMASK (HSIZE-1) |
| 61 | #define HPRIME 9941 |
| 62 | #define BITS 16 |
| 63 | #undef MAXSEG_64K |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 64 | #define MAXCODE(n) (1L << (n)) |
| 65 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 66 | /* Block compress mode -C compatible with 2.0 */ |
Eric Andersen | 14f5c8d | 2005-04-16 19:39:00 +0000 | [diff] [blame] | 67 | static int block_mode = BLOCK_MODE; |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 68 | |
| 69 | /* user settable max # bits/code */ |
Eric Andersen | 14f5c8d | 2005-04-16 19:39:00 +0000 | [diff] [blame] | 70 | static int maxbits = BITS; |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 71 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 72 | /* Input buffer */ |
Eric Andersen | 14f5c8d | 2005-04-16 19:39:00 +0000 | [diff] [blame] | 73 | static unsigned char inbuf[IBUFSIZ + 64]; |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 74 | |
| 75 | /* Output buffer */ |
Eric Andersen | 14f5c8d | 2005-04-16 19:39:00 +0000 | [diff] [blame] | 76 | static unsigned char outbuf[OBUFSIZ + 2048]; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 77 | |
| 78 | |
Eric Andersen | 14f5c8d | 2005-04-16 19:39:00 +0000 | [diff] [blame] | 79 | static long int htab[HSIZE]; |
| 80 | static unsigned short codetab[HSIZE]; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 81 | |
| 82 | #define htabof(i) htab[i] |
| 83 | #define codetabof(i) codetab[i] |
| 84 | #define tab_prefixof(i) codetabof(i) |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 85 | #define tab_suffixof(i) ((unsigned char *)(htab))[i] |
| 86 | #define de_stack ((unsigned char *)&(htab[HSIZE-1])) |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 87 | #define clear_htab() memset(htab, -1, sizeof(htab)) |
| 88 | #define clear_tab_prefixof() memset(codetab, 0, 256); |
| 89 | |
| 90 | |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 91 | /* |
| 92 | * Decompress stdin to stdout. This routine adapts to the codes in the |
| 93 | * file building the "string" table on-the-fly; requiring no table to |
| 94 | * be stored in the compressed file. The tables used herein are shared |
| 95 | * with those of the compress() routine. See the definitions above. |
| 96 | */ |
| 97 | |
Glenn L McGrath | 2e41d0c | 2002-09-27 06:46:02 +0000 | [diff] [blame] | 98 | extern int uncompress(int fd_in, int fd_out) |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 99 | { |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 100 | unsigned char *stackp; |
| 101 | long int code; |
| 102 | int finchar; |
| 103 | long int oldcode; |
| 104 | long int incode; |
| 105 | int inbits; |
| 106 | int posbits; |
| 107 | int outpos; |
| 108 | int insize; |
| 109 | int bitmask; |
| 110 | long int free_ent; |
| 111 | long int maxcode; |
| 112 | long int maxmaxcode; |
| 113 | int n_bits; |
| 114 | int rsize = 0; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 115 | |
| 116 | insize = 0; |
| 117 | |
Manuel Novoa III | cad5364 | 2003-03-19 09:13:01 +0000 | [diff] [blame] | 118 | inbuf[0] = bb_xread_char(fd_in); |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 119 | |
| 120 | maxbits = inbuf[0] & BIT_MASK; |
| 121 | block_mode = inbuf[0] & BLOCK_MODE; |
| 122 | maxmaxcode = MAXCODE(maxbits); |
| 123 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 124 | if (maxbits > BITS) { |
Manuel Novoa III | cad5364 | 2003-03-19 09:13:01 +0000 | [diff] [blame] | 125 | bb_error_msg("compressed with %d bits, can only handle %d bits", maxbits, |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 126 | BITS); |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 127 | return -1; |
| 128 | } |
| 129 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 130 | maxcode = MAXCODE(n_bits = INIT_BITS) - 1; |
| 131 | bitmask = (1 << n_bits) - 1; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 132 | oldcode = -1; |
| 133 | finchar = 0; |
| 134 | outpos = 0; |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 135 | posbits = 0 << 3; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 136 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 137 | free_ent = ((block_mode) ? FIRST : 256); |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 138 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 139 | /* As above, initialize the first 256 entries in the table. */ |
| 140 | clear_tab_prefixof(); |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 141 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 142 | for (code = 255; code >= 0; --code) { |
| 143 | tab_suffixof(code) = (unsigned char) code; |
| 144 | } |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 145 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 146 | do { |
| 147 | resetbuf:; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 148 | { |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 149 | int i; |
| 150 | int e; |
| 151 | int o; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 152 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 153 | e = insize - (o = (posbits >> 3)); |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 154 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 155 | for (i = 0; i < e; ++i) |
| 156 | inbuf[i] = inbuf[i + o]; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 157 | |
| 158 | insize = e; |
| 159 | posbits = 0; |
| 160 | } |
| 161 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 162 | if (insize < (int) sizeof(inbuf) - IBUFSIZ) { |
Glenn L McGrath | 1a2d75f | 2003-11-21 22:17:28 +0000 | [diff] [blame] | 163 | rsize = safe_read(fd_in, inbuf + insize, IBUFSIZ); |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 164 | insize += rsize; |
| 165 | } |
| 166 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 167 | inbits = ((rsize > 0) ? (insize - insize % n_bits) << 3 : |
| 168 | (insize << 3) - (n_bits - 1)); |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 169 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 170 | while (inbits > posbits) { |
| 171 | if (free_ent > maxcode) { |
| 172 | posbits = |
| 173 | ((posbits - 1) + |
| 174 | ((n_bits << 3) - |
| 175 | (posbits - 1 + (n_bits << 3)) % (n_bits << 3))); |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 176 | ++n_bits; |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 177 | if (n_bits == maxbits) { |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 178 | maxcode = maxmaxcode; |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 179 | } else { |
| 180 | maxcode = MAXCODE(n_bits) - 1; |
| 181 | } |
| 182 | bitmask = (1 << n_bits) - 1; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 183 | goto resetbuf; |
| 184 | } |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 185 | { |
| 186 | unsigned char *p = &inbuf[posbits >> 3]; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 187 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 188 | code = |
| 189 | ((((long) (p[0])) | ((long) (p[1]) << 8) | |
| 190 | ((long) (p[2]) << 16)) >> (posbits & 0x7)) & bitmask; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 191 | } |
| 192 | posbits += n_bits; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 193 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 194 | |
| 195 | if (oldcode == -1) { |
| 196 | outbuf[outpos++] = (unsigned char) (finchar = |
| 197 | (int) (oldcode = code)); |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 198 | continue; |
| 199 | } |
| 200 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 201 | if (code == CLEAR && block_mode) { |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 202 | clear_tab_prefixof(); |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 203 | free_ent = FIRST - 1; |
| 204 | posbits = |
| 205 | ((posbits - 1) + |
| 206 | ((n_bits << 3) - |
| 207 | (posbits - 1 + (n_bits << 3)) % (n_bits << 3))); |
| 208 | maxcode = MAXCODE(n_bits = INIT_BITS) - 1; |
| 209 | bitmask = (1 << n_bits) - 1; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 210 | goto resetbuf; |
| 211 | } |
| 212 | |
| 213 | incode = code; |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 214 | stackp = de_stack; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 215 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 216 | /* Special case for KwKwK string. */ |
| 217 | if (code >= free_ent) { |
| 218 | if (code > free_ent) { |
| 219 | unsigned char *p; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 220 | |
| 221 | posbits -= n_bits; |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 222 | p = &inbuf[posbits >> 3]; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 223 | |
Manuel Novoa III | cad5364 | 2003-03-19 09:13:01 +0000 | [diff] [blame] | 224 | bb_error_msg |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 225 | ("insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)", |
| 226 | insize, posbits, p[-1], p[0], p[1], p[2], p[3], |
| 227 | (posbits & 07)); |
Manuel Novoa III | cad5364 | 2003-03-19 09:13:01 +0000 | [diff] [blame] | 228 | bb_error_msg("uncompress: corrupt input"); |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 229 | return -1; |
| 230 | } |
| 231 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 232 | *--stackp = (unsigned char) finchar; |
| 233 | code = oldcode; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 234 | } |
| 235 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 236 | /* Generate output characters in reverse order */ |
| 237 | while ((long int) code >= (long int) 256) { |
| 238 | *--stackp = tab_suffixof(code); |
| 239 | code = tab_prefixof(code); |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 240 | } |
| 241 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 242 | *--stackp = (unsigned char) (finchar = tab_suffixof(code)); |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 243 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 244 | /* And put them out in forward order */ |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 245 | { |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 246 | int i; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 247 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 248 | if (outpos + (i = (de_stack - stackp)) >= OBUFSIZ) { |
| 249 | do { |
| 250 | if (i > OBUFSIZ - outpos) { |
| 251 | i = OBUFSIZ - outpos; |
| 252 | } |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 253 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 254 | if (i > 0) { |
| 255 | memcpy(outbuf + outpos, stackp, i); |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 256 | outpos += i; |
| 257 | } |
| 258 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 259 | if (outpos >= OBUFSIZ) { |
Glenn L McGrath | 2e41d0c | 2002-09-27 06:46:02 +0000 | [diff] [blame] | 260 | write(fd_out, outbuf, outpos); |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 261 | outpos = 0; |
| 262 | } |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 263 | stackp += i; |
| 264 | } while ((i = (de_stack - stackp)) > 0); |
| 265 | } else { |
| 266 | memcpy(outbuf + outpos, stackp, i); |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 267 | outpos += i; |
| 268 | } |
| 269 | } |
| 270 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 271 | /* Generate the new entry. */ |
| 272 | if ((code = free_ent) < maxmaxcode) { |
| 273 | tab_prefixof(code) = (unsigned short) oldcode; |
| 274 | tab_suffixof(code) = (unsigned char) finchar; |
| 275 | free_ent = code + 1; |
| 276 | } |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 277 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 278 | /* Remember previous code. */ |
| 279 | oldcode = incode; |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 280 | } |
| 281 | |
Glenn L McGrath | fedbfe4 | 2002-11-28 09:09:47 +0000 | [diff] [blame] | 282 | } while (rsize > 0); |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 283 | |
Glenn L McGrath | 2e41d0c | 2002-09-27 06:46:02 +0000 | [diff] [blame] | 284 | if (outpos > 0) { |
| 285 | write(fd_out, outbuf, outpos); |
| 286 | } |
Robert Griebl | 94a6a95 | 2002-05-19 19:00:14 +0000 | [diff] [blame] | 287 | |
| 288 | return 0; |
| 289 | } |