aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-04-03 16:39:31 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-04-03 16:39:31 +0000
commit421d9e59416850968707dfec7a665cb0211b8d1c (patch)
treecee92b2a5cd0ea7298aab569ed944fdeb59dbdf2
parent101a470068a62a70489797a3fdfa5084af80106e (diff)
downloadbusybox-w32-421d9e59416850968707dfec7a665cb0211b8d1c.tar.gz
busybox-w32-421d9e59416850968707dfec7a665cb0211b8d1c.tar.bz2
busybox-w32-421d9e59416850968707dfec7a665cb0211b8d1c.zip
- move buffer allocation schemes to libbb.h
- include the correct headers: applets need busybox.h while lib* need libbb.h
-rw-r--r--archival/uncompress.c16
-rw-r--r--include/busybox.h17
-rw-r--r--include/libbb.h18
-rw-r--r--libbb/bb_do_delay.c1
-rw-r--r--libbb/bb_echo.c2
-rw-r--r--libbb/compare_string_array.c16
-rw-r--r--libbb/copy_file.c2
-rw-r--r--libbb/copyfd.c1
-rw-r--r--libbb/get_last_path_component.c2
-rw-r--r--libbb/get_terminal_width_height.c16
-rw-r--r--libbb/md5.c8
-rw-r--r--libbb/messages.c14
-rw-r--r--libbb/mode_string.c16
-rw-r--r--libbb/sha1.c2
-rw-r--r--libbb/u_signal_names.c17
-rw-r--r--libbb/xgetlarg.c4
-rw-r--r--networking/dnsd.c2
-rw-r--r--networking/ifupdown.c2
18 files changed, 47 insertions, 109 deletions
diff --git a/archival/uncompress.c b/archival/uncompress.c
index 8a874d09d..c47436ea3 100644
--- a/archival/uncompress.c
+++ b/archival/uncompress.c
@@ -2,19 +2,7 @@
2/* 2/*
3 * Uncompress applet for busybox (c) 2002 Glenn McGrath 3 * Uncompress applet for busybox (c) 2002 Glenn McGrath
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */ 6 */
19 7
20#include <stdlib.h> 8#include <stdlib.h>
@@ -24,7 +12,7 @@
24#include <sys/stat.h> 12#include <sys/stat.h>
25#include <fcntl.h> 13#include <fcntl.h>
26 14
27#include "libbb.h" 15#include "busybox.h"
28#include "unarchive.h" 16#include "unarchive.h"
29 17
30#define GUNZIP_TO_STDOUT 1 18#define GUNZIP_TO_STDOUT 1
diff --git a/include/busybox.h b/include/busybox.h
index 18f9dd56e..59d800e8b 100644
--- a/include/busybox.h
+++ b/include/busybox.h
@@ -62,23 +62,6 @@ extern const struct BB_applet applets[];
62#include "applets.h" 62#include "applets.h"
63#undef PROTOTYPES 63#undef PROTOTYPES
64 64
65#ifdef CONFIG_FEATURE_BUFFERS_GO_ON_STACK
66#define RESERVE_CONFIG_BUFFER(buffer,len) char buffer[len]
67#define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char buffer[len]
68#define RELEASE_CONFIG_BUFFER(buffer) ((void)0)
69#else
70#ifdef CONFIG_FEATURE_BUFFERS_GO_IN_BSS
71#define RESERVE_CONFIG_BUFFER(buffer,len) static char buffer[len]
72#define RESERVE_CONFIG_UBUFFER(buffer,len) static unsigned char buffer[len]
73#define RELEASE_CONFIG_BUFFER(buffer) ((void)0)
74#else
75#define RESERVE_CONFIG_BUFFER(buffer,len) char *buffer=xmalloc(len)
76#define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
77#define RELEASE_CONFIG_BUFFER(buffer) free (buffer)
78#endif
79#endif
80
81
82#ifndef RB_POWER_OFF 65#ifndef RB_POWER_OFF
83/* Stop system and switch power off if possible. */ 66/* Stop system and switch power off if possible. */
84#define RB_POWER_OFF 0x4321fedc 67#define RB_POWER_OFF 0x4321fedc
diff --git a/include/libbb.h b/include/libbb.h
index f444084b3..64a235a9f 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -59,6 +59,24 @@
59#define MAX(a,b) (((a)>(b))?(a):(b)) 59#define MAX(a,b) (((a)>(b))?(a):(b))
60#endif 60#endif
61 61
62/* buffer allocation schemes */
63#ifdef CONFIG_FEATURE_BUFFERS_GO_ON_STACK
64#define RESERVE_CONFIG_BUFFER(buffer,len) char buffer[len]
65#define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char buffer[len]
66#define RELEASE_CONFIG_BUFFER(buffer) ((void)0)
67#else
68#ifdef CONFIG_FEATURE_BUFFERS_GO_IN_BSS
69#define RESERVE_CONFIG_BUFFER(buffer,len) static char buffer[len]
70#define RESERVE_CONFIG_UBUFFER(buffer,len) static unsigned char buffer[len]
71#define RELEASE_CONFIG_BUFFER(buffer) ((void)0)
72#else
73#define RESERVE_CONFIG_BUFFER(buffer,len) char *buffer=xmalloc(len)
74#define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
75#define RELEASE_CONFIG_BUFFER(buffer) free (buffer)
76#endif
77#endif
78
79
62extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE; 80extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE;
63extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); 81extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
64extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); 82extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
diff --git a/libbb/bb_do_delay.c b/libbb/bb_do_delay.c
index ddcff0765..1fbdc9ae8 100644
--- a/libbb/bb_do_delay.c
+++ b/libbb/bb_do_delay.c
@@ -9,6 +9,7 @@
9 9
10#include <time.h> 10#include <time.h>
11#include <unistd.h> 11#include <unistd.h>
12#include "libbb.h"
12 13
13void bb_do_delay(int seconds) 14void bb_do_delay(int seconds)
14{ 15{
diff --git a/libbb/bb_echo.c b/libbb/bb_echo.c
index 9ad73df85..0c5a94766 100644
--- a/libbb/bb_echo.c
+++ b/libbb/bb_echo.c
@@ -26,7 +26,7 @@
26 26
27#include <stdio.h> 27#include <stdio.h>
28#include <string.h> 28#include <string.h>
29#include "busybox.h" 29#include "libbb.h"
30 30
31int bb_echo(int ATTRIBUTE_UNUSED argc, char **argv) 31int bb_echo(int ATTRIBUTE_UNUSED argc, char **argv)
32{ 32{
diff --git a/libbb/compare_string_array.c b/libbb/compare_string_array.c
index 529d29495..d379feea4 100644
--- a/libbb/compare_string_array.c
+++ b/libbb/compare_string_array.c
@@ -1,20 +1,10 @@
1/* vi:set ts=4:*/
1/* 2/*
2 * This program is free software; you can redistribute it and/or modify 3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 */ 4 */
16 5
17#include <string.h> 6#include <string.h>
7#include "libbb.h"
18 8
19/* returns the array number of the string */ 9/* returns the array number of the string */
20int compare_string_array(const char * const string_array[], const char *key) 10int compare_string_array(const char * const string_array[], const char *key)
diff --git a/libbb/copy_file.c b/libbb/copy_file.c
index 35352d27a..3b172ffe4 100644
--- a/libbb/copy_file.c
+++ b/libbb/copy_file.c
@@ -18,7 +18,7 @@
18#include <stdlib.h> 18#include <stdlib.h>
19#include <string.h> 19#include <string.h>
20 20
21#include "busybox.h" 21#include "libbb.h"
22 22
23/* Compiler version-specific crap that should be in a header file somewhere. */ 23/* Compiler version-specific crap that should be in a header file somewhere. */
24 24
diff --git a/libbb/copyfd.c b/libbb/copyfd.c
index d138f3e59..e2c542e32 100644
--- a/libbb/copyfd.c
+++ b/libbb/copyfd.c
@@ -12,7 +12,6 @@
12#include <string.h> 12#include <string.h>
13#include <unistd.h> 13#include <unistd.h>
14 14
15#include "busybox.h"
16#include "libbb.h" 15#include "libbb.h"
17 16
18 17
diff --git a/libbb/get_last_path_component.c b/libbb/get_last_path_component.c
index c950faeb3..311909726 100644
--- a/libbb/get_last_path_component.c
+++ b/libbb/get_last_path_component.c
@@ -7,6 +7,8 @@
7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 */ 8 */
9 9
10#include "libbb.h"
11
10char *bb_get_last_path_component(char *path) 12char *bb_get_last_path_component(char *path)
11{ 13{
12 char *first = path; 14 char *first = path;
diff --git a/libbb/get_terminal_width_height.c b/libbb/get_terminal_width_height.c
index 01136d414..df5aa907f 100644
--- a/libbb/get_terminal_width_height.c
+++ b/libbb/get_terminal_width_height.c
@@ -4,19 +4,7 @@
4 * 4 *
5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */ 8 */
21 9
22#include <stdio.h> 10#include <stdio.h>
@@ -26,7 +14,7 @@
26#include <unistd.h> 14#include <unistd.h>
27#include <termios.h> 15#include <termios.h>
28#include <sys/ioctl.h> 16#include <sys/ioctl.h>
29#include "busybox.h" 17#include "libbb.h"
30 18
31/* It is perfectly ok to pass in a NULL for either width or for 19/* It is perfectly ok to pass in a NULL for either width or for
32 * height, in which case that value will not be set. */ 20 * height, in which case that value will not be set. */
diff --git a/libbb/md5.c b/libbb/md5.c
index 8cec88535..b5aa89fc6 100644
--- a/libbb/md5.c
+++ b/libbb/md5.c
@@ -1,9 +1,9 @@
1/* 1/*
2 * md5.c - Compute MD5 checksum of strings according to the 2 * md5.c - Compute MD5 checksum of strings according to the
3 * definition of MD5 in RFC 1321 from April 1992. 3 * definition of MD5 in RFC 1321 from April 1992.
4 * 4 *
5 * Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. 5 * Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
6 * 6 *
7 * Copyright (C) 1995-1999 Free Software Foundation, Inc. 7 * Copyright (C) 1995-1999 Free Software Foundation, Inc.
8 * Copyright (C) 2001 Manuel Novoa III 8 * Copyright (C) 2001 Manuel Novoa III
9 * Copyright (C) 2003 Glenn L. McGrath 9 * Copyright (C) 2003 Glenn L. McGrath
@@ -19,7 +19,7 @@
19#include <string.h> 19#include <string.h>
20#include <unistd.h> 20#include <unistd.h>
21 21
22#include "busybox.h" 22#include "libbb.h"
23 23
24# if CONFIG_MD5_SIZE_VS_SPEED < 0 || CONFIG_MD5_SIZE_VS_SPEED > 3 24# if CONFIG_MD5_SIZE_VS_SPEED < 0 || CONFIG_MD5_SIZE_VS_SPEED > 3
25# define MD5_SIZE_VS_SPEED 2 25# define MD5_SIZE_VS_SPEED 2
@@ -71,7 +71,7 @@ void md5_begin(md5_ctx_t *ctx)
71 * starting at BUFFER. 71 * starting at BUFFER.
72 * It is necessary that LEN is a multiple of 64!!! 72 * It is necessary that LEN is a multiple of 64!!!
73 */ 73 */
74void md5_hash_block(const void *buffer, size_t len, md5_ctx_t *ctx) 74static void md5_hash_block(const void *buffer, size_t len, md5_ctx_t *ctx)
75{ 75{
76 uint32_t correct_words[16]; 76 uint32_t correct_words[16];
77 const uint32_t *words = buffer; 77 const uint32_t *words = buffer;
diff --git a/libbb/messages.c b/libbb/messages.c
index 23f0ea2ba..b9a5353a7 100644
--- a/libbb/messages.c
+++ b/libbb/messages.c
@@ -2,19 +2,7 @@
2/* 2/*
3 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 3 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * 6 *
19 */ 7 */
20 8
diff --git a/libbb/mode_string.c b/libbb/mode_string.c
index 83142ba8a..5a9775930 100644
--- a/libbb/mode_string.c
+++ b/libbb/mode_string.c
@@ -4,19 +4,7 @@
4 * 4 *
5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org> 5 * Copyright (C) 2003 Manuel Novoa III <mjn3@codepoet.org>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * 8 *
21 */ 9 */
22 10
@@ -28,6 +16,8 @@
28#include <assert.h> 16#include <assert.h>
29#include <sys/stat.h> 17#include <sys/stat.h>
30 18
19#include "libbb.h"
20
31#if ( S_ISUID != 04000 ) || ( S_ISGID != 02000 ) || ( S_ISVTX != 01000 ) \ 21#if ( S_ISUID != 04000 ) || ( S_ISGID != 02000 ) || ( S_ISVTX != 01000 ) \
32 || ( S_IRUSR != 00400 ) || ( S_IWUSR != 00200 ) || ( S_IXUSR != 00100 ) \ 22 || ( S_IRUSR != 00400 ) || ( S_IWUSR != 00200 ) || ( S_IXUSR != 00100 ) \
33 || ( S_IRGRP != 00040 ) || ( S_IWGRP != 00020 ) || ( S_IXGRP != 00010 ) \ 23 || ( S_IRGRP != 00040 ) || ( S_IWGRP != 00020 ) || ( S_IXGRP != 00010 ) \
diff --git a/libbb/sha1.c b/libbb/sha1.c
index 128d4b98f..4b28266af 100644
--- a/libbb/sha1.c
+++ b/libbb/sha1.c
@@ -45,7 +45,7 @@
45#include <string.h> 45#include <string.h>
46#include <unistd.h> 46#include <unistd.h>
47 47
48#include "busybox.h" 48#include "libbb.h"
49 49
50# define SHA1_BLOCK_SIZE 64 50# define SHA1_BLOCK_SIZE 64
51# define SHA1_DIGEST_SIZE 20 51# define SHA1_DIGEST_SIZE 20
diff --git a/libbb/u_signal_names.c b/libbb/u_signal_names.c
index be444a97b..31ebd895a 100644
--- a/libbb/u_signal_names.c
+++ b/libbb/u_signal_names.c
@@ -5,20 +5,7 @@
5 * Copyright (C) many different people. 5 * Copyright (C) many different people.
6 * If you wrote this, please acknowledge your work. 6 * If you wrote this, please acknowledge your work.
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 * USA
22 */ 9 */
23 10
24#include <signal.h> 11#include <signal.h>
@@ -27,6 +14,8 @@
27#include <stdlib.h> 14#include <stdlib.h>
28#include <stdio.h> 15#include <stdio.h>
29 16
17#include "libbb.h"
18
30struct signal_name { 19struct signal_name {
31 const char *name; 20 const char *name;
32 int number; 21 int number;
diff --git a/libbb/xgetlarg.c b/libbb/xgetlarg.c
index 6d3c4d1db..893cd2813 100644
--- a/libbb/xgetlarg.c
+++ b/libbb/xgetlarg.c
@@ -1,6 +1,8 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Copyright (C) 2003-2004 Erik Andersen <andersen@codepoet.org> 3 * Copyright (C) 2003-2004 Erik Andersen <andersen@codepoet.org>
4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
4 */ 6 */
5 7
6 8
@@ -11,7 +13,7 @@
11#include <assert.h> 13#include <assert.h>
12#include <ctype.h> 14#include <ctype.h>
13 15
14#include "busybox.h" 16#include "libbb.h"
15 17
16long bb_xgetlarg(const char *arg, int base, long lower, long upper) 18long bb_xgetlarg(const char *arg, int base, long lower, long upper)
17{ 19{
diff --git a/networking/dnsd.c b/networking/dnsd.c
index 9ca4105d3..a815860ab 100644
--- a/networking/dnsd.c
+++ b/networking/dnsd.c
@@ -21,7 +21,7 @@
21#include <arpa/inet.h> 21#include <arpa/inet.h>
22#include <sys/socket.h> 22#include <sys/socket.h>
23#include <ctype.h> 23#include <ctype.h>
24#include "libbb.h" 24#include "busybox.h"
25 25
26static char *fileconf = "/etc/dnsd.conf"; 26static char *fileconf = "/etc/dnsd.conf";
27#define LOCK_FILE "/var/run/dnsd.lock" 27#define LOCK_FILE "/var/run/dnsd.lock"
diff --git a/networking/ifupdown.c b/networking/ifupdown.c
index d4167e9a0..560c7a201 100644
--- a/networking/ifupdown.c
+++ b/networking/ifupdown.c
@@ -32,7 +32,7 @@
32#include <string.h> 32#include <string.h>
33#include <unistd.h> 33#include <unistd.h>
34 34
35#include "libbb.h" 35#include "busybox.h"
36 36
37#define MAX_OPT_DEPTH 10 37#define MAX_OPT_DEPTH 10
38#define EUNBALBRACK 10001 38#define EUNBALBRACK 10001