Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b7d70c822 | ||
|
|
8aa0b62a88 | ||
|
|
9e6089ee0f | ||
|
|
c9dd5f945b | ||
|
|
be0c36009a | ||
|
|
23b1e5c7df | ||
|
|
879d6c85af | ||
|
|
8a915880e7 | ||
|
|
95b520110d | ||
|
|
deba6dea03 | ||
|
|
46bf7de5f6 | ||
|
|
ff9b4a8981 | ||
|
|
fdbac35b33 | ||
|
|
842757dc96 | ||
|
|
3450636169 | ||
|
|
2d91deba45 | ||
|
|
0034443140 | ||
|
|
af6b40a1ea | ||
|
|
f672c9e62f | ||
|
|
bb9579ffc3 | ||
|
|
fa1c5aac51 | ||
|
|
73f6a1b058 | ||
|
|
221b2ea6c4 | ||
|
|
9a53feaa76 | ||
|
|
57c82fe7c4 | ||
|
|
51038a3f42 | ||
|
|
74bcd16425 | ||
|
|
dc6647201d | ||
|
|
c126f8ffb6 | ||
|
|
3555fd006e | ||
|
|
13cb842773 | ||
|
|
547e102082 | ||
|
|
7499918f30 | ||
|
|
14d7ea460f | ||
|
|
b6071b6341 | ||
|
|
eba260587a | ||
|
|
4e664ac51d | ||
|
|
089decab65 | ||
|
|
220238305f | ||
|
|
26eeb0c9da | ||
|
|
f9d6aa0a86 | ||
|
|
4db35647dd | ||
|
|
2835efe3da | ||
|
|
1b06419e60 | ||
|
|
655584b07a | ||
|
|
6c7ac21f3a | ||
|
|
096b151f76 | ||
|
|
439e3df653 | ||
|
|
0139ca92ff | ||
|
|
8d79ce8320 | ||
|
|
20aab260e2 | ||
|
|
0382eb8865 | ||
|
|
e92895c038 | ||
|
|
c8eae6684b | ||
|
|
c1cda4a609 | ||
|
|
81108e7653 | ||
|
|
c3fbec73fb | ||
|
|
8d3b0497a4 | ||
|
|
778041f8d1 | ||
|
|
b9e4ce99d8 | ||
|
|
ed4492a697 | ||
|
|
7b0241579c | ||
|
|
6fc92a506a | ||
|
|
4cdc607f72 | ||
|
|
bc4c030023 | ||
|
|
044228d5ec | ||
|
|
51ded05b3b | ||
|
|
a868ec89e8 | ||
|
|
58a5bd187d | ||
|
|
06ef16563b | ||
|
|
ccd65c9be6 | ||
|
|
3d46224b78 | ||
|
|
cfeb08a193 | ||
|
|
5e66a26eaa | ||
|
|
26a0d9a945 | ||
|
|
b028e08d35 | ||
|
|
7467c8d3b6 | ||
|
|
f69bfc76fa | ||
|
|
ab6526c8b3 | ||
|
|
3e94f729a5 | ||
|
|
c127008840 | ||
|
|
481d19b38e | ||
|
|
daf0b78e1a | ||
|
|
93febe672a | ||
|
|
c59fa37d40 | ||
|
|
248c57ca43 | ||
|
|
59e50f634a | ||
|
|
8c145dc31b | ||
|
|
55522080c6 | ||
|
|
5c58d283bb | ||
|
|
91b84603d3 | ||
|
|
2a46634617 | ||
|
|
5710f9f690 | ||
|
|
654944fc36 | ||
|
|
c3d2f1287e | ||
|
|
6199fa90e5 | ||
|
|
6248355c6f | ||
|
|
5a4a46a251 | ||
|
|
f52947ba71 | ||
|
|
aa64ba459f | ||
|
|
ceece81414 | ||
|
|
d0e5f86a10 | ||
|
|
d0b4d3dabf | ||
|
|
7b2dfc623b |
No files matched your search
@@ -43,8 +43,8 @@ Matt Kraai <kraai@alumni.carnegiemellon.edu>
|
||||
John Lombardo <john@deltanet.com>
|
||||
dirname, tr
|
||||
|
||||
Glenn McGrath <bug1@netconnect.com.au>
|
||||
ar.c
|
||||
Glenn McGrath <bug1@optushome.com.au>
|
||||
ar, dpkg, dpkg-deb
|
||||
|
||||
Bruce Perens <bruce@pixar.com>
|
||||
Original author of BusyBox. His code is still in many apps.
|
||||
@@ -74,7 +74,7 @@ Enrique Zanardi <ezanardi@ull.es>
|
||||
tarcat (since removed), loadkmap, various fixes, Debian maintenance
|
||||
|
||||
Vladimir Oleynik <dzo@simtreas.ru>
|
||||
cmdedit, stty-port, locale, various fixes
|
||||
cmdedit; ports: ash, stty, traceroute; locale, various fixes
|
||||
and irreconcilable critic of everything not perfect.
|
||||
|
||||
Tim Riker <Tim@Rikers.org>
|
||||
|
||||
@@ -1,3 +1,94 @@
|
||||
0.60.0
|
||||
|
||||
Note:
|
||||
|
||||
For this release I have bumped the version number to 0.60.0. This
|
||||
reflects the fact that this release is intended to form a new stable
|
||||
BusyBox release series. If you need to rely on a stable version of
|
||||
BusyBox, you should plan on using the stable 0.60.x series. If bugs
|
||||
show up then I will release 0.60.1, then 0.60.2, etc... This is also
|
||||
intended to deal with the fact that the BusyBox build system will be
|
||||
getting a major overhaul for the next release and I don't want that to
|
||||
break products that people are shipping. To avoid that, the new build
|
||||
system will be released as part of a new BusyBox development series
|
||||
that will have some not-yet-decided-on odd version number. Once things
|
||||
stabablize and the new build system is working for everyone, then I
|
||||
will release that as a new stable release series.
|
||||
|
||||
Critical Bugfixes:
|
||||
* Matt Kraai
|
||||
-- Fixed wget output file opening (wget failed in 0.52).
|
||||
-- Fixed a memory leak in syslogd (found by Adam Slattery).
|
||||
* Vladimir Oleynik, Matt Kraai, Erik Andersen
|
||||
-- several nasty bugs in ash and msh. msh could not assign
|
||||
any variables and had debug code still enabled. ash
|
||||
had several compile errors (depending on selected options)
|
||||
and variable assignment problems as well.
|
||||
|
||||
New Applets:
|
||||
* David McCullough <davidm@lineo.com> -- modprobe
|
||||
* Vladimir Oleynik -- traceroute
|
||||
* Erik Andersen -- pidof
|
||||
|
||||
New Scripts:
|
||||
* David Schleef, Erik Andersen, Stuart Hughes -- depmod.pl
|
||||
This is a replacement for the depmod program from the modutils
|
||||
package, but is fully cross platform and is designed to run on
|
||||
your host system (not on the target).
|
||||
|
||||
Other Changes:
|
||||
* Erik Andersen
|
||||
-- fixed busybox.spec so it should now work on redhat systems
|
||||
-- fixed dos2unix and unix2dos so they should work once again
|
||||
-- Adjustments to make busybox more uClinux friendly. Busybox
|
||||
should now work on uClinux systems without needing and source
|
||||
code changes (applets that won't work on uClinux systems are
|
||||
now automagicaly disabled).
|
||||
-- various things (cleanups, libc compatibility work, etc, etc)
|
||||
* Jim Gleason <jimg@lineo.com>
|
||||
-- Fixed for sed, where it failed to preserve whether or not the
|
||||
line was previously altered when running a subst command.
|
||||
* Matt Kraai
|
||||
-- Made tar read 20 512byte blocks at a time (like GNU tar)
|
||||
-- Allow msh.c assignments with the export and readonly commands.
|
||||
-- Added BB_FEATURE_DEVFS to enable devfs device names.
|
||||
-- Better devfs support
|
||||
-- Don't save/restore vi readonly flag if vi is compiled read-only.
|
||||
-- Reworked rdate option handling (is now smaller).
|
||||
-- Size reduction in ping
|
||||
-- Always write dd counts to stderr
|
||||
-- Allow multiple shells to be enabled
|
||||
* Aaron Lehmann
|
||||
-- slimmed down md5sum
|
||||
-- contributed a nice new (hand written, not lex/yacc) Posix math
|
||||
support for ash, which is once again a full posix shell.
|
||||
* Felix von Leitner <leitner@convergence.de> -- patches to make busybox
|
||||
work with dietlibc.
|
||||
* David McCullough
|
||||
-- Adjustments to make busybox more uClinux friendly
|
||||
* Glenn McGrath
|
||||
-- Fixed gzip so when a filename is '-' it will use stdin/stdout
|
||||
-- dpkg rewrite. Should now be compatable with the real dpkg,
|
||||
but needs more testing.
|
||||
-- Updates to archiving tools (gunzip/gzip/cpio/ar/etc)
|
||||
-- Rewrote uuencode, will allow base64 encoding to be used by wget
|
||||
* Vladimir Oleynik
|
||||
-- Fixed tr to support 'tr a-z A-Z' syntax,
|
||||
-- Many ash corrections, optimizations, and cleanups.
|
||||
-- optimizations for traceroute, md5sum, chown, ping
|
||||
-- cmdedit updates and API change
|
||||
-- Namespace cleanup (i.e. adding 'static' private function calls)
|
||||
-- added "stopped jobs" warning to ash on exit
|
||||
* Adam Slattery
|
||||
-- Fixed ping compile problem
|
||||
* Robert J. Osborne <rj@resourceinternational.com>
|
||||
-- fixed a vi bug with delete and escape sequences on empty files.
|
||||
|
||||
|
||||
-Erik Andersen, 31 July 2001
|
||||
|
||||
|
||||
|
||||
0.52
|
||||
|
||||
Critical Bugfixes:
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
// BusyBox Applications
|
||||
//#define BB_ADJTIMEX
|
||||
//#define BB_AR
|
||||
//#define BB_ASH
|
||||
#define BB_BASENAME
|
||||
#define BB_CAT
|
||||
#define BB_CHGRP
|
||||
@@ -51,6 +52,7 @@
|
||||
#define BB_HEAD
|
||||
//#define BB_HOSTID
|
||||
//#define BB_HOSTNAME
|
||||
//#define BB_HUSH
|
||||
#define BB_ID
|
||||
//#define BB_IFCONFIG
|
||||
#define BB_INIT
|
||||
@@ -58,6 +60,7 @@
|
||||
#define BB_KILL
|
||||
#define BB_KILLALL
|
||||
#define BB_KLOGD
|
||||
//#define BB_LASH
|
||||
//#define BB_LENGTH
|
||||
#define BB_LN
|
||||
//#define BB_LOADACM
|
||||
@@ -75,12 +78,15 @@
|
||||
#define BB_MKNOD
|
||||
#define BB_MKSWAP
|
||||
//#define BB_MKTEMP
|
||||
//#define BB_NC
|
||||
#define BB_MODPROBE
|
||||
#define BB_MORE
|
||||
#define BB_MOUNT
|
||||
#define BB_MSH
|
||||
//#define BB_MT
|
||||
#define BB_MV
|
||||
//#define BB_NC
|
||||
//#define BB_NSLOOKUP
|
||||
#define BB_PIDOF
|
||||
//#define BB_PING
|
||||
//#define BB_PIVOT_ROOT
|
||||
#define BB_POWEROFF
|
||||
@@ -99,7 +105,6 @@
|
||||
//#define BB_RPM2CPIO
|
||||
#define BB_SED
|
||||
//#define BB_SETKEYCODES
|
||||
#define BB_SH
|
||||
#define BB_SLEEP
|
||||
#define BB_SORT
|
||||
//#define BB_STTY
|
||||
@@ -114,6 +119,7 @@
|
||||
//#define BB_TFTP
|
||||
#define BB_TOUCH
|
||||
//#define BB_TR
|
||||
//#define BB_TRACEROUTE
|
||||
#define BB_TRUE_FALSE
|
||||
#define BB_TTY
|
||||
//#define BB_UNIX2DOS
|
||||
@@ -143,40 +149,12 @@
|
||||
// pretty/useful).
|
||||
//
|
||||
//
|
||||
// If you enabled BB_SH above, you may select one of the following shells.
|
||||
// You can only select ONE of the following shells. Sorry.
|
||||
//
|
||||
// lash is the very smallest shell (adds just 10k) and it is quite usable as
|
||||
// a command prompt, but it is not suitable for any but the most trivial
|
||||
// scripting (such as an initrd that calls insmod a few times) since it does
|
||||
// not understand Bourne shell grammer. It does handle pipes, redirects, and
|
||||
// job control though. Adding in command editing makes it very nice
|
||||
// lightweight command prompt.
|
||||
//#define BB_FEATURE_LASH
|
||||
//
|
||||
// hush is also quite small (just 18k) and it has very complete Bourne shell
|
||||
// grammer. It handles if/then/else/fi just fine, but doesn't handle loops
|
||||
// like for/do/done or case/esac and such. It also currently has a problem
|
||||
// with job control.
|
||||
//#define BB_FEATURE_HUSH
|
||||
//
|
||||
// msh: The minix shell (adds just 30k) is quite complete and handles things
|
||||
// like for/do/done, case/esac and all the things you expect a Bourne shell to
|
||||
// do. It is not always pedantically correct about Bourne shell grammer (try
|
||||
// running the shell testscript "tests/sh.testcases" on it and compare vs bash)
|
||||
// but for most things it works quite well. It also uses only vfork, so it can
|
||||
// be used on uClinux systems. This was only recently added, so there is still
|
||||
// room to shrink it further...
|
||||
#define BB_FEATURE_MSH
|
||||
//
|
||||
// ash: This adds about 60k in the default configuration and is the most
|
||||
// complete and most pedantically correct shell included with busybox. This
|
||||
// shell was also recently added, and several people (mainly Vladimir and Erik)
|
||||
// have been working on it. There are a number of configurable things at the
|
||||
// top of ash.c as well, so check those out if you want to tweak things. The
|
||||
// Posix math support is currently disabled (that bit of code was horrible) but
|
||||
// will be restored for the next BusyBox release.
|
||||
//#define BB_FEATURE_ASH
|
||||
// If you enabled one or more of the shells, you may select which one
|
||||
// should be run when sh is invoked:
|
||||
//#define BB_FEATURE_SH_IS_ASH
|
||||
//#define BB_FEATURE_SH_IS_HUSH
|
||||
//#define BB_FEATURE_SH_IS_LASH
|
||||
#define BB_FEATURE_SH_IS_MSH
|
||||
//
|
||||
// BusyBox will, by default, malloc space for its buffers. This costs code
|
||||
// size for the call to xmalloc. You can use the following feature to have
|
||||
@@ -283,11 +261,11 @@
|
||||
#define BB_FEATURE_SORT_UNIQUE
|
||||
//
|
||||
// Enable command line editing in the shell.
|
||||
// Only relevant if BB_SH is enabled. On by default.
|
||||
// Only relevant if a shell is enabled. On by default.
|
||||
#define BB_FEATURE_COMMAND_EDITING
|
||||
//
|
||||
// Enable tab completion in the shell. This is now working quite nicely.
|
||||
// This feature adds a bit over 4k. Only relevant if BB_SH is enabled.
|
||||
// This feature adds a bit over 4k. Only relevant if a shell is enabled.
|
||||
#define BB_FEATURE_COMMAND_TAB_COMPLETION
|
||||
//
|
||||
// Attempts to match usernames in a ~-prefixed path
|
||||
@@ -296,7 +274,7 @@
|
||||
//Allow the shell to invoke all the compiled in BusyBox applets as if they
|
||||
//were shell builtins. Nice for staticly linking an emergency rescue shell,
|
||||
//among other things. Off by default.
|
||||
// Only relevant if BB_SH is enabled.
|
||||
// Only relevant if a shell is enabled.
|
||||
//#define BB_FEATURE_SH_STANDALONE_SHELL
|
||||
//
|
||||
//When this is enabled, busybox shell applets can be called using full path
|
||||
@@ -305,13 +283,13 @@
|
||||
//will use BusyBox cat even if /bin/cat exists on the filesystem and is _not_
|
||||
//busybox. Some systems want this, others do not. Choose wisely. :-) This
|
||||
//only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled.
|
||||
// Only relevant if BB_SH is enabled. Off by default.
|
||||
// Only relevant if a shell is enabled. Off by default.
|
||||
//#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
|
||||
//
|
||||
// Uncomment this option for a fancy shell prompt that includes the
|
||||
// current username and hostname. On systems that don't have usernames
|
||||
// or hostnames, this can look hideous.
|
||||
// Only relevant if BB_SH is enabled.
|
||||
// Only relevant if a shell is enabled.
|
||||
//#define BB_FEATURE_SH_FANCY_PROMPT
|
||||
//
|
||||
//Turn on extra fbset options
|
||||
@@ -405,6 +383,9 @@
|
||||
// Support for TELNET to pass TERM type to remote host. Adds 384 bytes.
|
||||
#define BB_FEATURE_TELNET_TTYPE
|
||||
//
|
||||
// Support for devfs.
|
||||
//#define BB_FEATURE_DEVFS
|
||||
//
|
||||
// End of Features List
|
||||
//
|
||||
//
|
||||
@@ -416,8 +397,21 @@
|
||||
// Nothing beyond this point should ever be touched by
|
||||
// mere mortals so leave this stuff alone.
|
||||
//
|
||||
#if defined BB_SH
|
||||
#if defined BB_FEATURE_COMMAND_EDITING
|
||||
#include <features.h>
|
||||
#if defined __UCLIBC__ && ! defined __UCLIBC_HAS_MMU__
|
||||
#undef BB_RPM2CPIO /* Uses gz_open(), which uses fork() */
|
||||
#undef BB_DPKG_DEB /* Uses gz_open(), which uses fork() */
|
||||
#undef BB_ASH /* Uses fork() */
|
||||
#undef BB_HUSH /* Uses fork() */
|
||||
#undef BB_LASH /* Uses fork() */
|
||||
#undef BB_INIT /* Uses fork() */
|
||||
#undef BB_FEATURE_TAR_GZIP /* Uses fork() */
|
||||
#undef BB_SYSLOGD /* Uses daemon() */
|
||||
#undef BB_KLOGD /* Uses daemon() */
|
||||
#undef BB_UPDATE /* Uses daemon() */
|
||||
#endif
|
||||
#if defined BB_ASH || defined BB_HUSH || defined BB_LASH || defined BB_MSH
|
||||
#if defined BB_FEATURE_COMMAND_EDITING
|
||||
#define BB_CMDEDIT
|
||||
#else
|
||||
#undef BB_FEATURE_COMMAND_EDITING
|
||||
@@ -425,26 +419,6 @@
|
||||
#undef BB_FEATURE_COMMAND_USERNAME_COMPLETION
|
||||
#undef BB_FEATURE_SH_FANCY_PROMPT
|
||||
#endif
|
||||
#if ! defined BB_FEATURE_LASH && ! defined BB_FEATURE_HUSH && ! defined BB_FEATURE_MSH && ! defined BB_FEATURE_ASH
|
||||
#define BB_FEATURE_MSH
|
||||
#endif
|
||||
#if defined BB_FEATURE_ASH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_LASH
|
||||
#undef BB_FEATURE_HUSH
|
||||
#undef BB_FEATURE_MSH
|
||||
#elif defined BB_FEATURE_MSH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_LASH
|
||||
#undef BB_FEATURE_HUSH
|
||||
#undef BB_FEATURE_ASH
|
||||
#elif defined BB_FEATURE_HUSH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_LASH
|
||||
#undef BB_FEATURE_MSH
|
||||
#undef BB_FEATURE_ASH
|
||||
#elif defined BB_FEATURE_LASH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_HUSH
|
||||
#undef BB_FEATURE_MSH
|
||||
#undef BB_FEATURE_ASH
|
||||
#endif
|
||||
#else
|
||||
#undef BB_FEATURE_SH_APPLETS_ALWAYS_WIN
|
||||
#undef BB_FEATURE_SH_STANDALONE_SHELL
|
||||
@@ -477,8 +451,26 @@
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_UNIX2DOS
|
||||
#define BB_DOS2UNIX
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_SYSLOGD
|
||||
#if defined BB_FEATURE_IPC_SYSLOG
|
||||
#define BB_LOGREAD
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#if defined BB_ASH && defined BB_FEATURE_SH_IS_ASH
|
||||
# define BB_SH
|
||||
# define shell_main ash_main
|
||||
#elif defined BB_HUSH && defined BB_FEATURE_SH_IS_HUSH
|
||||
# define BB_SH
|
||||
# define shell_main hush_main
|
||||
#elif defined BB_LASH && defined BB_FEATURE_SH_IS_LASH
|
||||
# define BB_SH
|
||||
# define shell_main lash_main
|
||||
#elif defined BB_MSH && defined BB_FEATURE_SH_IS_MSH
|
||||
# define BB_SH
|
||||
# define shell_main msh_main
|
||||
#endif
|
||||
@@ -18,7 +18,7 @@
|
||||
#
|
||||
|
||||
PROG := busybox
|
||||
VERSION := 0.52
|
||||
VERSION := 0.60.0
|
||||
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
|
||||
export VERSION
|
||||
|
||||
@@ -227,7 +227,10 @@ ifneq ($(strip $(USE_SYSTEM_PWD_GRP)),true)
|
||||
fgetpwent.c __getgrent.c grent.c getgrnam.c getgrgid.c fgetgrent.c \
|
||||
initgroups.c setgroups.c
|
||||
PWD_OBJS=$(patsubst %.c,$(PWD_GRP)/%.o, $(PWD_CSRC))
|
||||
PWD_CFLAGS = -I$(PWD_GRP_DIR)
|
||||
ifneq ($(strip $(BB_SRC_DIR)),)
|
||||
PWD_CFLAGS = -I- -I.
|
||||
endif
|
||||
PWD_CFLAGS += -I$(PWD_GRP_DIR)
|
||||
else
|
||||
CFLAGS += -DUSE_SYSTEM_PWD_GRP
|
||||
endif
|
||||
@@ -235,7 +238,7 @@ endif
|
||||
LIBBB = libbb
|
||||
LIBBB_LIB = libbb.a
|
||||
LIBBB_CSRC= ask_confirmation.c chomp.c concat_path_file.c copy_file.c \
|
||||
copy_file_chunk.c daemon.c device_open.c error_msg.c \
|
||||
copy_file_chunk.c libc5.c device_open.c error_msg.c \
|
||||
error_msg_and_die.c fgets_str.c find_mount_point.c find_pid_by_name.c \
|
||||
find_root_device.c full_read.c full_write.c get_console.c \
|
||||
get_last_path_component.c get_line_from_file.c gz_open.c human_readable.c \
|
||||
@@ -247,17 +250,18 @@ safe_read.c safe_strncpy.c syscalls.c syslog_msg_with_name.c time_string.c \
|
||||
trim.c unzip.c vdprintf.c verror_msg.c vperror_msg.c wfopen.c xfuncs.c \
|
||||
xgetcwd.c xreadlink.c xregcomp.c interface.c remove_file.c last_char_is.c \
|
||||
copyfd.c vherror_msg.c herror_msg.c herror_msg_and_die.c xgethostbyname.c \
|
||||
dirname.c make_directory.c
|
||||
dirname.c make_directory.c create_icmp_socket.c u_signal_names.c arith.c
|
||||
LIBBB_OBJS=$(patsubst %.c,$(LIBBB)/%.o, $(LIBBB_CSRC))
|
||||
LIBBB_CFLAGS = -I$(LIBBB)
|
||||
ifneq ($(strip $(BB_SRC_DIR)),)
|
||||
LIBBB_CFLAGS += -I$(BB_SRC_DIR)/$(LIBBB)
|
||||
ifeq ($(strip $(BB_SRC_DIR)),)
|
||||
LIBBB_CFLAGS += -I$(LIBBB)
|
||||
else
|
||||
LIBBB_CFLAGS = -I- -I. -I./$(LIBBB) -I$(BB_SRC_DIR)/$(LIBBB) -I$(BB_SRC_DIR)
|
||||
endif
|
||||
|
||||
LIBBB_MSRC=libbb/messages.c
|
||||
LIBBB_MESSAGES= full_version name_too_long omitting_directory not_a_directory \
|
||||
memory_exhausted invalid_date invalid_option io_error dash_dash_help \
|
||||
write_error too_few_args name_longer_than_foo unknown
|
||||
write_error too_few_args name_longer_than_foo unknown can_not_create_raw_socket
|
||||
LIBBB_MOBJ=$(patsubst %,$(LIBBB)/%.o, $(LIBBB_MESSAGES))
|
||||
|
||||
LIBBB_ARCSRC=libbb/unarchive.c
|
||||
@@ -349,9 +353,13 @@ busybox.links: busybox.mkll Config.h applets.h
|
||||
- $(SHELL) $^ >$@
|
||||
|
||||
nfsmount.o cmdedit.o: %.o: %.h
|
||||
sh.o: cmdedit.h
|
||||
ash.o hush.o lash.o msh.o: cmdedit.h
|
||||
$(OBJECTS): %.o: %.c Config.h busybox.h applets.h Makefile
|
||||
$(CC) -I- $(CFLAGS) -I. $(patsubst %,-I%,$(subst :, ,$(BB_SRC_DIR))) -c $< -o $*.o
|
||||
ifeq ($(strip $(BB_SRC_DIR)),)
|
||||
$(CC) $(CFLAGS) -I. $(patsubst %,-I%,$(subst :, ,$(BB_SRC_DIR))) -c $< -o $*.o
|
||||
else
|
||||
$(CC) $(CFLAGS) -I- -I. $(patsubst %,-I%,$(subst :, ,$(BB_SRC_DIR))) -c $< -o $*.o
|
||||
endif
|
||||
|
||||
$(PWD_OBJS): %.o: %.c Config.h busybox.h applets.h Makefile
|
||||
- mkdir -p $(PWD_GRP)
|
||||
@@ -377,8 +385,6 @@ libbb.a: $(LIBBB_MOBJ) $(LIBBB_AROBJS) $(LIBBB_OBJS)
|
||||
|
||||
usage.o: usage.h
|
||||
|
||||
sh.o: sh.c lash.c hush.c msh.c ash.c
|
||||
|
||||
libbb/loop.o: libbb/loop.h
|
||||
|
||||
libbb/loop.h: mk_loop_h.sh
|
||||
@@ -396,7 +402,7 @@ clean:
|
||||
docs/busybox.lineo.com/BusyBox.html
|
||||
- rm -f docs/busybox.txt docs/busybox.dvi docs/busybox.ps \
|
||||
docs/busybox.pdf docs/busybox.lineo.com/busybox.html
|
||||
- rm -f multibuild.log Config.h.orig
|
||||
- rm -f multibuild.log Config.h.orig *.gdb *.elf
|
||||
- rm -rf docs/busybox _install libpwd.a libbb.a pod2htm*
|
||||
- rm -f busybox.links libbb/loop.h *~ slist.mk core applet_source_list
|
||||
- find -name \*.o -exec rm -f {} \;
|
||||
|
||||
@@ -11,9 +11,7 @@ the expected functionality and behave very much like their GNU counterparts.
|
||||
BusyBox has been written with size-optimization and limited resources in mind.
|
||||
It is also extremely modular so you can easily include or exclude commands (or
|
||||
features) at compile time. This makes it easy to customize your embedded
|
||||
systems. To create a working system, just add /dev, a shell, and a kernel. For
|
||||
a really minimal system, you can even use the busybox shell (not Bourne
|
||||
compatible, but very small and quite usable) and the busybox vi editor.
|
||||
systems. To create a working system, just add /dev, /etc, and a kernel.
|
||||
|
||||
BusyBox was originally written to support the Debian Rescue/Install disks, but
|
||||
it also makes an excellent environment for any small or embedded system.
|
||||
@@ -36,7 +34,8 @@ Supported architectures:
|
||||
|
||||
Busybox in general will build on any architecture supported by gcc. It has
|
||||
a few specialized features added for __sparc__ and __alpha__. insmod
|
||||
functionality is currently limited to x86, ARM, SH3/4, powerpc, and MIPS.
|
||||
functionality is currently limited to x86, ARM, SH3/4, powerpc, m68k,
|
||||
and MIPS.
|
||||
|
||||
Supported libcs:
|
||||
|
||||
@@ -50,6 +49,36 @@ Supported kernels:
|
||||
|
||||
----------------
|
||||
|
||||
Shells:
|
||||
|
||||
lash is the very smallest shell (adds just 10k) and it is quite usable as
|
||||
a command prompt, but it is not suitable for any but the most trivial
|
||||
scripting (such as an initrd that calls insmod a few times) since it does
|
||||
not understand Bourne shell grammer. It does handle pipes, redirects, and
|
||||
job control though. Adding in command editing makes it a very nice
|
||||
lightweight command prompt.
|
||||
|
||||
hush is also quite small (just 18k) and it has very complete Bourne shell
|
||||
grammer. It handles if/then/else/fi just fine, but doesn't handle loops
|
||||
like for/do/done or case/esac and such. It also currently has a problem
|
||||
with job control. Using hush is not yet recommended.
|
||||
|
||||
msh: The minix shell (adds just 30k) is quite complete and handles things
|
||||
like for/do/done, case/esac and all the things you expect a Bourne shell to
|
||||
do. It is not always pedantically correct about Bourne shell grammer (try
|
||||
running the shell testscript "tests/sh.testcases" on it and compare vs bash)
|
||||
but for most things it works quite well. It also uses only vfork, so it can
|
||||
be used on uClinux systems. This was only recently added, so there is still
|
||||
room to shrink it further...
|
||||
|
||||
ash: This adds about 60k in the default configuration and is the most
|
||||
complete and most pedantically correct shell included with busybox. This
|
||||
shell was also recently added, and several people (mainly Vladimir and Erik)
|
||||
have been working on it. There are a number of configurable things at the
|
||||
top of ash.c as well, so check those out if you want to tweak things.
|
||||
|
||||
----------------
|
||||
|
||||
Getting help:
|
||||
|
||||
When you find you need help, you can check out the BusyBox mailing list
|
||||
|
||||
@@ -52,6 +52,9 @@
|
||||
#ifdef BB_AR
|
||||
APPLET(ar, ar_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_ASH
|
||||
APPLET_NOUSAGE("ash", ash_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_BASENAME
|
||||
APPLET(basename, basename_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
@@ -185,6 +188,9 @@
|
||||
#ifdef BB_HOSTNAME
|
||||
APPLET(hostname, hostname_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_HUSH
|
||||
APPLET_NOUSAGE("hush", hush_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_ID
|
||||
APPLET(id, id_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
@@ -206,6 +212,9 @@
|
||||
#ifdef BB_KLOGD
|
||||
APPLET(klogd, klogd_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_LASH
|
||||
APPLET(lash, lash_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LENGTH
|
||||
APPLET(length, length_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
@@ -263,12 +272,18 @@
|
||||
#ifdef BB_MKTEMP
|
||||
APPLET(mktemp, mktemp_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MODPROBE
|
||||
APPLET(modprobe, modprobe_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_MORE
|
||||
APPLET(more, more_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MOUNT
|
||||
APPLET(mount, mount_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MSH
|
||||
APPLET_NOUSAGE("msh", msh_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MT
|
||||
APPLET(mt, mt_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
@@ -281,6 +296,9 @@
|
||||
#ifdef BB_NSLOOKUP
|
||||
APPLET(nslookup, nslookup_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PIDOF
|
||||
APPLET(pidof, pidof_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PING
|
||||
APPLET(ping, ping_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
@@ -338,8 +356,14 @@
|
||||
#ifdef BB_SETKEYCODES
|
||||
APPLET(setkeycodes, setkeycodes_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SH
|
||||
APPLET(sh, shell_main, _BB_DIR_BIN)
|
||||
#if defined(BB_FEATURE_SH_IS_ASH) && defined(BB_ASH)
|
||||
APPLET_NOUSAGE("sh", ash_main, _BB_DIR_BIN)
|
||||
#elif defined(BB_FEATURE_SH_IS_HUSH) && defined(BB_HUSH)
|
||||
APPLET_NOUSAGE("sh", hush_main, _BB_DIR_BIN)
|
||||
#elif defined(BB_FEATURE_SH_IS_LASH) && defined(BB_LASH)
|
||||
APPLET_NOUSAGE("sh", lash_main, _BB_DIR_BIN)
|
||||
#elif defined(BB_FEATURE_SH_IS_MSH) && defined(BB_MSH)
|
||||
APPLET_NOUSAGE("sh", msh_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SLEEP
|
||||
APPLET(sleep, sleep_main, _BB_DIR_BIN)
|
||||
@@ -386,6 +410,9 @@
|
||||
#ifdef BB_TR
|
||||
APPLET(tr, tr_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TRACEROUTE
|
||||
APPLET(traceroute, traceroute_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TRUE_FALSE
|
||||
APPLET(true, true_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
@@ -402,7 +429,7 @@
|
||||
APPLET(uniq, uniq_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UNIX2DOS
|
||||
APPLET(unix2dos, unix2dos_main, _BB_DIR_USR_BIN)
|
||||
APPLET(unix2dos, dos2unix_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UPDATE
|
||||
APPLET(update, update_main, _BB_DIR_SBIN)
|
||||
|
||||
+47
-5
@@ -272,9 +272,14 @@
|
||||
"\t-d\toutput will be in DOS format"
|
||||
|
||||
#define dpkg_trivial_usage \
|
||||
"[-i|-r|--unpack|--configure] my.deb"
|
||||
"-i package_file\n"
|
||||
"[-CPru] package_name"
|
||||
#define dpkg_full_usage \
|
||||
"WORK IN PROGRESS, only useful for debian-installer"
|
||||
"\t-i\tInstall the package\n" \
|
||||
"\t-C\tConfigure an unpackaged package\n" \
|
||||
"\t-P\tPurge all files of a package\n" \
|
||||
"\t-r\tRemove all but the configuration files for a package\n" \
|
||||
"\t-u\tUnpack a package, but dont configure it\n"
|
||||
|
||||
#define dpkg_deb_trivial_usage \
|
||||
"[-cefItxX] FILE [argument]"
|
||||
@@ -1079,6 +1084,13 @@
|
||||
"$ ls -la /tmp/temp.mWiLjM\n" \
|
||||
"-rw------- 1 andersen andersen 0 Apr 25 17:10 /tmp/temp.mWiLjM\n"
|
||||
|
||||
#define modprobe_trivial_usage \
|
||||
"[FILE ...]"
|
||||
#define modprobe_full_usage \
|
||||
"Used for hight level module loading and unloading."
|
||||
#define modprobe_example_usage \
|
||||
"$ modprobe cdrom\n"
|
||||
|
||||
#define more_trivial_usage \
|
||||
"[FILE ...]"
|
||||
#define more_full_usage \
|
||||
@@ -1178,6 +1190,14 @@
|
||||
"Name: debian\n" \
|
||||
"Address: 127.0.0.1\n"
|
||||
|
||||
#define pidof_trivial_usage \
|
||||
"process-name [process-name ...]"
|
||||
#define pidof_full_usage \
|
||||
"Lists the PIDs of all processes with names that match the names on the command line"
|
||||
#define pidof_example_usage \
|
||||
"$ pidof init\n" \
|
||||
"1\n"
|
||||
|
||||
#ifndef BB_FEATURE_FANCY_PING
|
||||
#define ping_trivial_usage "host"
|
||||
#define ping_full_usage "Send ICMP ECHO_REQUEST packets to network hosts"
|
||||
@@ -1345,12 +1365,12 @@
|
||||
#define setkeycodes_example_usage \
|
||||
"$ setkeycodes e030 127\n"
|
||||
|
||||
#define sh_trivial_usage \
|
||||
#define lash_trivial_usage \
|
||||
"[FILE]...\n" \
|
||||
"or: sh -c command [args]..."
|
||||
#define sh_full_usage \
|
||||
#define lash_full_usage \
|
||||
"lash: The BusyBox LAme SHell (command interpreter)"
|
||||
#define sh_notes_usage \
|
||||
#define lash_notes_usage \
|
||||
"This command does not yet have proper documentation.\n" \
|
||||
"\n" \
|
||||
"Use lash just as you would use any other shell. It properly handles pipes,\n" \
|
||||
@@ -1593,6 +1613,28 @@
|
||||
"$ echo "gdkkn vnqkc" | tr [a-y] [b-z]\n" \
|
||||
"hello world\n"
|
||||
|
||||
#define traceroute_trivial_usage \
|
||||
"[-dnrv] [-m max_ttl] [-p port#] [-q nqueries]\n\
|
||||
[-s src_addr] [-t tos] [-w wait] host [data size]"
|
||||
#define traceroute_full_usage \
|
||||
"trace the route ip packets follow going to \"host\"\n" \
|
||||
"Options:\n" \
|
||||
"\t-d\tset SO_DEBUG options to socket\n" \
|
||||
"\t-n\tPrint hop addresses numerically rather than symbolically\n" \
|
||||
"\t-r\tBypass the normal routing tables and send directly to a host\n" \
|
||||
"\t-v\tVerbose output\n" \
|
||||
"\t-m max_ttl\tSet the max time-to-live (max number of hops)\n" \
|
||||
"\t-p port#\tSet the base UDP port number used in probes\n" \
|
||||
"\t\t(default is 33434)\n" \
|
||||
"\t-q nqueries\tSet the number of probes per ``ttl'' to nqueries\n" \
|
||||
"\t\t(default is 3)\n" \
|
||||
"\t-s src_addr\tUse the following IP address as the source address\n" \
|
||||
"\t-t tos\tSet the type-of-service in probe packets to the following value\n" \
|
||||
"\t\t(default 0)\n" \
|
||||
"\t-w wait\tSet the time (in seconds) to wait for a response to a probe\n" \
|
||||
"\t\t(default 3 sec.)."
|
||||
|
||||
|
||||
#define true_trivial_usage \
|
||||
""
|
||||
#define true_full_usage \
|
||||
|
||||
@@ -70,20 +70,20 @@ extern int ar_main(int argc, char **argv)
|
||||
|
||||
/* check ar magic */
|
||||
fread(ar_magic, 1, 8, src_stream);
|
||||
archive_offset = 8;
|
||||
if (strncmp(ar_magic,"!<arch>",7) != 0) {
|
||||
error_msg_and_die("invalid magic");
|
||||
}
|
||||
archive_offset = 8;
|
||||
|
||||
extract_names = malloc(sizeof(char *));
|
||||
extract_names[0] = NULL;
|
||||
/* Create a list of files to extract */
|
||||
while (optind < argc) {
|
||||
extract_names = xrealloc(extract_names, sizeof(char *) * (num_of_entries + 2));
|
||||
extract_names[num_of_entries] = xstrdup(argv[optind]);
|
||||
num_of_entries++;
|
||||
*extract_names = realloc(*extract_names, num_of_entries);
|
||||
extract_names[num_of_entries - 1] = xstrdup(argv[optind]);
|
||||
extract_names[num_of_entries] = NULL;
|
||||
optind++;
|
||||
}
|
||||
|
||||
unarchive(src_stream, &get_header_ar, extract_function, "./", extract_names);
|
||||
unarchive(src_stream, stdout, &get_header_ar, extract_function, "./", extract_names);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+6
-6
@@ -70,20 +70,20 @@ extern int ar_main(int argc, char **argv)
|
||||
|
||||
/* check ar magic */
|
||||
fread(ar_magic, 1, 8, src_stream);
|
||||
archive_offset = 8;
|
||||
if (strncmp(ar_magic,"!<arch>",7) != 0) {
|
||||
error_msg_and_die("invalid magic");
|
||||
}
|
||||
archive_offset = 8;
|
||||
|
||||
extract_names = malloc(sizeof(char *));
|
||||
extract_names[0] = NULL;
|
||||
/* Create a list of files to extract */
|
||||
while (optind < argc) {
|
||||
extract_names = xrealloc(extract_names, sizeof(char *) * (num_of_entries + 2));
|
||||
extract_names[num_of_entries] = xstrdup(argv[optind]);
|
||||
num_of_entries++;
|
||||
*extract_names = realloc(*extract_names, num_of_entries);
|
||||
extract_names[num_of_entries - 1] = xstrdup(argv[optind]);
|
||||
extract_names[num_of_entries] = NULL;
|
||||
optind++;
|
||||
}
|
||||
|
||||
unarchive(src_stream, &get_header_ar, extract_function, "./", extract_names);
|
||||
unarchive(src_stream, stdout, &get_header_ar, extract_function, "./", extract_names);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+10
-7
@@ -68,25 +68,28 @@ extern int cpio_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (extract_function & extract_all_to_fs && extract_function & extract_list) {
|
||||
if ((extract_function & extract_all_to_fs) && (extract_function & extract_list)) {
|
||||
extract_function ^= extract_all_to_fs; /* If specify t, don't extract*/
|
||||
}
|
||||
|
||||
if (extract_function & extract_all_to_fs && extract_function & extract_verbose_list) { /* The meaning of v changes on extract */
|
||||
if ((extract_function & extract_all_to_fs) && (extract_function & extract_verbose_list)) {
|
||||
/* The meaning of v changes on extract */
|
||||
extract_function ^= extract_verbose_list;
|
||||
extract_function |= extract_list;
|
||||
}
|
||||
|
||||
extract_names = malloc(4);
|
||||
while (optind < argc) {
|
||||
extract_names = xrealloc(extract_names, sizeof(char *) * (num_of_entries + 2));
|
||||
extract_names[num_of_entries] = xstrdup(argv[optind]);
|
||||
num_of_entries++;
|
||||
*extract_names = realloc(*extract_names, num_of_entries);
|
||||
extract_names[num_of_entries - 1] = xstrdup(argv[optind]);
|
||||
extract_names[num_of_entries] = NULL;
|
||||
optind++;
|
||||
}
|
||||
|
||||
unarchive(src_stream, &get_header_cpio, extract_function, "./", extract_names);
|
||||
if (oldmask) umask(oldmask); /* Restore umask if we changed it */
|
||||
unarchive(src_stream, stdout, &get_header_cpio, extract_function, "./", extract_names);
|
||||
if (oldmask) {
|
||||
umask(oldmask); /* Restore umask if we changed it */
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
+1346
-755
File diff suppressed because it is too large.
Load diff
+9
-4
@@ -110,12 +110,17 @@ extern int dpkg_deb_main(int argc, char **argv)
|
||||
}
|
||||
else if (arg_type == arg_type_field) {
|
||||
char *field = NULL;
|
||||
char *name;
|
||||
char *value;
|
||||
int field_start = 0;
|
||||
|
||||
while ((field = read_package_field(&output_buffer[field_start])) != NULL) {
|
||||
field_start += (strlen(field) + 1);
|
||||
if (strstr(field, argv[optind + 1]) == field) {
|
||||
puts(field + strlen(argv[optind + 1]) + 2);
|
||||
while (1) {
|
||||
field_start += read_package_field(&output_buffer[field_start], &name, &value);
|
||||
if (name == NULL) {
|
||||
break;
|
||||
}
|
||||
if (strcmp(name, argv[optind + 1]) == 0) {
|
||||
puts(value);
|
||||
}
|
||||
free(field);
|
||||
}
|
||||
|
||||
@@ -118,6 +118,9 @@ extern int gunzip_main(int argc, char **argv)
|
||||
/* Open input file */
|
||||
in_file = xfopen(if_name, "r");
|
||||
|
||||
/* set the buffer size */
|
||||
setvbuf(in_file, NULL, _IOFBF, 0x8000);
|
||||
|
||||
/* Get the time stamp on the input file. */
|
||||
if (stat(if_name, &stat_buf) < 0) {
|
||||
error_msg_and_die("Couldn't stat file %s", if_name);
|
||||
|
||||
+1
-1
@@ -1246,7 +1246,7 @@ int gzip_main(int argc, char **argv)
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
if (optind == argc) {
|
||||
if ((optind == argc) || (strcmp(argv[optind], "-") == 0)) {
|
||||
fromstdin = 1;
|
||||
tostdout = 1;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ static char *license_msg[] = {
|
||||
#include <string.h>
|
||||
#include "libbb.h"
|
||||
|
||||
FILE *in_file, *out_file;
|
||||
static FILE *in_file, *out_file;
|
||||
|
||||
/* these are freed by gz_close */
|
||||
static unsigned char *window;
|
||||
@@ -91,9 +91,9 @@ static const int N_MAX = 288; /* maximum number of codes in any set */
|
||||
static long bytes_out; /* number of output bytes */
|
||||
static unsigned long outcnt; /* bytes in output buffer */
|
||||
|
||||
unsigned hufts; /* track memory usage */
|
||||
unsigned long bb; /* bit buffer */
|
||||
unsigned bk; /* bits in bit buffer */
|
||||
static unsigned hufts; /* track memory usage */
|
||||
static unsigned long bb; /* bit buffer */
|
||||
static unsigned bk; /* bits in bit buffer */
|
||||
|
||||
typedef struct huft_s {
|
||||
unsigned char e; /* number of extra bits or operation */
|
||||
@@ -104,7 +104,7 @@ typedef struct huft_s {
|
||||
} v;
|
||||
} huft_t;
|
||||
|
||||
unsigned short mask_bits[] = {
|
||||
static const unsigned short mask_bits[] = {
|
||||
0x0000,
|
||||
0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
|
||||
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
|
||||
@@ -154,7 +154,7 @@ static void make_crc_table()
|
||||
* Write the output window window[0..outcnt-1] and update crc and bytes_out.
|
||||
* (Used for the decompressed data only.)
|
||||
*/
|
||||
void flush_window()
|
||||
static void flush_window(void)
|
||||
{
|
||||
int n;
|
||||
|
||||
@@ -925,9 +925,6 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
|
||||
outcnt = 0;
|
||||
bytes_out = 0L;
|
||||
|
||||
/* set the buffer size */
|
||||
setvbuf(in_file, NULL, _IOFBF, 0x8000);
|
||||
|
||||
magic[0] = fgetc(in_file);
|
||||
magic[1] = fgetc(in_file);
|
||||
|
||||
@@ -1024,6 +1021,6 @@ extern void gz_close(int gunzip_pid)
|
||||
if (waitpid(gunzip_pid, NULL, 0) == -1) {
|
||||
printf("Couldnt wait ?");
|
||||
}
|
||||
free(window);
|
||||
free(crc_table);
|
||||
free(window);
|
||||
free(crc_table);
|
||||
}
|
||||
@@ -67,7 +67,7 @@ static char *license_msg[] = {
|
||||
#include <string.h>
|
||||
#include "libbb.h"
|
||||
|
||||
FILE *in_file, *out_file;
|
||||
static FILE *in_file, *out_file;
|
||||
|
||||
/* these are freed by gz_close */
|
||||
static unsigned char *window;
|
||||
@@ -91,9 +91,9 @@ static const int N_MAX = 288; /* maximum number of codes in any set */
|
||||
static long bytes_out; /* number of output bytes */
|
||||
static unsigned long outcnt; /* bytes in output buffer */
|
||||
|
||||
unsigned hufts; /* track memory usage */
|
||||
unsigned long bb; /* bit buffer */
|
||||
unsigned bk; /* bits in bit buffer */
|
||||
static unsigned hufts; /* track memory usage */
|
||||
static unsigned long bb; /* bit buffer */
|
||||
static unsigned bk; /* bits in bit buffer */
|
||||
|
||||
typedef struct huft_s {
|
||||
unsigned char e; /* number of extra bits or operation */
|
||||
@@ -104,7 +104,7 @@ typedef struct huft_s {
|
||||
} v;
|
||||
} huft_t;
|
||||
|
||||
unsigned short mask_bits[] = {
|
||||
static const unsigned short mask_bits[] = {
|
||||
0x0000,
|
||||
0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
|
||||
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
|
||||
@@ -154,7 +154,7 @@ static void make_crc_table()
|
||||
* Write the output window window[0..outcnt-1] and update crc and bytes_out.
|
||||
* (Used for the decompressed data only.)
|
||||
*/
|
||||
void flush_window()
|
||||
static void flush_window(void)
|
||||
{
|
||||
int n;
|
||||
|
||||
@@ -925,9 +925,6 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
|
||||
outcnt = 0;
|
||||
bytes_out = 0L;
|
||||
|
||||
/* set the buffer size */
|
||||
setvbuf(in_file, NULL, _IOFBF, 0x8000);
|
||||
|
||||
magic[0] = fgetc(in_file);
|
||||
magic[1] = fgetc(in_file);
|
||||
|
||||
@@ -1024,6 +1021,6 @@ extern void gz_close(int gunzip_pid)
|
||||
if (waitpid(gunzip_pid, NULL, 0) == -1) {
|
||||
printf("Couldnt wait ?");
|
||||
}
|
||||
free(window);
|
||||
free(crc_table);
|
||||
free(window);
|
||||
free(crc_table);
|
||||
}
|
||||
@@ -74,6 +74,8 @@ extern int rpm2cpio_main(int argc, char **argv)
|
||||
} else {
|
||||
rpmfile = fopen(argv[1], "r");
|
||||
if (!rpmfile) perror_msg_and_die("Can't open rpm file");
|
||||
/* set the buffer size */
|
||||
setvbuf(rpmfile, NULL, _IOFBF, 0x8000);
|
||||
}
|
||||
|
||||
fread (&lead, sizeof(struct rpm_lead), 1, rpmfile);
|
||||
@@ -85,6 +87,7 @@ extern int rpm2cpio_main(int argc, char **argv)
|
||||
skip_header(rpmfile);
|
||||
|
||||
cpiofile = gz_open(rpmfile, &gunzip_pid);
|
||||
|
||||
copyfd(fileno(cpiofile), fileno(stdout));
|
||||
gz_close(gunzip_pid);
|
||||
fclose(rpmfile);
|
||||
|
||||
+7
-3
@@ -284,6 +284,10 @@ extern int tar_main(int argc, char **argv)
|
||||
/* unzip tarFd in a seperate process */
|
||||
if (unzipFlag == TRUE) {
|
||||
comp_file = fdopen(tarFd, "r");
|
||||
|
||||
/* set the buffer size */
|
||||
setvbuf(comp_file, NULL, _IOFBF, 0x8000);
|
||||
|
||||
if ((tarFd = fileno(gz_open(comp_file, &pid))) == EXIT_FAILURE) {
|
||||
error_msg_and_die("Couldnt unzip file");
|
||||
}
|
||||
@@ -330,7 +334,7 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
|
||||
size_t writeSize;
|
||||
size_t readSize;
|
||||
size_t actualWriteSz;
|
||||
char buffer[BUFSIZ];
|
||||
char buffer[20 * TAR_BLOCK_SIZE];
|
||||
size_t size = header->size;
|
||||
int outFd=fileno(stdout);
|
||||
|
||||
@@ -354,9 +358,9 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
|
||||
if ( size > sizeof(buffer) )
|
||||
writeSize = readSize = sizeof(buffer);
|
||||
else {
|
||||
int mod = size % 512;
|
||||
int mod = size % TAR_BLOCK_SIZE;
|
||||
if ( mod != 0 )
|
||||
readSize = size + (512 - mod);
|
||||
readSize = size + (TAR_BLOCK_SIZE - mod);
|
||||
else
|
||||
readSize = size;
|
||||
writeSize = size;
|
||||
|
||||
@@ -69,13 +69,16 @@ extern const struct BB_applet applets[];
|
||||
#ifdef BB_FEATURE_BUFFERS_GO_ON_STACK
|
||||
#define RESERVE_BB_BUFFER(buffer,len) char buffer[len]
|
||||
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char buffer[len]
|
||||
#define RELEASE_BB_BUFFER(buffer) ((void)0)
|
||||
#else
|
||||
#ifdef BB_FEATURE_BUFFERS_GO_IN_BSS
|
||||
#define RESERVE_BB_BUFFER(buffer,len) static char buffer[len]
|
||||
#define RESERVE_BB_UBUFFER(buffer,len) static unsigned char buffer[len]
|
||||
#define RELEASE_BB_BUFFER(buffer) ((void)0)
|
||||
#else
|
||||
#define RESERVE_BB_BUFFER(buffer,len) char *buffer=xmalloc(len)
|
||||
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
|
||||
#define RELEASE_BB_BUFFER(buffer) free (buffer)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
+16
-8
@@ -1,13 +1,21 @@
|
||||
Name: busybox
|
||||
Version: 0.52
|
||||
Release: 1
|
||||
%define name busybox
|
||||
%define epoch 0
|
||||
%define version 0.60.0
|
||||
%define release %(date -I | sed -e 's/-/_/g')
|
||||
%define serial 1
|
||||
|
||||
Name: %{name}
|
||||
#Epoch: %{epoch}
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
Serial: %{serial}
|
||||
Copyright: GPL
|
||||
Group: System/Utilities
|
||||
Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary.
|
||||
Copyright: GPL
|
||||
URL: http://busybox.lineo.com/
|
||||
Source: ftp://oss.lineo.com/busybox/%{name}-%{version}.tar.gz
|
||||
Buildroot: /var/tmp/%{name}-%{version}
|
||||
Packager : Erik Andersen <andersen@lineo.com>
|
||||
Conflicts: fileutils grep shellutils
|
||||
Buildroot: /tmp/%{Name}-%{Version}
|
||||
Source: %{Name}-%{Version}.tar.gz
|
||||
|
||||
%Description
|
||||
BusyBox combines tiny versions of many common UNIX utilities into a single
|
||||
@@ -19,7 +27,7 @@ their full featured GNU cousins; however, the options that are provided behave
|
||||
very much like their GNU counterparts.
|
||||
|
||||
%Prep
|
||||
%setup -q -n %{Name}-%{Version}
|
||||
%setup -q -n %{name}-%{version}
|
||||
|
||||
%Build
|
||||
make
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
static long uid;
|
||||
static long gid;
|
||||
|
||||
static int (*chown_func)() = chown;
|
||||
static int (*chown_func)(const char *, __uid_t, __gid_t) = chown;
|
||||
|
||||
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||
{
|
||||
|
||||
@@ -48,17 +48,17 @@ int chroot_main(int argc, char **argv)
|
||||
prog = *argv;
|
||||
execvp(*argv, argv);
|
||||
} else {
|
||||
#ifndef BB_SH
|
||||
prog = getenv("SHELL");
|
||||
if (!prog)
|
||||
prog = "/bin/sh";
|
||||
execlp(prog, prog, NULL);
|
||||
#else
|
||||
#if defined(BB_SH) && defined BB_FEATURE_SH_STANDALONE_SHELL
|
||||
char shell[] = "/bin/sh";
|
||||
char *shell_argv[2] = { shell, NULL };
|
||||
applet_name = shell;
|
||||
shell_main(1, shell_argv);
|
||||
return EXIT_SUCCESS;
|
||||
#else
|
||||
prog = getenv("SHELL");
|
||||
if (!prog)
|
||||
prog = "/bin/sh";
|
||||
execlp(prog, prog, NULL);
|
||||
#endif
|
||||
}
|
||||
perror_msg_and_die("cannot execute %s", prog);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Termios command line History and Editting.
|
||||
*
|
||||
* Copyright (c) 1986-2001 may safely be consumed by a BSD or GPL license.
|
||||
* Written by: Vladimir Oleynik <vodz@usa.net>
|
||||
* Written by: Vladimir Oleynik <dzo@simtreas.ru>
|
||||
*
|
||||
* Used ideas:
|
||||
* Adam Rogoyski <rogoyski@cs.utexas.edu>
|
||||
@@ -123,9 +123,8 @@ volatile int handlers_sets = 0; /* Set next bites: */
|
||||
enum {
|
||||
SET_ATEXIT = 1, /* when atexit() has been called
|
||||
and get euid,uid,gid to fast compare */
|
||||
SET_TERM_HANDLERS = 2, /* set many terminates signal handlers */
|
||||
SET_WCHG_HANDLERS = 4, /* winchg signal handler */
|
||||
SET_RESET_TERM = 8, /* if the terminal needs to be reset upon exit */
|
||||
SET_WCHG_HANDLERS = 2, /* winchg signal handler */
|
||||
SET_RESET_TERM = 4, /* if the terminal needs to be reset upon exit */
|
||||
};
|
||||
|
||||
|
||||
@@ -142,10 +141,6 @@ static
|
||||
#endif
|
||||
char *cmdedit_prompt; /* --- "" - - "" - -"- --""-- --""--- */
|
||||
|
||||
/* Link into lash to reset context to 0 on ^C and such */
|
||||
extern unsigned int shell_context;
|
||||
|
||||
|
||||
#ifdef BB_FEATURE_GETUSERNAME_AND_HOMEDIR
|
||||
static char *user_buf = "";
|
||||
static char *home_pwd_buf = "";
|
||||
@@ -169,13 +164,17 @@ static int my_gid;
|
||||
|
||||
#endif /* BB_FEATURE_COMMAND_TAB_COMPLETION */
|
||||
|
||||
/* It seems that libc5 doesn't know what a sighandler_t is... */
|
||||
#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)
|
||||
typedef void (*sighandler_t) (int);
|
||||
#endif
|
||||
|
||||
static void cmdedit_setwidth(int w, int redraw_flg);
|
||||
|
||||
static void win_changed(int nsig)
|
||||
{
|
||||
struct winsize win = { 0, 0, 0, 0 };
|
||||
static __sighandler_t previous_SIGWINCH_handler; /* for reset */
|
||||
static sighandler_t previous_SIGWINCH_handler; /* for reset */
|
||||
|
||||
/* emulate || signal call */
|
||||
if (nsig == -SIGWINCH || nsig == SIGWINCH) {
|
||||
@@ -319,6 +318,7 @@ static void put_prompt(void)
|
||||
out1str(cmdedit_prompt);
|
||||
cmdedit_x = cmdedit_prmt_len; /* count real x terminal position */
|
||||
cursor = 0;
|
||||
cmdedit_y = 0; /* new quasireal y */
|
||||
}
|
||||
|
||||
#ifndef BB_FEATURE_SH_FANCY_PROMPT
|
||||
@@ -456,7 +456,6 @@ static void redraw(int y, int back_cursor)
|
||||
{
|
||||
if (y > 0) /* up to start y */
|
||||
printf("\033[%dA", y);
|
||||
cmdedit_y = 0; /* new quasireal y */
|
||||
putchar('\r');
|
||||
put_prompt();
|
||||
input_end(); /* rewrite */
|
||||
@@ -497,14 +496,6 @@ static void input_forward(void)
|
||||
}
|
||||
|
||||
|
||||
static void clean_up_and_die(int sig)
|
||||
{
|
||||
goto_new_line();
|
||||
if (sig != SIGINT)
|
||||
exit(EXIT_SUCCESS); /* cmdedit_reset_term() called in atexit */
|
||||
cmdedit_reset_term();
|
||||
}
|
||||
|
||||
static void cmdedit_setwidth(int w, int redraw_flg)
|
||||
{
|
||||
cmdedit_termw = cmdedit_prmt_len + 2;
|
||||
@@ -525,7 +516,7 @@ static void cmdedit_setwidth(int w, int redraw_flg)
|
||||
}
|
||||
}
|
||||
|
||||
extern void cmdedit_init(void)
|
||||
static void cmdedit_init(void)
|
||||
{
|
||||
cmdedit_prmt_len = 0;
|
||||
if ((handlers_sets & SET_WCHG_HANDLERS) == 0) {
|
||||
@@ -557,14 +548,6 @@ extern void cmdedit_init(void)
|
||||
handlers_sets |= SET_ATEXIT;
|
||||
atexit(cmdedit_reset_term); /* be sure to do this only once */
|
||||
}
|
||||
|
||||
if ((handlers_sets & SET_TERM_HANDLERS) == 0) {
|
||||
signal(SIGKILL, clean_up_and_die);
|
||||
signal(SIGINT, clean_up_and_die);
|
||||
signal(SIGQUIT, clean_up_and_die);
|
||||
signal(SIGTERM, clean_up_and_die);
|
||||
handlers_sets |= SET_TERM_HANDLERS;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BB_FEATURE_COMMAND_TAB_COMPLETION
|
||||
@@ -1174,7 +1157,8 @@ enum {
|
||||
*
|
||||
*/
|
||||
|
||||
extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
|
||||
|
||||
int cmdedit_read_input(char *prompt, char command[BUFSIZ])
|
||||
{
|
||||
|
||||
int break_out = 0;
|
||||
@@ -1187,25 +1171,21 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
|
||||
len = 0;
|
||||
command_ps = command;
|
||||
|
||||
if (new_settings.c_cc[VERASE] == 0) { /* first call */
|
||||
|
||||
getTermSettings(0, (void *) &initial_settings);
|
||||
memcpy(&new_settings, &initial_settings, sizeof(struct termios));
|
||||
new_settings.c_lflag &= ~ICANON; /* unbuffered input */
|
||||
/* Turn off echoing and CTRL-C, so we can trap it */
|
||||
new_settings.c_lflag &= ~(ECHO | ECHONL | ISIG);
|
||||
getTermSettings(0, (void *) &initial_settings);
|
||||
memcpy(&new_settings, &initial_settings, sizeof(struct termios));
|
||||
new_settings.c_lflag &= ~ICANON; /* unbuffered input */
|
||||
/* Turn off echoing and CTRL-C, so we can trap it */
|
||||
new_settings.c_lflag &= ~(ECHO | ECHONL | ISIG);
|
||||
#ifndef linux
|
||||
/* Hmm, in linux c_cc[] not parsed if set ~ICANON */
|
||||
new_settings.c_cc[VMIN] = 1;
|
||||
new_settings.c_cc[VTIME] = 0;
|
||||
/* Turn off CTRL-C, so we can trap it */
|
||||
/* Hmm, in linux c_cc[] not parsed if set ~ICANON */
|
||||
new_settings.c_cc[VMIN] = 1;
|
||||
new_settings.c_cc[VTIME] = 0;
|
||||
/* Turn off CTRL-C, so we can trap it */
|
||||
# ifndef _POSIX_VDISABLE
|
||||
# define _POSIX_VDISABLE '\0'
|
||||
# endif
|
||||
new_settings.c_cc[VINTR] = _POSIX_VDISABLE;
|
||||
new_settings.c_cc[VINTR] = _POSIX_VDISABLE;
|
||||
#endif
|
||||
}
|
||||
|
||||
command[0] = 0;
|
||||
|
||||
setTermSettings(0, (void *) &new_settings);
|
||||
@@ -1220,7 +1200,7 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
|
||||
|
||||
fflush(stdout); /* buffered out to fast */
|
||||
|
||||
if (read(0, &c, 1) < 1)
|
||||
if (safe_read(0, &c, 1) < 1)
|
||||
/* if we can't read input then exit */
|
||||
goto prepare_to_die;
|
||||
|
||||
@@ -1241,22 +1221,26 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ])
|
||||
break;
|
||||
case 3:
|
||||
/* Control-c -- stop gathering input */
|
||||
|
||||
/* Link into lash to reset context to 0 on ^C and such */
|
||||
shell_context = 0;
|
||||
|
||||
/* Go to the next line */
|
||||
goto_new_line();
|
||||
command[0] = 0;
|
||||
|
||||
return;
|
||||
len = 0;
|
||||
lastWasTab = FALSE;
|
||||
put_prompt();
|
||||
break;
|
||||
case 4:
|
||||
/* Control-d -- Delete one character, or exit
|
||||
* if the len=0 and no chars to delete */
|
||||
if (len == 0) {
|
||||
prepare_to_die:
|
||||
#if !defined(BB_ASH)
|
||||
printf("exit");
|
||||
clean_up_and_die(0);
|
||||
goto_new_line();
|
||||
/* cmdedit_reset_term() called in atexit */
|
||||
exit(EXIT_SUCCESS);
|
||||
#else
|
||||
break_out = -1; /* for control stoped jobs */
|
||||
break;
|
||||
#endif
|
||||
} else {
|
||||
input_delete();
|
||||
}
|
||||
@@ -1307,12 +1291,12 @@ prepare_to_die:
|
||||
|
||||
case ESC:{
|
||||
/* escape sequence follows */
|
||||
if (read(0, &c, 1) < 1)
|
||||
return;
|
||||
if (safe_read(0, &c, 1) < 1)
|
||||
goto prepare_to_die;
|
||||
/* different vt100 emulations */
|
||||
if (c == '[' || c == 'O') {
|
||||
if (read(0, &c, 1) < 1)
|
||||
return;
|
||||
if (safe_read(0, &c, 1) < 1)
|
||||
goto prepare_to_die;
|
||||
}
|
||||
switch (c) {
|
||||
#ifdef BB_FEATURE_COMMAND_TAB_COMPLETION
|
||||
@@ -1376,8 +1360,8 @@ prepare_to_die:
|
||||
}
|
||||
if (c >= '1' && c <= '9')
|
||||
do
|
||||
if (read(0, &c, 1) < 1)
|
||||
return;
|
||||
if (safe_read(0, &c, 1) < 1)
|
||||
goto prepare_to_die;
|
||||
while (c != '~');
|
||||
break;
|
||||
}
|
||||
@@ -1386,8 +1370,8 @@ prepare_to_die:
|
||||
#ifdef BB_FEATURE_NONPRINTABLE_INVERSE_PUT
|
||||
/* Control-V -- Add non-printable symbol */
|
||||
if (c == 22) {
|
||||
if (read(0, &c, 1) < 1)
|
||||
return;
|
||||
if (safe_read(0, &c, 1) < 1)
|
||||
goto prepare_to_die;
|
||||
if (c == 0) {
|
||||
beep();
|
||||
break;
|
||||
@@ -1477,32 +1461,22 @@ prepare_to_die:
|
||||
num_ok_lines++;
|
||||
#endif
|
||||
}
|
||||
if(break_out>0) {
|
||||
command[len++] = '\n'; /* set '\n' */
|
||||
command[len] = 0;
|
||||
}
|
||||
#if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION)
|
||||
input_tab(0); /* strong free */
|
||||
#endif
|
||||
#if defined(BB_FEATURE_SH_FANCY_PROMPT)
|
||||
free(cmdedit_prompt);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Undo the effects of cmdedit_init(). */
|
||||
extern void cmdedit_terminate(void)
|
||||
{
|
||||
cmdedit_reset_term();
|
||||
if ((handlers_sets & SET_TERM_HANDLERS) != 0) {
|
||||
signal(SIGKILL, SIG_DFL);
|
||||
signal(SIGINT, SIG_DFL);
|
||||
signal(SIGQUIT, SIG_DFL);
|
||||
signal(SIGTERM, SIG_DFL);
|
||||
signal(SIGWINCH, SIG_DFL);
|
||||
handlers_sets &= ~SET_TERM_HANDLERS;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif /* BB_FEATURE_COMMAND_EDITING */
|
||||
|
||||
|
||||
@@ -1515,8 +1489,6 @@ const char *memory_exhausted = "Memory exhausted";
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
unsigned int shell_context;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char buff[BUFSIZ];
|
||||
@@ -1532,15 +1504,16 @@ int main(int argc, char **argv)
|
||||
#ifdef BB_FEATURE_NONPRINTABLE_INVERSE_PUT
|
||||
setlocale(LC_ALL, "");
|
||||
#endif
|
||||
shell_context = 1;
|
||||
do {
|
||||
while(1) {
|
||||
int l;
|
||||
cmdedit_read_input(prompt, buff);
|
||||
l = strlen(buff);
|
||||
if(l==0)
|
||||
break;
|
||||
if(l > 0 && buff[l-1] == '\n')
|
||||
buff[l-1] = 0;
|
||||
printf("*** cmdedit_read_input() returned line =%s=\n", buff);
|
||||
} while (shell_context);
|
||||
}
|
||||
printf("*** cmdedit_read_input() detect ^C\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#ifndef CMDEDIT_H
|
||||
#define CMDEDIT_H
|
||||
|
||||
void cmdedit_init(void);
|
||||
void cmdedit_terminate(void);
|
||||
void cmdedit_read_input(char* promptStr, char* command); /* read a line of input */
|
||||
int cmdedit_read_input(char* promptStr, char* command);
|
||||
|
||||
#endif /* CMDEDIT_H */
|
||||
@@ -51,9 +51,9 @@ int dumpkmap_main(int argc, char **argv)
|
||||
show_usage();
|
||||
}
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
fd = open(CURRENT_VC, O_RDWR);
|
||||
if (fd < 0) {
|
||||
perror_msg("Error opening /dev/tty0");
|
||||
perror_msg("Error opening " CURRENT_VC);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@ int loadacm_main(int argc, char **argv)
|
||||
show_usage();
|
||||
}
|
||||
|
||||
fd = open("/dev/tty", O_RDWR);
|
||||
fd = open(CURRENT_VC, O_RDWR);
|
||||
if (fd < 0) {
|
||||
perror_msg_and_die("Error opening /dev/tty1");
|
||||
perror_msg_and_die("Error opening " CURRENT_VC);
|
||||
}
|
||||
|
||||
if (screen_map_load(fd, stdin)) {
|
||||
|
||||
@@ -46,9 +46,9 @@ extern int loadfont_main(int argc, char **argv)
|
||||
if (argc != 1)
|
||||
show_usage();
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
fd = open(CURRENT_VC, O_RDWR);
|
||||
if (fd < 0)
|
||||
perror_msg_and_die("Error opening /dev/tty0");
|
||||
perror_msg_and_die("Error opening " CURRENT_VC);
|
||||
loadnewfont(fd);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
@@ -53,9 +53,9 @@ int loadkmap_main(int argc, char **argv)
|
||||
if (argc != 1)
|
||||
show_usage();
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
fd = open(CURRENT_VC, O_RDWR);
|
||||
if (fd < 0)
|
||||
perror_msg_and_die("Error opening /dev/tty0");
|
||||
perror_msg_and_die("Error opening " CURRENT_VC);
|
||||
|
||||
read(0, buff, 7);
|
||||
if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7))
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@
|
||||
static long uid;
|
||||
static long gid;
|
||||
|
||||
static int (*chown_func)() = chown;
|
||||
static int (*chown_func)(const char *, __uid_t, __gid_t) = chown;
|
||||
|
||||
static int fileAction(const char *fileName, struct stat *statbuf, void* junk)
|
||||
{
|
||||
|
||||
+6
-6
@@ -48,17 +48,17 @@ int chroot_main(int argc, char **argv)
|
||||
prog = *argv;
|
||||
execvp(*argv, argv);
|
||||
} else {
|
||||
#ifndef BB_SH
|
||||
prog = getenv("SHELL");
|
||||
if (!prog)
|
||||
prog = "/bin/sh";
|
||||
execlp(prog, prog, NULL);
|
||||
#else
|
||||
#if defined(BB_SH) && defined BB_FEATURE_SH_STANDALONE_SHELL
|
||||
char shell[] = "/bin/sh";
|
||||
char *shell_argv[2] = { shell, NULL };
|
||||
applet_name = shell;
|
||||
shell_main(1, shell_argv);
|
||||
return EXIT_SUCCESS;
|
||||
#else
|
||||
prog = getenv("SHELL");
|
||||
if (!prog)
|
||||
prog = "/bin/sh";
|
||||
execlp(prog, prog, NULL);
|
||||
#endif
|
||||
}
|
||||
perror_msg_and_die("cannot execute %s", prog);
|
||||
|
||||
+2
-4
@@ -344,10 +344,8 @@ extern int cut_main(int argc, char **argv)
|
||||
int i;
|
||||
FILE *file;
|
||||
for (i = optind; i < argc; i++) {
|
||||
file = fopen(argv[i], "r");
|
||||
if (file == NULL) {
|
||||
perror_msg("%s", argv[i]);
|
||||
} else {
|
||||
file = wfopen(argv[i], "r");
|
||||
if(file) {
|
||||
cut_file(file);
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
+2
-6
@@ -50,7 +50,6 @@ int dd_main(int argc, char **argv)
|
||||
size_t bs = 512, count = -1;
|
||||
ssize_t n;
|
||||
off_t seek = 0, skip = 0;
|
||||
FILE *statusfp;
|
||||
char *infile = NULL, *outfile = NULL, *buf;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
@@ -110,12 +109,9 @@ int dd_main(int argc, char **argv)
|
||||
if (ftruncate(ofd, seek * bs) < 0)
|
||||
perror_msg_and_die("%s", outfile);
|
||||
}
|
||||
|
||||
statusfp = stdout;
|
||||
} else {
|
||||
ofd = STDOUT_FILENO;
|
||||
outfile = "standard output";
|
||||
statusfp = stderr;
|
||||
}
|
||||
|
||||
if (skip) {
|
||||
@@ -151,8 +147,8 @@ int dd_main(int argc, char **argv)
|
||||
out_part++;
|
||||
}
|
||||
|
||||
fprintf(statusfp, "%ld+%ld records in\n", (long)in_full, (long)in_part);
|
||||
fprintf(statusfp, "%ld+%ld records out\n", (long)out_full, (long)out_part);
|
||||
fprintf(stderr, "%ld+%ld records in\n", (long)in_full, (long)in_part);
|
||||
fprintf(stderr, "%ld+%ld records out\n", (long)out_full, (long)out_part);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+62
-19
@@ -29,21 +29,56 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/time.h>
|
||||
#include "busybox.h"
|
||||
|
||||
/* Teach libc5 what a uint64_t is */
|
||||
#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)
|
||||
typedef unsigned long int uint64_t;
|
||||
#endif
|
||||
|
||||
static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
// if fn is NULL then input is stdin and output is stdout
|
||||
static int convert(char *fn, int ConvType) {
|
||||
int c;
|
||||
char *tempFn = NULL;
|
||||
static int convert(char *fn, int ConvType)
|
||||
{
|
||||
int c, fd;
|
||||
struct timeval tv;
|
||||
char tempFn[BUFSIZ];
|
||||
static uint64_t value=0;
|
||||
FILE *in = stdin, *out = stdout;
|
||||
|
||||
if (fn != NULL) {
|
||||
if ((in = wfopen(fn, "r")) == NULL) {
|
||||
if ((in = wfopen(fn, "rw")) == NULL) {
|
||||
return -1;
|
||||
}
|
||||
if ((out = tmpfile()) == NULL) {
|
||||
perror_msg(NULL);
|
||||
return -2;
|
||||
strcpy(tempFn, fn);
|
||||
c = strlen(tempFn);
|
||||
tempFn[c] = '.';
|
||||
while(1) {
|
||||
if (c >=BUFSIZ)
|
||||
error_msg_and_die("unique name not found");
|
||||
/* Get some semi random stuff to try and make a
|
||||
* random filename based (and in the same dir as)
|
||||
* the input file... */
|
||||
gettimeofday (&tv, NULL);
|
||||
value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid ();
|
||||
tempFn[++c] = letters[value % 62];
|
||||
tempFn[c+1] = '\0';
|
||||
value /= 62;
|
||||
|
||||
if ((fd = open(tempFn, O_RDWR | O_CREAT | O_EXCL, 0600)) < 0 ) {
|
||||
continue;
|
||||
}
|
||||
out = fdopen(fd, "w+");
|
||||
if (!out) {
|
||||
close(fd);
|
||||
remove(tempFn);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +86,7 @@ static int convert(char *fn, int ConvType) {
|
||||
if (c == '\r') {
|
||||
if ((ConvType == CT_UNIX2DOS) && (fn != NULL)) {
|
||||
// file is alredy in DOS format so it is not necessery to touch it
|
||||
remove(tempFn);
|
||||
if (fclose(in) < 0 || fclose(out) < 0) {
|
||||
perror_msg(NULL);
|
||||
return -2;
|
||||
@@ -64,6 +100,7 @@ static int convert(char *fn, int ConvType) {
|
||||
if (c == '\n') {
|
||||
if ((ConvType == CT_DOS2UNIX) && (fn != NULL)) {
|
||||
// file is alredy in UNIX format so it is not necessery to touch it
|
||||
remove(tempFn);
|
||||
if ((fclose(in) < 0) || (fclose(out) < 0)) {
|
||||
perror_msg(NULL);
|
||||
return -2;
|
||||
@@ -95,29 +132,35 @@ static int convert(char *fn, int ConvType) {
|
||||
}
|
||||
|
||||
if (fn != NULL) {
|
||||
if (fclose(in) < 0 || fclose(out) < 0 ||
|
||||
(in = fopen(tempFn, "r")) == NULL || (out = fopen(fn, "w")) == NULL) {
|
||||
perror_msg(NULL);
|
||||
return -2;
|
||||
if (fclose(in) < 0 || fclose(out) < 0) {
|
||||
perror_msg(NULL);
|
||||
remove(tempFn);
|
||||
return -2;
|
||||
}
|
||||
|
||||
while ((c = fgetc(in)) != EOF) {
|
||||
fputc(c, out);
|
||||
}
|
||||
|
||||
if ((fclose(in) < 0) || (fclose(out) < 0)) {
|
||||
perror_msg(NULL);
|
||||
return -2;
|
||||
/* Assume they are both on the same filesystem */
|
||||
if (rename(tempFn, fn) < 0) {
|
||||
perror_msg("unable to rename '%s' as '%s'", tempFn, fn);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dos2unix_main(int argc, char *argv[]) {
|
||||
int dos2unix_main(int argc, char *argv[])
|
||||
{
|
||||
int ConvType = CT_AUTO;
|
||||
int o;
|
||||
|
||||
//See if we are supposed to be doing dos2unix or unix2dos
|
||||
if (argv[0][0]=='d') {
|
||||
ConvType = CT_DOS2UNIX;
|
||||
}
|
||||
if (argv[0][0]=='u') {
|
||||
ConvType = CT_UNIX2DOS;
|
||||
}
|
||||
|
||||
// process parameters
|
||||
while ((o = getopt(argc, argv, "du")) != EOF) {
|
||||
switch (o) {
|
||||
|
||||
+4
-1
@@ -61,6 +61,7 @@ enum {
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "busybox.h"
|
||||
|
||||
@@ -303,6 +304,7 @@ static struct dnode **dnalloc(int num)
|
||||
return(p);
|
||||
}
|
||||
|
||||
#ifdef BB_FEATURE_LS_RECURSIVE
|
||||
static void dfree(struct dnode **dnp)
|
||||
{
|
||||
struct dnode *cur, *next;
|
||||
@@ -318,6 +320,7 @@ static void dfree(struct dnode **dnp)
|
||||
}
|
||||
free(dnp); /* free the array holding the dnode pointers */
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which)
|
||||
{
|
||||
@@ -634,7 +637,7 @@ static int list_single(struct dnode *dn)
|
||||
my_getpwuid(scratch, dn->dstat.st_uid);
|
||||
printf("%-8.8s ", scratch);
|
||||
my_getgrgid(scratch, dn->dstat.st_gid);
|
||||
printf("%-8.8s ", scratch);
|
||||
printf("%-8.8s", scratch);
|
||||
column += 17;
|
||||
break;
|
||||
#endif
|
||||
|
||||
+42
-112
@@ -63,24 +63,6 @@
|
||||
|
||||
/* md5.c - Functions to compute MD5 message digest of files or memory blocks
|
||||
* according to the definition of MD5 in RFC 1321 from April 1992.
|
||||
* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
*
|
||||
* NOTE: The canonical source of this file is maintained with the GNU C
|
||||
* Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
*
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */
|
||||
@@ -90,34 +72,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* md5.h - Declaration of functions and data types used for MD5 sum
|
||||
computing library functions.
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
NOTE: The canonical source of this file is maintained with the GNU C
|
||||
Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _MD5_H
|
||||
static const int _MD5_H = 1;
|
||||
|
||||
/* The following contortions are an attempt to use the C preprocessor
|
||||
to determine an unsigned integral type that is 32 bits wide. An
|
||||
alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
|
||||
doing that would require that the configure script compile and *run*
|
||||
the resulting executable. Locally running cross-compiled executables
|
||||
is usually not possible. */
|
||||
computing library functions. */
|
||||
|
||||
typedef u_int32_t md5_uint32;
|
||||
|
||||
@@ -141,20 +96,20 @@ struct md5_ctx
|
||||
|
||||
/* Initialize structure containing state of computation.
|
||||
(RFC 1321, 3.3: Step 3) */
|
||||
extern void md5_init_ctx __P ((struct md5_ctx *ctx));
|
||||
static void md5_init_ctx __P ((struct md5_ctx *ctx));
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is necessary that LEN is a multiple of 64!!! */
|
||||
extern void md5_process_block __P ((const void *buffer, size_t len,
|
||||
static void md5_process_block __P ((const void *buffer, size_t len,
|
||||
struct md5_ctx *ctx));
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is NOT required that LEN is a multiple of 64. */
|
||||
extern void md5_process_bytes __P ((const void *buffer, size_t len,
|
||||
static void md5_process_bytes __P ((const void *buffer, size_t len,
|
||||
struct md5_ctx *ctx));
|
||||
|
||||
/* Process the remaining bytes in the buffer and put result from CTX
|
||||
@@ -164,30 +119,21 @@ extern void md5_process_bytes __P ((const void *buffer, size_t len,
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf));
|
||||
static void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf));
|
||||
|
||||
|
||||
/* Put result from CTX in first 16 bytes following RESBUF. The result is
|
||||
always in little endian byte order, so that a byte-wise output yields
|
||||
to the wanted ASCII representation of the message digest.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
extern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf));
|
||||
|
||||
|
||||
/* Compute MD5 message digest for bytes read from STREAM. The
|
||||
resulting message digest number will be written into the 16 bytes
|
||||
beginning at RESBLOCK. */
|
||||
extern int md5_stream __P ((FILE *stream, void *resblock));
|
||||
static int md5_stream __P ((FILE *stream, void *resblock));
|
||||
|
||||
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
|
||||
result is always in little endian byte order, so that a byte-wise
|
||||
output yields to the wanted ASCII representation of the message
|
||||
digest. */
|
||||
extern void *md5_buffer __P ((const char *buffer, size_t len, void *resblock));
|
||||
|
||||
#endif
|
||||
static void *md5_buffer __P ((const char *buffer, size_t len, void *resblock));
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//--------end of md5.h
|
||||
@@ -221,27 +167,12 @@ void md5_init_ctx(struct md5_ctx *ctx)
|
||||
ctx->buflen = 0;
|
||||
}
|
||||
|
||||
/* Put result from CTX in first 16 bytes following RESBUF. The result
|
||||
must be in little endian byte order.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
void *md5_read_ctx(const struct md5_ctx *ctx, void *resbuf)
|
||||
{
|
||||
((md5_uint32 *) resbuf)[0] = SWAP(ctx->A);
|
||||
((md5_uint32 *) resbuf)[1] = SWAP(ctx->B);
|
||||
((md5_uint32 *) resbuf)[2] = SWAP(ctx->C);
|
||||
((md5_uint32 *) resbuf)[3] = SWAP(ctx->D);
|
||||
|
||||
return resbuf;
|
||||
}
|
||||
|
||||
/* Process the remaining bytes in the internal buffer and the usual
|
||||
prolog according to the standard and write the result to RESBUF.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
void *md5_finish_ctx(struct md5_ctx *ctx, void *resbuf)
|
||||
static void *md5_finish_ctx(struct md5_ctx *ctx, void *resbuf)
|
||||
{
|
||||
/* Take yet unprocessed bytes into account. */
|
||||
md5_uint32 bytes = ctx->buflen;
|
||||
@@ -268,13 +199,24 @@ void *md5_finish_ctx(struct md5_ctx *ctx, void *resbuf)
|
||||
/* Process last bytes. */
|
||||
md5_process_block(ctx->buffer, bytes + pad + 8, ctx);
|
||||
|
||||
return md5_read_ctx(ctx, resbuf);
|
||||
/* Put result from CTX in first 16 bytes following RESBUF. The result is
|
||||
always in little endian byte order, so that a byte-wise output yields
|
||||
to the wanted ASCII representation of the message digest.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
((md5_uint32 *) resbuf)[0] = SWAP(ctx->A);
|
||||
((md5_uint32 *) resbuf)[1] = SWAP(ctx->B);
|
||||
((md5_uint32 *) resbuf)[2] = SWAP(ctx->C);
|
||||
((md5_uint32 *) resbuf)[3] = SWAP(ctx->D);
|
||||
|
||||
return resbuf;
|
||||
}
|
||||
|
||||
/* Compute MD5 message digest for bytes read from STREAM. The
|
||||
resulting message digest number will be written into the 16 bytes
|
||||
beginning at RESBLOCK. */
|
||||
int md5_stream(FILE *stream, void *resblock)
|
||||
static int md5_stream(FILE *stream, void *resblock)
|
||||
{
|
||||
/* Important: BLOCKSIZE must be a multiple of 64. */
|
||||
static const int BLOCKSIZE = 4096;
|
||||
@@ -326,7 +268,7 @@ static const int BLOCKSIZE = 4096;
|
||||
result is always in little endian byte order, so that a byte-wise
|
||||
output yields to the wanted ASCII representation of the message
|
||||
digest. */
|
||||
void *md5_buffer(const char *buffer, size_t len, void *resblock)
|
||||
static void *md5_buffer(const char *buffer, size_t len, void *resblock)
|
||||
{
|
||||
struct md5_ctx ctx;
|
||||
|
||||
@@ -340,7 +282,7 @@ void *md5_buffer(const char *buffer, size_t len, void *resblock)
|
||||
return md5_finish_ctx(&ctx, resblock);
|
||||
}
|
||||
|
||||
void md5_process_bytes(const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
static void md5_process_bytes(const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
{
|
||||
/* When we already have some bits in our internal buffer concatenate
|
||||
both inputs first. */
|
||||
@@ -388,7 +330,7 @@ void md5_process_bytes(const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
|
||||
/* Process LEN bytes of BUFFER, accumulating context into CTX.
|
||||
It is assumed that LEN % 64 == 0. */
|
||||
void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
{
|
||||
md5_uint32 correct_words[16];
|
||||
const md5_uint32 *words = buffer;
|
||||
@@ -490,7 +432,6 @@ void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
break;
|
||||
case 3:
|
||||
temp += FI(B,C,D);
|
||||
break;
|
||||
}
|
||||
temp += cwp[(int)(*pp++)] + *pc++;
|
||||
temp = CYCLIC (temp, ps[i&3]);
|
||||
@@ -550,6 +491,7 @@ void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
|
||||
/* It is unfortunate that C does not provide an operator for
|
||||
cyclic rotation. Hope the C compiler is smart enough. */
|
||||
/* gcc 2.95.4 seems to be --aaronl */
|
||||
#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
|
||||
|
||||
/* Before we start, one word to the strange constants.
|
||||
@@ -707,11 +649,7 @@ void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#define ISWHITE(c) ((c) == ' ' || (c) == '\t')
|
||||
#define IN_CTYPE_DOMAIN(c) 1
|
||||
#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
|
||||
#define STREQ(a, b) (strcmp ((a), (b)) == 0)
|
||||
#define TOLOWER(Ch) tolower (Ch)
|
||||
#define OPENOPTS(BINARY) "r"
|
||||
#define ISXDIGIT(c) (isxdigit (c))
|
||||
|
||||
/* The minimum length of a valid digest line in a file produced
|
||||
by `md5sum FILE' and read by `md5sum -c'. This length does
|
||||
@@ -731,7 +669,6 @@ static int warn = 0; /* With -w, print a message to standard error warning
|
||||
static int split_3(char *s,
|
||||
size_t s_len,
|
||||
unsigned char **u,
|
||||
int *binary,
|
||||
char **w)
|
||||
{
|
||||
size_t i = 0;
|
||||
@@ -762,9 +699,8 @@ static int split_3(char *s,
|
||||
|
||||
s[i++] = '\0';
|
||||
|
||||
if (s[i] != ' ' && s[i] != '*')
|
||||
if (s[i] != ' ' && s[i++] != '*')
|
||||
return FALSE;
|
||||
*binary = (s[i++] == '*');
|
||||
|
||||
/* All characters between the type indicator and end of line are
|
||||
significant -- that includes leading and trailing white space. */
|
||||
@@ -812,7 +748,7 @@ static int split_3(char *s,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int hex_digits(unsigned char const *s)
|
||||
static inline int hex_digits(unsigned char const *s)
|
||||
{
|
||||
while (*s) {
|
||||
if (!ISXDIGIT(*s))
|
||||
@@ -826,21 +762,18 @@ static int hex_digits(unsigned char const *s)
|
||||
put the result in *MD5_RESULT. Return non-zero upon failure, zero
|
||||
to indicate success. */
|
||||
static int md5_file(const char *filename,
|
||||
int binary,
|
||||
unsigned char *md5_result)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
if (STREQ(filename, "-")) {
|
||||
if (filename[0] == '-' && filename[1] == '\0') {
|
||||
have_read_stdin = 1;
|
||||
fp = stdin;
|
||||
} else {
|
||||
fp = fopen(filename, OPENOPTS(binary));
|
||||
if (fp == NULL) {
|
||||
perror_msg("%s", filename);
|
||||
fp = wfopen(filename, "r");
|
||||
if (fp == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (md5_stream(fp, md5_result)) {
|
||||
perror_msg("%s", filename);
|
||||
@@ -868,22 +801,19 @@ static int md5_check(const char *checkfile_name)
|
||||
size_t line_number;
|
||||
char line[BUFSIZ];
|
||||
|
||||
if (STREQ(checkfile_name, "-")) {
|
||||
if (checkfile_name[0] == '-' && checkfile_name[1] == '\0') {
|
||||
have_read_stdin = 1;
|
||||
checkfile_stream = stdin;
|
||||
} else {
|
||||
checkfile_stream = fopen(checkfile_name, "r");
|
||||
if (checkfile_stream == NULL) {
|
||||
perror_msg("%s", checkfile_name);
|
||||
checkfile_stream = wfopen(checkfile_name, "r");
|
||||
if (checkfile_stream == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
line_number = 0;
|
||||
|
||||
do {
|
||||
char *filename;
|
||||
int binary;
|
||||
unsigned char *md5num;
|
||||
int line_length;
|
||||
|
||||
@@ -903,7 +833,7 @@ static int md5_check(const char *checkfile_name)
|
||||
if (line[line_length - 1] == '\n')
|
||||
line[--line_length] = '\0';
|
||||
|
||||
if (split_3(line, line_length, &md5num, &binary, &filename)
|
||||
if (split_3(line, line_length, &md5num, &filename)
|
||||
|| !hex_digits(md5num)) {
|
||||
if (warn) {
|
||||
error_msg("%s: %lu: improperly formatted MD5 checksum line",
|
||||
@@ -919,7 +849,7 @@ static int md5_check(const char *checkfile_name)
|
||||
|
||||
++n_properly_formated_lines;
|
||||
|
||||
if (md5_file(filename, binary, md5buffer)) {
|
||||
if (md5_file(filename, md5buffer)) {
|
||||
++n_open_or_read_failures;
|
||||
if (!status_only) {
|
||||
printf("%s: FAILED open or read\n", filename);
|
||||
@@ -930,9 +860,9 @@ static int md5_check(const char *checkfile_name)
|
||||
/* Compare generated binary number with text representation
|
||||
in check file. Ignore case of hex digits. */
|
||||
for (cnt = 0; cnt < 16; ++cnt) {
|
||||
if (TOLOWER(md5num[2 * cnt])
|
||||
if (tolower(md5num[2 * cnt])
|
||||
!= bin2hex[md5buffer[cnt] >> 4]
|
||||
|| (TOLOWER(md5num[2 * cnt + 1])
|
||||
|| (tolower(md5num[2 * cnt + 1])
|
||||
!= (bin2hex[md5buffer[cnt] & 0xf])))
|
||||
break;
|
||||
}
|
||||
@@ -997,8 +927,8 @@ int md5sum_main(int argc,
|
||||
char **string = NULL;
|
||||
size_t n_strings = 0;
|
||||
size_t err = 0;
|
||||
int file_type_specified = 0;
|
||||
int binary = 0;
|
||||
char file_type_specified = 0;
|
||||
char binary = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "g:bcstw")) != -1) {
|
||||
switch (opt) {
|
||||
@@ -1084,9 +1014,9 @@ int md5sum_main(int argc,
|
||||
int fail;
|
||||
char *file = argv[optind];
|
||||
|
||||
fail = md5_file (file, binary, md5buffer);
|
||||
fail = md5_file (file, md5buffer);
|
||||
err |= fail;
|
||||
if (!fail && STREQ(file, "-")) {
|
||||
if (!fail && file[0]=='-' && file[1] == '\0') {
|
||||
size_t i;
|
||||
for (i = 0; i < 16; ++i)
|
||||
printf ("%02x", md5buffer[i]);
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
|
||||
David MacKenzie <djm@gnu.ai.mit.edu>
|
||||
|
||||
Special for busybox ported by Vladimir Oleynik <vodz@usa.net> 2001
|
||||
Special for busybox ported by Vladimir Oleynik <dzo@simtreas.ru> 2001
|
||||
|
||||
*/
|
||||
|
||||
|
||||
+13
-5
@@ -54,7 +54,7 @@ static void convert()
|
||||
if (in_index == read_chars) {
|
||||
if ((read_chars = read(0, (char *) pinput, BUFSIZ)) <= 0) {
|
||||
if (write(1, (char *) poutput, out_index) != out_index)
|
||||
write(2, write_error, strlen(write_error));
|
||||
error_msg("%s", write_error);
|
||||
exit(0);
|
||||
}
|
||||
in_index = 0;
|
||||
@@ -67,10 +67,8 @@ static void convert()
|
||||
continue;
|
||||
poutput[out_index++] = last = coded;
|
||||
if (out_index == BUFSIZ) {
|
||||
if (write(1, (char *) poutput, out_index) != out_index) {
|
||||
write(2, write_error, strlen(write_error));
|
||||
exit(1);
|
||||
}
|
||||
if (write(1, (char *) poutput, out_index) != out_index)
|
||||
error_msg_and_die("%s", write_error);
|
||||
out_index = 0;
|
||||
}
|
||||
}
|
||||
@@ -105,6 +103,16 @@ static unsigned int expand(const char *arg, register unsigned char *buffer)
|
||||
if (*arg == '\\') {
|
||||
arg++;
|
||||
*buffer++ = process_escape_sequence(&arg);
|
||||
} else if (*(arg+1) == '-') {
|
||||
ac = *(arg+2);
|
||||
if(ac == 0) {
|
||||
*buffer++ = *arg++;
|
||||
continue;
|
||||
}
|
||||
i = *arg;
|
||||
while (i <= ac)
|
||||
*buffer++ = i++;
|
||||
arg += 3; /* Skip the assumed a-z */
|
||||
} else if (*arg == '[') {
|
||||
arg++;
|
||||
i = *arg++;
|
||||
|
||||
+13
-10
@@ -201,12 +201,13 @@ static int decode (const char *inname,
|
||||
const char *forced_outname)
|
||||
{
|
||||
struct passwd *pw;
|
||||
register int n;
|
||||
register char *p;
|
||||
int mode, n1;
|
||||
int mode;
|
||||
char buf[2 * BUFSIZ];
|
||||
char *outname;
|
||||
int do_base64 = 0;
|
||||
int res;
|
||||
int dofre;
|
||||
|
||||
/* Search for header line. */
|
||||
|
||||
@@ -226,6 +227,7 @@ static int decode (const char *inname,
|
||||
}
|
||||
|
||||
/* If the output file name is given on the command line this rules. */
|
||||
dofre = FALSE;
|
||||
if (forced_outname != NULL)
|
||||
outname = (char *) forced_outname;
|
||||
else {
|
||||
@@ -246,12 +248,8 @@ static int decode (const char *inname,
|
||||
error_msg("%s: No user `%s'", inname, buf + 1);
|
||||
return FALSE;
|
||||
}
|
||||
n = strlen (pw->pw_dir);
|
||||
n1 = strlen (p);
|
||||
outname = (char *) alloca ((size_t) (n + n1 + 2));
|
||||
memcpy (outname + n + 1, p, (size_t) (n1 + 1));
|
||||
memcpy (outname, pw->pw_dir, (size_t) n);
|
||||
outname[n] = '/';
|
||||
outname = concat_path_file(pw->pw_dir, p);
|
||||
dofre = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,6 +259,8 @@ static int decode (const char *inname,
|
||||
|| chmod (outname, mode & (S_IRWXU | S_IRWXG | S_IRWXO))
|
||||
)) {
|
||||
perror_msg("%s", outname); /* */
|
||||
if (dofre)
|
||||
free(outname);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -269,9 +269,12 @@ static int decode (const char *inname,
|
||||
|
||||
/* For each input line: */
|
||||
if (do_base64)
|
||||
return read_base64 (inname);
|
||||
res = read_base64 (inname);
|
||||
else
|
||||
return read_stduu (inname);
|
||||
res = read_stduu (inname);
|
||||
if (dofre)
|
||||
free(outname);
|
||||
return res;
|
||||
}
|
||||
|
||||
int uudecode_main (int argc,
|
||||
|
||||
+164
-221
@@ -1,237 +1,180 @@
|
||||
/* uuencode.c -- uuencode utility.
|
||||
* Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Copyright (C) 2000 by Glenn McGrath
|
||||
*
|
||||
* This product 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.
|
||||
* based on the function base64_encode from http.c in wget v1.6
|
||||
* Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
|
||||
*
|
||||
* This product 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.
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this product; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
* 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 Library General Public License for more details.
|
||||
*
|
||||
* Original copyright notice is retained at the end of this file.
|
||||
* 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.
|
||||
*/
|
||||
/* Reworked to GNU style by Ian Lance Taylor, ian@airs.com, August 93. */
|
||||
/* Hacked to work with BusyBox by Alfred M. Szmidt */
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include "busybox.h"
|
||||
|
||||
#define RW (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)
|
||||
|
||||
static void encode __P ((void));
|
||||
|
||||
/* Pointer to the translation table we currently use. */
|
||||
static const char *trans_ptr;
|
||||
|
||||
/* The two currently defined translation tables. The first is the
|
||||
standard uuencoding, the second is base64 encoding. */
|
||||
static const char uu_std[64] = {
|
||||
'`', '!', '"', '#', '$', '%', '&', '\'',
|
||||
'(', ')', '*', '+', ',', '-', '.', '/',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', ':', ';', '<', '=', '>', '?',
|
||||
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
|
||||
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
|
||||
'X', 'Y', 'Z', '[', '\\', ']', '^', '_'
|
||||
/* Conversion table. for base 64 */
|
||||
static char tbl_base64[64] = {
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
||||
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
||||
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
||||
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
||||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
||||
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
||||
'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
||||
'4', '5', '6', '7', '8', '9', '+', '/'
|
||||
};
|
||||
|
||||
static const char uu_base64[64] = {
|
||||
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
||||
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
|
||||
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
|
||||
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
|
||||
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
|
||||
'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
|
||||
'w', 'x', 'y', 'z', '0', '1', '2', '3',
|
||||
'4', '5', '6', '7', '8', '9', '+', '/'
|
||||
static char tbl_std[64] = {
|
||||
'`', '!', '"', '#', '$', '%', '&', '\'',
|
||||
'(', ')', '*', '+', ',', '-', '.', '/',
|
||||
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', ':', ';', '<', '=', '>', '?',
|
||||
'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
|
||||
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
|
||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
|
||||
'X', 'Y', 'Z', '[', '\\', ']', '^', '_'
|
||||
};
|
||||
|
||||
/* ENC is the basic 1 character encoding function to make a char printing. */
|
||||
#define ENC(Char) (trans_ptr[(Char) & 077])
|
||||
|
||||
/* Copy from IN to OUT, encoding as you go along. */
|
||||
static void encode()
|
||||
{
|
||||
register int ch, n;
|
||||
char *p = NULL;
|
||||
char buf[80];
|
||||
|
||||
while (1) {
|
||||
n = 0;
|
||||
do {
|
||||
register int m = fread (buf, 1, 45 - n, stdin);
|
||||
if (m == 0)
|
||||
break;
|
||||
n += m;
|
||||
}
|
||||
while (n < 45);
|
||||
|
||||
if (n == 0)
|
||||
break;
|
||||
|
||||
if (trans_ptr == uu_std)
|
||||
if (putchar (ENC (n)) == EOF)
|
||||
break;
|
||||
for (p = buf; n > 2; n -= 3, p += 3) {
|
||||
ch = *p >> 2;
|
||||
ch = ENC (ch);
|
||||
if (putchar (ch) == EOF)
|
||||
break;
|
||||
ch = ((*p << 4) & 060) | ((p[1] >> 4) & 017);
|
||||
ch = ENC (ch);
|
||||
if (putchar (ch) == EOF)
|
||||
break;
|
||||
ch = ((p[1] << 2) & 074) | ((p[2] >> 6) & 03);
|
||||
ch = ENC (ch);
|
||||
if (putchar (ch) == EOF)
|
||||
break;
|
||||
ch = p[2] & 077;
|
||||
ch = ENC (ch);
|
||||
if (putchar (ch) == EOF)
|
||||
break;
|
||||
}
|
||||
|
||||
if (n != 0)
|
||||
break;
|
||||
|
||||
if (putchar ('\n') == EOF)
|
||||
break;
|
||||
}
|
||||
|
||||
while (n != 0) {
|
||||
char c1 = *p;
|
||||
char c2 = n == 1 ? 0 : p[1];
|
||||
|
||||
ch = c1 >> 2;
|
||||
ch = ENC (ch);
|
||||
if (putchar (ch) == EOF)
|
||||
break;
|
||||
|
||||
ch = ((c1 << 4) & 060) | ((c2 >> 4) & 017);
|
||||
ch = ENC (ch);
|
||||
if (putchar (ch) == EOF)
|
||||
break;
|
||||
|
||||
if (n == 1)
|
||||
ch = trans_ptr == uu_std ? ENC ('\0') : '=';
|
||||
else {
|
||||
ch = (c2 << 2) & 074;
|
||||
ch = ENC (ch);
|
||||
}
|
||||
if (putchar (ch) == EOF)
|
||||
break;
|
||||
ch = trans_ptr == uu_std ? ENC ('\0') : '=';
|
||||
if (putchar (ch) == EOF)
|
||||
break;
|
||||
putchar ('\n');
|
||||
break;
|
||||
}
|
||||
|
||||
if (ferror (stdin))
|
||||
error_msg("Read error");
|
||||
|
||||
if (trans_ptr == uu_std) {
|
||||
putchar (ENC ('\0'));
|
||||
putchar ('\n');
|
||||
}
|
||||
}
|
||||
|
||||
int uuencode_main (int argc,
|
||||
char **argv)
|
||||
{
|
||||
int opt;
|
||||
struct stat sb;
|
||||
int mode;
|
||||
|
||||
trans_ptr = uu_std; /* Standard encoding is old uu format */
|
||||
|
||||
/* Parse any options */
|
||||
while ((opt = getopt (argc, argv, "m")) > 0) {
|
||||
switch (opt) {
|
||||
case 'm':
|
||||
trans_ptr = uu_base64;
|
||||
break;
|
||||
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
switch (argc - optind) {
|
||||
case 2:
|
||||
/* Optional first argument is input file. */
|
||||
if (!freopen (argv[optind], "r", stdin) || fstat (fileno (stdin), &sb)) {
|
||||
perror_msg("%s", argv[optind]);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
mode = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
optind++;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
mode = RW & ~umask (RW);
|
||||
break;
|
||||
|
||||
case 0:
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
|
||||
printf("begin%s %o %s\n", trans_ptr == uu_std ? "" : "-base64",
|
||||
mode, argv[optind]);
|
||||
encode();
|
||||
printf(trans_ptr == uu_std ? "end\n" : "====\n");
|
||||
if (ferror (stdout)) {
|
||||
error_msg("Write error");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
/* Copyright (c) 1983 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
|
||||
* ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
|
||||
*
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
/*
|
||||
* Encode the string S of length LENGTH to base64 format and place it
|
||||
* to STORE. STORE will be 0-terminated, and must point to a writable
|
||||
* buffer of at least 1+BASE64_LENGTH(length) bytes.
|
||||
* where BASE64_LENGTH(len) = (4 * ((LENGTH + 2) / 3))
|
||||
*/
|
||||
static void uuencode (const char *s, const char *store, const int length, const char *tbl)
|
||||
{
|
||||
int i;
|
||||
unsigned char *p = (unsigned char *)store;
|
||||
|
||||
/* Transform the 3x8 bits to 4x6 bits, as required by base64. */
|
||||
for (i = 0; i < length; i += 3) {
|
||||
*p++ = tbl[s[0] >> 2];
|
||||
*p++ = tbl[((s[0] & 3) << 4) + (s[1] >> 4)];
|
||||
*p++ = tbl[((s[1] & 0xf) << 2) + (s[2] >> 6)];
|
||||
*p++ = tbl[s[2] & 0x3f];
|
||||
s += 3;
|
||||
}
|
||||
/* Pad the result if necessary... */
|
||||
if (i == length + 1) {
|
||||
*(p - 1) = '=';
|
||||
}
|
||||
else if (i == length + 2) {
|
||||
*(p - 1) = *(p - 2) = '=';
|
||||
}
|
||||
/* ...and zero-terminate it. */
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
int uuencode_main(int argc, char **argv)
|
||||
{
|
||||
const int src_buf_size = 60; // This *MUST* be a multiple of 3
|
||||
const int dst_buf_size = 4 * ((src_buf_size + 2) / 3);
|
||||
RESERVE_BB_BUFFER(src_buf, src_buf_size + 1);
|
||||
RESERVE_BB_BUFFER(dst_buf, dst_buf_size + 1);
|
||||
struct stat stat_buf;
|
||||
FILE *src_stream = stdin;
|
||||
char *tbl = tbl_std;
|
||||
size_t size;
|
||||
mode_t mode;
|
||||
int opt;
|
||||
int column = 0;
|
||||
int write_size = 0;
|
||||
int remaining;
|
||||
int buffer_offset = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "m")) != -1) {
|
||||
switch (opt) {
|
||||
case 'm':
|
||||
tbl = tbl_base64;
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
switch (argc - optind) {
|
||||
case 2:
|
||||
src_stream = xfopen(argv[optind], "r");
|
||||
stat(argv[optind], &stat_buf);
|
||||
mode = stat_buf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
if (src_stream == stdout) {
|
||||
printf("NULL\n");
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
mode = 0666 & ~umask(0666);
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
}
|
||||
|
||||
printf("begin%s %o %s", tbl == tbl_std ? "" : "-base64", mode, argv[argc - 1]);
|
||||
|
||||
while ((size = fread(src_buf, 1, src_buf_size, src_stream)) > 0) {
|
||||
/* Encode the buffer we just read in */
|
||||
uuencode(src_buf, dst_buf, size, tbl);
|
||||
|
||||
/* Write the buffer to stdout, wrapping at 60 chars.
|
||||
* This looks overly complex, but it gets tricky as
|
||||
* the line has to continue to wrap correctly if we
|
||||
* have to refill the buffer
|
||||
*
|
||||
* Improvments most welcome
|
||||
*/
|
||||
|
||||
/* Initialise values for the new buffer */
|
||||
remaining = 4 * ((size + 2) / 3);
|
||||
buffer_offset = 0;
|
||||
|
||||
/* Write the buffer to stdout, wrapping at 60 chars
|
||||
* starting from the column the last buffer ran out
|
||||
*/
|
||||
do {
|
||||
if (remaining > (60 - column)) {
|
||||
write_size = 60 - column;
|
||||
}
|
||||
else if (remaining < 60) {
|
||||
write_size = remaining;
|
||||
} else {
|
||||
write_size = 60;
|
||||
}
|
||||
|
||||
/* Setup a new row if required */
|
||||
if (column == 0) {
|
||||
putchar('\n');
|
||||
if (tbl == tbl_std) {
|
||||
putchar('M');
|
||||
}
|
||||
}
|
||||
/* Write to the 60th column */
|
||||
if (fwrite(&dst_buf[buffer_offset], 1, write_size, stdout) != write_size) {
|
||||
perror("Couldnt finish writing");
|
||||
}
|
||||
/* Update variables based on last write */
|
||||
buffer_offset += write_size;
|
||||
remaining -= write_size;
|
||||
column += write_size;
|
||||
if (column % 60 == 0) {
|
||||
column = 0;
|
||||
}
|
||||
} while (remaining > 0);
|
||||
}
|
||||
printf(tbl == tbl_std ? "\n`\nend\n" : "\n====\n");
|
||||
|
||||
return(EXIT_SUCCESS);
|
||||
}
|
||||
@@ -68,25 +68,28 @@ extern int cpio_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (extract_function & extract_all_to_fs && extract_function & extract_list) {
|
||||
if ((extract_function & extract_all_to_fs) && (extract_function & extract_list)) {
|
||||
extract_function ^= extract_all_to_fs; /* If specify t, don't extract*/
|
||||
}
|
||||
|
||||
if (extract_function & extract_all_to_fs && extract_function & extract_verbose_list) { /* The meaning of v changes on extract */
|
||||
if ((extract_function & extract_all_to_fs) && (extract_function & extract_verbose_list)) {
|
||||
/* The meaning of v changes on extract */
|
||||
extract_function ^= extract_verbose_list;
|
||||
extract_function |= extract_list;
|
||||
}
|
||||
|
||||
extract_names = malloc(4);
|
||||
while (optind < argc) {
|
||||
extract_names = xrealloc(extract_names, sizeof(char *) * (num_of_entries + 2));
|
||||
extract_names[num_of_entries] = xstrdup(argv[optind]);
|
||||
num_of_entries++;
|
||||
*extract_names = realloc(*extract_names, num_of_entries);
|
||||
extract_names[num_of_entries - 1] = xstrdup(argv[optind]);
|
||||
extract_names[num_of_entries] = NULL;
|
||||
optind++;
|
||||
}
|
||||
|
||||
unarchive(src_stream, &get_header_cpio, extract_function, "./", extract_names);
|
||||
if (oldmask) umask(oldmask); /* Restore umask if we changed it */
|
||||
unarchive(src_stream, stdout, &get_header_cpio, extract_function, "./", extract_names);
|
||||
if (oldmask) {
|
||||
umask(oldmask); /* Restore umask if we changed it */
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -344,10 +344,8 @@ extern int cut_main(int argc, char **argv)
|
||||
int i;
|
||||
FILE *file;
|
||||
for (i = optind; i < argc; i++) {
|
||||
file = fopen(argv[i], "r");
|
||||
if (file == NULL) {
|
||||
perror_msg("%s", argv[i]);
|
||||
} else {
|
||||
file = wfopen(argv[i], "r");
|
||||
if(file) {
|
||||
cut_file(file);
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ int dd_main(int argc, char **argv)
|
||||
size_t bs = 512, count = -1;
|
||||
ssize_t n;
|
||||
off_t seek = 0, skip = 0;
|
||||
FILE *statusfp;
|
||||
char *infile = NULL, *outfile = NULL, *buf;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
@@ -110,12 +109,9 @@ int dd_main(int argc, char **argv)
|
||||
if (ftruncate(ofd, seek * bs) < 0)
|
||||
perror_msg_and_die("%s", outfile);
|
||||
}
|
||||
|
||||
statusfp = stdout;
|
||||
} else {
|
||||
ofd = STDOUT_FILENO;
|
||||
outfile = "standard output";
|
||||
statusfp = stderr;
|
||||
}
|
||||
|
||||
if (skip) {
|
||||
@@ -151,8 +147,8 @@ int dd_main(int argc, char **argv)
|
||||
out_part++;
|
||||
}
|
||||
|
||||
fprintf(statusfp, "%ld+%ld records in\n", (long)in_full, (long)in_part);
|
||||
fprintf(statusfp, "%ld+%ld records out\n", (long)out_full, (long)out_part);
|
||||
fprintf(stderr, "%ld+%ld records in\n", (long)in_full, (long)in_part);
|
||||
fprintf(stderr, "%ld+%ld records out\n", (long)out_full, (long)out_part);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Vendored
+52
-63
@@ -9,6 +9,7 @@
|
||||
// BusyBox Applications
|
||||
//#define BB_ADJTIMEX
|
||||
#define BB_AR
|
||||
//#define BB_ASH
|
||||
#define BB_BASENAME
|
||||
#define BB_CAT
|
||||
#define BB_CHGRP
|
||||
@@ -51,6 +52,7 @@
|
||||
#define BB_HEAD
|
||||
//#define BB_HOSTID
|
||||
//#define BB_HOSTNAME
|
||||
//#define BB_HUSH
|
||||
#define BB_ID
|
||||
//#define BB_IFCONFIG
|
||||
#define BB_INIT
|
||||
@@ -58,6 +60,7 @@
|
||||
#define BB_KILL
|
||||
#define BB_KILLALL
|
||||
#define BB_KLOGD
|
||||
//#define BB_LASH
|
||||
//#define BB_LENGTH
|
||||
#define BB_LN
|
||||
//#define BB_LOADACM
|
||||
@@ -75,12 +78,15 @@
|
||||
#define BB_MKNOD
|
||||
#define BB_MKSWAP
|
||||
//#define BB_MKTEMP
|
||||
//#define BB_NC
|
||||
//#define BB_MODPROBE
|
||||
#define BB_MORE
|
||||
#define BB_MOUNT
|
||||
//#define BB_MSH
|
||||
//#define BB_MT
|
||||
#define BB_MV
|
||||
//#define BB_NC
|
||||
//#define BB_NSLOOKUP
|
||||
//#define BB_PIDOF
|
||||
#define BB_PING
|
||||
//#define BB_PIVOT_ROOT
|
||||
#define BB_POWEROFF
|
||||
@@ -99,7 +105,6 @@
|
||||
//#define BB_RPM2CPIO
|
||||
#define BB_SED
|
||||
//#define BB_SETKEYCODES
|
||||
//#define BB_SH
|
||||
#define BB_SLEEP
|
||||
#define BB_SORT
|
||||
//#define BB_STTY
|
||||
@@ -114,6 +119,7 @@
|
||||
//#define BB_TFTP
|
||||
#define BB_TOUCH
|
||||
#define BB_TR
|
||||
//#define BB_TRACEROUTE
|
||||
#define BB_TRUE_FALSE
|
||||
#define BB_TTY
|
||||
//#define BB_UNIX2DOS
|
||||
@@ -143,40 +149,12 @@
|
||||
// pretty/useful).
|
||||
//
|
||||
//
|
||||
// If you enabled BB_SH above, you may select one of the following shells.
|
||||
// You can only select ONE of the following shells. Sorry.
|
||||
//
|
||||
// lash is the very smallest shell (adds just 10k) and it is quite usable as a
|
||||
// command prompt, but it is not suitable for any but the most trivial scripting
|
||||
// (such as an initrd that calls insmod a few times) since it does not
|
||||
// understand Bourne shell grammer. It does handle pipes, redirects, and job
|
||||
// control though. Adding in command editing makes it very nice lightweight
|
||||
// command prompt.
|
||||
//#define BB_FEATURE_LASH
|
||||
//
|
||||
// hush is also quite small (just 18k) and it has very complete Bourne shell
|
||||
// grammer. It handles if/then/else/fi just fine, but doesn't handle loops
|
||||
// like for/do/done or case/esac and such. It also currently has a problem
|
||||
// with job control.
|
||||
//#define BB_FEATURE_HUSH
|
||||
//
|
||||
// msh: The minix shell (adds just 30k) is quite complete and handles things
|
||||
// like for/do/done, case/esac and all the things you expect a Bourne shell to
|
||||
// do. It is not always pedantically correct about Bourne shell grammer (try
|
||||
// running the shell testscript "tests/sh.testcases" on it and compare vs
|
||||
// bash) but for most things it works quite well. It also uses only vfork, so
|
||||
// it can be used on uClinux systems. This was only recently added, so there is
|
||||
// still room to shrink it further...
|
||||
#define BB_FEATURE_MSH
|
||||
//
|
||||
// ash: This adds about 60k in the default configuration and is the most
|
||||
// complete and most pedantically correct shell included with busybox. This
|
||||
// shell was also recently added, and several people (mainly Vladimir and Erik)
|
||||
// have been working on it. There are a number of configurable things at the
|
||||
// top of ash.c as well, so check those out if you want to tweak things. The
|
||||
// Posix math support is currently disabled (that bit of code was horrible) but
|
||||
// will be restored for the next BusyBox release.
|
||||
//#define BB_FEATURE_ASH
|
||||
// If you enabled one or more of the shells, you may select which one
|
||||
// should be run when sh is invoked:
|
||||
//#define BB_FEATURE_SH_IS_ASH
|
||||
//#define BB_FEATURE_SH_IS_HUSH
|
||||
//#define BB_FEATURE_SH_IS_LASH
|
||||
#define BB_FEATURE_SH_IS_MSH
|
||||
//
|
||||
// BusyBox will, by default, malloc space for its buffers. This costs code
|
||||
// size for the call to xmalloc. You can use the following feature to have
|
||||
@@ -283,11 +261,11 @@
|
||||
#define BB_FEATURE_SORT_UNIQUE
|
||||
//
|
||||
// Enable command line editing in the shell.
|
||||
// Only relevant if BB_SH is enabled. On by default.
|
||||
// Only relevant if a shell is enabled. On by default.
|
||||
#define BB_FEATURE_COMMAND_EDITING
|
||||
//
|
||||
// Enable tab completion in the shell. This is now working quite nicely.
|
||||
// This feature adds a bit over 4k. Only relevant if BB_SH is enabled.
|
||||
// This feature adds a bit over 4k. Only relevant if a shell is enabled.
|
||||
#define BB_FEATURE_COMMAND_TAB_COMPLETION
|
||||
//
|
||||
// Attempts to match usernames in a ~-prefixed path
|
||||
@@ -296,7 +274,7 @@
|
||||
//Allow the shell to invoke all the compiled in BusyBox applets as if they
|
||||
//were shell builtins. Nice for staticly linking an emergency rescue shell,
|
||||
//among other things. Off by default.
|
||||
// Only relevant if BB_SH is enabled.
|
||||
// Only relevant if a shell is enabled.
|
||||
//#define BB_FEATURE_SH_STANDALONE_SHELL
|
||||
//
|
||||
//When this is enabled, busybox shell applets can be called using full path
|
||||
@@ -305,13 +283,13 @@
|
||||
//will use BusyBox cat even if /bin/cat exists on the filesystem and is _not_
|
||||
//busybox. Some systems want this, others do not. Choose wisely. :-) This
|
||||
//only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled.
|
||||
// Only relevant if BB_SH is enabled. Off by default.
|
||||
// Only relevant if a shell is enabled. Off by default.
|
||||
//#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
|
||||
//
|
||||
// Uncomment this option for a fancy shell prompt that includes the
|
||||
// current username and hostname. On systems that don't have usernames
|
||||
// or hostnames, this can look hideous.
|
||||
// Only relevant if BB_SH is enabled.
|
||||
// Only relevant if a shell is enabled.
|
||||
//#define BB_FEATURE_SH_FANCY_PROMPT
|
||||
//
|
||||
//Turn on extra fbset options
|
||||
@@ -416,8 +394,21 @@
|
||||
// Nothing beyond this point should ever be touched by
|
||||
// mere mortals so leave this stuff alone.
|
||||
//
|
||||
#if defined BB_SH
|
||||
#if defined BB_FEATURE_COMMAND_EDITING
|
||||
#include <features.h>
|
||||
#if defined __UCLIBC__ && ! defined __UCLIBC_HAS_MMU__
|
||||
#undef BB_RPM2CPIO /* Uses gz_open(), which uses fork() */
|
||||
#undef BB_DPKG_DEB /* Uses gz_open(), which uses fork() */
|
||||
#undef BB_ASH /* Uses fork() */
|
||||
#undef BB_HUSH /* Uses fork() */
|
||||
#undef BB_LASH /* Uses fork() */
|
||||
#undef BB_INIT /* Uses fork() */
|
||||
#undef BB_FEATURE_TAR_GZIP /* Uses fork() */
|
||||
#undef BB_SYSLOGD /* Uses daemon() */
|
||||
#undef BB_KLOGD /* Uses daemon() */
|
||||
#undef BB_UPDATE /* Uses daemon() */
|
||||
#endif
|
||||
#if defined BB_ASH || defined BB_HUSH || defined BB_LASH || defined BB_MSH
|
||||
#if defined BB_FEATURE_COMMAND_EDITING
|
||||
#define BB_CMDEDIT
|
||||
#else
|
||||
#undef BB_FEATURE_COMMAND_EDITING
|
||||
@@ -425,26 +416,6 @@
|
||||
#undef BB_FEATURE_COMMAND_USERNAME_COMPLETION
|
||||
#undef BB_FEATURE_SH_FANCY_PROMPT
|
||||
#endif
|
||||
#if ! defined BB_FEATURE_LASH && ! defined BB_FEATURE_HUSH && ! defined BB_FEATURE_MSH && ! defined BB_FEATURE_ASH
|
||||
#define BB_FEATURE_MSH
|
||||
#endif
|
||||
#if defined BB_FEATURE_ASH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_LASH
|
||||
#undef BB_FEATURE_HUSH
|
||||
#undef BB_FEATURE_MSH
|
||||
#elif defined BB_FEATURE_MSH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_LASH
|
||||
#undef BB_FEATURE_HUSH
|
||||
#undef BB_FEATURE_ASH
|
||||
#elif defined BB_FEATURE_HUSH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_LASH
|
||||
#undef BB_FEATURE_MSH
|
||||
#undef BB_FEATURE_ASH
|
||||
#elif defined BB_FEATURE_LASH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_HUSH
|
||||
#undef BB_FEATURE_MSH
|
||||
#undef BB_FEATURE_ASH
|
||||
#endif
|
||||
#else
|
||||
#undef BB_FEATURE_SH_APPLETS_ALWAYS_WIN
|
||||
#undef BB_FEATURE_SH_STANDALONE_SHELL
|
||||
@@ -477,8 +448,26 @@
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_UNIX2DOS
|
||||
#define BB_DOS2UNIX
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_SYSLOGD
|
||||
#if defined BB_FEATURE_IPC_SYSLOG
|
||||
#define BB_LOGREAD
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#if defined BB_ASH && defined BB_FEATURE_SH_IS_ASH
|
||||
# define BB_SH
|
||||
# define shell_main ash_main
|
||||
#elif defined BB_HUSH && defined BB_FEATURE_SH_IS_HUSH
|
||||
# define BB_SH
|
||||
# define shell_main hush_main
|
||||
#elif defined BB_LASH && defined BB_FEATURE_SH_IS_LASH
|
||||
# define BB_SH
|
||||
# define shell_main lash_main
|
||||
#elif defined BB_MSH && defined BB_FEATURE_SH_IS_MSH
|
||||
# define BB_SH
|
||||
# define shell_main msh_main
|
||||
#endif
|
||||
Vendored
+53
-64
@@ -9,6 +9,7 @@
|
||||
// BusyBox Applications
|
||||
//#define BB_ADJTIMEX
|
||||
#define BB_AR
|
||||
#define BB_ASH
|
||||
#define BB_BASENAME
|
||||
#define BB_CAT
|
||||
#define BB_CHGRP
|
||||
@@ -51,6 +52,7 @@
|
||||
#define BB_HEAD
|
||||
#define BB_HOSTID
|
||||
#define BB_HOSTNAME
|
||||
//#define BB_HUSH
|
||||
#define BB_ID
|
||||
#define BB_IFCONFIG
|
||||
#define BB_INIT
|
||||
@@ -58,6 +60,7 @@
|
||||
#define BB_KILL
|
||||
#define BB_KILLALL
|
||||
#define BB_KLOGD
|
||||
//#define BB_LASH
|
||||
#define BB_LENGTH
|
||||
#define BB_LN
|
||||
#define BB_LOADACM
|
||||
@@ -75,12 +78,15 @@
|
||||
#define BB_MKNOD
|
||||
#define BB_MKSWAP
|
||||
#define BB_MKTEMP
|
||||
#define BB_NC
|
||||
//#define BB_MODPROBE
|
||||
#define BB_MORE
|
||||
#define BB_MOUNT
|
||||
//#define BB_MSH
|
||||
#define BB_MT
|
||||
#define BB_MV
|
||||
#define BB_NC
|
||||
#define BB_NSLOOKUP
|
||||
#define BB_PIDOF
|
||||
#define BB_PING
|
||||
#define BB_PIVOT_ROOT
|
||||
#define BB_POWEROFF
|
||||
@@ -99,7 +105,6 @@
|
||||
#define BB_RPM2CPIO
|
||||
#define BB_SED
|
||||
#define BB_SETKEYCODES
|
||||
#define BB_SH
|
||||
#define BB_SLEEP
|
||||
#define BB_SORT
|
||||
#define BB_STTY
|
||||
@@ -114,6 +119,7 @@
|
||||
#define BB_TFTP
|
||||
#define BB_TOUCH
|
||||
#define BB_TR
|
||||
#define BB_TRACEROUTE
|
||||
#define BB_TRUE_FALSE
|
||||
#define BB_TTY
|
||||
#define BB_UNIX2DOS
|
||||
@@ -143,40 +149,12 @@
|
||||
// pretty/useful).
|
||||
//
|
||||
//
|
||||
// If you enabled BB_SH above, you may select one of the following shells.
|
||||
// You can only select ONE of the following shells. Sorry.
|
||||
//
|
||||
// lash is the very smallest shell (adds just 10k) and it is quite usable as a
|
||||
// command prompt, but it is not suitable for any but the most trivial scripting
|
||||
// (such as an initrd that calls insmod a few times) since it does not
|
||||
// understand Bourne shell grammer. It does handle pipes, redirects, and job
|
||||
// control though. Adding in command editing makes it very nice lightweight
|
||||
// command prompt.
|
||||
//#define BB_FEATURE_LASH
|
||||
//
|
||||
// hush is also quite small (just 18k) and it has very complete Bourne shell
|
||||
// grammer. It handles if/then/else/fi just fine, but doesn't handle loops
|
||||
// like for/do/done or case/esac and such. It also currently has a problem
|
||||
// with job control.
|
||||
//#define BB_FEATURE_HUSH
|
||||
//
|
||||
// msh: The minix shell (adds just 30k) is quite complete and handles things
|
||||
// like for/do/done, case/esac and all the things you expect a Bourne shell to
|
||||
// do. It is not always pedantically correct about Bourne shell grammer (try
|
||||
// running the shell testscript "tests/sh.testcases" on it and compare vs
|
||||
// bash) but for most things it works quite well. It also uses only vfork, so
|
||||
// it can be used on uClinux systems. This was only recently added, so there is
|
||||
// still room to shrink it further...
|
||||
//#define BB_FEATURE_MSH
|
||||
//
|
||||
// ash: This adds about 60k in the default configuration and is the most
|
||||
// complete and most pedantically correct shell included with busybox. This
|
||||
// shell was also recently added, and several people (mainly Vladimir and Erik)
|
||||
// have been working on it. There are a number of configurable things at the
|
||||
// top of ash.c as well, so check those out if you want to tweak things. The
|
||||
// Posix math support is currently disabled (that bit of code was horrible) but
|
||||
// will be restored for the next BusyBox release.
|
||||
#define BB_FEATURE_ASH
|
||||
// If you enabled one or more of the shells, you may select which one
|
||||
// should be run when sh is invoked:
|
||||
#define BB_FEATURE_SH_IS_ASH
|
||||
//#define BB_FEATURE_SH_IS_HUSH
|
||||
//#define BB_FEATURE_SH_IS_LASH
|
||||
//#define BB_FEATURE_SH_IS_MSH
|
||||
//
|
||||
// BusyBox will, by default, malloc space for its buffers. This costs code
|
||||
// size for the call to xmalloc. You can use the following feature to have
|
||||
@@ -283,11 +261,11 @@
|
||||
#define BB_FEATURE_SORT_UNIQUE
|
||||
//
|
||||
// Enable command line editing in the shell.
|
||||
// Only relevant if BB_SH is enabled. On by default.
|
||||
// Only relevant if a shell is enabled. On by default.
|
||||
#define BB_FEATURE_COMMAND_EDITING
|
||||
//
|
||||
// Enable tab completion in the shell. This is now working quite nicely.
|
||||
// This feature adds a bit over 4k. Only relevant if BB_SH is enabled.
|
||||
// This feature adds a bit over 4k. Only relevant if a shell is enabled.
|
||||
#define BB_FEATURE_COMMAND_TAB_COMPLETION
|
||||
//
|
||||
// Attempts to match usernames in a ~-prefixed path
|
||||
@@ -296,7 +274,7 @@
|
||||
//Allow the shell to invoke all the compiled in BusyBox applets as if they
|
||||
//were shell builtins. Nice for staticly linking an emergency rescue shell,
|
||||
//among other things. Off by default.
|
||||
// Only relevant if BB_SH is enabled.
|
||||
// Only relevant if a shell is enabled.
|
||||
#define BB_FEATURE_SH_STANDALONE_SHELL
|
||||
//
|
||||
//When this is enabled, busybox shell applets can be called using full path
|
||||
@@ -305,13 +283,13 @@
|
||||
//will use BusyBox cat even if /bin/cat exists on the filesystem and is _not_
|
||||
//busybox. Some systems want this, others do not. Choose wisely. :-) This
|
||||
//only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled.
|
||||
// Only relevant if BB_SH is enabled. Off by default.
|
||||
//#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
|
||||
// Only relevant if a shell is enabled. Off by default.
|
||||
#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
|
||||
//
|
||||
// Uncomment this option for a fancy shell prompt that includes the
|
||||
// current username and hostname. On systems that don't have usernames
|
||||
// or hostnames, this can look hideous.
|
||||
// Only relevant if BB_SH is enabled.
|
||||
// Only relevant if a shell is enabled.
|
||||
#define BB_FEATURE_SH_FANCY_PROMPT
|
||||
//
|
||||
//Turn on extra fbset options
|
||||
@@ -416,8 +394,21 @@
|
||||
// Nothing beyond this point should ever be touched by
|
||||
// mere mortals so leave this stuff alone.
|
||||
//
|
||||
#if defined BB_SH
|
||||
#if defined BB_FEATURE_COMMAND_EDITING
|
||||
#include <features.h>
|
||||
#if defined __UCLIBC__ && ! defined __UCLIBC_HAS_MMU__
|
||||
#undef BB_RPM2CPIO /* Uses gz_open(), which uses fork() */
|
||||
#undef BB_DPKG_DEB /* Uses gz_open(), which uses fork() */
|
||||
#undef BB_ASH /* Uses fork() */
|
||||
#undef BB_HUSH /* Uses fork() */
|
||||
#undef BB_LASH /* Uses fork() */
|
||||
#undef BB_INIT /* Uses fork() */
|
||||
#undef BB_FEATURE_TAR_GZIP /* Uses fork() */
|
||||
#undef BB_SYSLOGD /* Uses daemon() */
|
||||
#undef BB_KLOGD /* Uses daemon() */
|
||||
#undef BB_UPDATE /* Uses daemon() */
|
||||
#endif
|
||||
#if defined BB_ASH || defined BB_HUSH || defined BB_LASH || defined BB_MSH
|
||||
#if defined BB_FEATURE_COMMAND_EDITING
|
||||
#define BB_CMDEDIT
|
||||
#else
|
||||
#undef BB_FEATURE_COMMAND_EDITING
|
||||
@@ -425,26 +416,6 @@
|
||||
#undef BB_FEATURE_COMMAND_USERNAME_COMPLETION
|
||||
#undef BB_FEATURE_SH_FANCY_PROMPT
|
||||
#endif
|
||||
#if ! defined BB_FEATURE_LASH && ! defined BB_FEATURE_HUSH && ! defined BB_FEATURE_MSH && ! defined BB_FEATURE_ASH
|
||||
#define BB_FEATURE_MSH
|
||||
#endif
|
||||
#if defined BB_FEATURE_ASH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_LASH
|
||||
#undef BB_FEATURE_HUSH
|
||||
#undef BB_FEATURE_MSH
|
||||
#elif defined BB_FEATURE_MSH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_LASH
|
||||
#undef BB_FEATURE_HUSH
|
||||
#undef BB_FEATURE_ASH
|
||||
#elif defined BB_FEATURE_HUSH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_LASH
|
||||
#undef BB_FEATURE_MSH
|
||||
#undef BB_FEATURE_ASH
|
||||
#elif defined BB_FEATURE_LASH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_HUSH
|
||||
#undef BB_FEATURE_MSH
|
||||
#undef BB_FEATURE_ASH
|
||||
#endif
|
||||
#else
|
||||
#undef BB_FEATURE_SH_APPLETS_ALWAYS_WIN
|
||||
#undef BB_FEATURE_SH_STANDALONE_SHELL
|
||||
@@ -477,8 +448,26 @@
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_UNIX2DOS
|
||||
#define BB_DOS2UNIX
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_SYSLOGD
|
||||
#if defined BB_FEATURE_IPC_SYSLOG
|
||||
#define BB_LOGREAD
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#if defined BB_ASH && defined BB_FEATURE_SH_IS_ASH
|
||||
# define BB_SH
|
||||
# define shell_main ash_main
|
||||
#elif defined BB_HUSH && defined BB_FEATURE_SH_IS_HUSH
|
||||
# define BB_SH
|
||||
# define shell_main hush_main
|
||||
#elif defined BB_LASH && defined BB_FEATURE_SH_IS_LASH
|
||||
# define BB_SH
|
||||
# define shell_main lash_main
|
||||
#elif defined BB_MSH && defined BB_FEATURE_SH_IS_MSH
|
||||
# define BB_SH
|
||||
# define shell_main msh_main
|
||||
#endif
|
||||
Vendored
+52
-63
@@ -9,6 +9,7 @@
|
||||
// BusyBox Applications
|
||||
//#define BB_ADJTIMEX
|
||||
//#define BB_AR
|
||||
//#define BB_ASH
|
||||
#define BB_BASENAME
|
||||
#define BB_CAT
|
||||
#define BB_CHGRP
|
||||
@@ -51,6 +52,7 @@
|
||||
#define BB_HEAD
|
||||
//#define BB_HOSTID
|
||||
//#define BB_HOSTNAME
|
||||
//#define BB_HUSH
|
||||
#define BB_ID
|
||||
//#define BB_IFCONFIG
|
||||
#define BB_INIT
|
||||
@@ -58,6 +60,7 @@
|
||||
#define BB_KILL
|
||||
#define BB_KILLALL
|
||||
#define BB_KLOGD
|
||||
//#define BB_LASH
|
||||
//#define BB_LENGTH
|
||||
#define BB_LN
|
||||
//#define BB_LOADACM
|
||||
@@ -75,12 +78,15 @@
|
||||
#define BB_MKNOD
|
||||
#define BB_MKSWAP
|
||||
//#define BB_MKTEMP
|
||||
//#define BB_NC
|
||||
//#define BB_MODPROBE
|
||||
#define BB_MORE
|
||||
#define BB_MOUNT
|
||||
//#define BB_MSH
|
||||
//#define BB_MT
|
||||
#define BB_MV
|
||||
//#define BB_NC
|
||||
//#define BB_NSLOOKUP
|
||||
//#define BB_PIDOF
|
||||
#define BB_PING
|
||||
#define BB_PIVOT_ROOT
|
||||
#define BB_POWEROFF
|
||||
@@ -99,7 +105,6 @@
|
||||
//#define BB_RPM2CPIO
|
||||
#define BB_SED
|
||||
//#define BB_SETKEYCODES
|
||||
//#define BB_SH
|
||||
#define BB_SLEEP
|
||||
#define BB_SORT
|
||||
//#define BB_STTY
|
||||
@@ -114,6 +119,7 @@
|
||||
//#define BB_TFTP
|
||||
#define BB_TOUCH
|
||||
#define BB_TR
|
||||
//#define BB_TRACEROUTE
|
||||
#define BB_TRUE_FALSE
|
||||
#define BB_TTY
|
||||
//#define BB_UNIX2DOS
|
||||
@@ -143,40 +149,12 @@
|
||||
// pretty/useful).
|
||||
//
|
||||
//
|
||||
// If you enabled BB_SH above, you may select one of the following shells.
|
||||
// You can only select ONE of the following shells. Sorry.
|
||||
//
|
||||
// lash is the very smallest shell (adds just 10k) and it is quite usable as a
|
||||
// command prompt, but it is not suitable for any but the most trivial scripting
|
||||
// (such as an initrd that calls insmod a few times) since it does not
|
||||
// understand Bourne shell grammer. It does handle pipes, redirects, and job
|
||||
// control though. Adding in command editing makes it very nice lightweight
|
||||
// command prompt.
|
||||
//#define BB_FEATURE_LASH
|
||||
//
|
||||
// hush is also quite small (just 18k) and it has very complete Bourne shell
|
||||
// grammer. It handles if/then/else/fi just fine, but doesn't handle loops
|
||||
// like for/do/done or case/esac and such. It also currently has a problem
|
||||
// with job control.
|
||||
//#define BB_FEATURE_HUSH
|
||||
//
|
||||
// msh: The minix shell (adds just 30k) is quite complete and handles things
|
||||
// like for/do/done, case/esac and all the things you expect a Bourne shell to
|
||||
// do. It is not always pedantically correct about Bourne shell grammer (try
|
||||
// running the shell testscript "tests/sh.testcases" on it and compare vs
|
||||
// bash) but for most things it works quite well. It also uses only vfork, so
|
||||
// it can be used on uClinux systems. This was only recently added, so there is
|
||||
// still room to shrink it further...
|
||||
#define BB_FEATURE_MSH
|
||||
//
|
||||
// ash: This adds about 60k in the default configuration and is the most
|
||||
// complete and most pedantically correct shell included with busybox. This
|
||||
// shell was also recently added, and several people (mainly Vladimir and Erik)
|
||||
// have been working on it. There are a number of configurable things at the
|
||||
// top of ash.c as well, so check those out if you want to tweak things. The
|
||||
// Posix math support is currently disabled (that bit of code was horrible) but
|
||||
// will be restored for the next BusyBox release.
|
||||
//#define BB_FEATURE_ASH
|
||||
// If you enabled one or more of the shells, you may select which one
|
||||
// should be run when sh is invoked:
|
||||
//#define BB_FEATURE_SH_IS_ASH
|
||||
//#define BB_FEATURE_SH_IS_HUSH
|
||||
//#define BB_FEATURE_SH_IS_LASH
|
||||
#define BB_FEATURE_SH_IS_MSH
|
||||
//
|
||||
// BusyBox will, by default, malloc space for its buffers. This costs code
|
||||
// size for the call to xmalloc. You can use the following feature to have
|
||||
@@ -283,11 +261,11 @@
|
||||
#define BB_FEATURE_SORT_UNIQUE
|
||||
//
|
||||
// Enable command line editing in the shell.
|
||||
// Only relevant if BB_SH is enabled. On by default.
|
||||
// Only relevant if a shell is enabled. On by default.
|
||||
#define BB_FEATURE_COMMAND_EDITING
|
||||
//
|
||||
// Enable tab completion in the shell. This is now working quite nicely.
|
||||
// This feature adds a bit over 4k. Only relevant if BB_SH is enabled.
|
||||
// This feature adds a bit over 4k. Only relevant if a shell is enabled.
|
||||
#define BB_FEATURE_COMMAND_TAB_COMPLETION
|
||||
//
|
||||
// Attempts to match usernames in a ~-prefixed path
|
||||
@@ -296,7 +274,7 @@
|
||||
//Allow the shell to invoke all the compiled in BusyBox applets as if they
|
||||
//were shell builtins. Nice for staticly linking an emergency rescue shell,
|
||||
//among other things. Off by default.
|
||||
// Only relevant if BB_SH is enabled.
|
||||
// Only relevant if a shell is enabled.
|
||||
//#define BB_FEATURE_SH_STANDALONE_SHELL
|
||||
//
|
||||
//When this is enabled, busybox shell applets can be called using full path
|
||||
@@ -305,13 +283,13 @@
|
||||
//will use BusyBox cat even if /bin/cat exists on the filesystem and is _not_
|
||||
//busybox. Some systems want this, others do not. Choose wisely. :-) This
|
||||
//only has meaning when BB_FEATURE_SH_STANDALONE_SHELL is enabled.
|
||||
// Only relevant if BB_SH is enabled. Off by default.
|
||||
// Only relevant if a shell is enabled. Off by default.
|
||||
//#define BB_FEATURE_SH_APPLETS_ALWAYS_WIN
|
||||
//
|
||||
// Uncomment this option for a fancy shell prompt that includes the
|
||||
// current username and hostname. On systems that don't have usernames
|
||||
// or hostnames, this can look hideous.
|
||||
// Only relevant if BB_SH is enabled.
|
||||
// Only relevant if a shell is enabled.
|
||||
//#define BB_FEATURE_SH_FANCY_PROMPT
|
||||
//
|
||||
//Turn on extra fbset options
|
||||
@@ -416,8 +394,21 @@
|
||||
// Nothing beyond this point should ever be touched by
|
||||
// mere mortals so leave this stuff alone.
|
||||
//
|
||||
#if defined BB_SH
|
||||
#if defined BB_FEATURE_COMMAND_EDITING
|
||||
#include <features.h>
|
||||
#if defined __UCLIBC__ && ! defined __UCLIBC_HAS_MMU__
|
||||
#undef BB_RPM2CPIO /* Uses gz_open(), which uses fork() */
|
||||
#undef BB_DPKG_DEB /* Uses gz_open(), which uses fork() */
|
||||
#undef BB_ASH /* Uses fork() */
|
||||
#undef BB_HUSH /* Uses fork() */
|
||||
#undef BB_LASH /* Uses fork() */
|
||||
#undef BB_INIT /* Uses fork() */
|
||||
#undef BB_FEATURE_TAR_GZIP /* Uses fork() */
|
||||
#undef BB_SYSLOGD /* Uses daemon() */
|
||||
#undef BB_KLOGD /* Uses daemon() */
|
||||
#undef BB_UPDATE /* Uses daemon() */
|
||||
#endif
|
||||
#if defined BB_ASH || defined BB_HUSH || defined BB_LASH || defined BB_MSH
|
||||
#if defined BB_FEATURE_COMMAND_EDITING
|
||||
#define BB_CMDEDIT
|
||||
#else
|
||||
#undef BB_FEATURE_COMMAND_EDITING
|
||||
@@ -425,26 +416,6 @@
|
||||
#undef BB_FEATURE_COMMAND_USERNAME_COMPLETION
|
||||
#undef BB_FEATURE_SH_FANCY_PROMPT
|
||||
#endif
|
||||
#if ! defined BB_FEATURE_LASH && ! defined BB_FEATURE_HUSH && ! defined BB_FEATURE_MSH && ! defined BB_FEATURE_ASH
|
||||
#define BB_FEATURE_MSH
|
||||
#endif
|
||||
#if defined BB_FEATURE_ASH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_LASH
|
||||
#undef BB_FEATURE_HUSH
|
||||
#undef BB_FEATURE_MSH
|
||||
#elif defined BB_FEATURE_MSH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_LASH
|
||||
#undef BB_FEATURE_HUSH
|
||||
#undef BB_FEATURE_ASH
|
||||
#elif defined BB_FEATURE_HUSH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_LASH
|
||||
#undef BB_FEATURE_MSH
|
||||
#undef BB_FEATURE_ASH
|
||||
#elif defined BB_FEATURE_LASH && (defined BB_FEATURE_LASH || defined BB_FEATURE_HUSH || defined BB_FEATURE_MSH)
|
||||
#undef BB_FEATURE_HUSH
|
||||
#undef BB_FEATURE_MSH
|
||||
#undef BB_FEATURE_ASH
|
||||
#endif
|
||||
#else
|
||||
#undef BB_FEATURE_SH_APPLETS_ALWAYS_WIN
|
||||
#undef BB_FEATURE_SH_STANDALONE_SHELL
|
||||
@@ -477,8 +448,26 @@
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_UNIX2DOS
|
||||
#define BB_DOS2UNIX
|
||||
#endif
|
||||
//
|
||||
#ifdef BB_SYSLOGD
|
||||
#if defined BB_FEATURE_IPC_SYSLOG
|
||||
#define BB_LOGREAD
|
||||
#endif
|
||||
#endif
|
||||
//
|
||||
#if defined BB_ASH && defined BB_FEATURE_SH_IS_ASH
|
||||
# define BB_SH
|
||||
# define shell_main ash_main
|
||||
#elif defined BB_HUSH && defined BB_FEATURE_SH_IS_HUSH
|
||||
# define BB_SH
|
||||
# define shell_main hush_main
|
||||
#elif defined BB_LASH && defined BB_FEATURE_SH_IS_LASH
|
||||
# define BB_SH
|
||||
# define shell_main lash_main
|
||||
#elif defined BB_MSH && defined BB_FEATURE_SH_IS_MSH
|
||||
# define BB_SH
|
||||
# define shell_main msh_main
|
||||
#endif
|
||||
Vendored
+13
@@ -1,3 +1,16 @@
|
||||
busybox (1:0.60.0-1) unstable; urgency=low
|
||||
|
||||
* New version released. See changelog for details.
|
||||
|
||||
-- Erik Andersen <andersee@debian.org> Thu, 2 Aug 2001 12:12:37 -0600
|
||||
|
||||
busybox (1:0.52-1.1) unstable; urgency=high
|
||||
|
||||
* Non-maintainer upload
|
||||
* Fixed wget -P handling (closes: #106223).
|
||||
|
||||
-- Matt Kraai <kraai@debian.org> Wed, 25 Jul 2001 11:01:38 -0600
|
||||
|
||||
busybox (1:0.52-1) unstable; urgency=high
|
||||
|
||||
* New version released. See changelog for details.
|
||||
|
||||
Vendored
+1
-1
@@ -30,7 +30,7 @@ Depends: ${shlibs:Depends}
|
||||
Conflicts: busybox
|
||||
Replaces: busybox
|
||||
Section: shells
|
||||
Description: Provides a stand alone rescue shell with tons of builtin utilities.
|
||||
Description: Standalone rescue shell with tons of builtin utilities.
|
||||
BusyBox combines tiny versions of many common UNIX utilities into a single
|
||||
small executable. It provides minimalist replacements for the most common
|
||||
utilities you would usually find on your desktop system (i.e., ls, cp, mv,
|
||||
|
||||
+55
-128
@@ -45,8 +45,7 @@ the expected functionality and behave very much like their GNU counterparts.
|
||||
BusyBox has been written with size-optimization and limited resources in mind.
|
||||
It is also extremely modular so you can easily include or exclude commands (or
|
||||
features) at compile time. This makes it easy to customize your embedded
|
||||
systems. To create a working system, just add /dev, a kernel, and a shell.
|
||||
For a really minimal system, you can even use the busybox shell (not Bourne compatible, but very small and quite usable), and the busybox vi editor.
|
||||
systems. To create a working system, just add /dev, /etc, and a kernel.
|
||||
<p>
|
||||
|
||||
BusyBox is now maintained by
|
||||
@@ -82,6 +81,59 @@ To subscribe, go and visit <a href="http://opensource.lineo.com/mailman/listinfo
|
||||
|
||||
<ul>
|
||||
|
||||
<li> <b>2 August 2001 -- BusyBox 0.60.0 released</b>
|
||||
<br>
|
||||
I am very pleased to announce the immediate availability of
|
||||
BusyBox 0.60.0. I have personally tested this release with libc5, glibc,
|
||||
and <a href="http://cvs.uclinux.org/uClibc.html">uClibc</a> on
|
||||
x86, ARM, and powerpc using linux 2.2 and 2.4, and I know a number
|
||||
of people using it on everything from ia64 to m68k with great success.
|
||||
Everything seems to be working very nicely now, so getting a nice
|
||||
stable bug-free(tm) release out seems to be in order. This releases fixes
|
||||
a memory leak in syslogd, a number of bugs in the ash and msh shells, and
|
||||
cleans up a number of things.
|
||||
|
||||
<p>
|
||||
|
||||
Those wanting an easy way to test the 0.60.0 release with uClibc can
|
||||
use <a href="http://user-mode-linux.sourceforge.net/">User-Mode Linux</a>
|
||||
to give it a try by downloading and compiling
|
||||
<a href="ftp://oss.lineo.com/buildroot.tar.gz">buildroot.tar.gz</a>.
|
||||
You don't have to be root or reboot your machine to run test this way.
|
||||
Preconfigured User-Mode Linux kernel source is also on oss.lineo.com.
|
||||
<p>
|
||||
Another cool thing is the nifty <a href="ftp://oss.lineo.com/busybox/tutorial/index.html">
|
||||
BusyBox Tutorial</a> contributed by K Computing. This requires
|
||||
a ShockWave plugin (or standalone viewer), so you may want to grab the
|
||||
the GPLed shockwave viewer from <a href="http://www.swift-tools.com/Flash/flash-0.4.10.tgz">here</a>
|
||||
to view the tutorial.
|
||||
<p>
|
||||
|
||||
Finally, In case you didn't notice anything odd about the
|
||||
version number of this release, let me point out that this release
|
||||
is <em>not</em> 0.53, because I bumped the version number up a
|
||||
bit. This reflects the fact that this release is intended to form
|
||||
a new stable BusyBox release series. If you need to rely on a
|
||||
stable version of BusyBox, you should plan on using the stable
|
||||
0.60.x series. If bugs show up then I will release 0.60.1, then
|
||||
0.60.2, etc... This is also intended to deal with the fact that
|
||||
the BusyBox build system will be getting a major overhaul for the
|
||||
next release and I don't want that to break products that people
|
||||
are shipping. To avoid that, the new build system will be
|
||||
released as part of a new BusyBox development series that will
|
||||
have some not-yet-decided-on odd version number. Once things
|
||||
stabilize and the new build system is working for everyone, then
|
||||
I will release that as a new stable release series.
|
||||
|
||||
<p>
|
||||
The
|
||||
<a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a> has all
|
||||
the details. As usual BusyBox 0.60.0 can be downloaded from
|
||||
<a href="ftp://oss.lineo.com/busybox">ftp://oss.lineo.com/busybox</a>.
|
||||
<p>Have Fun!
|
||||
<p>
|
||||
|
||||
|
||||
<li> <b>7 July 2001 -- BusyBox 0.52 released</b>
|
||||
<br>
|
||||
|
||||
@@ -89,7 +141,7 @@ To subscribe, go and visit <a href="http://opensource.lineo.com/mailman/listinfo
|
||||
BusyBox 0.52 (the "new-and-improved rock-solid release"). This
|
||||
release is the result of <em>many</em> hours of work and has tons
|
||||
of bugfixes, optimizations, and cleanups. This release adds
|
||||
several new applets, including several new shells (such as hust, msh,
|
||||
several new applets, including several new shells (such as hush, msh,
|
||||
and ash).
|
||||
|
||||
<p>
|
||||
@@ -114,131 +166,6 @@ To subscribe, go and visit <a href="http://opensource.lineo.com/mailman/listinfo
|
||||
turning off whichever applets you don't need.)
|
||||
<p>
|
||||
|
||||
<li> <b>10 April 2001 -- BusyBox 0.51 released</b>
|
||||
<br>
|
||||
|
||||
BusyBox 0.51 (the "rock-solid release") is now out there. This
|
||||
release adds only 2 new applets: env and vi. The vi applet,
|
||||
contributed by Sterling Huxley, is very functional, and is only
|
||||
22k. This release fixes 3 critical bugs in the 0.50 release.
|
||||
There were 2 potential segfaults in lash (the busybox shell) in
|
||||
the 0.50 release which are now fixed. Another critical bug in
|
||||
0.50 which is now fixed: syslogd from 0.50 could potentially
|
||||
deadlock the init process and thereby break your entire system.
|
||||
<p>
|
||||
|
||||
There are a number of improvements in this release as well. For
|
||||
one thing, the wget applet is greatly improved. Dmitry Zakharov
|
||||
added FTP support, and Laurence Anderson make wget fully RFC
|
||||
compliant for HTTP 1.1. The mechanism for including utility
|
||||
functions in previous releases was clumsy and error prone. Now
|
||||
all utility functions are part of a new libbb library, which makes
|
||||
maintaining utility functions much simpler. And BusyBox now
|
||||
compiles on itanium systems (thanks to the Debian itanium porters
|
||||
for letting me use their system!).
|
||||
<p>
|
||||
You can read the
|
||||
<a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a> for
|
||||
complete details. BusyBox 0.51 can be downloaded from
|
||||
<a href="ftp://oss.lineo.com/busybox">ftp://oss.lineo.com/busybox</a>.
|
||||
<p>Have Fun!
|
||||
<p>
|
||||
|
||||
<li> <b>Busybox Boot-Floppy Image</b>
|
||||
|
||||
<p>Because you asked for it, we have made available a <a href=
|
||||
"ftp://opensource.lineo.com/busybox/busybox.floppy.img"> Busybox boot floppy
|
||||
image</a>. Here's how you use it:
|
||||
|
||||
<ol>
|
||||
|
||||
<li> <a href= "ftp://opensource.lineo.com/busybox/busybox.floppy.img">
|
||||
Download the image</a>
|
||||
|
||||
<li> dd it onto a floppy like so: <tt> dd if=busybox.floppy.img
|
||||
of=/dev/fd0 ; sync </tt>
|
||||
|
||||
<li> Pop it in a machine and boot up.
|
||||
|
||||
</ol>
|
||||
|
||||
<p> If you want to look at the contents of the initrd image, do this:
|
||||
|
||||
<pre>
|
||||
mount ./busybox.floppy.img /mnt -o loop -t msdos
|
||||
cp /mnt/initrd.gz /tmp
|
||||
umount /mnt
|
||||
gunzip /tmp/initrd.gz
|
||||
mount /tmp/initrd /mnt -o loop -t minix
|
||||
</pre>
|
||||
|
||||
|
||||
<li> <b>15 March 2001 -- BusyBox 0.50 released</b>
|
||||
<br>
|
||||
|
||||
This release adds several new applets including ifconfig, route, pivot_root, stty,
|
||||
and tftp, and also fixes tons of bugs. Tab completion in the
|
||||
shell is now working very well, and the shell's environment variable
|
||||
expansion was fixed. Tons of other things were fixed or made
|
||||
smaller. For a fairly complete overview, see the
|
||||
<a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a>.
|
||||
<p>
|
||||
lash (the busybox shell) is still with us, fixed up a bit so it
|
||||
now behaves itself quite nicely. It really is quite usable as
|
||||
long as you don't expect it to provide Bourne shell grammer.
|
||||
Standard things like pipes, redirects, command line editing, and
|
||||
environment variable expansion work great. But we have found that
|
||||
this shell, while very usable, does not provide an extensible
|
||||
framework for adding in full Bourne shell behavior. So the first order of
|
||||
business as we begin working on the next BusyBox release will be to merge in the new shell
|
||||
currently in progress at
|
||||
<a href="http://doolittle.faludi.com/~larry/parser.html">Larry Doolittle's website</a>.
|
||||
<p>
|
||||
|
||||
|
||||
<li> <b>27 January 2001 -- BusyBox 0.49 released</b>
|
||||
<br>
|
||||
|
||||
Several new applets, lots of bug fixes, cleanups, and many smaller
|
||||
things made nicer. Several cleanups and improvements to the shell.
|
||||
For a list of the most interesting changes
|
||||
you might want to look at the <a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a>.
|
||||
<p>
|
||||
Special thanks go out to Matt Kraai and Larry Doolittle for all their
|
||||
work on this release, and for keeping on top of things while I've been
|
||||
out of town.
|
||||
<p>
|
||||
<em>Special Note</em><br>
|
||||
|
||||
BusyBox 0.49 was supposed to have replaced lash, the BusyBox
|
||||
shell, with a new shell that understands full Bourne shell/Posix shell grammer.
|
||||
Well, that simply didn't happen in time for this release. A new
|
||||
shell that will eventually replace lash is already under
|
||||
construction. This new shell is being developed by Larry
|
||||
Doolittle, and could use all of our help. Please see the work in
|
||||
progress on <a href="http://doolittle.faludi.com/~larry/parser.html">Larry's website</a>
|
||||
and help out if you can. This shell will be included in the next
|
||||
release of BusyBox.
|
||||
<p>
|
||||
|
||||
<li> <b>13 December 2000 -- BusyBox 0.48 released</b>
|
||||
<br>
|
||||
|
||||
This release fixes lots and lots of bugs. This has had some very
|
||||
rigorous testing, and looks very, very clean. The usual tar
|
||||
update of course: tar no longer breaks hardlinks, tar -xzf is
|
||||
optionally supported, and the LRP folks will be pleased to know
|
||||
that 'tar -X' and 'tar --exclude' are both now in. Applets are
|
||||
now looked up using a binary search making lash (the busybox
|
||||
shell) much faster. For the new debian-installer (for Debian
|
||||
woody) a .udeb can now be generated.
|
||||
<p>
|
||||
The curious can get a list of some of the more interesting changes by reading
|
||||
the <a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a>.
|
||||
<p>
|
||||
Many thanks go out to the many many people that have contributed to
|
||||
this release, especially Matt Kraai, Larry Doolittle, and Kent Robotti.
|
||||
<p>
|
||||
|
||||
|
||||
<li> <b>Old News</b>
|
||||
|
||||
@@ -41,6 +41,131 @@
|
||||
<p> <li> <b>Take me back to the <a href="http://busybox.lineo.com/">BusyBox</a> web site.</b>
|
||||
<hr>
|
||||
|
||||
<li> <b>10 April 2001 -- BusyBox 0.51 released</b>
|
||||
<br>
|
||||
|
||||
BusyBox 0.51 (the "rock-solid release") is now out there. This
|
||||
release adds only 2 new applets: env and vi. The vi applet,
|
||||
contributed by Sterling Huxley, is very functional, and is only
|
||||
22k. This release fixes 3 critical bugs in the 0.50 release.
|
||||
There were 2 potential segfaults in lash (the busybox shell) in
|
||||
the 0.50 release which are now fixed. Another critical bug in
|
||||
0.50 which is now fixed: syslogd from 0.50 could potentially
|
||||
deadlock the init process and thereby break your entire system.
|
||||
<p>
|
||||
|
||||
There are a number of improvements in this release as well. For
|
||||
one thing, the wget applet is greatly improved. Dmitry Zakharov
|
||||
added FTP support, and Laurence Anderson make wget fully RFC
|
||||
compliant for HTTP 1.1. The mechanism for including utility
|
||||
functions in previous releases was clumsy and error prone. Now
|
||||
all utility functions are part of a new libbb library, which makes
|
||||
maintaining utility functions much simpler. And BusyBox now
|
||||
compiles on itanium systems (thanks to the Debian itanium porters
|
||||
for letting me use their system!).
|
||||
<p>
|
||||
You can read the
|
||||
<a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a> for
|
||||
complete details. BusyBox 0.51 can be downloaded from
|
||||
<a href="ftp://oss.lineo.com/busybox">ftp://oss.lineo.com/busybox</a>.
|
||||
<p>Have Fun!
|
||||
<p>
|
||||
|
||||
<li> <b>Busybox Boot-Floppy Image</b>
|
||||
|
||||
<p>Because you asked for it, we have made available a <a href=
|
||||
"ftp://opensource.lineo.com/busybox/busybox.floppy.img"> Busybox boot floppy
|
||||
image</a>. Here's how you use it:
|
||||
|
||||
<ol>
|
||||
|
||||
<li> <a href= "ftp://opensource.lineo.com/busybox/busybox.floppy.img">
|
||||
Download the image</a>
|
||||
|
||||
<li> dd it onto a floppy like so: <tt> dd if=busybox.floppy.img
|
||||
of=/dev/fd0 ; sync </tt>
|
||||
|
||||
<li> Pop it in a machine and boot up.
|
||||
|
||||
</ol>
|
||||
|
||||
<p> If you want to look at the contents of the initrd image, do this:
|
||||
|
||||
<pre>
|
||||
mount ./busybox.floppy.img /mnt -o loop -t msdos
|
||||
cp /mnt/initrd.gz /tmp
|
||||
umount /mnt
|
||||
gunzip /tmp/initrd.gz
|
||||
mount /tmp/initrd /mnt -o loop -t minix
|
||||
</pre>
|
||||
|
||||
|
||||
<li> <b>15 March 2001 -- BusyBox 0.50 released</b>
|
||||
<br>
|
||||
|
||||
This release adds several new applets including ifconfig, route, pivot_root, stty,
|
||||
and tftp, and also fixes tons of bugs. Tab completion in the
|
||||
shell is now working very well, and the shell's environment variable
|
||||
expansion was fixed. Tons of other things were fixed or made
|
||||
smaller. For a fairly complete overview, see the
|
||||
<a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a>.
|
||||
<p>
|
||||
lash (the busybox shell) is still with us, fixed up a bit so it
|
||||
now behaves itself quite nicely. It really is quite usable as
|
||||
long as you don't expect it to provide Bourne shell grammer.
|
||||
Standard things like pipes, redirects, command line editing, and
|
||||
environment variable expansion work great. But we have found that
|
||||
this shell, while very usable, does not provide an extensible
|
||||
framework for adding in full Bourne shell behavior. So the first order of
|
||||
business as we begin working on the next BusyBox release will be to merge in the new shell
|
||||
currently in progress at
|
||||
<a href="http://doolittle.faludi.com/~larry/parser.html">Larry Doolittle's website</a>.
|
||||
<p>
|
||||
|
||||
|
||||
<li> <b>27 January 2001 -- BusyBox 0.49 released</b>
|
||||
<br>
|
||||
|
||||
Several new applets, lots of bug fixes, cleanups, and many smaller
|
||||
things made nicer. Several cleanups and improvements to the shell.
|
||||
For a list of the most interesting changes
|
||||
you might want to look at the <a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a>.
|
||||
<p>
|
||||
Special thanks go out to Matt Kraai and Larry Doolittle for all their
|
||||
work on this release, and for keeping on top of things while I've been
|
||||
out of town.
|
||||
<p>
|
||||
<em>Special Note</em><br>
|
||||
|
||||
BusyBox 0.49 was supposed to have replaced lash, the BusyBox
|
||||
shell, with a new shell that understands full Bourne shell/Posix shell grammer.
|
||||
Well, that simply didn't happen in time for this release. A new
|
||||
shell that will eventually replace lash is already under
|
||||
construction. This new shell is being developed by Larry
|
||||
Doolittle, and could use all of our help. Please see the work in
|
||||
progress on <a href="http://doolittle.faludi.com/~larry/parser.html">Larry's website</a>
|
||||
and help out if you can. This shell will be included in the next
|
||||
release of BusyBox.
|
||||
<p>
|
||||
|
||||
<li> <b>13 December 2000 -- BusyBox 0.48 released</b>
|
||||
<br>
|
||||
|
||||
This release fixes lots and lots of bugs. This has had some very
|
||||
rigorous testing, and looks very, very clean. The usual tar
|
||||
update of course: tar no longer breaks hardlinks, tar -xzf is
|
||||
optionally supported, and the LRP folks will be pleased to know
|
||||
that 'tar -X' and 'tar --exclude' are both now in. Applets are
|
||||
now looked up using a binary search making lash (the busybox
|
||||
shell) much faster. For the new debian-installer (for Debian
|
||||
woody) a .udeb can now be generated.
|
||||
<p>
|
||||
The curious can get a list of some of the more interesting changes by reading
|
||||
the <a href="ftp://oss.lineo.com/busybox/Changelog">changelog</a>.
|
||||
<p>
|
||||
Many thanks go out to the many many people that have contributed to
|
||||
this release, especially Matt Kraai, Larry Doolittle, and Kent Robotti.
|
||||
<p>
|
||||
<p> <li> <b>26 September 2000 -- BusyBox 0.47 released</b>
|
||||
<br>
|
||||
|
||||
|
||||
+62
-19
@@ -29,21 +29,56 @@
|
||||
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/time.h>
|
||||
#include "busybox.h"
|
||||
|
||||
/* Teach libc5 what a uint64_t is */
|
||||
#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)
|
||||
typedef unsigned long int uint64_t;
|
||||
#endif
|
||||
|
||||
static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
// if fn is NULL then input is stdin and output is stdout
|
||||
static int convert(char *fn, int ConvType) {
|
||||
int c;
|
||||
char *tempFn = NULL;
|
||||
static int convert(char *fn, int ConvType)
|
||||
{
|
||||
int c, fd;
|
||||
struct timeval tv;
|
||||
char tempFn[BUFSIZ];
|
||||
static uint64_t value=0;
|
||||
FILE *in = stdin, *out = stdout;
|
||||
|
||||
if (fn != NULL) {
|
||||
if ((in = wfopen(fn, "r")) == NULL) {
|
||||
if ((in = wfopen(fn, "rw")) == NULL) {
|
||||
return -1;
|
||||
}
|
||||
if ((out = tmpfile()) == NULL) {
|
||||
perror_msg(NULL);
|
||||
return -2;
|
||||
strcpy(tempFn, fn);
|
||||
c = strlen(tempFn);
|
||||
tempFn[c] = '.';
|
||||
while(1) {
|
||||
if (c >=BUFSIZ)
|
||||
error_msg_and_die("unique name not found");
|
||||
/* Get some semi random stuff to try and make a
|
||||
* random filename based (and in the same dir as)
|
||||
* the input file... */
|
||||
gettimeofday (&tv, NULL);
|
||||
value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid ();
|
||||
tempFn[++c] = letters[value % 62];
|
||||
tempFn[c+1] = '\0';
|
||||
value /= 62;
|
||||
|
||||
if ((fd = open(tempFn, O_RDWR | O_CREAT | O_EXCL, 0600)) < 0 ) {
|
||||
continue;
|
||||
}
|
||||
out = fdopen(fd, "w+");
|
||||
if (!out) {
|
||||
close(fd);
|
||||
remove(tempFn);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +86,7 @@ static int convert(char *fn, int ConvType) {
|
||||
if (c == '\r') {
|
||||
if ((ConvType == CT_UNIX2DOS) && (fn != NULL)) {
|
||||
// file is alredy in DOS format so it is not necessery to touch it
|
||||
remove(tempFn);
|
||||
if (fclose(in) < 0 || fclose(out) < 0) {
|
||||
perror_msg(NULL);
|
||||
return -2;
|
||||
@@ -64,6 +100,7 @@ static int convert(char *fn, int ConvType) {
|
||||
if (c == '\n') {
|
||||
if ((ConvType == CT_DOS2UNIX) && (fn != NULL)) {
|
||||
// file is alredy in UNIX format so it is not necessery to touch it
|
||||
remove(tempFn);
|
||||
if ((fclose(in) < 0) || (fclose(out) < 0)) {
|
||||
perror_msg(NULL);
|
||||
return -2;
|
||||
@@ -95,29 +132,35 @@ static int convert(char *fn, int ConvType) {
|
||||
}
|
||||
|
||||
if (fn != NULL) {
|
||||
if (fclose(in) < 0 || fclose(out) < 0 ||
|
||||
(in = fopen(tempFn, "r")) == NULL || (out = fopen(fn, "w")) == NULL) {
|
||||
perror_msg(NULL);
|
||||
return -2;
|
||||
if (fclose(in) < 0 || fclose(out) < 0) {
|
||||
perror_msg(NULL);
|
||||
remove(tempFn);
|
||||
return -2;
|
||||
}
|
||||
|
||||
while ((c = fgetc(in)) != EOF) {
|
||||
fputc(c, out);
|
||||
}
|
||||
|
||||
if ((fclose(in) < 0) || (fclose(out) < 0)) {
|
||||
perror_msg(NULL);
|
||||
return -2;
|
||||
/* Assume they are both on the same filesystem */
|
||||
if (rename(tempFn, fn) < 0) {
|
||||
perror_msg("unable to rename '%s' as '%s'", tempFn, fn);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dos2unix_main(int argc, char *argv[]) {
|
||||
int dos2unix_main(int argc, char *argv[])
|
||||
{
|
||||
int ConvType = CT_AUTO;
|
||||
int o;
|
||||
|
||||
//See if we are supposed to be doing dos2unix or unix2dos
|
||||
if (argv[0][0]=='d') {
|
||||
ConvType = CT_DOS2UNIX;
|
||||
}
|
||||
if (argv[0][0]=='u') {
|
||||
ConvType = CT_UNIX2DOS;
|
||||
}
|
||||
|
||||
// process parameters
|
||||
while ((o = getopt(argc, argv, "du")) != EOF) {
|
||||
switch (o) {
|
||||
|
||||
+9
-4
@@ -110,12 +110,17 @@ extern int dpkg_deb_main(int argc, char **argv)
|
||||
}
|
||||
else if (arg_type == arg_type_field) {
|
||||
char *field = NULL;
|
||||
char *name;
|
||||
char *value;
|
||||
int field_start = 0;
|
||||
|
||||
while ((field = read_package_field(&output_buffer[field_start])) != NULL) {
|
||||
field_start += (strlen(field) + 1);
|
||||
if (strstr(field, argv[optind + 1]) == field) {
|
||||
puts(field + strlen(argv[optind + 1]) + 2);
|
||||
while (1) {
|
||||
field_start += read_package_field(&output_buffer[field_start], &name, &value);
|
||||
if (name == NULL) {
|
||||
break;
|
||||
}
|
||||
if (strcmp(name, argv[optind + 1]) == 0) {
|
||||
puts(value);
|
||||
}
|
||||
free(field);
|
||||
}
|
||||
|
||||
+2
-2
@@ -51,9 +51,9 @@ int dumpkmap_main(int argc, char **argv)
|
||||
show_usage();
|
||||
}
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
fd = open(CURRENT_VC, O_RDWR);
|
||||
if (fd < 0) {
|
||||
perror_msg("Error opening /dev/tty0");
|
||||
perror_msg("Error opening " CURRENT_VC);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -650,12 +650,12 @@ static void process_file(FILE *file)
|
||||
|
||||
/* we print the line once, unless we were told to be quiet */
|
||||
if (!be_quiet)
|
||||
altered = do_subst_command(&sed_cmds[i], line);
|
||||
altered |= do_subst_command(&sed_cmds[i], line);
|
||||
|
||||
/* we also print the line if we were given the 'p' flag
|
||||
* (this is quite possibly the second printing) */
|
||||
if (sed_cmds[i].sub_p)
|
||||
altered = do_subst_command(&sed_cmds[i], line);
|
||||
altered |= do_subst_command(&sed_cmds[i], line);
|
||||
|
||||
break;
|
||||
|
||||
|
||||
+9
-5
@@ -18,8 +18,8 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
char *vi_Version =
|
||||
"$Id: vi.c,v 1.11 2001/07/02 18:06:14 andersen Exp $";
|
||||
static const char vi_Version[] =
|
||||
"$Id: vi.c,v 1.15 2001/08/02 05:26:41 andersen Exp $";
|
||||
|
||||
/*
|
||||
* To compile for standalone use:
|
||||
@@ -1982,9 +1982,13 @@ static void colon(Byte * buf)
|
||||
// read after current line- unless user said ":0r foo"
|
||||
if (b != 0)
|
||||
q = next_line(q);
|
||||
#ifdef BB_FEATURE_VI_READONLY
|
||||
l= readonly; // remember current files' status
|
||||
#endif
|
||||
ch = file_insert(fn, q, file_size(fn));
|
||||
#ifdef BB_FEATURE_VI_READONLY
|
||||
readonly= l;
|
||||
#endif
|
||||
if (ch < 0)
|
||||
goto vc1; // nothing was inserted
|
||||
// how many lines in text[]?
|
||||
@@ -2636,12 +2640,12 @@ static Byte *char_insert(Byte * p, Byte c) // insert the char c at 'p'
|
||||
cmdcnt = 0;
|
||||
end_cmd_q(); // stop adding to q
|
||||
strcpy((char *) status_buffer, " "); // clear the status buffer
|
||||
if (p[-1] != '\n') {
|
||||
if ((p[-1] != '\n') && (dot>text)) {
|
||||
p--;
|
||||
}
|
||||
} else if (c == erase_char) { // Is this a BS
|
||||
// 123456789
|
||||
if (p[-1] != '\n') {
|
||||
if ((p[-1] != '\n') && (dot>text)) {
|
||||
p--;
|
||||
p = text_hole_delete(p, p); // shrink buffer 1 char
|
||||
#ifdef BB_FEATURE_VI_DOT_CMD
|
||||
@@ -3554,7 +3558,7 @@ static int file_write(Byte * fn, Byte * first, Byte * last)
|
||||
}
|
||||
charcnt = 0;
|
||||
// FIXIT- use the correct umask()
|
||||
fd = open((char *) fn, (O_RDWR | O_CREAT | O_TRUNC), 0664);
|
||||
fd = open((char *) fn, (O_WRONLY | O_CREAT | O_TRUNC), 0664);
|
||||
if (fd < 0)
|
||||
return (-1);
|
||||
cnt = last - first + 1;
|
||||
|
||||
+16
-8
@@ -1,13 +1,21 @@
|
||||
Name: busybox
|
||||
Version: 0.52
|
||||
Release: 1
|
||||
%define name busybox
|
||||
%define epoch 0
|
||||
%define version 0.60.0
|
||||
%define release %(date -I | sed -e 's/-/_/g')
|
||||
%define serial 1
|
||||
|
||||
Name: %{name}
|
||||
#Epoch: %{epoch}
|
||||
Version: %{version}
|
||||
Release: %{release}
|
||||
Serial: %{serial}
|
||||
Copyright: GPL
|
||||
Group: System/Utilities
|
||||
Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary.
|
||||
Copyright: GPL
|
||||
URL: http://busybox.lineo.com/
|
||||
Source: ftp://oss.lineo.com/busybox/%{name}-%{version}.tar.gz
|
||||
Buildroot: /var/tmp/%{name}-%{version}
|
||||
Packager : Erik Andersen <andersen@lineo.com>
|
||||
Conflicts: fileutils grep shellutils
|
||||
Buildroot: /tmp/%{Name}-%{Version}
|
||||
Source: %{Name}-%{Version}.tar.gz
|
||||
|
||||
%Description
|
||||
BusyBox combines tiny versions of many common UNIX utilities into a single
|
||||
@@ -19,7 +27,7 @@ their full featured GNU cousins; however, the options that are provided behave
|
||||
very much like their GNU counterparts.
|
||||
|
||||
%Prep
|
||||
%setup -q -n %{Name}-%{Version}
|
||||
%setup -q -n %{name}-%{version}
|
||||
|
||||
%Build
|
||||
make
|
||||
|
||||
Executable
+227
@@ -0,0 +1,227 @@
|
||||
#!/usr/bin/perl -w
|
||||
# vi: set ts=4:
|
||||
# Copyright (c) 2001 David Schleef <ds@schleef.org>
|
||||
# Copyright (c) 2001 Erik Andersen <andersen@lineo.com>
|
||||
# Copyright (c) 2001 Stuart Hughes <stuarth@lineo.com>
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the same terms as Perl itself.
|
||||
|
||||
# TODO -- use strict mode...
|
||||
#use strict;
|
||||
|
||||
use Getopt::Long;
|
||||
use File::Find;
|
||||
|
||||
|
||||
# Set up some default values
|
||||
|
||||
my $basedir="";
|
||||
my $kernel;
|
||||
my $kernelsyms;
|
||||
my $stdout=1;
|
||||
my $verbose=0;
|
||||
|
||||
|
||||
# get command-line options
|
||||
|
||||
my %opt;
|
||||
|
||||
GetOptions(
|
||||
\%opt,
|
||||
"help|h",
|
||||
"basedir|b=s" => \$basedir,
|
||||
"kernel|k=s" => \$kernel,
|
||||
"kernelsyms|F=s" => \$kernelsyms,
|
||||
"stdout|n" => \$stdout,
|
||||
"verbose|v" => \$verbose,
|
||||
);
|
||||
|
||||
if (defined $opt{help}) {
|
||||
print
|
||||
"$0 [OPTION]... [basedir]\n",
|
||||
"\t-h --help\t\tShow this help screen\n",
|
||||
"\t-b --basedir\t\tModules base directory (defaults to /lib/modules)\n",
|
||||
"\t-k --kernel\t\tKernel binary for the target\n",
|
||||
"\t-F --kernelsyms\t\tKernel symbol file\n",
|
||||
"\t-n --stdout\t\tWrite to stdout instead of modules.dep\n",
|
||||
"\t-v --verbose\t\tPrint out lots of debugging stuff\n",
|
||||
;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
if($basedir !~ m-/lib/modules-) {
|
||||
warn "WARNING: base directory does not match ..../lib/modules\n";
|
||||
}
|
||||
|
||||
# Find the list of .o files living under $basedir
|
||||
#if ($verbose) { printf "Locating all modules\n"; }
|
||||
my($file) = "";
|
||||
my(@liblist) = ();
|
||||
find sub {
|
||||
if ( -f $_ && ! -d $_ ) {
|
||||
$file = $File::Find::name;
|
||||
if ( $file =~ /.o$/ ) {
|
||||
push(@liblist, $file);
|
||||
if ($verbose) { printf "$file\n"; }
|
||||
}
|
||||
}
|
||||
}, $basedir;
|
||||
if ($verbose) { printf "Finished locating modules\n"; }
|
||||
|
||||
foreach $obj ( @liblist, $kernel ){
|
||||
# turn the input file name into a target tag name
|
||||
# vmlinux is a special that is only used to resolve symbols
|
||||
if($obj =~ /vmlinux/) {
|
||||
$tgtname = "vmlinux";
|
||||
} else {
|
||||
($tgtname) = $obj =~ m-(/lib/modules/.*)$-;
|
||||
}
|
||||
|
||||
warn "MODULE = $tgtname\n" if $verbose;
|
||||
|
||||
# get a list of symbols
|
||||
@output=`nm $obj`;
|
||||
$ksymtab=grep m/ __ksymtab/, @output;
|
||||
|
||||
# gather the exported symbols
|
||||
if($ksymtab){
|
||||
# explicitly exported
|
||||
foreach ( @output ) {
|
||||
/ __ksymtab_(.*)$/ and do {
|
||||
warn "sym = $1\n" if $verbose;
|
||||
$exp->{$1} = $tgtname;
|
||||
};
|
||||
}
|
||||
} else {
|
||||
# exporting all symbols
|
||||
foreach ( @output) {
|
||||
/ [ABCDGRST] (.*)$/ and do {
|
||||
warn "syma = $1\n" if $verbose;
|
||||
$exp->{$1} = $tgtname;
|
||||
};
|
||||
}
|
||||
}
|
||||
# gather the unresolved symbols
|
||||
foreach ( @output ) {
|
||||
!/ __this_module/ && / U (.*)$/ and do {
|
||||
warn "und = $1\n" if $verbose;
|
||||
push @{$dep->{$tgtname}}, $1;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# reduce dependancies: remove unresolvable and resolved from vmlinux
|
||||
# remove duplicates
|
||||
foreach $module (keys %$dep) {
|
||||
$mod->{$module} = {};
|
||||
foreach (@{$dep->{$module}}) {
|
||||
if( $exp->{$_} ) {
|
||||
warn "resolved symbol $_ in file $exp->{$_}\n" if $verbose;
|
||||
next if $exp->{$_} =~ /vmlinux/;
|
||||
$mod->{$module}{$exp->{$_}} = 1;
|
||||
} else {
|
||||
warn "unresolved symbol $_ in file $module\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# resolve the dependancies for each module
|
||||
foreach $module ( keys %$mod ) {
|
||||
print "$module:\t";
|
||||
@sorted = sort bydep keys %{$mod->{$module}};
|
||||
print join(" \\\n\t",@sorted);
|
||||
# foreach $m (@sorted ) {
|
||||
# print "\t$m\n";
|
||||
# }
|
||||
print "\n\n";
|
||||
}
|
||||
|
||||
sub bydep
|
||||
{
|
||||
foreach my $f ( keys %{$mod->{$b}} ) {
|
||||
if($f eq $a) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
depmod.pl - a cross platform script to generate kernel module dependency
|
||||
lists which can then be used by modprobe.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
depmod.pl [OPTION]... [FILE]...
|
||||
|
||||
Example:
|
||||
|
||||
depmod.pl -F linux/System.map target/lib/modules
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
The purpose of this script is to automagically generate a list of of kernel
|
||||
module dependancies. This script produces dependancy lists that should be
|
||||
identical to the depmod program from the modutils package. Unlike the depmod
|
||||
binary, however, depmod.pl is designed to be run on your host system, not
|
||||
on your target system.
|
||||
|
||||
This script was written by David Schleef <ds@schleef.org> to be used in
|
||||
conjunction with the BusyBox modprobe applet.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<-h --help>
|
||||
|
||||
This displays the help message.
|
||||
|
||||
=item B<-b --basedir>
|
||||
|
||||
The base directory uner which the target's modules will be found. This
|
||||
defaults to the /lib/modules directory.
|
||||
|
||||
=item B<-k --kernel>
|
||||
|
||||
Kernel binary for the target. You must either supply a kernel binary
|
||||
or a kernel symbol file (using the -F option).
|
||||
|
||||
=item B<-F --kernelsyms>
|
||||
|
||||
Kernel symbol file for the target. You must supply either a kernel symbol file
|
||||
kernel binary for the target (using the -k option).
|
||||
|
||||
=item B<-n --stdout>
|
||||
|
||||
Write to stdout instead of modules.dep. This is currently hard coded...
|
||||
kernel binary for the target (using the -k option).
|
||||
|
||||
=item B<--verbose>
|
||||
|
||||
Be verbose (not implemented)
|
||||
|
||||
=back
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright (c) 2001 David Schleef <ds@schleef.org>
|
||||
Copyright (c) 2001 Erik Andersen <andersen@lineo.com>
|
||||
Copyright (c) 2001 Stuart Hughes <stuarth@lineo.com>
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the same terms as Perl itself.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
David Schleef <ds@schleef.org>
|
||||
|
||||
=cut
|
||||
|
||||
# $Id: depmod.pl,v 1.1 2001/07/30 19:32:03 andersen Exp $
|
||||
|
||||
+22
-19
@@ -24,7 +24,7 @@
|
||||
# <runlevels>: The runlevels field is completely ignored.
|
||||
#
|
||||
# <action>: Valid actions include: sysinit, respawn, askfirst, wait, once,
|
||||
# and ctrlaltdel.
|
||||
# ctrlaltdel, and shutdown.
|
||||
#
|
||||
# Note: askfirst acts just like respawn, but before running the specified
|
||||
# process it displays the line "Please press Enter to activate this
|
||||
@@ -36,14 +36,19 @@
|
||||
#
|
||||
# <process>: Specifies the process to be executed and it's command line.
|
||||
#
|
||||
# Note: BusyBox init works just fine without an inittab. If no inittab
|
||||
# is found, it has the following default behavior:
|
||||
# ::sysinit:/etc/init.d/rcS
|
||||
# ::askfirst:/bin/sh
|
||||
# if it detects that /dev/console is _not_ a serial console, it will also run:
|
||||
# tty2::askfirst:/bin/sh
|
||||
# Note: BusyBox init works just fine without an inittab. If no inittab is
|
||||
# found, it has the following default behavior:
|
||||
# ::sysinit:/etc/init.d/rcS
|
||||
# ::askfirst:/bin/sh
|
||||
# ::ctrlaltdel:/sbin/reboot
|
||||
# ::shutdown:/sbin/swapoff -a
|
||||
# ::shutdown:/bin/umount -a -r
|
||||
# if it detects that /dev/console is _not_ a serial console, it will
|
||||
# also run:
|
||||
# tty2::askfirst:/bin/sh
|
||||
# tty3::askfirst:/bin/sh
|
||||
# tty4::askfirst:/bin/sh
|
||||
#
|
||||
|
||||
# Boot-time system configuration/initialization script.
|
||||
# This is run first except when booting in single-user mode.
|
||||
#
|
||||
@@ -56,28 +61,26 @@
|
||||
# login, but since we are bypassing login in this case, BusyBox lets you do
|
||||
# this yourself...
|
||||
#
|
||||
# Start an "askfirst" shell on the console (whatever that may be).
|
||||
# Start an "askfirst" shell on the console (whatever that may be)
|
||||
::askfirst:-/bin/sh
|
||||
#
|
||||
# Start an "askfirst" shell on /dev/tty2-4
|
||||
tty2::askfirst:-/bin/sh
|
||||
tty3::askfirst:-/bin/sh
|
||||
tty4::askfirst:-/bin/sh
|
||||
|
||||
# /sbin/getty invocations for selected ttys
|
||||
#
|
||||
tty5::respawn:/sbin/getty 38400 tty5
|
||||
tty6::respawn:/sbin/getty 38400 tty6
|
||||
tty4::respawn:/sbin/getty 38400 tty5
|
||||
tty5::respawn:/sbin/getty 38400 tty6
|
||||
|
||||
# Example of how to put a getty on a serial line (for a terminal)
|
||||
#
|
||||
#ttyS0::respawn:/sbin/getty -L ttyS0 9600 vt100
|
||||
#ttyS1::respawn:/sbin/getty -L ttyS1 9600 vt100
|
||||
#::respawn:/sbin/getty -L ttyS0 9600 vt100
|
||||
#::respawn:/sbin/getty -L ttyS1 9600 vt100
|
||||
#
|
||||
# Example how to put a getty on a modem line.
|
||||
#ttyS2::respawn:/sbin/getty -x0 -s 57600 ttyS2
|
||||
#::respawn:/sbin/getty 57600 ttyS2
|
||||
|
||||
# Stuff to do before rebooting
|
||||
::ctrlaltdel:/bin/umount -a -r
|
||||
::ctrlaltdel:/sbin/swapoff -a
|
||||
::ctrlaltdel:/sbin/reboot
|
||||
::shutdown:/bin/umount -a -r
|
||||
::shutdown:/sbin/swapoff -a
|
||||
|
||||
+4
-1
@@ -179,7 +179,10 @@ static void grep_file(FILE *file)
|
||||
if (print_match_counts) {
|
||||
if (print_filename)
|
||||
printf("%s:", cur_file);
|
||||
printf("%d\n", nmatches);
|
||||
if (print_files_with_matches && nmatches > 0)
|
||||
printf("1\n");
|
||||
else
|
||||
printf("%d\n", nmatches);
|
||||
}
|
||||
|
||||
/* grep -l: print just the filename, but only if we grepped the line in the file */
|
||||
|
||||
@@ -179,7 +179,10 @@ static void grep_file(FILE *file)
|
||||
if (print_match_counts) {
|
||||
if (print_filename)
|
||||
printf("%s:", cur_file);
|
||||
printf("%d\n", nmatches);
|
||||
if (print_files_with_matches && nmatches > 0)
|
||||
printf("1\n");
|
||||
else
|
||||
printf("%d\n", nmatches);
|
||||
}
|
||||
|
||||
/* grep -l: print just the filename, but only if we grepped the line in the file */
|
||||
|
||||
@@ -118,6 +118,9 @@ extern int gunzip_main(int argc, char **argv)
|
||||
/* Open input file */
|
||||
in_file = xfopen(if_name, "r");
|
||||
|
||||
/* set the buffer size */
|
||||
setvbuf(in_file, NULL, _IOFBF, 0x8000);
|
||||
|
||||
/* Get the time stamp on the input file. */
|
||||
if (stat(if_name, &stat_buf) < 0) {
|
||||
error_msg_and_die("Couldn't stat file %s", if_name);
|
||||
|
||||
@@ -1246,7 +1246,7 @@ int gzip_main(int argc, char **argv)
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
if (optind == argc) {
|
||||
if ((optind == argc) || (strcmp(argv[optind], "-") == 0)) {
|
||||
fromstdin = 1;
|
||||
tostdout = 1;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
#else
|
||||
#define applet_name "hush"
|
||||
#include "standalone.h"
|
||||
#define shell_main main
|
||||
#define hush_main main
|
||||
#undef BB_FEATURE_SH_FANCY_PROMPT
|
||||
#endif
|
||||
|
||||
@@ -237,10 +237,6 @@ unsigned int global_argc;
|
||||
unsigned int last_return_code;
|
||||
extern char **environ; /* This is in <unistd.h>, but protected with __USE_GNU */
|
||||
|
||||
/* Variables we export */
|
||||
unsigned int shell_context; /* Used in cmdedit.c to reset the
|
||||
* context when someone hits ^C */
|
||||
|
||||
/* "globals" within this file */
|
||||
static char *ifs;
|
||||
static char map[256];
|
||||
@@ -883,7 +879,6 @@ static void get_user_input(struct in_str *i)
|
||||
** child processes (rob@sysgo.de)
|
||||
*/
|
||||
cmdedit_read_input(prompt_str, the_command);
|
||||
cmdedit_terminate();
|
||||
#else
|
||||
fputs(prompt_str, stdout);
|
||||
fflush(stdout);
|
||||
@@ -1411,6 +1406,7 @@ static int run_pipe_real(struct pipe *pi)
|
||||
/* Set the handling for job control signals back to the default. */
|
||||
signal(SIGINT, SIG_DFL);
|
||||
signal(SIGQUIT, SIG_DFL);
|
||||
signal(SIGTERM, SIG_DFL);
|
||||
signal(SIGTSTP, SIG_DFL);
|
||||
signal(SIGTTIN, SIG_DFL);
|
||||
signal(SIGTTOU, SIG_DFL);
|
||||
@@ -2551,6 +2547,7 @@ static void setup_job_control()
|
||||
/* Ignore interactive and job-control signals. */
|
||||
signal(SIGINT, SIG_IGN);
|
||||
signal(SIGQUIT, SIG_IGN);
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
signal(SIGTSTP, SIG_IGN);
|
||||
signal(SIGTTIN, SIG_IGN);
|
||||
signal(SIGTTOU, SIG_IGN);
|
||||
@@ -2565,7 +2562,7 @@ static void setup_job_control()
|
||||
tcsetpgrp(shell_terminal, shell_pgrp);
|
||||
}
|
||||
|
||||
int shell_main(int argc, char **argv)
|
||||
int hush_main(int argc, char **argv)
|
||||
{
|
||||
int opt;
|
||||
FILE *input;
|
||||
@@ -2575,8 +2572,8 @@ int shell_main(int argc, char **argv)
|
||||
global_argc = argc;
|
||||
global_argv = argv;
|
||||
|
||||
/* (re?) initialize globals. Sometimes shell_main() ends up calling
|
||||
* shell_main(), therefore we cannot rely on the BSS to zero out this
|
||||
/* (re?) initialize globals. Sometimes hush_main() ends up calling
|
||||
* hush_main(), therefore we cannot rely on the BSS to zero out this
|
||||
* stuff. Reset these to 0 every time. */
|
||||
ifs = NULL;
|
||||
/* map[] is taken care of with call to update_ifs_map() */
|
||||
|
||||
+30
-3
@@ -52,6 +52,9 @@
|
||||
#ifdef BB_AR
|
||||
APPLET(ar, ar_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_ASH
|
||||
APPLET_NOUSAGE("ash", ash_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_BASENAME
|
||||
APPLET(basename, basename_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
@@ -185,6 +188,9 @@
|
||||
#ifdef BB_HOSTNAME
|
||||
APPLET(hostname, hostname_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_HUSH
|
||||
APPLET_NOUSAGE("hush", hush_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_ID
|
||||
APPLET(id, id_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
@@ -206,6 +212,9 @@
|
||||
#ifdef BB_KLOGD
|
||||
APPLET(klogd, klogd_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_LASH
|
||||
APPLET(lash, lash_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_LENGTH
|
||||
APPLET(length, length_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
@@ -263,12 +272,18 @@
|
||||
#ifdef BB_MKTEMP
|
||||
APPLET(mktemp, mktemp_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MODPROBE
|
||||
APPLET(modprobe, modprobe_main, _BB_DIR_SBIN)
|
||||
#endif
|
||||
#ifdef BB_MORE
|
||||
APPLET(more, more_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MOUNT
|
||||
APPLET(mount, mount_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MSH
|
||||
APPLET_NOUSAGE("msh", msh_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_MT
|
||||
APPLET(mt, mt_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
@@ -281,6 +296,9 @@
|
||||
#ifdef BB_NSLOOKUP
|
||||
APPLET(nslookup, nslookup_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PIDOF
|
||||
APPLET(pidof, pidof_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_PING
|
||||
APPLET(ping, ping_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
@@ -338,8 +356,14 @@
|
||||
#ifdef BB_SETKEYCODES
|
||||
APPLET(setkeycodes, setkeycodes_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SH
|
||||
APPLET(sh, shell_main, _BB_DIR_BIN)
|
||||
#if defined(BB_FEATURE_SH_IS_ASH) && defined(BB_ASH)
|
||||
APPLET_NOUSAGE("sh", ash_main, _BB_DIR_BIN)
|
||||
#elif defined(BB_FEATURE_SH_IS_HUSH) && defined(BB_HUSH)
|
||||
APPLET_NOUSAGE("sh", hush_main, _BB_DIR_BIN)
|
||||
#elif defined(BB_FEATURE_SH_IS_LASH) && defined(BB_LASH)
|
||||
APPLET_NOUSAGE("sh", lash_main, _BB_DIR_BIN)
|
||||
#elif defined(BB_FEATURE_SH_IS_MSH) && defined(BB_MSH)
|
||||
APPLET_NOUSAGE("sh", msh_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
#ifdef BB_SLEEP
|
||||
APPLET(sleep, sleep_main, _BB_DIR_BIN)
|
||||
@@ -386,6 +410,9 @@
|
||||
#ifdef BB_TR
|
||||
APPLET(tr, tr_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TRACEROUTE
|
||||
APPLET(traceroute, traceroute_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_TRUE_FALSE
|
||||
APPLET(true, true_main, _BB_DIR_BIN)
|
||||
#endif
|
||||
@@ -402,7 +429,7 @@
|
||||
APPLET(uniq, uniq_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UNIX2DOS
|
||||
APPLET(unix2dos, unix2dos_main, _BB_DIR_USR_BIN)
|
||||
APPLET(unix2dos, dos2unix_main, _BB_DIR_USR_BIN)
|
||||
#endif
|
||||
#ifdef BB_UPDATE
|
||||
APPLET(update, update_main, _BB_DIR_SBIN)
|
||||
|
||||
@@ -69,13 +69,16 @@ extern const struct BB_applet applets[];
|
||||
#ifdef BB_FEATURE_BUFFERS_GO_ON_STACK
|
||||
#define RESERVE_BB_BUFFER(buffer,len) char buffer[len]
|
||||
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char buffer[len]
|
||||
#define RELEASE_BB_BUFFER(buffer) ((void)0)
|
||||
#else
|
||||
#ifdef BB_FEATURE_BUFFERS_GO_IN_BSS
|
||||
#define RESERVE_BB_BUFFER(buffer,len) static char buffer[len]
|
||||
#define RESERVE_BB_UBUFFER(buffer,len) static unsigned char buffer[len]
|
||||
#define RELEASE_BB_BUFFER(buffer) ((void)0)
|
||||
#else
|
||||
#define RESERVE_BB_BUFFER(buffer,len) char *buffer=xmalloc(len)
|
||||
#define RESERVE_BB_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
|
||||
#define RELEASE_BB_BUFFER(buffer) free (buffer)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
+43
-5
@@ -41,11 +41,13 @@
|
||||
#include "../busybox.h"
|
||||
#endif
|
||||
|
||||
#if __GNU_LIBRARY__ < 5
|
||||
#if (__GNU_LIBRARY__ < 5) && (!defined __dietlibc__)
|
||||
/* libc5 doesn't define socklen_t */
|
||||
typedef unsigned int socklen_t;
|
||||
/* libc5 doesn't implement BSD 4.4 daemon() */
|
||||
extern int daemon (int nochdir, int noclose);
|
||||
/* libc5 doesn't implement strtok_r */
|
||||
char *strtok_r(char *s, const char *delim, char **ptrptr);
|
||||
#endif
|
||||
|
||||
/* Some useful definitions */
|
||||
@@ -212,6 +214,8 @@ char *xreadlink(const char *path);
|
||||
char *concat_path_file(const char *path, const char *filename);
|
||||
char *last_char_is(const char *s, int c);
|
||||
|
||||
extern long arith (const char *startbuf, int *errcode);
|
||||
|
||||
typedef struct file_headers_s {
|
||||
char *name;
|
||||
char *link_name;
|
||||
@@ -237,13 +241,15 @@ enum extract_functions_e {
|
||||
extract_control_tar_gz = 128,
|
||||
extract_unzip_only = 256,
|
||||
extract_unconditional = 512,
|
||||
extract_create_leading_dirs = 1024
|
||||
extract_create_leading_dirs = 1024,
|
||||
extract_quiet = 2048,
|
||||
extract_exclude_list = 4096
|
||||
};
|
||||
char *unarchive(FILE *src_stream, file_header_t *(*get_header)(FILE *),
|
||||
char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_header)(FILE *),
|
||||
const int extract_function, const char *prefix, char **extract_names);
|
||||
char *deb_extract(const char *package_filename, FILE *out_stream, const int extract_function,
|
||||
const char *prefix, const char *filename);
|
||||
char *read_package_field(const char *package_buffer);
|
||||
int read_package_field(const char *package_buffer, char **field_name, char **field_value);
|
||||
char *fgets_str(FILE *file, const char *terminating_string);
|
||||
|
||||
extern int unzip(FILE *l_in_file, FILE *l_out_file);
|
||||
@@ -251,10 +257,13 @@ extern void gz_close(int gunzip_pid);
|
||||
extern FILE *gz_open(FILE *compressed_file, int *pid);
|
||||
|
||||
extern struct hostent *xgethostbyname(const char *name);
|
||||
extern int create_icmp_socket(void);
|
||||
|
||||
char *dirname (const char *path);
|
||||
|
||||
int make_directory (char *path, mode_t mode, int flags);
|
||||
int make_directory (char *path, long mode, int flags);
|
||||
|
||||
const char *u_signal_names(const char *str_sig, int *signo, int startnum);
|
||||
|
||||
#define CT_AUTO 0
|
||||
#define CT_UNIX2DOS 1
|
||||
@@ -283,5 +292,34 @@ extern const char * const write_error;
|
||||
extern const char * const too_few_args;
|
||||
extern const char * const name_longer_than_foo;
|
||||
extern const char * const unknown;
|
||||
extern const char * const can_not_create_raw_socket;
|
||||
|
||||
#ifdef BB_FEATURE_DEVFS
|
||||
# define CURRENT_VC "/dev/vc/0"
|
||||
# define VC_1 "/dev/vc/1"
|
||||
# define VC_2 "/dev/vc/2"
|
||||
# define VC_3 "/dev/vc/3"
|
||||
# define VC_4 "/dev/vc/4"
|
||||
# define VC_5 "/dev/vc/5"
|
||||
# define SC_0 "/dev/tts/0"
|
||||
# define SC_1 "/dev/tts/1"
|
||||
# define VC_FORMAT "/dev/vc/%d"
|
||||
# define SC_FORMAT "/dev/tts/%d"
|
||||
#else
|
||||
# define CURRENT_VC "/dev/tty0"
|
||||
# define VC_1 "/dev/tty1"
|
||||
# define VC_2 "/dev/tty2"
|
||||
# define VC_3 "/dev/tty3"
|
||||
# define VC_4 "/dev/tty4"
|
||||
# define VC_5 "/dev/tty5"
|
||||
# define SC_0 "/dev/ttyS0"
|
||||
# define SC_1 "/dev/ttyS1"
|
||||
# define VC_FORMAT "/dev/tty%d"
|
||||
# define SC_FORMAT "/dev/ttyS%d"
|
||||
#endif
|
||||
|
||||
/* The following devices are the same on devfs and non-devfs systems. */
|
||||
#define CURRENT_TTY "/dev/tty"
|
||||
#define CONSOLE_DEV "/dev/console"
|
||||
|
||||
#endif /* __LIBBB_H__ */
|
||||
+47
-5
@@ -272,9 +272,14 @@
|
||||
"\t-d\toutput will be in DOS format"
|
||||
|
||||
#define dpkg_trivial_usage \
|
||||
"[-i|-r|--unpack|--configure] my.deb"
|
||||
"-i package_file\n"
|
||||
"[-CPru] package_name"
|
||||
#define dpkg_full_usage \
|
||||
"WORK IN PROGRESS, only useful for debian-installer"
|
||||
"\t-i\tInstall the package\n" \
|
||||
"\t-C\tConfigure an unpackaged package\n" \
|
||||
"\t-P\tPurge all files of a package\n" \
|
||||
"\t-r\tRemove all but the configuration files for a package\n" \
|
||||
"\t-u\tUnpack a package, but dont configure it\n"
|
||||
|
||||
#define dpkg_deb_trivial_usage \
|
||||
"[-cefItxX] FILE [argument]"
|
||||
@@ -1079,6 +1084,13 @@
|
||||
"$ ls -la /tmp/temp.mWiLjM\n" \
|
||||
"-rw------- 1 andersen andersen 0 Apr 25 17:10 /tmp/temp.mWiLjM\n"
|
||||
|
||||
#define modprobe_trivial_usage \
|
||||
"[FILE ...]"
|
||||
#define modprobe_full_usage \
|
||||
"Used for hight level module loading and unloading."
|
||||
#define modprobe_example_usage \
|
||||
"$ modprobe cdrom\n"
|
||||
|
||||
#define more_trivial_usage \
|
||||
"[FILE ...]"
|
||||
#define more_full_usage \
|
||||
@@ -1178,6 +1190,14 @@
|
||||
"Name: debian\n" \
|
||||
"Address: 127.0.0.1\n"
|
||||
|
||||
#define pidof_trivial_usage \
|
||||
"process-name [process-name ...]"
|
||||
#define pidof_full_usage \
|
||||
"Lists the PIDs of all processes with names that match the names on the command line"
|
||||
#define pidof_example_usage \
|
||||
"$ pidof init\n" \
|
||||
"1\n"
|
||||
|
||||
#ifndef BB_FEATURE_FANCY_PING
|
||||
#define ping_trivial_usage "host"
|
||||
#define ping_full_usage "Send ICMP ECHO_REQUEST packets to network hosts"
|
||||
@@ -1345,12 +1365,12 @@
|
||||
#define setkeycodes_example_usage \
|
||||
"$ setkeycodes e030 127\n"
|
||||
|
||||
#define sh_trivial_usage \
|
||||
#define lash_trivial_usage \
|
||||
"[FILE]...\n" \
|
||||
"or: sh -c command [args]..."
|
||||
#define sh_full_usage \
|
||||
#define lash_full_usage \
|
||||
"lash: The BusyBox LAme SHell (command interpreter)"
|
||||
#define sh_notes_usage \
|
||||
#define lash_notes_usage \
|
||||
"This command does not yet have proper documentation.\n" \
|
||||
"\n" \
|
||||
"Use lash just as you would use any other shell. It properly handles pipes,\n" \
|
||||
@@ -1593,6 +1613,28 @@
|
||||
"$ echo "gdkkn vnqkc" | tr [a-y] [b-z]\n" \
|
||||
"hello world\n"
|
||||
|
||||
#define traceroute_trivial_usage \
|
||||
"[-dnrv] [-m max_ttl] [-p port#] [-q nqueries]\n\
|
||||
[-s src_addr] [-t tos] [-w wait] host [data size]"
|
||||
#define traceroute_full_usage \
|
||||
"trace the route ip packets follow going to \"host\"\n" \
|
||||
"Options:\n" \
|
||||
"\t-d\tset SO_DEBUG options to socket\n" \
|
||||
"\t-n\tPrint hop addresses numerically rather than symbolically\n" \
|
||||
"\t-r\tBypass the normal routing tables and send directly to a host\n" \
|
||||
"\t-v\tVerbose output\n" \
|
||||
"\t-m max_ttl\tSet the max time-to-live (max number of hops)\n" \
|
||||
"\t-p port#\tSet the base UDP port number used in probes\n" \
|
||||
"\t\t(default is 33434)\n" \
|
||||
"\t-q nqueries\tSet the number of probes per ``ttl'' to nqueries\n" \
|
||||
"\t\t(default is 3)\n" \
|
||||
"\t-s src_addr\tUse the following IP address as the source address\n" \
|
||||
"\t-t tos\tSet the type-of-service in probe packets to the following value\n" \
|
||||
"\t\t(default 0)\n" \
|
||||
"\t-w wait\tSet the time (in seconds) to wait for a response to a probe\n" \
|
||||
"\t\t(default 3 sec.)."
|
||||
|
||||
|
||||
#define true_trivial_usage \
|
||||
""
|
||||
#define true_full_usage \
|
||||
|
||||
@@ -84,7 +84,7 @@ static const int RB_DISABLE_CAD = 0;
|
||||
static const int RB_AUTOBOOT = 0x01234567;
|
||||
#endif
|
||||
|
||||
#if __GNU_LIBRARY__ > 5
|
||||
#if (__GNU_LIBRARY__ > 5) || defined(__dietlibc__)
|
||||
#include <sys/reboot.h>
|
||||
#define init_reboot(magic) reboot(magic)
|
||||
#else
|
||||
@@ -117,13 +117,6 @@ static const int RB_AUTOBOOT = 0x01234567;
|
||||
#endif
|
||||
|
||||
|
||||
#define VT_PRIMARY "/dev/tty1" /* Primary virtual console */
|
||||
#define VT_SECONDARY "/dev/tty2" /* Virtual console */
|
||||
#define VT_THIRD "/dev/tty3" /* Virtual console */
|
||||
#define VT_FOURTH "/dev/tty4" /* Virtual console */
|
||||
#define VT_LOG "/dev/tty5" /* Virtual console */
|
||||
#define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */
|
||||
#define SERIAL_CON1 "/dev/ttyS1" /* Serial console */
|
||||
#define SHELL "/bin/sh" /* Default shell */
|
||||
#define LOGIN_SHELL "-" SHELL /* Default login shell */
|
||||
#define INITTAB "/etc/inittab" /* inittab file location */
|
||||
@@ -176,10 +169,10 @@ struct initActionTag {
|
||||
static initAction *initActionList = NULL;
|
||||
|
||||
|
||||
static char *secondConsole = VT_SECONDARY;
|
||||
static char *thirdConsole = VT_THIRD;
|
||||
static char *fourthConsole = VT_FOURTH;
|
||||
static char *log = VT_LOG;
|
||||
static char *secondConsole = VC_2;
|
||||
static char *thirdConsole = VC_3;
|
||||
static char *fourthConsole = VC_4;
|
||||
static char *log = VC_5;
|
||||
static int kernelVersion = 0;
|
||||
static char termType[32] = "TERM=linux";
|
||||
static char console[32] = _PATH_CONSOLE;
|
||||
@@ -341,20 +334,19 @@ static void console_init()
|
||||
else if ((s = getenv("console")) != NULL) {
|
||||
/* remap tty[ab] to /dev/ttyS[01] */
|
||||
if (strcmp(s, "ttya") == 0)
|
||||
safe_strncpy(console, SERIAL_CON0, sizeof(console));
|
||||
safe_strncpy(console, SC_0, sizeof(console));
|
||||
else if (strcmp(s, "ttyb") == 0)
|
||||
safe_strncpy(console, SERIAL_CON1, sizeof(console));
|
||||
safe_strncpy(console, SC_1, sizeof(console));
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
/* 2.2 kernels: identify the real console backend and try to use it */
|
||||
if (ioctl(0, TIOCGSERIAL, &sr) == 0) {
|
||||
/* this is a serial console */
|
||||
snprintf(console, sizeof(console) - 1, "/dev/ttyS%d", sr.line);
|
||||
snprintf(console, sizeof(console) - 1, SC_FORMAT, sr.line);
|
||||
} else if (ioctl(0, VT_GETSTATE, &vt) == 0) {
|
||||
/* this is linux virtual tty */
|
||||
snprintf(console, sizeof(console) - 1, "/dev/tty%d",
|
||||
vt.v_active);
|
||||
snprintf(console, sizeof(console) - 1, VC_FORMAT, vt.v_active);
|
||||
} else {
|
||||
safe_strncpy(console, _PATH_CONSOLE, sizeof(console));
|
||||
tried_devcons++;
|
||||
@@ -371,7 +363,7 @@ static void console_init()
|
||||
/* Can't open selected console -- try vt1 */
|
||||
if (!tried_vtprimary) {
|
||||
tried_vtprimary++;
|
||||
safe_strncpy(console, VT_PRIMARY, sizeof(console));
|
||||
safe_strncpy(console, VC_1, sizeof(console));
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
+10
-18
@@ -84,7 +84,7 @@ static const int RB_DISABLE_CAD = 0;
|
||||
static const int RB_AUTOBOOT = 0x01234567;
|
||||
#endif
|
||||
|
||||
#if __GNU_LIBRARY__ > 5
|
||||
#if (__GNU_LIBRARY__ > 5) || defined(__dietlibc__)
|
||||
#include <sys/reboot.h>
|
||||
#define init_reboot(magic) reboot(magic)
|
||||
#else
|
||||
@@ -117,13 +117,6 @@ static const int RB_AUTOBOOT = 0x01234567;
|
||||
#endif
|
||||
|
||||
|
||||
#define VT_PRIMARY "/dev/tty1" /* Primary virtual console */
|
||||
#define VT_SECONDARY "/dev/tty2" /* Virtual console */
|
||||
#define VT_THIRD "/dev/tty3" /* Virtual console */
|
||||
#define VT_FOURTH "/dev/tty4" /* Virtual console */
|
||||
#define VT_LOG "/dev/tty5" /* Virtual console */
|
||||
#define SERIAL_CON0 "/dev/ttyS0" /* Primary serial console */
|
||||
#define SERIAL_CON1 "/dev/ttyS1" /* Serial console */
|
||||
#define SHELL "/bin/sh" /* Default shell */
|
||||
#define LOGIN_SHELL "-" SHELL /* Default login shell */
|
||||
#define INITTAB "/etc/inittab" /* inittab file location */
|
||||
@@ -176,10 +169,10 @@ struct initActionTag {
|
||||
static initAction *initActionList = NULL;
|
||||
|
||||
|
||||
static char *secondConsole = VT_SECONDARY;
|
||||
static char *thirdConsole = VT_THIRD;
|
||||
static char *fourthConsole = VT_FOURTH;
|
||||
static char *log = VT_LOG;
|
||||
static char *secondConsole = VC_2;
|
||||
static char *thirdConsole = VC_3;
|
||||
static char *fourthConsole = VC_4;
|
||||
static char *log = VC_5;
|
||||
static int kernelVersion = 0;
|
||||
static char termType[32] = "TERM=linux";
|
||||
static char console[32] = _PATH_CONSOLE;
|
||||
@@ -341,20 +334,19 @@ static void console_init()
|
||||
else if ((s = getenv("console")) != NULL) {
|
||||
/* remap tty[ab] to /dev/ttyS[01] */
|
||||
if (strcmp(s, "ttya") == 0)
|
||||
safe_strncpy(console, SERIAL_CON0, sizeof(console));
|
||||
safe_strncpy(console, SC_0, sizeof(console));
|
||||
else if (strcmp(s, "ttyb") == 0)
|
||||
safe_strncpy(console, SERIAL_CON1, sizeof(console));
|
||||
safe_strncpy(console, SC_1, sizeof(console));
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
/* 2.2 kernels: identify the real console backend and try to use it */
|
||||
if (ioctl(0, TIOCGSERIAL, &sr) == 0) {
|
||||
/* this is a serial console */
|
||||
snprintf(console, sizeof(console) - 1, "/dev/ttyS%d", sr.line);
|
||||
snprintf(console, sizeof(console) - 1, SC_FORMAT, sr.line);
|
||||
} else if (ioctl(0, VT_GETSTATE, &vt) == 0) {
|
||||
/* this is linux virtual tty */
|
||||
snprintf(console, sizeof(console) - 1, "/dev/tty%d",
|
||||
vt.v_active);
|
||||
snprintf(console, sizeof(console) - 1, VC_FORMAT, vt.v_active);
|
||||
} else {
|
||||
safe_strncpy(console, _PATH_CONSOLE, sizeof(console));
|
||||
tried_devcons++;
|
||||
@@ -371,7 +363,7 @@ static void console_init()
|
||||
/* Can't open selected console -- try vt1 */
|
||||
if (!tried_vtprimary) {
|
||||
tried_vtprimary++;
|
||||
safe_strncpy(console, VT_PRIMARY, sizeof(console));
|
||||
safe_strncpy(console, VC_1, sizeof(console));
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini insmod implementation for busybox
|
||||
* This version of insmod now supports x86, ARM, SH3/4, powerpc, and MIPS.
|
||||
*
|
||||
* This version of insmod supports x86, ARM, SH3/4, powerpc, m68k,
|
||||
* and MIPS.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by Erik Andersen <andersen@lineo.com>
|
||||
@@ -130,7 +133,7 @@
|
||||
#ifndef MODUTILS_MODULE_H
|
||||
static const int MODUTILS_MODULE_H = 1;
|
||||
|
||||
#ident "$Id: insmod.c,v 1.67 2001/06/28 21:36:06 andersen Exp $"
|
||||
#ident "$Id: insmod.c,v 1.70 2001/07/31 22:51:49 andersen Exp $"
|
||||
|
||||
/* This file contains the structures used by the 2.0 and 2.1 kernels.
|
||||
We do not use the kernel headers directly because we do not wish
|
||||
@@ -347,7 +350,7 @@ int delete_module(const char *);
|
||||
#ifndef MODUTILS_OBJ_H
|
||||
static const int MODUTILS_OBJ_H = 1;
|
||||
|
||||
#ident "$Id: insmod.c,v 1.67 2001/06/28 21:36:06 andersen Exp $"
|
||||
#ident "$Id: insmod.c,v 1.70 2001/07/31 22:51:49 andersen Exp $"
|
||||
|
||||
/* The relocatable object is manipulated using elfin types. */
|
||||
|
||||
@@ -537,78 +540,75 @@ struct obj_symbol_patch
|
||||
|
||||
/* Generic object manipulation routines. */
|
||||
|
||||
unsigned long obj_elf_hash(const char *);
|
||||
static unsigned long obj_elf_hash(const char *);
|
||||
|
||||
unsigned long obj_elf_hash_n(const char *, unsigned long len);
|
||||
static unsigned long obj_elf_hash_n(const char *, unsigned long len);
|
||||
|
||||
struct obj_symbol *obj_add_symbol (struct obj_file *f, const char *name,
|
||||
unsigned long symidx, int info, int secidx,
|
||||
ElfW(Addr) value, unsigned long size);
|
||||
|
||||
struct obj_symbol *obj_find_symbol (struct obj_file *f,
|
||||
static struct obj_symbol *obj_find_symbol (struct obj_file *f,
|
||||
const char *name);
|
||||
|
||||
ElfW(Addr) obj_symbol_final_value(struct obj_file *f,
|
||||
static ElfW(Addr) obj_symbol_final_value(struct obj_file *f,
|
||||
struct obj_symbol *sym);
|
||||
|
||||
void obj_set_symbol_compare(struct obj_file *f,
|
||||
#ifdef BB_FEATURE_INSMOD_VERSION_CHECKING
|
||||
static void obj_set_symbol_compare(struct obj_file *f,
|
||||
int (*cmp)(const char *, const char *),
|
||||
unsigned long (*hash)(const char *));
|
||||
#endif
|
||||
|
||||
struct obj_section *obj_find_section (struct obj_file *f,
|
||||
static struct obj_section *obj_find_section (struct obj_file *f,
|
||||
const char *name);
|
||||
|
||||
void obj_insert_section_load_order (struct obj_file *f,
|
||||
static void obj_insert_section_load_order (struct obj_file *f,
|
||||
struct obj_section *sec);
|
||||
|
||||
struct obj_section *obj_create_alloced_section (struct obj_file *f,
|
||||
static struct obj_section *obj_create_alloced_section (struct obj_file *f,
|
||||
const char *name,
|
||||
unsigned long align,
|
||||
unsigned long size);
|
||||
|
||||
struct obj_section *obj_create_alloced_section_first (struct obj_file *f,
|
||||
static struct obj_section *obj_create_alloced_section_first (struct obj_file *f,
|
||||
const char *name,
|
||||
unsigned long align,
|
||||
unsigned long size);
|
||||
|
||||
void *obj_extend_section (struct obj_section *sec, unsigned long more);
|
||||
static void *obj_extend_section (struct obj_section *sec, unsigned long more);
|
||||
|
||||
int obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
|
||||
static int obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
|
||||
const char *string);
|
||||
|
||||
int obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
|
||||
static int obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
|
||||
struct obj_symbol *sym);
|
||||
|
||||
int obj_check_undefineds(struct obj_file *f);
|
||||
static int obj_check_undefineds(struct obj_file *f);
|
||||
|
||||
void obj_allocate_commons(struct obj_file *f);
|
||||
static void obj_allocate_commons(struct obj_file *f);
|
||||
|
||||
unsigned long obj_load_size (struct obj_file *f);
|
||||
static unsigned long obj_load_size (struct obj_file *f);
|
||||
|
||||
int obj_relocate (struct obj_file *f, ElfW(Addr) base);
|
||||
static int obj_relocate (struct obj_file *f, ElfW(Addr) base);
|
||||
|
||||
struct obj_file *obj_load(FILE *f, int loadprogbits);
|
||||
static struct obj_file *obj_load(FILE *f, int loadprogbits);
|
||||
|
||||
int obj_create_image (struct obj_file *f, char *image);
|
||||
static int obj_create_image (struct obj_file *f, char *image);
|
||||
|
||||
/* Architecture specific manipulation routines. */
|
||||
|
||||
struct obj_file *arch_new_file (void);
|
||||
static struct obj_file *arch_new_file (void);
|
||||
|
||||
struct obj_section *arch_new_section (void);
|
||||
static struct obj_section *arch_new_section (void);
|
||||
|
||||
struct obj_symbol *arch_new_symbol (void);
|
||||
static struct obj_symbol *arch_new_symbol (void);
|
||||
|
||||
enum obj_reloc arch_apply_relocation (struct obj_file *f,
|
||||
static enum obj_reloc arch_apply_relocation (struct obj_file *f,
|
||||
struct obj_section *targsec,
|
||||
struct obj_section *symsec,
|
||||
struct obj_symbol *sym,
|
||||
ElfW(RelM) *rel, ElfW(Addr) value);
|
||||
|
||||
int arch_create_got (struct obj_file *f);
|
||||
static int arch_create_got (struct obj_file *f);
|
||||
|
||||
struct new_module;
|
||||
int arch_init_module (struct obj_file *f, struct new_module *);
|
||||
static int arch_init_module (struct obj_file *f, struct new_module *);
|
||||
|
||||
#endif /* obj.h */
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -624,10 +624,10 @@ static const int STRVERSIONLEN = 32;
|
||||
|
||||
/*======================================================================*/
|
||||
|
||||
int flag_force_load = 0;
|
||||
int flag_autoclean = 0;
|
||||
int flag_verbose = 0;
|
||||
int flag_export = 1;
|
||||
static int flag_force_load = 0;
|
||||
static int flag_autoclean = 0;
|
||||
static int flag_verbose = 0;
|
||||
static int flag_export = 1;
|
||||
|
||||
|
||||
/*======================================================================*/
|
||||
@@ -700,12 +700,12 @@ struct external_module {
|
||||
struct new_module_symbol *syms;
|
||||
};
|
||||
|
||||
struct new_module_symbol *ksyms;
|
||||
size_t nksyms;
|
||||
static struct new_module_symbol *ksyms;
|
||||
static size_t nksyms;
|
||||
|
||||
struct external_module *ext_modules;
|
||||
int n_ext_modules;
|
||||
int n_ext_modules_used;
|
||||
static struct external_module *ext_modules;
|
||||
static int n_ext_modules;
|
||||
static int n_ext_modules_used;
|
||||
extern int delete_module(const char *);
|
||||
|
||||
static char m_filename[FILENAME_MAX + 1];
|
||||
@@ -740,7 +740,7 @@ static int check_module_name_match(const char *filename, struct stat *statbuf,
|
||||
|
||||
/*======================================================================*/
|
||||
|
||||
struct obj_file *arch_new_file(void)
|
||||
static struct obj_file *arch_new_file(void)
|
||||
{
|
||||
struct arch_file *f;
|
||||
f = xmalloc(sizeof(*f));
|
||||
@@ -758,12 +758,12 @@ struct obj_file *arch_new_file(void)
|
||||
return &f->root;
|
||||
}
|
||||
|
||||
struct obj_section *arch_new_section(void)
|
||||
static struct obj_section *arch_new_section(void)
|
||||
{
|
||||
return xmalloc(sizeof(struct obj_section));
|
||||
}
|
||||
|
||||
struct obj_symbol *arch_new_symbol(void)
|
||||
static struct obj_symbol *arch_new_symbol(void)
|
||||
{
|
||||
struct arch_symbol *sym;
|
||||
sym = xmalloc(sizeof(*sym));
|
||||
@@ -778,7 +778,7 @@ struct obj_symbol *arch_new_symbol(void)
|
||||
return &sym->root;
|
||||
}
|
||||
|
||||
enum obj_reloc
|
||||
static enum obj_reloc
|
||||
arch_apply_relocation(struct obj_file *f,
|
||||
struct obj_section *targsec,
|
||||
struct obj_section *symsec,
|
||||
@@ -1140,7 +1140,7 @@ arch_apply_relocation(struct obj_file *f,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int arch_create_got(struct obj_file *f)
|
||||
static int arch_create_got(struct obj_file *f)
|
||||
{
|
||||
#if defined(BB_USE_GOT_ENTRIES) || defined(BB_USE_PLT_ENTRIES)
|
||||
struct arch_file *ifile = (struct arch_file *) f;
|
||||
@@ -1271,7 +1271,7 @@ int arch_create_got(struct obj_file *f)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int arch_init_module(struct obj_file *f, struct new_module *mod)
|
||||
static int arch_init_module(struct obj_file *f, struct new_module *mod)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -1280,7 +1280,7 @@ int arch_init_module(struct obj_file *f, struct new_module *mod)
|
||||
/*======================================================================*/
|
||||
|
||||
/* Standard ELF hash function. */
|
||||
inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
|
||||
static inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
|
||||
{
|
||||
unsigned long h = 0;
|
||||
unsigned long g;
|
||||
@@ -1298,7 +1298,7 @@ inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
|
||||
return h;
|
||||
}
|
||||
|
||||
unsigned long obj_elf_hash(const char *name)
|
||||
static unsigned long obj_elf_hash(const char *name)
|
||||
{
|
||||
return obj_elf_hash_n(name, strlen(name));
|
||||
}
|
||||
@@ -1309,25 +1309,15 @@ unsigned long obj_elf_hash(const char *name)
|
||||
static int get_kernel_version(char str[STRVERSIONLEN])
|
||||
{
|
||||
struct utsname uts_info;
|
||||
char *p, *q;
|
||||
int a, b, c;
|
||||
int kv;
|
||||
|
||||
if (uname(&uts_info) < 0)
|
||||
return -1;
|
||||
strncpy(str, uts_info.release, STRVERSIONLEN);
|
||||
p = uts_info.release;
|
||||
|
||||
a = strtoul(p, &p, 10);
|
||||
if (*p != '.')
|
||||
kv = get_kernel_revision();
|
||||
if(kv==0)
|
||||
return -1;
|
||||
b = strtoul(p + 1, &p, 10);
|
||||
if (*p != '.')
|
||||
return -1;
|
||||
c = strtoul(p + 1, &q, 10);
|
||||
if (p + 1 == q)
|
||||
return -1;
|
||||
|
||||
return a << 16 | b << 8 | c;
|
||||
}
|
||||
|
||||
/* String comparison for non-co-versioned kernel and module. */
|
||||
@@ -1355,7 +1345,7 @@ static unsigned long ncv_symbol_hash(const char *str)
|
||||
return obj_elf_hash_n(str, len);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
obj_set_symbol_compare(struct obj_file *f,
|
||||
int (*cmp) (const char *, const char *),
|
||||
unsigned long (*hash) (const char *))
|
||||
@@ -1383,8 +1373,8 @@ obj_set_symbol_compare(struct obj_file *f,
|
||||
|
||||
#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */
|
||||
|
||||
|
||||
struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
|
||||
static struct obj_symbol *
|
||||
obj_add_symbol(struct obj_file *f, const char *name,
|
||||
unsigned long symidx, int info,
|
||||
int secidx, ElfW(Addr) value,
|
||||
unsigned long size)
|
||||
@@ -1478,7 +1468,8 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
|
||||
return sym;
|
||||
}
|
||||
|
||||
struct obj_symbol *obj_find_symbol(struct obj_file *f, const char *name)
|
||||
static struct obj_symbol *
|
||||
obj_find_symbol(struct obj_file *f, const char *name)
|
||||
{
|
||||
struct obj_symbol *sym;
|
||||
unsigned long hash = f->symbol_hash(name) % HASH_BUCKETS;
|
||||
@@ -1490,7 +1481,7 @@ struct obj_symbol *obj_find_symbol(struct obj_file *f, const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ElfW(Addr)
|
||||
static ElfW(Addr)
|
||||
obj_symbol_final_value(struct obj_file * f, struct obj_symbol * sym)
|
||||
{
|
||||
if (sym) {
|
||||
@@ -1504,7 +1495,7 @@ ElfW(Addr)
|
||||
}
|
||||
}
|
||||
|
||||
struct obj_section *obj_find_section(struct obj_file *f, const char *name)
|
||||
static struct obj_section *obj_find_section(struct obj_file *f, const char *name)
|
||||
{
|
||||
int i, n = f->header.e_shnum;
|
||||
|
||||
@@ -1537,7 +1528,7 @@ static int obj_load_order_prio(struct obj_section *a)
|
||||
return ac;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec)
|
||||
{
|
||||
struct obj_section **p;
|
||||
@@ -1549,7 +1540,7 @@ obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec)
|
||||
*p = sec;
|
||||
}
|
||||
|
||||
struct obj_section *obj_create_alloced_section(struct obj_file *f,
|
||||
static struct obj_section *obj_create_alloced_section(struct obj_file *f,
|
||||
const char *name,
|
||||
unsigned long align,
|
||||
unsigned long size)
|
||||
@@ -1575,7 +1566,7 @@ struct obj_section *obj_create_alloced_section(struct obj_file *f,
|
||||
return sec;
|
||||
}
|
||||
|
||||
struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
|
||||
static struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
|
||||
const char *name,
|
||||
unsigned long align,
|
||||
unsigned long size)
|
||||
@@ -1604,7 +1595,7 @@ struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
|
||||
return sec;
|
||||
}
|
||||
|
||||
void *obj_extend_section(struct obj_section *sec, unsigned long more)
|
||||
static void *obj_extend_section(struct obj_section *sec, unsigned long more)
|
||||
{
|
||||
unsigned long oldsize = sec->header.sh_size;
|
||||
if (more) {
|
||||
@@ -1614,7 +1605,6 @@ void *obj_extend_section(struct obj_section *sec, unsigned long more)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Conditionally add the symbols from the given symbol set to the
|
||||
new module. */
|
||||
|
||||
@@ -2631,7 +2621,7 @@ new_init_module(const char *m_name, struct obj_file *f,
|
||||
|
||||
/*======================================================================*/
|
||||
|
||||
int
|
||||
static int
|
||||
obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
|
||||
const char *string)
|
||||
{
|
||||
@@ -2660,7 +2650,7 @@ obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
|
||||
struct obj_symbol *sym)
|
||||
{
|
||||
@@ -2676,7 +2666,7 @@ obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int obj_check_undefineds(struct obj_file *f)
|
||||
static int obj_check_undefineds(struct obj_file *f)
|
||||
{
|
||||
unsigned long i;
|
||||
int ret = 1;
|
||||
@@ -2698,7 +2688,7 @@ int obj_check_undefineds(struct obj_file *f)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void obj_allocate_commons(struct obj_file *f)
|
||||
static void obj_allocate_commons(struct obj_file *f)
|
||||
{
|
||||
struct common_entry {
|
||||
struct common_entry *next;
|
||||
@@ -2807,7 +2797,7 @@ void obj_allocate_commons(struct obj_file *f)
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long obj_load_size(struct obj_file *f)
|
||||
static unsigned long obj_load_size(struct obj_file *f)
|
||||
{
|
||||
unsigned long dot = 0;
|
||||
struct obj_section *sec;
|
||||
@@ -2828,7 +2818,7 @@ unsigned long obj_load_size(struct obj_file *f)
|
||||
return dot;
|
||||
}
|
||||
|
||||
int obj_relocate(struct obj_file *f, ElfW(Addr) base)
|
||||
static int obj_relocate(struct obj_file *f, ElfW(Addr) base)
|
||||
{
|
||||
int i, n = f->header.e_shnum;
|
||||
int ret = 1;
|
||||
@@ -2958,7 +2948,7 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int obj_create_image(struct obj_file *f, char *image)
|
||||
static int obj_create_image(struct obj_file *f, char *image)
|
||||
{
|
||||
struct obj_section *sec;
|
||||
ElfW(Addr) base = f->baseaddr;
|
||||
@@ -2980,7 +2970,7 @@ int obj_create_image(struct obj_file *f, char *image)
|
||||
|
||||
/*======================================================================*/
|
||||
|
||||
struct obj_file *obj_load(FILE * fp, int loadprogbits)
|
||||
static struct obj_file *obj_load(FILE * fp, int loadprogbits)
|
||||
{
|
||||
struct obj_file *f;
|
||||
ElfW(Shdr) * section_headers;
|
||||
@@ -3186,7 +3176,7 @@ struct obj_file *obj_load(FILE * fp, int loadprogbits)
|
||||
* kernel for the module
|
||||
*/
|
||||
|
||||
int obj_load_progbits(FILE * fp, struct obj_file* f)
|
||||
static int obj_load_progbits(FILE * fp, struct obj_file* f)
|
||||
{
|
||||
char* imagebase = (char*) f->imagebase;
|
||||
ElfW(Addr) base = f->baseaddr;
|
||||
|
||||
@@ -34,96 +34,11 @@
|
||||
static const int KILL = 0;
|
||||
static const int KILLALL = 1;
|
||||
|
||||
struct signal_name {
|
||||
const char *name;
|
||||
int number;
|
||||
};
|
||||
|
||||
static const struct signal_name signames[] = {
|
||||
/* POSIX signals */
|
||||
{ "HUP", SIGHUP }, /* 1 */
|
||||
{ "INT", SIGINT }, /* 2 */
|
||||
{ "QUIT", SIGQUIT }, /* 3 */
|
||||
{ "ILL", SIGILL }, /* 4 */
|
||||
{ "ABRT", SIGABRT }, /* 6 */
|
||||
{ "FPE", SIGFPE }, /* 8 */
|
||||
{ "KILL", SIGKILL }, /* 9 */
|
||||
{ "SEGV", SIGSEGV }, /* 11 */
|
||||
{ "PIPE", SIGPIPE }, /* 13 */
|
||||
{ "ALRM", SIGALRM }, /* 14 */
|
||||
{ "TERM", SIGTERM }, /* 15 */
|
||||
{ "USR1", SIGUSR1 }, /* 10 (arm,i386,m68k,ppc), 30 (alpha,sparc*), 16 (mips) */
|
||||
{ "USR2", SIGUSR2 }, /* 12 (arm,i386,m68k,ppc), 31 (alpha,sparc*), 17 (mips) */
|
||||
{ "CHLD", SIGCHLD }, /* 17 (arm,i386,m68k,ppc), 20 (alpha,sparc*), 18 (mips) */
|
||||
{ "CONT", SIGCONT }, /* 18 (arm,i386,m68k,ppc), 19 (alpha,sparc*), 25 (mips) */
|
||||
{ "STOP", SIGSTOP }, /* 19 (arm,i386,m68k,ppc), 17 (alpha,sparc*), 23 (mips) */
|
||||
{ "TSTP", SIGTSTP }, /* 20 (arm,i386,m68k,ppc), 18 (alpha,sparc*), 24 (mips) */
|
||||
{ "TTIN", SIGTTIN }, /* 21 (arm,i386,m68k,ppc,alpha,sparc*), 26 (mips) */
|
||||
{ "TTOU", SIGTTOU }, /* 22 (arm,i386,m68k,ppc,alpha,sparc*), 27 (mips) */
|
||||
/* Miscellaneous other signals */
|
||||
#ifdef SIGTRAP
|
||||
{ "TRAP", SIGTRAP }, /* 5 */
|
||||
#endif
|
||||
#ifdef SIGIOT
|
||||
{ "IOT", SIGIOT }, /* 6, same as SIGABRT */
|
||||
#endif
|
||||
#ifdef SIGEMT
|
||||
{ "EMT", SIGEMT }, /* 7 (mips,alpha,sparc*) */
|
||||
#endif
|
||||
#ifdef SIGBUS
|
||||
{ "BUS", SIGBUS }, /* 7 (arm,i386,m68k,ppc), 10 (mips,alpha,sparc*) */
|
||||
#endif
|
||||
#ifdef SIGSYS
|
||||
{ "SYS", SIGSYS }, /* 12 (mips,alpha,sparc*) */
|
||||
#endif
|
||||
#ifdef SIGSTKFLT
|
||||
{ "STKFLT", SIGSTKFLT }, /* 16 (arm,i386,m68k,ppc) */
|
||||
#endif
|
||||
#ifdef SIGURG
|
||||
{ "URG", SIGURG }, /* 23 (arm,i386,m68k,ppc), 16 (alpha,sparc*), 21 (mips) */
|
||||
#endif
|
||||
#ifdef SIGIO
|
||||
{ "IO", SIGIO }, /* 29 (arm,i386,m68k,ppc), 23 (alpha,sparc*), 22 (mips) */
|
||||
#endif
|
||||
#ifdef SIGPOLL
|
||||
{ "POLL", SIGPOLL }, /* same as SIGIO */
|
||||
#endif
|
||||
#ifdef SIGCLD
|
||||
{ "CLD", SIGCLD }, /* same as SIGCHLD (mips) */
|
||||
#endif
|
||||
#ifdef SIGXCPU
|
||||
{ "XCPU", SIGXCPU }, /* 24 (arm,i386,m68k,ppc,alpha,sparc*), 30 (mips) */
|
||||
#endif
|
||||
#ifdef SIGXFSZ
|
||||
{ "XFSZ", SIGXFSZ }, /* 25 (arm,i386,m68k,ppc,alpha,sparc*), 31 (mips) */
|
||||
#endif
|
||||
#ifdef SIGVTALRM
|
||||
{ "VTALRM", SIGVTALRM }, /* 26 (arm,i386,m68k,ppc,alpha,sparc*), 28 (mips) */
|
||||
#endif
|
||||
#ifdef SIGPROF
|
||||
{ "PROF", SIGPROF }, /* 27 (arm,i386,m68k,ppc,alpha,sparc*), 29 (mips) */
|
||||
#endif
|
||||
#ifdef SIGPWR
|
||||
{ "PWR", SIGPWR }, /* 30 (arm,i386,m68k,ppc), 29 (alpha,sparc*), 19 (mips) */
|
||||
#endif
|
||||
#ifdef SIGINFO
|
||||
{ "INFO", SIGINFO }, /* 29 (alpha) */
|
||||
#endif
|
||||
#ifdef SIGLOST
|
||||
{ "LOST", SIGLOST }, /* 29 (arm,i386,m68k,ppc,sparc*) */
|
||||
#endif
|
||||
#ifdef SIGWINCH
|
||||
{ "WINCH", SIGWINCH }, /* 28 (arm,i386,m68k,ppc,alpha,sparc*), 20 (mips) */
|
||||
#endif
|
||||
#ifdef SIGUNUSED
|
||||
{ "UNUSED", SIGUNUSED }, /* 31 (arm,i386,m68k,ppc) */
|
||||
#endif
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
extern int kill_main(int argc, char **argv)
|
||||
{
|
||||
int whichApp, sig = SIGTERM;
|
||||
const char *name;
|
||||
|
||||
#ifdef BB_KILLALL
|
||||
/* Figure out what we are trying to do here */
|
||||
@@ -142,53 +57,37 @@ extern int kill_main(int argc, char **argv)
|
||||
while (*++(*argv)) {
|
||||
switch (**argv) {
|
||||
case 'l':
|
||||
{
|
||||
if(argc>1) {
|
||||
for(argv++; *argv; argv++) {
|
||||
name = u_signal_names(*argv, &sig, -1);
|
||||
if(name!=NULL)
|
||||
printf("%s\n", name);
|
||||
}
|
||||
} else {
|
||||
int col = 0;
|
||||
const struct signal_name *s = signames;
|
||||
|
||||
while (s->name != 0) {
|
||||
col +=
|
||||
fprintf(stderr, "%2d) %-8s", s->number,
|
||||
(s++)->name);
|
||||
for(sig=1; sig < NSIG; sig++) {
|
||||
name = u_signal_names(0, &sig, 1);
|
||||
if(name==NULL) /* unnamed */
|
||||
continue;
|
||||
col += printf("%2d) %-16s", sig, name);
|
||||
if (col > 60) {
|
||||
fprintf(stderr, "\n");
|
||||
printf("\n");
|
||||
col = 0;
|
||||
}
|
||||
}
|
||||
fprintf(stderr, "\n\n");
|
||||
return EXIT_SUCCESS;
|
||||
printf("\n");
|
||||
}
|
||||
break;
|
||||
return EXIT_SUCCESS;
|
||||
case '-':
|
||||
show_usage();
|
||||
default:
|
||||
{
|
||||
if (isdigit(**argv)) {
|
||||
sig = atoi(*argv);
|
||||
if (sig < 0 || sig >= NSIG)
|
||||
goto end;
|
||||
else {
|
||||
argc--;
|
||||
argv++;
|
||||
goto do_it_now;
|
||||
}
|
||||
} else {
|
||||
const struct signal_name *s = signames;
|
||||
|
||||
while (s->name != 0) {
|
||||
if (strcasecmp(s->name, *argv) == 0) {
|
||||
sig = s->number;
|
||||
name = u_signal_names(*argv, &sig, 0);
|
||||
if(name==NULL)
|
||||
error_msg_and_die( "bad signal name: %s", *argv);
|
||||
argc--;
|
||||
argv++;
|
||||
goto do_it_now;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
if (s->name == 0)
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
@@ -240,8 +139,4 @@ extern int kill_main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
|
||||
end:
|
||||
error_msg_and_die( "bad signal name: %s", *argv);
|
||||
}
|
||||
@@ -170,9 +170,7 @@ static struct built_in_command bltins_forking[] = {
|
||||
};
|
||||
|
||||
|
||||
/* Variables we export */
|
||||
unsigned int shell_context; /* Used in cmdedit.c to reset the
|
||||
context when someone hits ^C */
|
||||
static int shell_context; /* Type prompt trigger (PS1 or PS2) */
|
||||
|
||||
|
||||
/* Globals that are static to this file */
|
||||
@@ -716,7 +714,6 @@ static int get_command(FILE * source, char *command)
|
||||
** child processes (rob@sysgo.de)
|
||||
*/
|
||||
cmdedit_read_input(prompt_str, command);
|
||||
cmdedit_terminate();
|
||||
return 0;
|
||||
#else
|
||||
fputs(prompt_str, stdout);
|
||||
@@ -1548,7 +1545,7 @@ static void setup_job_control()
|
||||
tcsetpgrp(shell_terminal, shell_pgrp);
|
||||
}
|
||||
|
||||
int shell_main(int argc_l, char **argv_l)
|
||||
int lash_main(int argc_l, char **argv_l)
|
||||
{
|
||||
int opt, interactive=FALSE;
|
||||
FILE *input = stdin;
|
||||
@@ -1557,7 +1554,6 @@ int shell_main(int argc_l, char **argv_l)
|
||||
|
||||
/* These variables need re-initializing when recursing */
|
||||
last_jobid = 0;
|
||||
shell_context = 0;
|
||||
local_pending_command = NULL;
|
||||
close_me_head = NULL;
|
||||
job_list.head = NULL;
|
||||
|
||||
+263
@@ -0,0 +1,263 @@
|
||||
/* Copyright (c) 2001 Aaron Lehmann <aaronl@vitelus.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* This is my infix parser/evaluator. It is optimized for size, intended
|
||||
* as a replacement for yacc-based parsers. However, it may well be faster
|
||||
* than a comparable parser writen in yacc. The supported operators are
|
||||
* listed in #defines below. Parens, order of operations, and error handling
|
||||
* are supported. This code is threadsafe. */
|
||||
|
||||
/* To use the routine, call it with an expression string. It returns an
|
||||
* integer result. You will also need to define an "error" function
|
||||
* that takes printf arguments and _does not return_, or modify the code
|
||||
* to use another error mechanism. */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "libbb.h"
|
||||
|
||||
typedef char operator;
|
||||
|
||||
#define tok_decl(prec,id) (((id)<<5)|(prec))
|
||||
#define PREC(op) ((op)&0x1F)
|
||||
|
||||
#define TOK_LPAREN tok_decl(0,0)
|
||||
|
||||
#define TOK_OR tok_decl(1,0)
|
||||
|
||||
#define TOK_AND tok_decl(2,0)
|
||||
|
||||
#define TOK_BOR tok_decl(3,0)
|
||||
|
||||
#define TOK_BXOR tok_decl(4,0)
|
||||
|
||||
#define TOK_BAND tok_decl(5,0)
|
||||
|
||||
#define TOK_EQ tok_decl(6,0)
|
||||
#define TOK_NE tok_decl(6,1)
|
||||
|
||||
#define TOK_LT tok_decl(7,0)
|
||||
#define TOK_GT tok_decl(7,1)
|
||||
#define TOK_GE tok_decl(7,2)
|
||||
#define TOK_LE tok_decl(7,3)
|
||||
|
||||
#define TOK_LSHIFT tok_decl(8,0)
|
||||
#define TOK_RSHIFT tok_decl(8,1)
|
||||
|
||||
#define TOK_ADD tok_decl(9,0)
|
||||
#define TOK_SUB tok_decl(9,1)
|
||||
|
||||
#define TOK_MUL tok_decl(10,0)
|
||||
#define TOK_DIV tok_decl(10,1)
|
||||
#define TOK_REM tok_decl(10,2)
|
||||
|
||||
#define UNARYPREC 14
|
||||
#define TOK_BNOT tok_decl(UNARYPREC,0)
|
||||
#define TOK_NOT tok_decl(UNARYPREC,1)
|
||||
#define TOK_UMINUS tok_decl(UNARYPREC,2)
|
||||
|
||||
#define TOK_NUM tok_decl(15,0)
|
||||
|
||||
#define ARITH_APPLY(op) arith_apply(op, numstack, &numstackptr)
|
||||
#define NUMPTR (*numstackptr)
|
||||
static short arith_apply(operator op, long *numstack, long **numstackptr)
|
||||
{
|
||||
if (NUMPTR == numstack) goto err;
|
||||
if (op == TOK_UMINUS)
|
||||
NUMPTR[-1] *= -1;
|
||||
else if (op == TOK_NOT)
|
||||
NUMPTR[-1] = !(NUMPTR[-1]);
|
||||
else if (op == TOK_BNOT)
|
||||
NUMPTR[-1] = ~(NUMPTR[-1]);
|
||||
|
||||
/* Binary operators */
|
||||
else {
|
||||
if (NUMPTR-1 == numstack) goto err;
|
||||
--NUMPTR;
|
||||
if (op == TOK_BOR)
|
||||
NUMPTR[-1] |= *NUMPTR;
|
||||
else if (op == TOK_OR)
|
||||
NUMPTR[-1] = *NUMPTR || NUMPTR[-1];
|
||||
else if (op == TOK_BAND)
|
||||
NUMPTR[-1] &= *NUMPTR;
|
||||
else if (op == TOK_AND)
|
||||
NUMPTR[-1] = NUMPTR[-1] && *NUMPTR;
|
||||
else if (op == TOK_EQ)
|
||||
NUMPTR[-1] = (NUMPTR[-1] == *NUMPTR);
|
||||
else if (op == TOK_NE)
|
||||
NUMPTR[-1] = (NUMPTR[-1] != *NUMPTR);
|
||||
else if (op == TOK_GE)
|
||||
NUMPTR[-1] = (NUMPTR[-1] >= *NUMPTR);
|
||||
else if (op == TOK_RSHIFT)
|
||||
NUMPTR[-1] >>= *NUMPTR;
|
||||
else if (op == TOK_LSHIFT)
|
||||
NUMPTR[-1] <<= *NUMPTR;
|
||||
else if (op == TOK_GT)
|
||||
NUMPTR[-1] = (NUMPTR[-1] > *NUMPTR);
|
||||
else if (op == TOK_LT)
|
||||
NUMPTR[-1] = (NUMPTR[-1] < *NUMPTR);
|
||||
else if (op == TOK_LE)
|
||||
NUMPTR[-1] = (NUMPTR[-1] <= *NUMPTR);
|
||||
else if (op == TOK_MUL)
|
||||
NUMPTR[-1] *= *NUMPTR;
|
||||
else if (op == TOK_DIV) {
|
||||
if(*NUMPTR==0)
|
||||
return -2;
|
||||
NUMPTR[-1] /= *NUMPTR;
|
||||
}
|
||||
else if (op == TOK_REM) {
|
||||
if(*NUMPTR==0)
|
||||
return -2;
|
||||
NUMPTR[-1] %= *NUMPTR;
|
||||
}
|
||||
else if (op == TOK_ADD)
|
||||
NUMPTR[-1] += *NUMPTR;
|
||||
else if (op == TOK_SUB)
|
||||
NUMPTR[-1] -= *NUMPTR;
|
||||
}
|
||||
return 0;
|
||||
err: return(-1);
|
||||
}
|
||||
|
||||
extern long arith (const char *startbuf, int *errcode)
|
||||
{
|
||||
register char arithval;
|
||||
const char *expr = startbuf;
|
||||
|
||||
operator lasttok = TOK_MUL, op;
|
||||
size_t datasizes = strlen(startbuf);
|
||||
unsigned char prec;
|
||||
|
||||
long *numstack, *numstackptr;
|
||||
operator *stack = alloca(datasizes * sizeof(operator)), *stackptr = stack;
|
||||
|
||||
*errcode = 0;
|
||||
numstack = alloca((datasizes/2+1)*sizeof(long)), numstackptr = numstack;
|
||||
|
||||
while ((arithval = *expr)) {
|
||||
if (arithval == ' ' || arithval == '\n' || arithval == '\t')
|
||||
goto prologue;
|
||||
if ((unsigned)arithval-'0' <= 9) /* isdigit */ {
|
||||
*numstackptr++ = strtol(expr, (char **) &expr, 10);
|
||||
lasttok = TOK_NUM;
|
||||
continue;
|
||||
} if (arithval == '(') {
|
||||
*stackptr++ = TOK_LPAREN;
|
||||
lasttok = TOK_LPAREN;
|
||||
goto prologue;
|
||||
} if (arithval == ')') {
|
||||
lasttok = TOK_NUM;
|
||||
while (stackptr != stack) {
|
||||
op = *--stackptr;
|
||||
if (op == TOK_LPAREN)
|
||||
goto prologue;
|
||||
*errcode = ARITH_APPLY(op);
|
||||
if(*errcode) return *errcode;
|
||||
}
|
||||
goto err; /* Mismatched parens */
|
||||
} if (arithval == '|') {
|
||||
if (*++expr == '|')
|
||||
op = TOK_OR;
|
||||
else {
|
||||
--expr;
|
||||
op = TOK_BOR;
|
||||
}
|
||||
} else if (arithval == '&') {
|
||||
if (*++expr == '&')
|
||||
op = TOK_AND;
|
||||
else {
|
||||
--expr;
|
||||
op = TOK_BAND;
|
||||
}
|
||||
} else if (arithval == '=') {
|
||||
if (*++expr != '=') goto err; /* Unknown token */
|
||||
op = TOK_EQ;
|
||||
} else if (arithval == '!') {
|
||||
if (*++expr == '=')
|
||||
op = TOK_NE;
|
||||
else {
|
||||
--expr;
|
||||
op = TOK_NOT;
|
||||
}
|
||||
} else if (arithval == '>') {
|
||||
switch (*++expr) {
|
||||
case '=':
|
||||
op = TOK_GE;
|
||||
break;
|
||||
case '>':
|
||||
op = TOK_RSHIFT;
|
||||
break;
|
||||
default:
|
||||
--expr;
|
||||
op = TOK_GT;
|
||||
}
|
||||
} else if (arithval == '<') {
|
||||
switch (*++expr) {
|
||||
case '=':
|
||||
op = TOK_LE;
|
||||
break;
|
||||
case '<':
|
||||
op = TOK_LSHIFT;
|
||||
break;
|
||||
default:
|
||||
--expr;
|
||||
op = TOK_LT;
|
||||
}
|
||||
} else if (arithval == '*')
|
||||
op = TOK_MUL;
|
||||
else if (arithval == '/')
|
||||
op = TOK_DIV;
|
||||
else if (arithval == '%')
|
||||
op = TOK_REM;
|
||||
else if (arithval == '+') {
|
||||
if (lasttok != TOK_NUM) goto prologue; /* Unary plus */
|
||||
op = TOK_ADD;
|
||||
} else if (arithval == '-')
|
||||
op = (lasttok == TOK_NUM) ? TOK_SUB : TOK_UMINUS;
|
||||
else if (arithval == '~')
|
||||
op = TOK_BNOT;
|
||||
else goto err; /* Unknown token */
|
||||
|
||||
prec = PREC(op);
|
||||
if (prec != UNARYPREC)
|
||||
while (stackptr != stack && PREC(stackptr[-1]) >= prec) {
|
||||
*errcode = ARITH_APPLY(*--stackptr);
|
||||
if(*errcode) return *errcode;
|
||||
}
|
||||
*stackptr++ = op;
|
||||
lasttok = op;
|
||||
prologue: ++expr;
|
||||
} /* yay */
|
||||
|
||||
while (stackptr != stack) {
|
||||
*errcode = ARITH_APPLY(*--stackptr);
|
||||
if(*errcode) return *errcode;
|
||||
}
|
||||
if (numstackptr != numstack+1) {
|
||||
err:
|
||||
*errcode = -1;
|
||||
return -1;
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
return *numstack;
|
||||
}
|
||||
@@ -17,7 +17,7 @@ extern char *concat_path_file(const char *path, const char *filename)
|
||||
if (!path)
|
||||
path="";
|
||||
lc = last_char_is(path, '/');
|
||||
if (filename[0] == '/')
|
||||
while (*filename == '/')
|
||||
filename++;
|
||||
outbuf = xmalloc(strlen(path)+strlen(filename)+1+(lc==NULL));
|
||||
sprintf(outbuf, "%s%s%s", path, (lc==NULL)? "/" : "", filename);
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Utility routines.
|
||||
*
|
||||
* create raw socket for icmp protocol test permision
|
||||
* and drop root privilegies if running setuid
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include "libbb.h"
|
||||
|
||||
int create_icmp_socket(void)
|
||||
{
|
||||
struct protoent *proto;
|
||||
int sock;
|
||||
|
||||
proto = getprotobyname("icmp");
|
||||
/* if getprotobyname failed, just silently force
|
||||
* proto->p_proto to have the correct value for "icmp" */
|
||||
if ((sock = socket(AF_INET, SOCK_RAW,
|
||||
(proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */
|
||||
if (errno == EPERM)
|
||||
error_msg_and_die("permission denied. (are you root?)");
|
||||
else
|
||||
perror_msg_and_die(can_not_create_raw_socket);
|
||||
}
|
||||
|
||||
/* drop root privs if running setuid */
|
||||
setuid(getuid());
|
||||
|
||||
return sock;
|
||||
}
|
||||
+4
-4
@@ -98,15 +98,15 @@ int get_console_fd(char *tty_name)
|
||||
return fd;
|
||||
}
|
||||
|
||||
fd = open_a_console("/dev/tty");
|
||||
fd = open_a_console(CURRENT_TTY);
|
||||
if (fd >= 0)
|
||||
return fd;
|
||||
|
||||
fd = open_a_console("/dev/tty0");
|
||||
fd = open_a_console(CURRENT_VC);
|
||||
if (fd >= 0)
|
||||
return fd;
|
||||
|
||||
fd = open_a_console("/dev/console");
|
||||
fd = open_a_console(CONSOLE_DEV);
|
||||
if (fd >= 0)
|
||||
return fd;
|
||||
|
||||
@@ -114,7 +114,7 @@ int get_console_fd(char *tty_name)
|
||||
if (is_a_console(fd))
|
||||
return fd;
|
||||
|
||||
error_msg("Couldnt get a file descriptor referring to the console");
|
||||
error_msg("Couldn't get a file descriptor referring to the console");
|
||||
return -1; /* total failure */
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@ extern FILE *gz_open(FILE *compressed_file, int *pid)
|
||||
return(NULL);
|
||||
}
|
||||
if ((*pid = fork()) == -1) {
|
||||
error_msg("fork failured");
|
||||
error_msg("fork failed");
|
||||
return(NULL);
|
||||
}
|
||||
if (*pid==0) {
|
||||
@@ -29,7 +29,7 @@ extern FILE *gz_open(FILE *compressed_file, int *pid)
|
||||
}
|
||||
close(unzip_pipe[1]);
|
||||
if (unzip_pipe[0] == -1) {
|
||||
error_msg("Couldnt initialise gzip stream");
|
||||
error_msg("gzip stream init failed");
|
||||
}
|
||||
return(fdopen(unzip_pipe[0], "r"));
|
||||
}
|
||||
+5
-2
@@ -3,7 +3,7 @@
|
||||
* that either displays or sets the characteristics of
|
||||
* one or more of the system's networking interfaces.
|
||||
*
|
||||
* Version: $Id: interface.c,v 1.3 2001/06/01 21:47:15 andersen Exp $
|
||||
* Version: $Id: interface.c,v 1.4 2001/07/19 22:28:02 andersen Exp $
|
||||
*
|
||||
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
|
||||
* and others. Copyright 1993 MicroWalt Corporation
|
||||
@@ -78,7 +78,9 @@
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#if 0
|
||||
#include <arpa/nameser.h>
|
||||
#endif
|
||||
#include "libbb.h"
|
||||
|
||||
#define _(x) x
|
||||
@@ -455,9 +457,11 @@ static int INET_rresolve(char *name, size_t len, struct sockaddr_in *s_in,
|
||||
#ifdef DEBUG
|
||||
fprintf (stderr, "getnetbyaddr (%08lx)\n", host_ad);
|
||||
#endif
|
||||
#if 0
|
||||
np = getnetbyaddr(host_ad, AF_INET);
|
||||
if (np != NULL)
|
||||
safe_strncpy(name, np->n_name, len);
|
||||
#endif
|
||||
}
|
||||
if ((ent == NULL) && (np == NULL))
|
||||
safe_strncpy(name, inet_ntoa(s_in->sin_addr), len);
|
||||
@@ -1068,7 +1072,6 @@ static int if_readconf(void)
|
||||
struct ifconf ifc;
|
||||
struct ifreq *ifr;
|
||||
int n, err = -1;
|
||||
/* XXX Should this re-use the global skfd? */
|
||||
int skfd2;
|
||||
|
||||
/* SIOCGIFCONF currently seems to only work properly on AF_INET sockets
|
||||
|
||||
+43
-5
@@ -41,11 +41,13 @@
|
||||
#include "../busybox.h"
|
||||
#endif
|
||||
|
||||
#if __GNU_LIBRARY__ < 5
|
||||
#if (__GNU_LIBRARY__ < 5) && (!defined __dietlibc__)
|
||||
/* libc5 doesn't define socklen_t */
|
||||
typedef unsigned int socklen_t;
|
||||
/* libc5 doesn't implement BSD 4.4 daemon() */
|
||||
extern int daemon (int nochdir, int noclose);
|
||||
/* libc5 doesn't implement strtok_r */
|
||||
char *strtok_r(char *s, const char *delim, char **ptrptr);
|
||||
#endif
|
||||
|
||||
/* Some useful definitions */
|
||||
@@ -212,6 +214,8 @@ char *xreadlink(const char *path);
|
||||
char *concat_path_file(const char *path, const char *filename);
|
||||
char *last_char_is(const char *s, int c);
|
||||
|
||||
extern long arith (const char *startbuf, int *errcode);
|
||||
|
||||
typedef struct file_headers_s {
|
||||
char *name;
|
||||
char *link_name;
|
||||
@@ -237,13 +241,15 @@ enum extract_functions_e {
|
||||
extract_control_tar_gz = 128,
|
||||
extract_unzip_only = 256,
|
||||
extract_unconditional = 512,
|
||||
extract_create_leading_dirs = 1024
|
||||
extract_create_leading_dirs = 1024,
|
||||
extract_quiet = 2048,
|
||||
extract_exclude_list = 4096
|
||||
};
|
||||
char *unarchive(FILE *src_stream, file_header_t *(*get_header)(FILE *),
|
||||
char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_header)(FILE *),
|
||||
const int extract_function, const char *prefix, char **extract_names);
|
||||
char *deb_extract(const char *package_filename, FILE *out_stream, const int extract_function,
|
||||
const char *prefix, const char *filename);
|
||||
char *read_package_field(const char *package_buffer);
|
||||
int read_package_field(const char *package_buffer, char **field_name, char **field_value);
|
||||
char *fgets_str(FILE *file, const char *terminating_string);
|
||||
|
||||
extern int unzip(FILE *l_in_file, FILE *l_out_file);
|
||||
@@ -251,10 +257,13 @@ extern void gz_close(int gunzip_pid);
|
||||
extern FILE *gz_open(FILE *compressed_file, int *pid);
|
||||
|
||||
extern struct hostent *xgethostbyname(const char *name);
|
||||
extern int create_icmp_socket(void);
|
||||
|
||||
char *dirname (const char *path);
|
||||
|
||||
int make_directory (char *path, mode_t mode, int flags);
|
||||
int make_directory (char *path, long mode, int flags);
|
||||
|
||||
const char *u_signal_names(const char *str_sig, int *signo, int startnum);
|
||||
|
||||
#define CT_AUTO 0
|
||||
#define CT_UNIX2DOS 1
|
||||
@@ -283,5 +292,34 @@ extern const char * const write_error;
|
||||
extern const char * const too_few_args;
|
||||
extern const char * const name_longer_than_foo;
|
||||
extern const char * const unknown;
|
||||
extern const char * const can_not_create_raw_socket;
|
||||
|
||||
#ifdef BB_FEATURE_DEVFS
|
||||
# define CURRENT_VC "/dev/vc/0"
|
||||
# define VC_1 "/dev/vc/1"
|
||||
# define VC_2 "/dev/vc/2"
|
||||
# define VC_3 "/dev/vc/3"
|
||||
# define VC_4 "/dev/vc/4"
|
||||
# define VC_5 "/dev/vc/5"
|
||||
# define SC_0 "/dev/tts/0"
|
||||
# define SC_1 "/dev/tts/1"
|
||||
# define VC_FORMAT "/dev/vc/%d"
|
||||
# define SC_FORMAT "/dev/tts/%d"
|
||||
#else
|
||||
# define CURRENT_VC "/dev/tty0"
|
||||
# define VC_1 "/dev/tty1"
|
||||
# define VC_2 "/dev/tty2"
|
||||
# define VC_3 "/dev/tty3"
|
||||
# define VC_4 "/dev/tty4"
|
||||
# define VC_5 "/dev/tty5"
|
||||
# define SC_0 "/dev/ttyS0"
|
||||
# define SC_1 "/dev/ttyS1"
|
||||
# define VC_FORMAT "/dev/tty%d"
|
||||
# define SC_FORMAT "/dev/ttyS%d"
|
||||
#endif
|
||||
|
||||
/* The following devices are the same on devfs and non-devfs systems. */
|
||||
#define CURRENT_TTY "/dev/tty"
|
||||
#define CONSOLE_DEV "/dev/console"
|
||||
|
||||
#endif /* __LIBBB_H__ */
|
||||
@@ -1,4 +1,77 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
|
||||
|
||||
#include <features.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <paths.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#if __GNU_LIBRARY__ < 5
|
||||
|
||||
|
||||
/* Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
/*
|
||||
* Modified by Manuel Novoa III Mar 1, 2001
|
||||
*
|
||||
* Converted original strtok.c code of strtok to __strtok_r.
|
||||
* Cleaned up logic and reduced code size.
|
||||
*/
|
||||
|
||||
|
||||
char *strtok_r(char *s, const char *delim, char **save_ptr)
|
||||
{
|
||||
char *token;
|
||||
|
||||
token = 0; /* Initialize to no token. */
|
||||
|
||||
if (s == 0) { /* If not first time called... */
|
||||
s = *save_ptr; /* restart from where we left off. */
|
||||
}
|
||||
|
||||
if (s != 0) { /* If not finished... */
|
||||
*save_ptr = 0;
|
||||
|
||||
s += strspn(s, delim); /* Skip past any leading delimiters. */
|
||||
if (*s != '\0') { /* We have a token. */
|
||||
token = s;
|
||||
*save_ptr = strpbrk(token, delim); /* Find token's end. */
|
||||
if (*save_ptr != 0) {
|
||||
/* Terminate the token and make SAVE_PTR point past it. */
|
||||
*(*save_ptr)++ = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return token;
|
||||
}
|
||||
|
||||
/* Basically getdelim() with the delimiter hard wired to '\n' */
|
||||
ssize_t getline(char **linebuf, size_t *n, FILE *file)
|
||||
{
|
||||
return (getdelim (linebuf, n, '\n', file));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* daemon implementation for uClibc
|
||||
*
|
||||
@@ -26,14 +99,6 @@
|
||||
* Original copyright notice is retained at the end of this file.
|
||||
*/
|
||||
|
||||
#include <features.h>
|
||||
#include <fcntl.h>
|
||||
#include <paths.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#if __GNU_LIBRARY__ < 5
|
||||
|
||||
int daemon( int nochdir, int noclose )
|
||||
{
|
||||
int fd;
|
||||
@@ -62,7 +127,6 @@ int daemon( int nochdir, int noclose )
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*-
|
||||
@@ -99,3 +163,5 @@ int daemon( int nochdir, int noclose )
|
||||
*/
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
* Also create parent directories as necessary if flags contains
|
||||
* FILEUTILS_RECUR. */
|
||||
|
||||
int make_directory (char *path, mode_t mode, int flags)
|
||||
int make_directory (char *path, long mode, int flags)
|
||||
{
|
||||
if (!(flags & FILEUTILS_RECUR)) {
|
||||
if (mkdir (path, 0777) < 0) {
|
||||
|
||||
@@ -62,3 +62,6 @@
|
||||
const char * const unknown = "(unknown)";
|
||||
#endif
|
||||
|
||||
#ifdef L_can_not_create_raw_socket
|
||||
const char * const can_not_create_raw_socket = "can`t create raw socket";
|
||||
#endif
|
||||
+78
-17
@@ -3,28 +3,89 @@
|
||||
#include "libbb.h"
|
||||
|
||||
/*
|
||||
* Returns a [multi-line] package field
|
||||
* Gets the next package field from package_buffer, seperated into the field name
|
||||
* and field value, it returns the int offset to the first character of the next field
|
||||
*/
|
||||
extern char *read_package_field(const char *package_buffer)
|
||||
int read_package_field(const char *package_buffer, char **field_name, char **field_value)
|
||||
{
|
||||
char *field = NULL;
|
||||
int field_length = 0;
|
||||
int buffer_length = 0;
|
||||
int offset_name_start = 0;
|
||||
int offset_name_end = 0;
|
||||
int offset_value_start = 0;
|
||||
int offset_value_end = 0;
|
||||
int offset = 0;
|
||||
int next_offset;
|
||||
int name_length;
|
||||
int value_length;
|
||||
int exit_flag = FALSE;
|
||||
|
||||
buffer_length = strlen(package_buffer);
|
||||
|
||||
while ((field = strchr(&package_buffer[field_length], '\n')) != NULL) {
|
||||
field_length = buffer_length - strlen(field);
|
||||
if (package_buffer[field_length + 1] != ' ') {
|
||||
break;
|
||||
} else {
|
||||
field_length++;
|
||||
}
|
||||
if (package_buffer == NULL) {
|
||||
*field_name = NULL;
|
||||
*field_value = NULL;
|
||||
return(-1);
|
||||
}
|
||||
if (field_length == 0) {
|
||||
return(NULL);
|
||||
while (1) {
|
||||
next_offset = offset + 1;
|
||||
switch (package_buffer[offset]) {
|
||||
case('\0'):
|
||||
exit_flag = TRUE;
|
||||
break;
|
||||
case(':'):
|
||||
if (offset_name_end == 0) {
|
||||
offset_name_end = offset;
|
||||
offset_value_start = next_offset;
|
||||
}
|
||||
/* TODO: Name might still have trailing spaces if ':' isnt
|
||||
* immediately after name */
|
||||
break;
|
||||
case('\n'):
|
||||
/* TODO: The char next_offset may be out of bounds */
|
||||
if (package_buffer[next_offset] != ' ') {
|
||||
exit_flag = TRUE;
|
||||
break;
|
||||
}
|
||||
case('\t'):
|
||||
case(' '):
|
||||
/* increment the value start point if its a just filler */
|
||||
if (offset_name_start == offset) {
|
||||
offset_name_start++;
|
||||
}
|
||||
if (offset_value_start == offset) {
|
||||
offset_value_start++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (exit_flag == TRUE) {
|
||||
/* Check that the names are valid */
|
||||
offset_value_end = offset;
|
||||
name_length = offset_name_end - offset_name_start;
|
||||
value_length = offset_value_end - offset_value_start;
|
||||
if (name_length == 0) {
|
||||
break;
|
||||
}
|
||||
if ((name_length > 0) && (value_length > 0)) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* If not valid, start fresh with next field */
|
||||
exit_flag = FALSE;
|
||||
offset_name_start = offset + 1;
|
||||
offset_name_end = 0;
|
||||
offset_value_start = offset + 1;
|
||||
offset_value_end = offset + 1;
|
||||
offset++;
|
||||
}
|
||||
offset++;
|
||||
}
|
||||
if (name_length == 0) {
|
||||
*field_name = NULL;
|
||||
} else {
|
||||
return(xstrndup(package_buffer, field_length));
|
||||
*field_name = xstrndup(&package_buffer[offset_name_start], name_length);
|
||||
}
|
||||
if (value_length > 0) {
|
||||
*field_value = xstrndup(&package_buffer[offset_value_start], value_length);
|
||||
} else {
|
||||
*field_value = NULL;
|
||||
}
|
||||
return(next_offset);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
struct signal_name {
|
||||
const char *name;
|
||||
int number;
|
||||
};
|
||||
|
||||
static const struct signal_name signames[] = {
|
||||
/* POSIX signals */
|
||||
{ "EXIT", 0 }, /* 0 */
|
||||
{ "HUP", SIGHUP }, /* 1 */
|
||||
{ "INT", SIGINT }, /* 2 */
|
||||
{ "QUIT", SIGQUIT }, /* 3 */
|
||||
{ "ILL", SIGILL }, /* 4 */
|
||||
{ "ABRT", SIGABRT }, /* 6 */
|
||||
{ "FPE", SIGFPE }, /* 8 */
|
||||
{ "KILL", SIGKILL }, /* 9 */
|
||||
{ "SEGV", SIGSEGV }, /* 11 */
|
||||
{ "PIPE", SIGPIPE }, /* 13 */
|
||||
{ "ALRM", SIGALRM }, /* 14 */
|
||||
{ "TERM", SIGTERM }, /* 15 */
|
||||
{ "USR1", SIGUSR1 }, /* 10 (arm,i386,m68k,ppc), 30 (alpha,sparc*), 16 (mips) */
|
||||
{ "USR2", SIGUSR2 }, /* 12 (arm,i386,m68k,ppc), 31 (alpha,sparc*), 17 (mips) */
|
||||
{ "CHLD", SIGCHLD }, /* 17 (arm,i386,m68k,ppc), 20 (alpha,sparc*), 18 (mips) */
|
||||
{ "CONT", SIGCONT }, /* 18 (arm,i386,m68k,ppc), 19 (alpha,sparc*), 25 (mips) */
|
||||
{ "STOP", SIGSTOP }, /* 19 (arm,i386,m68k,ppc), 17 (alpha,sparc*), 23 (mips) */
|
||||
{ "TSTP", SIGTSTP }, /* 20 (arm,i386,m68k,ppc), 18 (alpha,sparc*), 24 (mips) */
|
||||
{ "TTIN", SIGTTIN }, /* 21 (arm,i386,m68k,ppc,alpha,sparc*), 26 (mips) */
|
||||
{ "TTOU", SIGTTOU }, /* 22 (arm,i386,m68k,ppc,alpha,sparc*), 27 (mips) */
|
||||
/* Miscellaneous other signals */
|
||||
#ifdef SIGTRAP
|
||||
{ "TRAP", SIGTRAP }, /* 5 */
|
||||
#endif
|
||||
#ifdef SIGIOT
|
||||
{ "IOT", SIGIOT }, /* 6, same as SIGABRT */
|
||||
#endif
|
||||
#ifdef SIGEMT
|
||||
{ "EMT", SIGEMT }, /* 7 (mips,alpha,sparc*) */
|
||||
#endif
|
||||
#ifdef SIGBUS
|
||||
{ "BUS", SIGBUS }, /* 7 (arm,i386,m68k,ppc), 10 (mips,alpha,sparc*) */
|
||||
#endif
|
||||
#ifdef SIGSYS
|
||||
{ "SYS", SIGSYS }, /* 12 (mips,alpha,sparc*) */
|
||||
#endif
|
||||
#ifdef SIGSTKFLT
|
||||
{ "STKFLT", SIGSTKFLT }, /* 16 (arm,i386,m68k,ppc) */
|
||||
#endif
|
||||
#ifdef SIGURG
|
||||
{ "URG", SIGURG }, /* 23 (arm,i386,m68k,ppc), 16 (alpha,sparc*), 21 (mips) */
|
||||
#endif
|
||||
#ifdef SIGIO
|
||||
{ "IO", SIGIO }, /* 29 (arm,i386,m68k,ppc), 23 (alpha,sparc*), 22 (mips) */
|
||||
#endif
|
||||
#ifdef SIGPOLL
|
||||
{ "POLL", SIGPOLL }, /* same as SIGIO */
|
||||
#endif
|
||||
#ifdef SIGCLD
|
||||
{ "CLD", SIGCLD }, /* same as SIGCHLD (mips) */
|
||||
#endif
|
||||
#ifdef SIGXCPU
|
||||
{ "XCPU", SIGXCPU }, /* 24 (arm,i386,m68k,ppc,alpha,sparc*), 30 (mips) */
|
||||
#endif
|
||||
#ifdef SIGXFSZ
|
||||
{ "XFSZ", SIGXFSZ }, /* 25 (arm,i386,m68k,ppc,alpha,sparc*), 31 (mips) */
|
||||
#endif
|
||||
#ifdef SIGVTALRM
|
||||
{ "VTALRM", SIGVTALRM }, /* 26 (arm,i386,m68k,ppc,alpha,sparc*), 28 (mips) */
|
||||
#endif
|
||||
#ifdef SIGPROF
|
||||
{ "PROF", SIGPROF }, /* 27 (arm,i386,m68k,ppc,alpha,sparc*), 29 (mips) */
|
||||
#endif
|
||||
#ifdef SIGPWR
|
||||
{ "PWR", SIGPWR }, /* 30 (arm,i386,m68k,ppc), 29 (alpha,sparc*), 19 (mips) */
|
||||
#endif
|
||||
#ifdef SIGINFO
|
||||
{ "INFO", SIGINFO }, /* 29 (alpha) */
|
||||
#endif
|
||||
#ifdef SIGLOST
|
||||
{ "LOST", SIGLOST }, /* 29 (arm,i386,m68k,ppc,sparc*) */
|
||||
#endif
|
||||
#ifdef SIGWINCH
|
||||
{ "WINCH", SIGWINCH }, /* 28 (arm,i386,m68k,ppc,alpha,sparc*), 20 (mips) */
|
||||
#endif
|
||||
#ifdef SIGUNUSED
|
||||
{ "UNUSED", SIGUNUSED }, /* 31 (arm,i386,m68k,ppc) */
|
||||
#endif
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
if str_sig == NULL returned signal name [*signo],
|
||||
if str_sig != NULL - set *signo from signal_name,
|
||||
findings with digit number or with or without SIG-prefix name
|
||||
|
||||
if startnum=0 flag for support finding zero signal,
|
||||
but str_sig="0" always found, (hmm - standart or realize?)
|
||||
if startnum<0 returned reverse signal_number <-> signal_name
|
||||
if found error - returned NULL
|
||||
|
||||
*/
|
||||
|
||||
const char *
|
||||
u_signal_names(const char *str_sig, int *signo, int startnum)
|
||||
{
|
||||
static char retstr[16];
|
||||
const struct signal_name *s = signames;
|
||||
static const char prefix[] = "SIG";
|
||||
const char *sptr;
|
||||
|
||||
if(startnum)
|
||||
s++;
|
||||
if(str_sig==NULL) {
|
||||
while (s->name != 0) {
|
||||
if(s->number == *signo)
|
||||
break;
|
||||
s++;
|
||||
}
|
||||
} else {
|
||||
if (isdigit(((unsigned char)*str_sig))) {
|
||||
char *endp;
|
||||
long int sn = strtol(str_sig, &endp, 10);
|
||||
/* test correct and overflow */
|
||||
if(*endp == 0 && sn >= 0 && sn < NSIG) {
|
||||
*signo = (int)sn;
|
||||
/* test for unnamed */
|
||||
sptr = u_signal_names(0, signo, 0);
|
||||
if(sptr==NULL)
|
||||
return NULL;
|
||||
if(sn!=0)
|
||||
sptr += 3;
|
||||
return sptr;
|
||||
}
|
||||
} else {
|
||||
sptr = str_sig;
|
||||
while (s->name != 0) {
|
||||
if (strcasecmp(s->name, sptr) == 0) {
|
||||
*signo = s->number;
|
||||
if(startnum<0) {
|
||||
sprintf(retstr, "%d", *signo);
|
||||
return retstr;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(s!=signames && sptr == str_sig &&
|
||||
strncasecmp(sptr, prefix, 3) == 0) {
|
||||
sptr += 3; /* strlen(prefix) */
|
||||
continue;
|
||||
}
|
||||
sptr = str_sig;
|
||||
s++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(s->name==0)
|
||||
return NULL;
|
||||
if(s!=signames)
|
||||
strcpy(retstr, prefix);
|
||||
else
|
||||
retstr[0] = 0;
|
||||
return strcat(retstr, s->name);
|
||||
}
|
||||
+56
-29
@@ -82,8 +82,11 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
|
||||
/* strip leading '/' in filename to extract as prefix may not be dir */
|
||||
/* Cant use concat_path_file here as prefix might not be a directory */
|
||||
char *path = file_entry->name;
|
||||
if (*path == '/') {
|
||||
path++;
|
||||
if (strncmp("./", path, 2) == 0) {
|
||||
path += 2;
|
||||
if (strlen(path) == 0) {
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
full_name = xmalloc(strlen(prefix) + strlen(path) + 1);
|
||||
strcpy(full_name, prefix);
|
||||
@@ -91,7 +94,6 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
|
||||
} else {
|
||||
full_name = file_entry->name;
|
||||
}
|
||||
|
||||
if (function & extract_to_stdout) {
|
||||
if (S_ISREG(file_entry->mode)) {
|
||||
copy_file_chunk(src_stream, out_stream, file_entry->size);
|
||||
@@ -102,6 +104,7 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
|
||||
if (S_ISREG(file_entry->mode)) {
|
||||
buffer = (char *) xmalloc(file_entry->size + 1);
|
||||
fread(buffer, 1, file_entry->size, src_stream);
|
||||
buffer[file_entry->size] = '\0';
|
||||
archive_offset += file_entry->size;
|
||||
return(buffer);
|
||||
}
|
||||
@@ -116,15 +119,19 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
|
||||
unlink(full_name); /* Directories might not be empty etc */
|
||||
}
|
||||
} else {
|
||||
error_msg("%s not created: newer or same age file exists", file_entry->name);
|
||||
seek_sub_file(src_stream, file_entry->size);
|
||||
if ((function & extract_quiet) != extract_quiet) {
|
||||
error_msg("%s not created: newer or same age file exists", file_entry->name);
|
||||
}
|
||||
seek_sub_file(src_stream, file_entry->size);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
if (function & extract_create_leading_dirs) { /* Create leading directories with default umask */
|
||||
char *parent = dirname(full_name);
|
||||
if (make_directory (parent, -1, FILEUTILS_RECUR) != 0) {
|
||||
error_msg("couldn't create leading directories");
|
||||
if ((function & extract_quiet) != extract_quiet) {
|
||||
error_msg("couldn't create leading directories");
|
||||
}
|
||||
}
|
||||
free (parent);
|
||||
}
|
||||
@@ -132,8 +139,10 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
|
||||
case S_IFREG:
|
||||
if (file_entry->link_name) { /* Found a cpio hard link */
|
||||
if (link(file_entry->link_name, full_name) != 0) {
|
||||
perror_msg("Cannot link from %s to '%s'",
|
||||
file_entry->name, file_entry->link_name);
|
||||
if ((function & extract_quiet) != extract_quiet) {
|
||||
perror_msg("Cannot link from %s to '%s'",
|
||||
file_entry->name, file_entry->link_name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ((dst_stream = wfopen(full_name, "w")) == NULL) {
|
||||
@@ -148,13 +157,17 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
|
||||
case S_IFDIR:
|
||||
if (stat_res != 0) {
|
||||
if (mkdir(full_name, file_entry->mode) < 0) {
|
||||
perror_msg("extract_archive: ");
|
||||
if ((function & extract_quiet) != extract_quiet) {
|
||||
perror_msg("extract_archive: ");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case S_IFLNK:
|
||||
if (symlink(file_entry->link_name, full_name) < 0) {
|
||||
perror_msg("Cannot create symlink from %s to '%s'", file_entry->name, file_entry->link_name);
|
||||
if ((function & extract_quiet) != extract_quiet) {
|
||||
perror_msg("Cannot create symlink from %s to '%s'", file_entry->name, file_entry->link_name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
@@ -163,7 +176,9 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
|
||||
case S_IFCHR:
|
||||
case S_IFIFO:
|
||||
if (mknod(full_name, file_entry->mode, file_entry->device) == -1) {
|
||||
perror_msg("Cannot create node %s", file_entry->name);
|
||||
if ((function & extract_quiet) != extract_quiet) {
|
||||
perror_msg("Cannot create node %s", file_entry->name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
@@ -173,7 +188,7 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
|
||||
* file pointed to, so dont try and change the date or mode, lchown does
|
||||
* does the right thing, but isnt available in older versions of libc */
|
||||
if (S_ISLNK(file_entry->mode)) {
|
||||
#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
|
||||
#if (__GLIBC__ > 2) && (__GLIBC_MINOR__ > 1)
|
||||
lchown(full_name, file_entry->uid, file_entry->gid);
|
||||
#endif
|
||||
} else {
|
||||
@@ -211,7 +226,7 @@ char *extract_archive(FILE *src_stream, FILE *out_stream, const file_header_t *f
|
||||
#endif
|
||||
|
||||
#ifdef L_unarchive
|
||||
char *unarchive(FILE *src_stream, file_header_t *(*get_headers)(FILE *),
|
||||
char *unarchive(FILE *src_stream, FILE *out_stream, file_header_t *(*get_headers)(FILE *),
|
||||
const int extract_function, const char *prefix, char **extract_names)
|
||||
{
|
||||
file_header_t *file_entry;
|
||||
@@ -222,19 +237,22 @@ char *unarchive(FILE *src_stream, file_header_t *(*get_headers)(FILE *),
|
||||
archive_offset = 0;
|
||||
while ((file_entry = get_headers(src_stream)) != NULL) {
|
||||
found = FALSE;
|
||||
if (extract_names[0] != NULL) {
|
||||
if (extract_names == NULL) {
|
||||
found = TRUE;
|
||||
} else {
|
||||
for(i = 0; extract_names[i] != 0; i++) {
|
||||
if (strcmp(extract_names[i], file_entry->name) == 0) {
|
||||
found = TRUE;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
/* seek past the data entry */
|
||||
seek_sub_file(src_stream, file_entry->size);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
buffer = extract_archive(src_stream, stdout, file_entry, extract_function, prefix);
|
||||
|
||||
if (found) {
|
||||
buffer = extract_archive(src_stream, out_stream, file_entry, extract_function, prefix);
|
||||
} else {
|
||||
/* seek past the data entry */
|
||||
seek_sub_file(src_stream, file_entry->size);
|
||||
}
|
||||
}
|
||||
return(buffer);
|
||||
}
|
||||
@@ -259,7 +277,6 @@ file_header_t *get_header_ar(FILE *src_stream)
|
||||
static char *ar_long_names;
|
||||
|
||||
if (fread(ar.raw, 1, 60, src_stream) != 60) {
|
||||
free (ar_long_names);
|
||||
return(NULL);
|
||||
}
|
||||
archive_offset += 60;
|
||||
@@ -375,7 +392,8 @@ file_header_t *get_header_cpio(FILE *src_stream)
|
||||
case '1': /* "newc" header format */
|
||||
cpio_entry = (file_header_t *) xcalloc(1, sizeof(file_header_t));
|
||||
sscanf(cpio_header, "%6c%8x%8x%8x%8x%8x%8lx%8lx%16c%8x%8x%8x%8c",
|
||||
dummy, &inode, &cpio_entry->mode, &cpio_entry->uid, &cpio_entry->gid,
|
||||
dummy, &inode, (unsigned int*)&cpio_entry->mode,
|
||||
(unsigned int*)&cpio_entry->uid, (unsigned int*)&cpio_entry->gid,
|
||||
&nlink, &cpio_entry->mtime, &cpio_entry->size,
|
||||
dummy, &major, &minor, &namesize, dummy);
|
||||
|
||||
@@ -478,7 +496,9 @@ file_header_t *get_header_tar(FILE *tar_stream)
|
||||
}
|
||||
|
||||
if (fread(tar.raw, 1, 512, tar_stream) != 512) {
|
||||
error_msg("Couldnt read header");
|
||||
/* Unfortunatly its common for tar files to have all sorts of
|
||||
* trailing garbage, fail silently */
|
||||
// error_msg("Couldnt read header");
|
||||
return(NULL);
|
||||
}
|
||||
archive_offset += 512;
|
||||
@@ -529,16 +549,18 @@ char *deb_extract(const char *package_filename, FILE *out_stream,
|
||||
FILE *deb_stream;
|
||||
FILE *uncompressed_stream = NULL;
|
||||
file_header_t *ar_header = NULL;
|
||||
char **file_list = NULL;
|
||||
char *output_buffer = NULL;
|
||||
char *ared_file = NULL;
|
||||
char ar_magic[8];
|
||||
char **file_list;
|
||||
int gunzip_pid;
|
||||
|
||||
file_list = malloc(sizeof(char *));
|
||||
file_list[0] = xstrdup(filename);
|
||||
file_list[1] = NULL;
|
||||
|
||||
if (filename != NULL) {
|
||||
file_list = xmalloc(sizeof(char *) * 2);
|
||||
file_list[0] = xstrdup(filename);
|
||||
file_list[1] = NULL;
|
||||
}
|
||||
|
||||
if (extract_function & extract_control_tar_gz) {
|
||||
ared_file = xstrdup("control.tar.gz");
|
||||
}
|
||||
@@ -548,6 +570,11 @@ char *deb_extract(const char *package_filename, FILE *out_stream,
|
||||
|
||||
/* open the debian package to be worked on */
|
||||
deb_stream = wfopen(package_filename, "r");
|
||||
if (deb_stream == NULL) {
|
||||
return(NULL);
|
||||
}
|
||||
/* set the buffer size */
|
||||
setvbuf(deb_stream, NULL, _IOFBF, 0x8000);
|
||||
|
||||
/* check ar magic */
|
||||
fread(ar_magic, 1, 8, deb_stream);
|
||||
@@ -561,7 +588,7 @@ char *deb_extract(const char *package_filename, FILE *out_stream,
|
||||
/* open a stream of decompressed data */
|
||||
uncompressed_stream = gz_open(deb_stream, &gunzip_pid);
|
||||
archive_offset = 0;
|
||||
output_buffer = unarchive(uncompressed_stream, get_header_tar, extract_function, prefix, file_list);
|
||||
output_buffer = unarchive(uncompressed_stream, out_stream, get_header_tar, extract_function, prefix, file_list);
|
||||
}
|
||||
seek_sub_file(deb_stream, ar_header->size);
|
||||
}
|
||||
|
||||
+8
-11
@@ -67,7 +67,7 @@ static char *license_msg[] = {
|
||||
#include <string.h>
|
||||
#include "libbb.h"
|
||||
|
||||
FILE *in_file, *out_file;
|
||||
static FILE *in_file, *out_file;
|
||||
|
||||
/* these are freed by gz_close */
|
||||
static unsigned char *window;
|
||||
@@ -91,9 +91,9 @@ static const int N_MAX = 288; /* maximum number of codes in any set */
|
||||
static long bytes_out; /* number of output bytes */
|
||||
static unsigned long outcnt; /* bytes in output buffer */
|
||||
|
||||
unsigned hufts; /* track memory usage */
|
||||
unsigned long bb; /* bit buffer */
|
||||
unsigned bk; /* bits in bit buffer */
|
||||
static unsigned hufts; /* track memory usage */
|
||||
static unsigned long bb; /* bit buffer */
|
||||
static unsigned bk; /* bits in bit buffer */
|
||||
|
||||
typedef struct huft_s {
|
||||
unsigned char e; /* number of extra bits or operation */
|
||||
@@ -104,7 +104,7 @@ typedef struct huft_s {
|
||||
} v;
|
||||
} huft_t;
|
||||
|
||||
unsigned short mask_bits[] = {
|
||||
static const unsigned short mask_bits[] = {
|
||||
0x0000,
|
||||
0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
|
||||
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
|
||||
@@ -154,7 +154,7 @@ static void make_crc_table()
|
||||
* Write the output window window[0..outcnt-1] and update crc and bytes_out.
|
||||
* (Used for the decompressed data only.)
|
||||
*/
|
||||
void flush_window()
|
||||
static void flush_window(void)
|
||||
{
|
||||
int n;
|
||||
|
||||
@@ -925,9 +925,6 @@ extern int unzip(FILE *l_in_file, FILE *l_out_file)
|
||||
outcnt = 0;
|
||||
bytes_out = 0L;
|
||||
|
||||
/* set the buffer size */
|
||||
setvbuf(in_file, NULL, _IOFBF, 0x8000);
|
||||
|
||||
magic[0] = fgetc(in_file);
|
||||
magic[1] = fgetc(in_file);
|
||||
|
||||
@@ -1024,6 +1021,6 @@ extern void gz_close(int gunzip_pid)
|
||||
if (waitpid(gunzip_pid, NULL, 0) == -1) {
|
||||
printf("Couldnt wait ?");
|
||||
}
|
||||
free(window);
|
||||
free(crc_table);
|
||||
free(window);
|
||||
free(crc_table);
|
||||
}
|
||||
@@ -37,9 +37,9 @@ int loadacm_main(int argc, char **argv)
|
||||
show_usage();
|
||||
}
|
||||
|
||||
fd = open("/dev/tty", O_RDWR);
|
||||
fd = open(CURRENT_VC, O_RDWR);
|
||||
if (fd < 0) {
|
||||
perror_msg_and_die("Error opening /dev/tty1");
|
||||
perror_msg_and_die("Error opening " CURRENT_VC);
|
||||
}
|
||||
|
||||
if (screen_map_load(fd, stdin)) {
|
||||
|
||||
+2
-2
@@ -46,9 +46,9 @@ extern int loadfont_main(int argc, char **argv)
|
||||
if (argc != 1)
|
||||
show_usage();
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
fd = open(CURRENT_VC, O_RDWR);
|
||||
if (fd < 0)
|
||||
perror_msg_and_die("Error opening /dev/tty0");
|
||||
perror_msg_and_die("Error opening " CURRENT_VC);
|
||||
loadnewfont(fd);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
+2
-2
@@ -53,9 +53,9 @@ int loadkmap_main(int argc, char **argv)
|
||||
if (argc != 1)
|
||||
show_usage();
|
||||
|
||||
fd = open("/dev/tty0", O_RDWR);
|
||||
fd = open(CURRENT_VC, O_RDWR);
|
||||
if (fd < 0)
|
||||
perror_msg_and_die("Error opening /dev/tty0");
|
||||
perror_msg_and_die("Error opening " CURRENT_VC);
|
||||
|
||||
read(0, buff, 7);
|
||||
if (0 != strncmp(buff, BINARY_KEYMAP_MAGIC, 7))
|
||||
|
||||
@@ -36,17 +36,18 @@
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#else
|
||||
/* We have to do this since the header file defines static
|
||||
* structures. Argh.... bad libc, bad, bad...
|
||||
*/
|
||||
#include <sys/syslog.h>
|
||||
|
||||
typedef struct _code {
|
||||
char *c_name;
|
||||
int c_val;
|
||||
} CODE;
|
||||
extern CODE prioritynames[];
|
||||
extern CODE facilitynames[];
|
||||
# ifndef __dietlibc__
|
||||
/* We have to do this since the header file defines static
|
||||
* structures. Argh.... bad libc, bad, bad...
|
||||
*/
|
||||
typedef struct _code {
|
||||
char *c_name;
|
||||
int c_val;
|
||||
} CODE;
|
||||
extern CODE prioritynames[];
|
||||
extern CODE facilitynames[];
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Decode a symbolic name to a numeric value
|
||||
@@ -127,14 +128,20 @@ extern int logger_main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
openlog(name, option, (pri | LOG_FACMASK));
|
||||
if (optind == argc) {
|
||||
/* read from stdin */
|
||||
i = 0;
|
||||
while ((c = getc(stdin)) != EOF && i < sizeof(buf)) {
|
||||
buf[i++] = c;
|
||||
}
|
||||
buf[i++] = '\0';
|
||||
message = buf;
|
||||
do {
|
||||
/* read from stdin */
|
||||
i = 0;
|
||||
while ((c = getc(stdin)) != EOF && c != '\n' &&
|
||||
i < (sizeof(buf)-1)) {
|
||||
buf[i++] = c;
|
||||
}
|
||||
if (i > 0) {
|
||||
buf[i++] = '\0';
|
||||
syslog(pri, "%s", buf);
|
||||
}
|
||||
} while (c != EOF);
|
||||
} else {
|
||||
len = 1; /* for the '\0' */
|
||||
message=xcalloc(1, 1);
|
||||
@@ -146,12 +153,10 @@ extern int logger_main(int argc, char **argv)
|
||||
strcat(message, " ");
|
||||
}
|
||||
message[strlen(message)-1] = '\0';
|
||||
syslog(pri, "%s", message);
|
||||
}
|
||||
|
||||
/*openlog(name, option, (pri | LOG_FACMASK));
|
||||
syslog(pri, "%s", message);
|
||||
closelog();*/
|
||||
syslog_msg_with_name(name,(pri | LOG_FACMASK),pri,message);
|
||||
closelog();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ enum {
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <termios.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include "busybox.h"
|
||||
|
||||
@@ -303,6 +304,7 @@ static struct dnode **dnalloc(int num)
|
||||
return(p);
|
||||
}
|
||||
|
||||
#ifdef BB_FEATURE_LS_RECURSIVE
|
||||
static void dfree(struct dnode **dnp)
|
||||
{
|
||||
struct dnode *cur, *next;
|
||||
@@ -318,6 +320,7 @@ static void dfree(struct dnode **dnp)
|
||||
}
|
||||
free(dnp); /* free the array holding the dnode pointers */
|
||||
}
|
||||
#endif
|
||||
|
||||
static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which)
|
||||
{
|
||||
@@ -634,7 +637,7 @@ static int list_single(struct dnode *dn)
|
||||
my_getpwuid(scratch, dn->dstat.st_uid);
|
||||
printf("%-8.8s ", scratch);
|
||||
my_getgrgid(scratch, dn->dstat.st_gid);
|
||||
printf("%-8.8s ", scratch);
|
||||
printf("%-8.8s", scratch);
|
||||
column += 17;
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -63,24 +63,6 @@
|
||||
|
||||
/* md5.c - Functions to compute MD5 message digest of files or memory blocks
|
||||
* according to the definition of MD5 in RFC 1321 from April 1992.
|
||||
* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
*
|
||||
* NOTE: The canonical source of this file is maintained with the GNU C
|
||||
* Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
*
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */
|
||||
@@ -90,34 +72,7 @@
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/* md5.h - Declaration of functions and data types used for MD5 sum
|
||||
computing library functions.
|
||||
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
NOTE: The canonical source of this file is maintained with the GNU C
|
||||
Library. Bugs can be reported to bug-glibc@prep.ai.mit.edu.
|
||||
|
||||
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _MD5_H
|
||||
static const int _MD5_H = 1;
|
||||
|
||||
/* The following contortions are an attempt to use the C preprocessor
|
||||
to determine an unsigned integral type that is 32 bits wide. An
|
||||
alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
|
||||
doing that would require that the configure script compile and *run*
|
||||
the resulting executable. Locally running cross-compiled executables
|
||||
is usually not possible. */
|
||||
computing library functions. */
|
||||
|
||||
typedef u_int32_t md5_uint32;
|
||||
|
||||
@@ -141,20 +96,20 @@ struct md5_ctx
|
||||
|
||||
/* Initialize structure containing state of computation.
|
||||
(RFC 1321, 3.3: Step 3) */
|
||||
extern void md5_init_ctx __P ((struct md5_ctx *ctx));
|
||||
static void md5_init_ctx __P ((struct md5_ctx *ctx));
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is necessary that LEN is a multiple of 64!!! */
|
||||
extern void md5_process_block __P ((const void *buffer, size_t len,
|
||||
static void md5_process_block __P ((const void *buffer, size_t len,
|
||||
struct md5_ctx *ctx));
|
||||
|
||||
/* Starting with the result of former calls of this function (or the
|
||||
initialization function update the context for the next LEN bytes
|
||||
starting at BUFFER.
|
||||
It is NOT required that LEN is a multiple of 64. */
|
||||
extern void md5_process_bytes __P ((const void *buffer, size_t len,
|
||||
static void md5_process_bytes __P ((const void *buffer, size_t len,
|
||||
struct md5_ctx *ctx));
|
||||
|
||||
/* Process the remaining bytes in the buffer and put result from CTX
|
||||
@@ -164,30 +119,21 @@ extern void md5_process_bytes __P ((const void *buffer, size_t len,
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf));
|
||||
static void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf));
|
||||
|
||||
|
||||
/* Put result from CTX in first 16 bytes following RESBUF. The result is
|
||||
always in little endian byte order, so that a byte-wise output yields
|
||||
to the wanted ASCII representation of the message digest.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
extern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf));
|
||||
|
||||
|
||||
/* Compute MD5 message digest for bytes read from STREAM. The
|
||||
resulting message digest number will be written into the 16 bytes
|
||||
beginning at RESBLOCK. */
|
||||
extern int md5_stream __P ((FILE *stream, void *resblock));
|
||||
static int md5_stream __P ((FILE *stream, void *resblock));
|
||||
|
||||
/* Compute MD5 message digest for LEN bytes beginning at BUFFER. The
|
||||
result is always in little endian byte order, so that a byte-wise
|
||||
output yields to the wanted ASCII representation of the message
|
||||
digest. */
|
||||
extern void *md5_buffer __P ((const char *buffer, size_t len, void *resblock));
|
||||
|
||||
#endif
|
||||
static void *md5_buffer __P ((const char *buffer, size_t len, void *resblock));
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
//--------end of md5.h
|
||||
@@ -221,27 +167,12 @@ void md5_init_ctx(struct md5_ctx *ctx)
|
||||
ctx->buflen = 0;
|
||||
}
|
||||
|
||||
/* Put result from CTX in first 16 bytes following RESBUF. The result
|
||||
must be in little endian byte order.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
void *md5_read_ctx(const struct md5_ctx *ctx, void *resbuf)
|
||||
{
|
||||
((md5_uint32 *) resbuf)[0] = SWAP(ctx->A);
|
||||
((md5_uint32 *) resbuf)[1] = SWAP(ctx->B);
|
||||
((md5_uint32 *) resbuf)[2] = SWAP(ctx->C);
|
||||
((md5_uint32 *) resbuf)[3] = SWAP(ctx->D);
|
||||
|
||||
return resbuf;
|
||||
}
|
||||
|
||||
/* Process the remaining bytes in the internal buffer and the usual
|
||||
prolog according to the standard and write the result to RESBUF.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
void *md5_finish_ctx(struct md5_ctx *ctx, void *resbuf)
|
||||
static void *md5_finish_ctx(struct md5_ctx *ctx, void *resbuf)
|
||||
{
|
||||
/* Take yet unprocessed bytes into account. */
|
||||
md5_uint32 bytes = ctx->buflen;
|
||||
@@ -268,13 +199,24 @@ void *md5_finish_ctx(struct md5_ctx *ctx, void *resbuf)
|
||||
/* Process last bytes. */
|
||||
md5_process_block(ctx->buffer, bytes + pad + 8, ctx);
|
||||
|
||||
return md5_read_ctx(ctx, resbuf);
|
||||
/* Put result from CTX in first 16 bytes following RESBUF. The result is
|
||||
always in little endian byte order, so that a byte-wise output yields
|
||||
to the wanted ASCII representation of the message digest.
|
||||
|
||||
IMPORTANT: On some systems it is required that RESBUF is correctly
|
||||
aligned for a 32 bits value. */
|
||||
((md5_uint32 *) resbuf)[0] = SWAP(ctx->A);
|
||||
((md5_uint32 *) resbuf)[1] = SWAP(ctx->B);
|
||||
((md5_uint32 *) resbuf)[2] = SWAP(ctx->C);
|
||||
((md5_uint32 *) resbuf)[3] = SWAP(ctx->D);
|
||||
|
||||
return resbuf;
|
||||
}
|
||||
|
||||
/* Compute MD5 message digest for bytes read from STREAM. The
|
||||
resulting message digest number will be written into the 16 bytes
|
||||
beginning at RESBLOCK. */
|
||||
int md5_stream(FILE *stream, void *resblock)
|
||||
static int md5_stream(FILE *stream, void *resblock)
|
||||
{
|
||||
/* Important: BLOCKSIZE must be a multiple of 64. */
|
||||
static const int BLOCKSIZE = 4096;
|
||||
@@ -326,7 +268,7 @@ static const int BLOCKSIZE = 4096;
|
||||
result is always in little endian byte order, so that a byte-wise
|
||||
output yields to the wanted ASCII representation of the message
|
||||
digest. */
|
||||
void *md5_buffer(const char *buffer, size_t len, void *resblock)
|
||||
static void *md5_buffer(const char *buffer, size_t len, void *resblock)
|
||||
{
|
||||
struct md5_ctx ctx;
|
||||
|
||||
@@ -340,7 +282,7 @@ void *md5_buffer(const char *buffer, size_t len, void *resblock)
|
||||
return md5_finish_ctx(&ctx, resblock);
|
||||
}
|
||||
|
||||
void md5_process_bytes(const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
static void md5_process_bytes(const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
{
|
||||
/* When we already have some bits in our internal buffer concatenate
|
||||
both inputs first. */
|
||||
@@ -388,7 +330,7 @@ void md5_process_bytes(const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
|
||||
/* Process LEN bytes of BUFFER, accumulating context into CTX.
|
||||
It is assumed that LEN % 64 == 0. */
|
||||
void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
{
|
||||
md5_uint32 correct_words[16];
|
||||
const md5_uint32 *words = buffer;
|
||||
@@ -490,7 +432,6 @@ void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
break;
|
||||
case 3:
|
||||
temp += FI(B,C,D);
|
||||
break;
|
||||
}
|
||||
temp += cwp[(int)(*pp++)] + *pc++;
|
||||
temp = CYCLIC (temp, ps[i&3]);
|
||||
@@ -550,6 +491,7 @@ void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
|
||||
/* It is unfortunate that C does not provide an operator for
|
||||
cyclic rotation. Hope the C compiler is smart enough. */
|
||||
/* gcc 2.95.4 seems to be --aaronl */
|
||||
#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
|
||||
|
||||
/* Before we start, one word to the strange constants.
|
||||
@@ -707,11 +649,7 @@ void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ctx)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#define ISWHITE(c) ((c) == ' ' || (c) == '\t')
|
||||
#define IN_CTYPE_DOMAIN(c) 1
|
||||
#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
|
||||
#define STREQ(a, b) (strcmp ((a), (b)) == 0)
|
||||
#define TOLOWER(Ch) tolower (Ch)
|
||||
#define OPENOPTS(BINARY) "r"
|
||||
#define ISXDIGIT(c) (isxdigit (c))
|
||||
|
||||
/* The minimum length of a valid digest line in a file produced
|
||||
by `md5sum FILE' and read by `md5sum -c'. This length does
|
||||
@@ -731,7 +669,6 @@ static int warn = 0; /* With -w, print a message to standard error warning
|
||||
static int split_3(char *s,
|
||||
size_t s_len,
|
||||
unsigned char **u,
|
||||
int *binary,
|
||||
char **w)
|
||||
{
|
||||
size_t i = 0;
|
||||
@@ -762,9 +699,8 @@ static int split_3(char *s,
|
||||
|
||||
s[i++] = '\0';
|
||||
|
||||
if (s[i] != ' ' && s[i] != '*')
|
||||
if (s[i] != ' ' && s[i++] != '*')
|
||||
return FALSE;
|
||||
*binary = (s[i++] == '*');
|
||||
|
||||
/* All characters between the type indicator and end of line are
|
||||
significant -- that includes leading and trailing white space. */
|
||||
@@ -812,7 +748,7 @@ static int split_3(char *s,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int hex_digits(unsigned char const *s)
|
||||
static inline int hex_digits(unsigned char const *s)
|
||||
{
|
||||
while (*s) {
|
||||
if (!ISXDIGIT(*s))
|
||||
@@ -826,21 +762,18 @@ static int hex_digits(unsigned char const *s)
|
||||
put the result in *MD5_RESULT. Return non-zero upon failure, zero
|
||||
to indicate success. */
|
||||
static int md5_file(const char *filename,
|
||||
int binary,
|
||||
unsigned char *md5_result)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
if (STREQ(filename, "-")) {
|
||||
if (filename[0] == '-' && filename[1] == '\0') {
|
||||
have_read_stdin = 1;
|
||||
fp = stdin;
|
||||
} else {
|
||||
fp = fopen(filename, OPENOPTS(binary));
|
||||
if (fp == NULL) {
|
||||
perror_msg("%s", filename);
|
||||
fp = wfopen(filename, "r");
|
||||
if (fp == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (md5_stream(fp, md5_result)) {
|
||||
perror_msg("%s", filename);
|
||||
@@ -868,22 +801,19 @@ static int md5_check(const char *checkfile_name)
|
||||
size_t line_number;
|
||||
char line[BUFSIZ];
|
||||
|
||||
if (STREQ(checkfile_name, "-")) {
|
||||
if (checkfile_name[0] == '-' && checkfile_name[1] == '\0') {
|
||||
have_read_stdin = 1;
|
||||
checkfile_stream = stdin;
|
||||
} else {
|
||||
checkfile_stream = fopen(checkfile_name, "r");
|
||||
if (checkfile_stream == NULL) {
|
||||
perror_msg("%s", checkfile_name);
|
||||
checkfile_stream = wfopen(checkfile_name, "r");
|
||||
if (checkfile_stream == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
line_number = 0;
|
||||
|
||||
do {
|
||||
char *filename;
|
||||
int binary;
|
||||
unsigned char *md5num;
|
||||
int line_length;
|
||||
|
||||
@@ -903,7 +833,7 @@ static int md5_check(const char *checkfile_name)
|
||||
if (line[line_length - 1] == '\n')
|
||||
line[--line_length] = '\0';
|
||||
|
||||
if (split_3(line, line_length, &md5num, &binary, &filename)
|
||||
if (split_3(line, line_length, &md5num, &filename)
|
||||
|| !hex_digits(md5num)) {
|
||||
if (warn) {
|
||||
error_msg("%s: %lu: improperly formatted MD5 checksum line",
|
||||
@@ -919,7 +849,7 @@ static int md5_check(const char *checkfile_name)
|
||||
|
||||
++n_properly_formated_lines;
|
||||
|
||||
if (md5_file(filename, binary, md5buffer)) {
|
||||
if (md5_file(filename, md5buffer)) {
|
||||
++n_open_or_read_failures;
|
||||
if (!status_only) {
|
||||
printf("%s: FAILED open or read\n", filename);
|
||||
@@ -930,9 +860,9 @@ static int md5_check(const char *checkfile_name)
|
||||
/* Compare generated binary number with text representation
|
||||
in check file. Ignore case of hex digits. */
|
||||
for (cnt = 0; cnt < 16; ++cnt) {
|
||||
if (TOLOWER(md5num[2 * cnt])
|
||||
if (tolower(md5num[2 * cnt])
|
||||
!= bin2hex[md5buffer[cnt] >> 4]
|
||||
|| (TOLOWER(md5num[2 * cnt + 1])
|
||||
|| (tolower(md5num[2 * cnt + 1])
|
||||
!= (bin2hex[md5buffer[cnt] & 0xf])))
|
||||
break;
|
||||
}
|
||||
@@ -997,8 +927,8 @@ int md5sum_main(int argc,
|
||||
char **string = NULL;
|
||||
size_t n_strings = 0;
|
||||
size_t err = 0;
|
||||
int file_type_specified = 0;
|
||||
int binary = 0;
|
||||
char file_type_specified = 0;
|
||||
char binary = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, "g:bcstw")) != -1) {
|
||||
switch (opt) {
|
||||
@@ -1084,9 +1014,9 @@ int md5sum_main(int argc,
|
||||
int fail;
|
||||
char *file = argv[optind];
|
||||
|
||||
fail = md5_file (file, binary, md5buffer);
|
||||
fail = md5_file (file, md5buffer);
|
||||
err |= fail;
|
||||
if (!fail && STREQ(file, "-")) {
|
||||
if (!fail && file[0]=='-' && file[1] == '\0') {
|
||||
size_t i;
|
||||
for (i = 0; i < 16; ++i)
|
||||
printf ("%02x", md5buffer[i]);
|
||||
|
||||
+26
-31
@@ -65,46 +65,41 @@ extern int update_main(int argc, char **argv)
|
||||
show_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (daemon(0, 1) < 0)
|
||||
perror_msg_and_die("daemon");
|
||||
|
||||
pid = fork();
|
||||
if (pid < 0)
|
||||
return EXIT_FAILURE;
|
||||
else if (pid == 0) {
|
||||
/* Become a proper daemon */
|
||||
setsid();
|
||||
chdir("/");
|
||||
#ifdef OPEN_MAX
|
||||
for (pid = 0; pid < OPEN_MAX; pid++) close(pid);
|
||||
for (pid = 0; pid < OPEN_MAX; pid++) close(pid);
|
||||
#else
|
||||
/* glibc 2.1.92 requires using sysconf(_SC_OPEN_MAX) */
|
||||
for (pid = 0; pid < sysconf(_SC_OPEN_MAX); pid++) close(pid);
|
||||
/* glibc 2.1.92 requires using sysconf(_SC_OPEN_MAX) */
|
||||
for (pid = 0; pid < sysconf(_SC_OPEN_MAX); pid++) close(pid);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is no longer necessary since 1.3.5x, but it will harmlessly
|
||||
* exit if that is the case.
|
||||
*/
|
||||
/* This is no longer necessary since 1.3.5x, but it will harmlessly
|
||||
* exit if that is the case.
|
||||
*/
|
||||
|
||||
/* set the program name that will show up in a 'ps' listing */
|
||||
argv[0] = "bdflush (update)";
|
||||
argv[1] = NULL;
|
||||
argv[2] = NULL;
|
||||
for (;;) {
|
||||
if (use_sync) {
|
||||
sleep(sync_duration);
|
||||
sync();
|
||||
} else {
|
||||
sleep(flush_duration);
|
||||
if (bdflush(1, 0) < 0) {
|
||||
openlog("update", LOG_CONS, LOG_DAEMON);
|
||||
syslog(LOG_INFO,
|
||||
"This kernel does not need update(8). Exiting.");
|
||||
closelog();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
/* set the program name that will show up in a 'ps' listing */
|
||||
argv[0] = "bdflush (update)";
|
||||
argv[1] = NULL;
|
||||
argv[2] = NULL;
|
||||
for (;;) {
|
||||
if (use_sync) {
|
||||
sleep(sync_duration);
|
||||
sync();
|
||||
} else {
|
||||
sleep(flush_duration);
|
||||
if (bdflush(1, 0) < 0) {
|
||||
openlog("update", LOG_CONS, LOG_DAEMON);
|
||||
syslog(LOG_INFO,
|
||||
"This kernel does not need update(8). Exiting.");
|
||||
closelog();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* really dumb modprobe implementation for busybox
|
||||
* Copyright (C) 2001 Lineo, davidm@lineo.com
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
#include "busybox.h"
|
||||
|
||||
static char cmd[128];
|
||||
|
||||
extern int modprobe_main(int argc, char** argv)
|
||||
{
|
||||
int ch, rc = 0;
|
||||
int loadall = 0, showconfig = 0, debug = 0, autoclean = 0, list = 0;
|
||||
int show_only = 0, quiet = 0, remove_opt = 0, do_syslog = 0, verbose = 0;
|
||||
char *load_type = NULL, *config = NULL;
|
||||
|
||||
while ((ch = getopt(argc, argv, "acdklnqrst:vVC:")) != -1)
|
||||
switch(ch) {
|
||||
case 'a':
|
||||
loadall++;
|
||||
break;
|
||||
case 'c':
|
||||
showconfig++;
|
||||
break;
|
||||
case 'd':
|
||||
debug++;
|
||||
break;
|
||||
case 'k':
|
||||
autoclean++;
|
||||
break;
|
||||
case 'l':
|
||||
list++;
|
||||
break;
|
||||
case 'n':
|
||||
show_only++;
|
||||
break;
|
||||
case 'q':
|
||||
quiet++;
|
||||
break;
|
||||
case 'r':
|
||||
remove_opt++;
|
||||
break;
|
||||
case 's':
|
||||
do_syslog++;
|
||||
break;
|
||||
case 't':
|
||||
load_type = optarg;
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
case 'C':
|
||||
config = optarg;
|
||||
break;
|
||||
case 'V':
|
||||
default:
|
||||
show_usage();
|
||||
break;
|
||||
}
|
||||
|
||||
if (load_type || config) {
|
||||
fprintf(stderr, "-t and -C not supported\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (showconfig)
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
if (list)
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
if (remove_opt) {
|
||||
do {
|
||||
sprintf(cmd, "rmmod %s %s %s",
|
||||
optind >= argc ? "-a" : "",
|
||||
do_syslog ? "-s" : "",
|
||||
optind < argc ? argv[optind] : "");
|
||||
if (do_syslog)
|
||||
syslog(LOG_INFO, "%s", cmd);
|
||||
if (show_only || verbose)
|
||||
printf("%s\n", cmd);
|
||||
if (!show_only)
|
||||
rc = system(cmd);
|
||||
} while (++optind < argc);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (optind >= argc) {
|
||||
fprintf(stderr, "No module or pattern provided\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
sprintf(cmd, "insmod %s %s %s",
|
||||
do_syslog ? "-s" : "",
|
||||
quiet ? "-q" : "",
|
||||
autoclean ? "-k" : "");
|
||||
while (optind < argc) {
|
||||
strcat(cmd, argv[optind]);
|
||||
strcat(cmd, " ");
|
||||
optind++;
|
||||
}
|
||||
if (do_syslog)
|
||||
syslog(LOG_INFO, "%s", cmd);
|
||||
if (show_only || verbose)
|
||||
printf("%s\n", cmd);
|
||||
if (!show_only)
|
||||
rc = system(cmd);
|
||||
else
|
||||
rc = 0;
|
||||
|
||||
exit(rc ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
+72
-82
@@ -1,7 +1,10 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* Mini insmod implementation for busybox
|
||||
* This version of insmod now supports x86, ARM, SH3/4, powerpc, and MIPS.
|
||||
*
|
||||
* This version of insmod supports x86, ARM, SH3/4, powerpc, m68k,
|
||||
* and MIPS.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 1999,2000,2001 by Lineo, inc.
|
||||
* Written by Erik Andersen <andersen@lineo.com>
|
||||
@@ -130,7 +133,7 @@
|
||||
#ifndef MODUTILS_MODULE_H
|
||||
static const int MODUTILS_MODULE_H = 1;
|
||||
|
||||
#ident "$Id: insmod.c,v 1.67 2001/06/28 21:36:06 andersen Exp $"
|
||||
#ident "$Id: insmod.c,v 1.70 2001/07/31 22:51:49 andersen Exp $"
|
||||
|
||||
/* This file contains the structures used by the 2.0 and 2.1 kernels.
|
||||
We do not use the kernel headers directly because we do not wish
|
||||
@@ -347,7 +350,7 @@ int delete_module(const char *);
|
||||
#ifndef MODUTILS_OBJ_H
|
||||
static const int MODUTILS_OBJ_H = 1;
|
||||
|
||||
#ident "$Id: insmod.c,v 1.67 2001/06/28 21:36:06 andersen Exp $"
|
||||
#ident "$Id: insmod.c,v 1.70 2001/07/31 22:51:49 andersen Exp $"
|
||||
|
||||
/* The relocatable object is manipulated using elfin types. */
|
||||
|
||||
@@ -537,78 +540,75 @@ struct obj_symbol_patch
|
||||
|
||||
/* Generic object manipulation routines. */
|
||||
|
||||
unsigned long obj_elf_hash(const char *);
|
||||
static unsigned long obj_elf_hash(const char *);
|
||||
|
||||
unsigned long obj_elf_hash_n(const char *, unsigned long len);
|
||||
static unsigned long obj_elf_hash_n(const char *, unsigned long len);
|
||||
|
||||
struct obj_symbol *obj_add_symbol (struct obj_file *f, const char *name,
|
||||
unsigned long symidx, int info, int secidx,
|
||||
ElfW(Addr) value, unsigned long size);
|
||||
|
||||
struct obj_symbol *obj_find_symbol (struct obj_file *f,
|
||||
static struct obj_symbol *obj_find_symbol (struct obj_file *f,
|
||||
const char *name);
|
||||
|
||||
ElfW(Addr) obj_symbol_final_value(struct obj_file *f,
|
||||
static ElfW(Addr) obj_symbol_final_value(struct obj_file *f,
|
||||
struct obj_symbol *sym);
|
||||
|
||||
void obj_set_symbol_compare(struct obj_file *f,
|
||||
#ifdef BB_FEATURE_INSMOD_VERSION_CHECKING
|
||||
static void obj_set_symbol_compare(struct obj_file *f,
|
||||
int (*cmp)(const char *, const char *),
|
||||
unsigned long (*hash)(const char *));
|
||||
#endif
|
||||
|
||||
struct obj_section *obj_find_section (struct obj_file *f,
|
||||
static struct obj_section *obj_find_section (struct obj_file *f,
|
||||
const char *name);
|
||||
|
||||
void obj_insert_section_load_order (struct obj_file *f,
|
||||
static void obj_insert_section_load_order (struct obj_file *f,
|
||||
struct obj_section *sec);
|
||||
|
||||
struct obj_section *obj_create_alloced_section (struct obj_file *f,
|
||||
static struct obj_section *obj_create_alloced_section (struct obj_file *f,
|
||||
const char *name,
|
||||
unsigned long align,
|
||||
unsigned long size);
|
||||
|
||||
struct obj_section *obj_create_alloced_section_first (struct obj_file *f,
|
||||
static struct obj_section *obj_create_alloced_section_first (struct obj_file *f,
|
||||
const char *name,
|
||||
unsigned long align,
|
||||
unsigned long size);
|
||||
|
||||
void *obj_extend_section (struct obj_section *sec, unsigned long more);
|
||||
static void *obj_extend_section (struct obj_section *sec, unsigned long more);
|
||||
|
||||
int obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
|
||||
static int obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
|
||||
const char *string);
|
||||
|
||||
int obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
|
||||
static int obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
|
||||
struct obj_symbol *sym);
|
||||
|
||||
int obj_check_undefineds(struct obj_file *f);
|
||||
static int obj_check_undefineds(struct obj_file *f);
|
||||
|
||||
void obj_allocate_commons(struct obj_file *f);
|
||||
static void obj_allocate_commons(struct obj_file *f);
|
||||
|
||||
unsigned long obj_load_size (struct obj_file *f);
|
||||
static unsigned long obj_load_size (struct obj_file *f);
|
||||
|
||||
int obj_relocate (struct obj_file *f, ElfW(Addr) base);
|
||||
static int obj_relocate (struct obj_file *f, ElfW(Addr) base);
|
||||
|
||||
struct obj_file *obj_load(FILE *f, int loadprogbits);
|
||||
static struct obj_file *obj_load(FILE *f, int loadprogbits);
|
||||
|
||||
int obj_create_image (struct obj_file *f, char *image);
|
||||
static int obj_create_image (struct obj_file *f, char *image);
|
||||
|
||||
/* Architecture specific manipulation routines. */
|
||||
|
||||
struct obj_file *arch_new_file (void);
|
||||
static struct obj_file *arch_new_file (void);
|
||||
|
||||
struct obj_section *arch_new_section (void);
|
||||
static struct obj_section *arch_new_section (void);
|
||||
|
||||
struct obj_symbol *arch_new_symbol (void);
|
||||
static struct obj_symbol *arch_new_symbol (void);
|
||||
|
||||
enum obj_reloc arch_apply_relocation (struct obj_file *f,
|
||||
static enum obj_reloc arch_apply_relocation (struct obj_file *f,
|
||||
struct obj_section *targsec,
|
||||
struct obj_section *symsec,
|
||||
struct obj_symbol *sym,
|
||||
ElfW(RelM) *rel, ElfW(Addr) value);
|
||||
|
||||
int arch_create_got (struct obj_file *f);
|
||||
static int arch_create_got (struct obj_file *f);
|
||||
|
||||
struct new_module;
|
||||
int arch_init_module (struct obj_file *f, struct new_module *);
|
||||
static int arch_init_module (struct obj_file *f, struct new_module *);
|
||||
|
||||
#endif /* obj.h */
|
||||
//----------------------------------------------------------------------------
|
||||
@@ -624,10 +624,10 @@ static const int STRVERSIONLEN = 32;
|
||||
|
||||
/*======================================================================*/
|
||||
|
||||
int flag_force_load = 0;
|
||||
int flag_autoclean = 0;
|
||||
int flag_verbose = 0;
|
||||
int flag_export = 1;
|
||||
static int flag_force_load = 0;
|
||||
static int flag_autoclean = 0;
|
||||
static int flag_verbose = 0;
|
||||
static int flag_export = 1;
|
||||
|
||||
|
||||
/*======================================================================*/
|
||||
@@ -700,12 +700,12 @@ struct external_module {
|
||||
struct new_module_symbol *syms;
|
||||
};
|
||||
|
||||
struct new_module_symbol *ksyms;
|
||||
size_t nksyms;
|
||||
static struct new_module_symbol *ksyms;
|
||||
static size_t nksyms;
|
||||
|
||||
struct external_module *ext_modules;
|
||||
int n_ext_modules;
|
||||
int n_ext_modules_used;
|
||||
static struct external_module *ext_modules;
|
||||
static int n_ext_modules;
|
||||
static int n_ext_modules_used;
|
||||
extern int delete_module(const char *);
|
||||
|
||||
static char m_filename[FILENAME_MAX + 1];
|
||||
@@ -740,7 +740,7 @@ static int check_module_name_match(const char *filename, struct stat *statbuf,
|
||||
|
||||
/*======================================================================*/
|
||||
|
||||
struct obj_file *arch_new_file(void)
|
||||
static struct obj_file *arch_new_file(void)
|
||||
{
|
||||
struct arch_file *f;
|
||||
f = xmalloc(sizeof(*f));
|
||||
@@ -758,12 +758,12 @@ struct obj_file *arch_new_file(void)
|
||||
return &f->root;
|
||||
}
|
||||
|
||||
struct obj_section *arch_new_section(void)
|
||||
static struct obj_section *arch_new_section(void)
|
||||
{
|
||||
return xmalloc(sizeof(struct obj_section));
|
||||
}
|
||||
|
||||
struct obj_symbol *arch_new_symbol(void)
|
||||
static struct obj_symbol *arch_new_symbol(void)
|
||||
{
|
||||
struct arch_symbol *sym;
|
||||
sym = xmalloc(sizeof(*sym));
|
||||
@@ -778,7 +778,7 @@ struct obj_symbol *arch_new_symbol(void)
|
||||
return &sym->root;
|
||||
}
|
||||
|
||||
enum obj_reloc
|
||||
static enum obj_reloc
|
||||
arch_apply_relocation(struct obj_file *f,
|
||||
struct obj_section *targsec,
|
||||
struct obj_section *symsec,
|
||||
@@ -1140,7 +1140,7 @@ arch_apply_relocation(struct obj_file *f,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int arch_create_got(struct obj_file *f)
|
||||
static int arch_create_got(struct obj_file *f)
|
||||
{
|
||||
#if defined(BB_USE_GOT_ENTRIES) || defined(BB_USE_PLT_ENTRIES)
|
||||
struct arch_file *ifile = (struct arch_file *) f;
|
||||
@@ -1271,7 +1271,7 @@ int arch_create_got(struct obj_file *f)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int arch_init_module(struct obj_file *f, struct new_module *mod)
|
||||
static int arch_init_module(struct obj_file *f, struct new_module *mod)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -1280,7 +1280,7 @@ int arch_init_module(struct obj_file *f, struct new_module *mod)
|
||||
/*======================================================================*/
|
||||
|
||||
/* Standard ELF hash function. */
|
||||
inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
|
||||
static inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
|
||||
{
|
||||
unsigned long h = 0;
|
||||
unsigned long g;
|
||||
@@ -1298,7 +1298,7 @@ inline unsigned long obj_elf_hash_n(const char *name, unsigned long n)
|
||||
return h;
|
||||
}
|
||||
|
||||
unsigned long obj_elf_hash(const char *name)
|
||||
static unsigned long obj_elf_hash(const char *name)
|
||||
{
|
||||
return obj_elf_hash_n(name, strlen(name));
|
||||
}
|
||||
@@ -1309,25 +1309,15 @@ unsigned long obj_elf_hash(const char *name)
|
||||
static int get_kernel_version(char str[STRVERSIONLEN])
|
||||
{
|
||||
struct utsname uts_info;
|
||||
char *p, *q;
|
||||
int a, b, c;
|
||||
int kv;
|
||||
|
||||
if (uname(&uts_info) < 0)
|
||||
return -1;
|
||||
strncpy(str, uts_info.release, STRVERSIONLEN);
|
||||
p = uts_info.release;
|
||||
|
||||
a = strtoul(p, &p, 10);
|
||||
if (*p != '.')
|
||||
kv = get_kernel_revision();
|
||||
if(kv==0)
|
||||
return -1;
|
||||
b = strtoul(p + 1, &p, 10);
|
||||
if (*p != '.')
|
||||
return -1;
|
||||
c = strtoul(p + 1, &q, 10);
|
||||
if (p + 1 == q)
|
||||
return -1;
|
||||
|
||||
return a << 16 | b << 8 | c;
|
||||
}
|
||||
|
||||
/* String comparison for non-co-versioned kernel and module. */
|
||||
@@ -1355,7 +1345,7 @@ static unsigned long ncv_symbol_hash(const char *str)
|
||||
return obj_elf_hash_n(str, len);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
obj_set_symbol_compare(struct obj_file *f,
|
||||
int (*cmp) (const char *, const char *),
|
||||
unsigned long (*hash) (const char *))
|
||||
@@ -1383,8 +1373,8 @@ obj_set_symbol_compare(struct obj_file *f,
|
||||
|
||||
#endif /* BB_FEATURE_INSMOD_VERSION_CHECKING */
|
||||
|
||||
|
||||
struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
|
||||
static struct obj_symbol *
|
||||
obj_add_symbol(struct obj_file *f, const char *name,
|
||||
unsigned long symidx, int info,
|
||||
int secidx, ElfW(Addr) value,
|
||||
unsigned long size)
|
||||
@@ -1478,7 +1468,8 @@ struct obj_symbol *obj_add_symbol(struct obj_file *f, const char *name,
|
||||
return sym;
|
||||
}
|
||||
|
||||
struct obj_symbol *obj_find_symbol(struct obj_file *f, const char *name)
|
||||
static struct obj_symbol *
|
||||
obj_find_symbol(struct obj_file *f, const char *name)
|
||||
{
|
||||
struct obj_symbol *sym;
|
||||
unsigned long hash = f->symbol_hash(name) % HASH_BUCKETS;
|
||||
@@ -1490,7 +1481,7 @@ struct obj_symbol *obj_find_symbol(struct obj_file *f, const char *name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ElfW(Addr)
|
||||
static ElfW(Addr)
|
||||
obj_symbol_final_value(struct obj_file * f, struct obj_symbol * sym)
|
||||
{
|
||||
if (sym) {
|
||||
@@ -1504,7 +1495,7 @@ ElfW(Addr)
|
||||
}
|
||||
}
|
||||
|
||||
struct obj_section *obj_find_section(struct obj_file *f, const char *name)
|
||||
static struct obj_section *obj_find_section(struct obj_file *f, const char *name)
|
||||
{
|
||||
int i, n = f->header.e_shnum;
|
||||
|
||||
@@ -1537,7 +1528,7 @@ static int obj_load_order_prio(struct obj_section *a)
|
||||
return ac;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec)
|
||||
{
|
||||
struct obj_section **p;
|
||||
@@ -1549,7 +1540,7 @@ obj_insert_section_load_order(struct obj_file *f, struct obj_section *sec)
|
||||
*p = sec;
|
||||
}
|
||||
|
||||
struct obj_section *obj_create_alloced_section(struct obj_file *f,
|
||||
static struct obj_section *obj_create_alloced_section(struct obj_file *f,
|
||||
const char *name,
|
||||
unsigned long align,
|
||||
unsigned long size)
|
||||
@@ -1575,7 +1566,7 @@ struct obj_section *obj_create_alloced_section(struct obj_file *f,
|
||||
return sec;
|
||||
}
|
||||
|
||||
struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
|
||||
static struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
|
||||
const char *name,
|
||||
unsigned long align,
|
||||
unsigned long size)
|
||||
@@ -1604,7 +1595,7 @@ struct obj_section *obj_create_alloced_section_first(struct obj_file *f,
|
||||
return sec;
|
||||
}
|
||||
|
||||
void *obj_extend_section(struct obj_section *sec, unsigned long more)
|
||||
static void *obj_extend_section(struct obj_section *sec, unsigned long more)
|
||||
{
|
||||
unsigned long oldsize = sec->header.sh_size;
|
||||
if (more) {
|
||||
@@ -1614,7 +1605,6 @@ void *obj_extend_section(struct obj_section *sec, unsigned long more)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Conditionally add the symbols from the given symbol set to the
|
||||
new module. */
|
||||
|
||||
@@ -2631,7 +2621,7 @@ new_init_module(const char *m_name, struct obj_file *f,
|
||||
|
||||
/*======================================================================*/
|
||||
|
||||
int
|
||||
static int
|
||||
obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
|
||||
const char *string)
|
||||
{
|
||||
@@ -2660,7 +2650,7 @@ obj_string_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
|
||||
struct obj_symbol *sym)
|
||||
{
|
||||
@@ -2676,7 +2666,7 @@ obj_symbol_patch(struct obj_file *f, int secidx, ElfW(Addr) offset,
|
||||
return 1;
|
||||
}
|
||||
|
||||
int obj_check_undefineds(struct obj_file *f)
|
||||
static int obj_check_undefineds(struct obj_file *f)
|
||||
{
|
||||
unsigned long i;
|
||||
int ret = 1;
|
||||
@@ -2698,7 +2688,7 @@ int obj_check_undefineds(struct obj_file *f)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void obj_allocate_commons(struct obj_file *f)
|
||||
static void obj_allocate_commons(struct obj_file *f)
|
||||
{
|
||||
struct common_entry {
|
||||
struct common_entry *next;
|
||||
@@ -2807,7 +2797,7 @@ void obj_allocate_commons(struct obj_file *f)
|
||||
}
|
||||
}
|
||||
|
||||
unsigned long obj_load_size(struct obj_file *f)
|
||||
static unsigned long obj_load_size(struct obj_file *f)
|
||||
{
|
||||
unsigned long dot = 0;
|
||||
struct obj_section *sec;
|
||||
@@ -2828,7 +2818,7 @@ unsigned long obj_load_size(struct obj_file *f)
|
||||
return dot;
|
||||
}
|
||||
|
||||
int obj_relocate(struct obj_file *f, ElfW(Addr) base)
|
||||
static int obj_relocate(struct obj_file *f, ElfW(Addr) base)
|
||||
{
|
||||
int i, n = f->header.e_shnum;
|
||||
int ret = 1;
|
||||
@@ -2958,7 +2948,7 @@ int obj_relocate(struct obj_file *f, ElfW(Addr) base)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int obj_create_image(struct obj_file *f, char *image)
|
||||
static int obj_create_image(struct obj_file *f, char *image)
|
||||
{
|
||||
struct obj_section *sec;
|
||||
ElfW(Addr) base = f->baseaddr;
|
||||
@@ -2980,7 +2970,7 @@ int obj_create_image(struct obj_file *f, char *image)
|
||||
|
||||
/*======================================================================*/
|
||||
|
||||
struct obj_file *obj_load(FILE * fp, int loadprogbits)
|
||||
static struct obj_file *obj_load(FILE * fp, int loadprogbits)
|
||||
{
|
||||
struct obj_file *f;
|
||||
ElfW(Shdr) * section_headers;
|
||||
@@ -3186,7 +3176,7 @@ struct obj_file *obj_load(FILE * fp, int loadprogbits)
|
||||
* kernel for the module
|
||||
*/
|
||||
|
||||
int obj_load_progbits(FILE * fp, struct obj_file* f)
|
||||
static int obj_load_progbits(FILE * fp, struct obj_file* f)
|
||||
{
|
||||
char* imagebase = (char*) f->imagebase;
|
||||
ElfW(Addr) base = f->baseaddr;
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
/* vi: set sw=4 ts=4: */
|
||||
/*
|
||||
* really dumb modprobe implementation for busybox
|
||||
* Copyright (C) 2001 Lineo, davidm@lineo.com
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <syslog.h>
|
||||
#include <string.h>
|
||||
#include "busybox.h"
|
||||
|
||||
static char cmd[128];
|
||||
|
||||
extern int modprobe_main(int argc, char** argv)
|
||||
{
|
||||
int ch, rc = 0;
|
||||
int loadall = 0, showconfig = 0, debug = 0, autoclean = 0, list = 0;
|
||||
int show_only = 0, quiet = 0, remove_opt = 0, do_syslog = 0, verbose = 0;
|
||||
char *load_type = NULL, *config = NULL;
|
||||
|
||||
while ((ch = getopt(argc, argv, "acdklnqrst:vVC:")) != -1)
|
||||
switch(ch) {
|
||||
case 'a':
|
||||
loadall++;
|
||||
break;
|
||||
case 'c':
|
||||
showconfig++;
|
||||
break;
|
||||
case 'd':
|
||||
debug++;
|
||||
break;
|
||||
case 'k':
|
||||
autoclean++;
|
||||
break;
|
||||
case 'l':
|
||||
list++;
|
||||
break;
|
||||
case 'n':
|
||||
show_only++;
|
||||
break;
|
||||
case 'q':
|
||||
quiet++;
|
||||
break;
|
||||
case 'r':
|
||||
remove_opt++;
|
||||
break;
|
||||
case 's':
|
||||
do_syslog++;
|
||||
break;
|
||||
case 't':
|
||||
load_type = optarg;
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
break;
|
||||
case 'C':
|
||||
config = optarg;
|
||||
break;
|
||||
case 'V':
|
||||
default:
|
||||
show_usage();
|
||||
break;
|
||||
}
|
||||
|
||||
if (load_type || config) {
|
||||
fprintf(stderr, "-t and -C not supported\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (showconfig)
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
if (list)
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
if (remove_opt) {
|
||||
do {
|
||||
sprintf(cmd, "rmmod %s %s %s",
|
||||
optind >= argc ? "-a" : "",
|
||||
do_syslog ? "-s" : "",
|
||||
optind < argc ? argv[optind] : "");
|
||||
if (do_syslog)
|
||||
syslog(LOG_INFO, "%s", cmd);
|
||||
if (show_only || verbose)
|
||||
printf("%s\n", cmd);
|
||||
if (!show_only)
|
||||
rc = system(cmd);
|
||||
} while (++optind < argc);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (optind >= argc) {
|
||||
fprintf(stderr, "No module or pattern provided\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
sprintf(cmd, "insmod %s %s %s",
|
||||
do_syslog ? "-s" : "",
|
||||
quiet ? "-q" : "",
|
||||
autoclean ? "-k" : "");
|
||||
while (optind < argc) {
|
||||
strcat(cmd, argv[optind]);
|
||||
strcat(cmd, " ");
|
||||
optind++;
|
||||
}
|
||||
if (do_syslog)
|
||||
syslog(LOG_INFO, "%s", cmd);
|
||||
if (show_only || verbose)
|
||||
printf("%s\n", cmd);
|
||||
if (!show_only)
|
||||
rc = system(cmd);
|
||||
else
|
||||
rc = 0;
|
||||
|
||||
exit(rc ? EXIT_FAILURE : EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,9 +79,9 @@ extern int more_main(int argc, char **argv)
|
||||
|
||||
/* not use inputing from terminal if usage: more > outfile */
|
||||
if(isatty(fileno(stdout))) {
|
||||
cin = fopen("/dev/tty", "r");
|
||||
cin = fopen(CURRENT_TTY, "r");
|
||||
if (!cin)
|
||||
cin = xfopen("/dev/console", "r");
|
||||
cin = xfopen(CONSOLE_DEV, "r");
|
||||
please_display_more_prompt = 0;
|
||||
#ifdef BB_FEATURE_USE_TERMIOS
|
||||
getTermSettings(fileno(cin), &initial_settings);
|
||||
|
||||
@@ -233,7 +233,7 @@ parse_mount_options(char *options, int *flags, char *strflags)
|
||||
}
|
||||
}
|
||||
|
||||
extern int
|
||||
static int
|
||||
mount_one(char *blockDevice, char *directory, char *filesystemType,
|
||||
unsigned long flags, char *string_flags, int useMtab, int fakeIt,
|
||||
char *mtab_opts, int whineOnErrors, int mount_all)
|
||||
|
||||
@@ -143,7 +143,7 @@ static int newfile(char *s);
|
||||
static char *findeq(char *cp);
|
||||
static char *cclass(char *p, int sub);
|
||||
static void initarea(void);
|
||||
extern int shell_main(int argc, char **argv);
|
||||
extern int msh_main(int argc, char **argv);
|
||||
|
||||
|
||||
struct brkcon {
|
||||
@@ -682,8 +682,7 @@ static void * brkaddr;
|
||||
|
||||
|
||||
#ifdef BB_FEATURE_COMMAND_EDITING
|
||||
char * current_prompt;
|
||||
unsigned int shell_context;
|
||||
static char * current_prompt;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -693,7 +692,7 @@ unsigned int shell_context;
|
||||
*/
|
||||
|
||||
|
||||
extern int shell_main(int argc, char **argv)
|
||||
extern int msh_main(int argc, char **argv)
|
||||
{
|
||||
register int f;
|
||||
register char *s;
|
||||
@@ -2867,7 +2866,6 @@ char *c, **v, **envp;
|
||||
for (i = 0; (*tp++ = c[i++]) != '\0';)
|
||||
;
|
||||
|
||||
fprintf(stderr, "calling exec\n");
|
||||
execve(e.linep, v, envp);
|
||||
switch (errno) {
|
||||
case ENOEXEC:
|
||||
@@ -3332,11 +3330,19 @@ void (*f)();
|
||||
int key;
|
||||
{
|
||||
if (*wp != NULL) {
|
||||
for (; *wp != NULL; wp++)
|
||||
for (; *wp != NULL; wp++) {
|
||||
if (isassign(*wp)) {
|
||||
char *cp;
|
||||
assign(*wp, COPYV);
|
||||
for (cp = *wp; *cp != '='; cp++)
|
||||
;
|
||||
*cp = '\0';
|
||||
}
|
||||
if (checkname(*wp))
|
||||
(*f)(lookup(*wp));
|
||||
else
|
||||
badid(*wp);
|
||||
}
|
||||
} else
|
||||
putvlist(key, 1);
|
||||
}
|
||||
@@ -4442,9 +4448,7 @@ register struct ioarg *ap;
|
||||
if ((i = ap->afid != bp->id) || bp->bufp == bp->ebufp) {
|
||||
if (i)
|
||||
lseek(ap->afile, ap->afpos, 0);
|
||||
do {
|
||||
i = read(ap->afile, bp->buf, sizeof(bp->buf));
|
||||
} while (i < 0 && errno == EINTR);
|
||||
i = safe_read(ap->afile, bp->buf, sizeof(bp->buf));
|
||||
if (i <= 0) {
|
||||
closef(ap->afile);
|
||||
return 0;
|
||||
@@ -4463,7 +4467,6 @@ register struct ioarg *ap;
|
||||
|
||||
while (size == 0 || position >= size) {
|
||||
cmdedit_read_input(current_prompt, mycommand);
|
||||
cmdedit_terminate();
|
||||
size = strlen(mycommand);
|
||||
position = 0;
|
||||
}
|
||||
@@ -4473,9 +4476,7 @@ register struct ioarg *ap;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
do {
|
||||
i = read(ap->afile, &c, sizeof(c));
|
||||
} while (i < 0 && errno == EINTR);
|
||||
i = safe_read(ap->afile, &c, sizeof(c));
|
||||
return(i == sizeof(c)? c&0177: (closef(ap->afile), 0));
|
||||
}
|
||||
}
|
||||
|
||||
Loaded 100 of 142 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user