Various cleanups I made while going through Erik Hovland's patch submissions,
some of which are even from him. :)
This commit is contained in:
parent
f087798e8b
commit
11c7a7bed6
@ -21,21 +21,6 @@
|
|||||||
* to free leaked bytebuffer memory (used in unzip.c), and some minor style
|
* to free leaked bytebuffer memory (used in unzip.c), and some minor style
|
||||||
* guide cleanups by Ed Clark
|
* guide cleanups by Ed Clark
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
|
* gzip (GNU zip) -- compress files with zip algorithm and 'compress' interface
|
||||||
* Copyright (C) 1992-1993 Jean-loup Gailly
|
* Copyright (C) 1992-1993 Jean-loup Gailly
|
||||||
* The unzip code was written and put in the public domain by Mark Adler.
|
* The unzip code was written and put in the public domain by Mark Adler.
|
||||||
@ -43,38 +28,14 @@
|
|||||||
* written by Spencer Thomas, Joe Orost, James Woods, Jim McKie, Steve Davies,
|
* written by Spencer Thomas, Joe Orost, James Woods, Jim McKie, Steve Davies,
|
||||||
* Ken Turkowski, Dave Mack and Peter Jannesen.
|
* Ken Turkowski, Dave Mack and Peter Jannesen.
|
||||||
*
|
*
|
||||||
* See the license_msg below and the file COPYING for the software license.
|
|
||||||
* See the file algorithm.doc for the compression algorithms and file formats.
|
* See the file algorithm.doc for the compression algorithms and file formats.
|
||||||
|
*
|
||||||
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if 0
|
#include "libbb.h"
|
||||||
static char *license_msg[] = {
|
|
||||||
" Copyright (C) 1992-1993 Jean-loup Gailly",
|
|
||||||
" This program is free software; you can redistribute it and/or modify",
|
|
||||||
" it under the terms of the GNU General Public License as published by",
|
|
||||||
" the Free Software Foundation; either version 2, or (at your option)",
|
|
||||||
" any later version.",
|
|
||||||
"",
|
|
||||||
" This program is distributed in the hope that it will be useful,",
|
|
||||||
" but WITHOUT ANY WARRANTY; without even the implied warranty of",
|
|
||||||
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
|
|
||||||
" GNU General Public License for more details.",
|
|
||||||
"",
|
|
||||||
" You should have received a copy of the GNU General Public License",
|
|
||||||
" along with this program; if not, write to the Free Software",
|
|
||||||
" Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.",
|
|
||||||
0
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include "libbb.h"
|
|
||||||
#include "unarchive.h"
|
#include "unarchive.h"
|
||||||
|
|
||||||
typedef struct huft_s {
|
typedef struct huft_s {
|
||||||
@ -213,17 +174,17 @@ int huft_build(unsigned int *b, const unsigned int n,
|
|||||||
unsigned eob_len; /* length of end-of-block code (value 256) */
|
unsigned eob_len; /* length of end-of-block code (value 256) */
|
||||||
unsigned f; /* i repeats in table every f entries */
|
unsigned f; /* i repeats in table every f entries */
|
||||||
int g; /* maximum code length */
|
int g; /* maximum code length */
|
||||||
int h; /* table level */
|
int htl; /* table level */
|
||||||
register unsigned i; /* counter, current code */
|
unsigned i; /* counter, current code */
|
||||||
register unsigned j; /* counter */
|
unsigned j; /* counter */
|
||||||
register int k; /* number of bits in current code */
|
int k; /* number of bits in current code */
|
||||||
register unsigned *p; /* pointer into c[], b[], or v[] */
|
unsigned *p; /* pointer into c[], b[], or v[] */
|
||||||
register huft_t *q; /* points to current table */
|
huft_t *q; /* points to current table */
|
||||||
huft_t r; /* table entry for structure assignment */
|
huft_t r; /* table entry for structure assignment */
|
||||||
huft_t *u[BMAX]; /* table stack */
|
huft_t *u[BMAX]; /* table stack */
|
||||||
unsigned v[N_MAX]; /* values in order of bit length */
|
unsigned v[N_MAX]; /* values in order of bit length */
|
||||||
int ws[BMAX+1]; /* bits decoded stack */
|
int ws[BMAX+1]; /* bits decoded stack */
|
||||||
register int w; /* bits decoded */
|
int w; /* bits decoded */
|
||||||
unsigned x[BMAX + 1]; /* bit offsets, then code stack */
|
unsigned x[BMAX + 1]; /* bit offsets, then code stack */
|
||||||
unsigned *xp; /* pointer into x */
|
unsigned *xp; /* pointer into x */
|
||||||
int y; /* number of dummy codes added */
|
int y; /* number of dummy codes added */
|
||||||
@ -284,7 +245,7 @@ int huft_build(unsigned int *b, const unsigned int n,
|
|||||||
/* Generate the Huffman codes and for each, make the table entries */
|
/* Generate the Huffman codes and for each, make the table entries */
|
||||||
x[0] = i = 0; /* first Huffman code is zero */
|
x[0] = i = 0; /* first Huffman code is zero */
|
||||||
p = v; /* grab values in bit order */
|
p = v; /* grab values in bit order */
|
||||||
h = -1; /* no tables yet--level -1 */
|
htl = -1; /* no tables yet--level -1 */
|
||||||
w = ws[0] = 0; /* bits decoded */
|
w = ws[0] = 0; /* bits decoded */
|
||||||
u[0] = (huft_t *) NULL; /* just to keep compilers happy */
|
u[0] = (huft_t *) NULL; /* just to keep compilers happy */
|
||||||
q = (huft_t *) NULL; /* ditto */
|
q = (huft_t *) NULL; /* ditto */
|
||||||
@ -296,8 +257,8 @@ int huft_build(unsigned int *b, const unsigned int n,
|
|||||||
while (a--) {
|
while (a--) {
|
||||||
/* here i is the Huffman code of length k bits for value *p */
|
/* here i is the Huffman code of length k bits for value *p */
|
||||||
/* make tables up to required level */
|
/* make tables up to required level */
|
||||||
while (k > ws[h + 1]) {
|
while (k > ws[htl + 1]) {
|
||||||
w = ws[++h];
|
w = ws[++htl];
|
||||||
|
|
||||||
/* compute minimum size table less than or equal to *m bits */
|
/* compute minimum size table less than or equal to *m bits */
|
||||||
z = (z = g - w) > *m ? *m : z; /* upper limit on table size */
|
z = (z = g - w) > *m ? *m : z; /* upper limit on table size */
|
||||||
@ -314,22 +275,22 @@ int huft_build(unsigned int *b, const unsigned int n,
|
|||||||
}
|
}
|
||||||
j = (w + j > eob_len && w < eob_len) ? eob_len - w : j; /* make EOB code end at table */
|
j = (w + j > eob_len && w < eob_len) ? eob_len - w : j; /* make EOB code end at table */
|
||||||
z = 1 << j; /* table entries for j-bit table */
|
z = 1 << j; /* table entries for j-bit table */
|
||||||
ws[h+1] = w + j; /* set bits decoded in stack */
|
ws[htl+1] = w + j; /* set bits decoded in stack */
|
||||||
|
|
||||||
/* allocate and link in new table */
|
/* allocate and link in new table */
|
||||||
q = (huft_t *) xmalloc((z + 1) * sizeof(huft_t));
|
q = (huft_t *) xzalloc((z + 1) * sizeof(huft_t));
|
||||||
*t = q + 1; /* link to list for huft_free() */
|
*t = q + 1; /* link to list for huft_free() */
|
||||||
*(t = &(q->v.t)) = NULL;
|
t = &(q->v.t);
|
||||||
u[h] = ++q; /* table starts after link */
|
u[htl] = ++q; /* table starts after link */
|
||||||
|
|
||||||
/* connect to last table, if there is one */
|
/* connect to last table, if there is one */
|
||||||
if (h) {
|
if (htl) {
|
||||||
x[h] = i; /* save pattern for backing up */
|
x[htl] = i; /* save pattern for backing up */
|
||||||
r.b = (unsigned char) (w - ws[h - 1]); /* bits to dump before this table */
|
r.b = (unsigned char) (w - ws[htl - 1]); /* bits to dump before this table */
|
||||||
r.e = (unsigned char) (16 + j); /* bits in this table */
|
r.e = (unsigned char) (16 + j); /* bits in this table */
|
||||||
r.v.t = q; /* pointer to this table */
|
r.v.t = q; /* pointer to this table */
|
||||||
j = (i & ((1 << w) - 1)) >> ws[h - 1];
|
j = (i & ((1 << w) - 1)) >> ws[htl - 1];
|
||||||
u[h - 1][j] = r; /* connect to last table */
|
u[htl - 1][j] = r; /* connect to last table */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,8 +319,8 @@ int huft_build(unsigned int *b, const unsigned int n,
|
|||||||
i ^= j;
|
i ^= j;
|
||||||
|
|
||||||
/* backup over finished tables */
|
/* backup over finished tables */
|
||||||
while ((i & ((1 << w) - 1)) != x[h]) {
|
while ((i & ((1 << w) - 1)) != x[htl]) {
|
||||||
w = ws[--h];
|
w = ws[--htl];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,16 +41,14 @@ errcode_t ext2fs_write_ext_attr(ext2_filsys fs, blk_t block, void *inbuf)
|
|||||||
char *write_buf;
|
char *write_buf;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
|
|
||||||
#if BB_BIG_ENDIAN
|
if (BB_BIG_ENDIAN && ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
|
||||||
if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ||
|
(fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE))) {
|
||||||
(fs->flags & EXT2_FLAG_SWAP_BYTES_WRITE)) {
|
|
||||||
retval = ext2fs_get_mem(fs->blocksize, &buf);
|
retval = ext2fs_get_mem(fs->blocksize, &buf);
|
||||||
if (retval)
|
if (retval)
|
||||||
return retval;
|
return retval;
|
||||||
write_buf = buf;
|
write_buf = buf;
|
||||||
ext2fs_swap_ext_attr(buf, inbuf, fs->blocksize, 1);
|
ext2fs_swap_ext_attr(buf, inbuf, fs->blocksize, 1);
|
||||||
} else
|
} else
|
||||||
#endif
|
|
||||||
write_buf = (char *) inbuf;
|
write_buf = (char *) inbuf;
|
||||||
retval = io_channel_write_blk(fs->io, block, 1, write_buf);
|
retval = io_channel_write_blk(fs->io, block, 1, write_buf);
|
||||||
if (buf)
|
if (buf)
|
||||||
|
@ -62,7 +62,7 @@ crontab_main(int ac, char **av)
|
|||||||
if ((pas = getpwuid(UserId)) == NULL)
|
if ((pas = getpwuid(UserId)) == NULL)
|
||||||
bb_perror_msg_and_die("getpwuid");
|
bb_perror_msg_and_die("getpwuid");
|
||||||
|
|
||||||
strncpy(caller, pas->pw_name, sizeof(caller));
|
safe_strncpy(caller, pas->pw_name, sizeof(caller));
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
if (ac > 1) {
|
if (ac > 1) {
|
||||||
|
@ -61,41 +61,6 @@ struct client_config_t client_config = {
|
|||||||
.arp = "\0\0\0\0\0\0", /* appease gcc-3.0 */
|
.arp = "\0\0\0\0\0\0", /* appease gcc-3.0 */
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef IN_BUSYBOX
|
|
||||||
static void ATTRIBUTE_NORETURN show_usage(void)
|
|
||||||
{
|
|
||||||
printf(
|
|
||||||
"Usage: udhcpc [OPTIONS]\n\n"
|
|
||||||
" -c, --clientid=CLIENTID Set client identifier - type is first char\n"
|
|
||||||
" -C, --clientid-none Suppress default client identifier\n"
|
|
||||||
" -V, --vendorclass=CLASSID Set vendor class identifier\n"
|
|
||||||
" -H, --hostname=HOSTNAME Client hostname\n"
|
|
||||||
" -h Alias for -H\n"
|
|
||||||
" -F, --fqdn=FQDN Client fully qualified domain name\n"
|
|
||||||
" -f, --foreground Do not fork after getting lease\n"
|
|
||||||
" -b, --background Fork to background if lease cannot be\n"
|
|
||||||
" immediately negotiated.\n"
|
|
||||||
" -i, --interface=INTERFACE Interface to use (default: eth0)\n"
|
|
||||||
" -n, --now Exit with failure if lease cannot be\n"
|
|
||||||
" immediately negotiated.\n"
|
|
||||||
" -p, --pidfile=file Store process ID of daemon in file\n"
|
|
||||||
" -q, --quit Quit after obtaining lease\n"
|
|
||||||
" -r, --request=IP IP address to request (default: none)\n"
|
|
||||||
" -s, --script=file Run file at dhcp events (default:\n"
|
|
||||||
" " DEFAULT_SCRIPT ")\n"
|
|
||||||
" -T, --timeout=seconds Try to get the lease for the amount of\n"
|
|
||||||
" seconds (default: 3)\n"
|
|
||||||
" -t, --retries=NUM Send up to NUM request packets\n"
|
|
||||||
" -v, --version Display version\n"
|
|
||||||
);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
#define show_usage bb_show_usage
|
|
||||||
extern void show_usage(void) ATTRIBUTE_NORETURN;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* just a little helper */
|
/* just a little helper */
|
||||||
static void change_mode(int new_mode)
|
static void change_mode(int new_mode)
|
||||||
{
|
{
|
||||||
@ -169,11 +134,7 @@ static void client_background(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef COMBINED_BINARY
|
|
||||||
int udhcpc_main(int argc, char *argv[])
|
int udhcpc_main(int argc, char *argv[])
|
||||||
#else
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
uint8_t *temp, *message;
|
uint8_t *temp, *message;
|
||||||
unsigned long t1 = 0, t2 = 0, xid = 0;
|
unsigned long t1 = 0, t2 = 0, xid = 0;
|
||||||
@ -218,7 +179,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'c':
|
case 'c':
|
||||||
if (no_clientid) show_usage();
|
if (no_clientid) bb_show_usage();
|
||||||
len = strlen(optarg) > 255 ? 255 : strlen(optarg);
|
len = strlen(optarg) > 255 ? 255 : strlen(optarg);
|
||||||
free(client_config.clientid);
|
free(client_config.clientid);
|
||||||
client_config.clientid = xmalloc(len + 2);
|
client_config.clientid = xmalloc(len + 2);
|
||||||
@ -228,7 +189,7 @@ int main(int argc, char *argv[])
|
|||||||
strncpy((char*)client_config.clientid + OPT_DATA, optarg, len);
|
strncpy((char*)client_config.clientid + OPT_DATA, optarg, len);
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
if (client_config.clientid) show_usage();
|
if (client_config.clientid) bb_show_usage();
|
||||||
no_clientid = 1;
|
no_clientid = 1;
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
@ -300,7 +261,7 @@ int main(int argc, char *argv[])
|
|||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
show_usage();
|
bb_show_usage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1974,7 +1974,7 @@ create_sgiinfo(void)
|
|||||||
/* I keep SGI's habit to write the sgilabel to the second block */
|
/* I keep SGI's habit to write the sgilabel to the second block */
|
||||||
sgilabel->directory[0].vol_file_start = SGI_SSWAP32(2);
|
sgilabel->directory[0].vol_file_start = SGI_SSWAP32(2);
|
||||||
sgilabel->directory[0].vol_file_size = SGI_SSWAP32(sizeof(sgiinfo));
|
sgilabel->directory[0].vol_file_size = SGI_SSWAP32(sizeof(sgiinfo));
|
||||||
strncpy((char*)sgilabel->directory[0].vol_file_name, "sgilabel", 8);
|
strcpy((char*)sgilabel->directory[0].vol_file_name, "sgilabel");
|
||||||
}
|
}
|
||||||
|
|
||||||
static sgiinfo *fill_sgiinfo(void);
|
static sgiinfo *fill_sgiinfo(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user