mirror of https://github.com/mirror/busybox.git
- move buffer allocation schemes to libbb.h
- include the correct headers: applets need busybox.h while lib* need libbb.h1_4_stable
parent
101a470068
commit
421d9e5941
|
@ -2,19 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* Uncompress applet for busybox (c) 2002 Glenn McGrath
|
* Uncompress applet for busybox (c) 2002 Glenn McGrath
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -24,7 +12,7 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include "libbb.h"
|
#include "busybox.h"
|
||||||
#include "unarchive.h"
|
#include "unarchive.h"
|
||||||
|
|
||||||
#define GUNZIP_TO_STDOUT 1
|
#define GUNZIP_TO_STDOUT 1
|
||||||
|
|
|
@ -62,23 +62,6 @@ extern const struct BB_applet applets[];
|
||||||
#include "applets.h"
|
#include "applets.h"
|
||||||
#undef PROTOTYPES
|
#undef PROTOTYPES
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_BUFFERS_GO_ON_STACK
|
|
||||||
#define RESERVE_CONFIG_BUFFER(buffer,len) char buffer[len]
|
|
||||||
#define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char buffer[len]
|
|
||||||
#define RELEASE_CONFIG_BUFFER(buffer) ((void)0)
|
|
||||||
#else
|
|
||||||
#ifdef CONFIG_FEATURE_BUFFERS_GO_IN_BSS
|
|
||||||
#define RESERVE_CONFIG_BUFFER(buffer,len) static char buffer[len]
|
|
||||||
#define RESERVE_CONFIG_UBUFFER(buffer,len) static unsigned char buffer[len]
|
|
||||||
#define RELEASE_CONFIG_BUFFER(buffer) ((void)0)
|
|
||||||
#else
|
|
||||||
#define RESERVE_CONFIG_BUFFER(buffer,len) char *buffer=xmalloc(len)
|
|
||||||
#define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
|
|
||||||
#define RELEASE_CONFIG_BUFFER(buffer) free (buffer)
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef RB_POWER_OFF
|
#ifndef RB_POWER_OFF
|
||||||
/* Stop system and switch power off if possible. */
|
/* Stop system and switch power off if possible. */
|
||||||
#define RB_POWER_OFF 0x4321fedc
|
#define RB_POWER_OFF 0x4321fedc
|
||||||
|
|
|
@ -59,6 +59,24 @@
|
||||||
#define MAX(a,b) (((a)>(b))?(a):(b))
|
#define MAX(a,b) (((a)>(b))?(a):(b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* buffer allocation schemes */
|
||||||
|
#ifdef CONFIG_FEATURE_BUFFERS_GO_ON_STACK
|
||||||
|
#define RESERVE_CONFIG_BUFFER(buffer,len) char buffer[len]
|
||||||
|
#define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char buffer[len]
|
||||||
|
#define RELEASE_CONFIG_BUFFER(buffer) ((void)0)
|
||||||
|
#else
|
||||||
|
#ifdef CONFIG_FEATURE_BUFFERS_GO_IN_BSS
|
||||||
|
#define RESERVE_CONFIG_BUFFER(buffer,len) static char buffer[len]
|
||||||
|
#define RESERVE_CONFIG_UBUFFER(buffer,len) static unsigned char buffer[len]
|
||||||
|
#define RELEASE_CONFIG_BUFFER(buffer) ((void)0)
|
||||||
|
#else
|
||||||
|
#define RESERVE_CONFIG_BUFFER(buffer,len) char *buffer=xmalloc(len)
|
||||||
|
#define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
|
||||||
|
#define RELEASE_CONFIG_BUFFER(buffer) free (buffer)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE;
|
extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE;
|
||||||
extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
|
extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
|
extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include "libbb.h"
|
||||||
|
|
||||||
void bb_do_delay(int seconds)
|
void bb_do_delay(int seconds)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "busybox.h"
|
#include "libbb.h"
|
||||||
|
|
||||||
int bb_echo(int ATTRIBUTE_UNUSED argc, char **argv)
|
int bb_echo(int ATTRIBUTE_UNUSED argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
|
/* vi:set ts=4:*/
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "libbb.h"
|
||||||
|
|
||||||
/* returns the array number of the string */
|
/* returns the array number of the string */
|
||||||
int compare_string_array(const char * const string_array[], const char *key)
|
int compare_string_array(const char * const string_array[], const char *key)
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "busybox.h"
|
#include "libbb.h"
|
||||||
|
|
||||||
/* Compiler version-specific crap that should be in a header file somewhere. */
|
/* Compiler version-specific crap that should be in a header file somewhere. */
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "busybox.h"
|
|
||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "libbb.h"
|
||||||
|
|
||||||
char *bb_get_last_path_component(char *path)
|
char *bb_get_last_path_component(char *path)
|
||||||
{
|
{
|
||||||
char *first = path;
|
char *first = path;
|
||||||
|
|
|
@ -4,19 +4,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
* 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
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -26,7 +14,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include "busybox.h"
|
#include "libbb.h"
|
||||||
|
|
||||||
/* It is perfectly ok to pass in a NULL for either width or for
|
/* It is perfectly ok to pass in a NULL for either width or for
|
||||||
* height, in which case that value will not be set. */
|
* height, in which case that value will not be set. */
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "busybox.h"
|
#include "libbb.h"
|
||||||
|
|
||||||
# if CONFIG_MD5_SIZE_VS_SPEED < 0 || CONFIG_MD5_SIZE_VS_SPEED > 3
|
# if CONFIG_MD5_SIZE_VS_SPEED < 0 || CONFIG_MD5_SIZE_VS_SPEED > 3
|
||||||
# define MD5_SIZE_VS_SPEED 2
|
# define MD5_SIZE_VS_SPEED 2
|
||||||
|
@ -71,7 +71,7 @@ void md5_begin(md5_ctx_t *ctx)
|
||||||
* starting at BUFFER.
|
* starting at BUFFER.
|
||||||
* It is necessary that LEN is a multiple of 64!!!
|
* It is necessary that LEN is a multiple of 64!!!
|
||||||
*/
|
*/
|
||||||
void md5_hash_block(const void *buffer, size_t len, md5_ctx_t *ctx)
|
static void md5_hash_block(const void *buffer, size_t len, md5_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
uint32_t correct_words[16];
|
uint32_t correct_words[16];
|
||||||
const uint32_t *words = buffer;
|
const uint32_t *words = buffer;
|
||||||
|
|
|
@ -2,19 +2,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
* 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
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -4,19 +4,7 @@
|
||||||
*
|
*
|
||||||
* Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
|
* Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
* 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
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -28,6 +16,8 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include "libbb.h"
|
||||||
|
|
||||||
#if ( S_ISUID != 04000 ) || ( S_ISGID != 02000 ) || ( S_ISVTX != 01000 ) \
|
#if ( S_ISUID != 04000 ) || ( S_ISGID != 02000 ) || ( S_ISVTX != 01000 ) \
|
||||||
|| ( S_IRUSR != 00400 ) || ( S_IWUSR != 00200 ) || ( S_IXUSR != 00100 ) \
|
|| ( S_IRUSR != 00400 ) || ( S_IWUSR != 00200 ) || ( S_IXUSR != 00100 ) \
|
||||||
|| ( S_IRGRP != 00040 ) || ( S_IWGRP != 00020 ) || ( S_IXGRP != 00010 ) \
|
|| ( S_IRGRP != 00040 ) || ( S_IWGRP != 00020 ) || ( S_IXGRP != 00010 ) \
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "busybox.h"
|
#include "libbb.h"
|
||||||
|
|
||||||
# define SHA1_BLOCK_SIZE 64
|
# define SHA1_BLOCK_SIZE 64
|
||||||
# define SHA1_DIGEST_SIZE 20
|
# define SHA1_DIGEST_SIZE 20
|
||||||
|
|
|
@ -5,20 +5,7 @@
|
||||||
* Copyright (C) many different people.
|
* Copyright (C) many different people.
|
||||||
* If you wrote this, please acknowledge your work.
|
* If you wrote this, please acknowledge your work.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
* 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
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -27,6 +14,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "libbb.h"
|
||||||
|
|
||||||
struct signal_name {
|
struct signal_name {
|
||||||
const char *name;
|
const char *name;
|
||||||
int number;
|
int number;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
/* vi: set sw=4 ts=4: */
|
/* vi: set sw=4 ts=4: */
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2003-2004 Erik Andersen <andersen@codepoet.org>
|
* Copyright (C) 2003-2004 Erik Andersen <andersen@codepoet.org>
|
||||||
|
*
|
||||||
|
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,7 +13,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "busybox.h"
|
#include "libbb.h"
|
||||||
|
|
||||||
long bb_xgetlarg(const char *arg, int base, long lower, long upper)
|
long bb_xgetlarg(const char *arg, int base, long lower, long upper)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "libbb.h"
|
#include "busybox.h"
|
||||||
|
|
||||||
static char *fileconf = "/etc/dnsd.conf";
|
static char *fileconf = "/etc/dnsd.conf";
|
||||||
#define LOCK_FILE "/var/run/dnsd.lock"
|
#define LOCK_FILE "/var/run/dnsd.lock"
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "libbb.h"
|
#include "busybox.h"
|
||||||
|
|
||||||
#define MAX_OPT_DEPTH 10
|
#define MAX_OPT_DEPTH 10
|
||||||
#define EUNBALBRACK 10001
|
#define EUNBALBRACK 10001
|
||||||
|
|
Loading…
Reference in New Issue