Compare commits

..
39 Commits
Author SHA1 Message Date
Eric Andersen 2f8880d233 fix 'grep -C' which requires an argument 2006-09-25 22:27:20 +00:00
Mike Frysinger d905e44d47 no longer needed 2006-03-23 23:43:06 +00:00
Mike Frysinger 5eda15566a move out of subdir 2006-03-23 23:42:40 +00:00
Mike Frysinger c5907cc380 ShaneAnderson writes in Bug 565:
need to include .config file before setting CROSS otherwise
TARGET_ARCH isnt set properly
2005-11-29 02:53:23 +00:00
Mike Frysinger 88c0e01caf Quote the user we pass to addgroup so funky chars are preserved. Fix by dragan_marinkovic in Bug 544 2005-11-15 05:53:00 +00:00
Rob Landley 2f49047deb Jan-Simon Moller adapted SVN 10238 (the selinux update) to the 1.0 line. 2005-10-09 17:03:26 +00:00
Mike Frysinger 2a5044cc46 merge endian fix from trunk 2005-09-15 01:34:28 +00:00
Mike Frysinger 3f762e4025 merge alpha/parisc support from trunk 2005-09-14 00:03:23 +00:00
Eric Andersen e78e45e801 Patch from Paul Fox to fix the reported vi status line problems.
Paul writes:

the bugs were being caused because when edit_status() and/or
show_status_line() were being called, the current status wasn't
always yet up to date.  i've changed things so that the
formatting/checking/displaying of the status line occurs more
rigorously as the last thing before the user is asked for input.
i did some minor optimization so we don't have to count the
file's lines every time, but this could be improved.  (yes, i
know that turning file_modified into a counter will cause it to
be wrong once in blue moon.  i'm willing to risk that.  ymmv.
this could be fixed with the addition of one more boolean.)
2005-09-12 22:20:22 +00:00
Eric Andersen 7a95dd6f82 sysctl was seriously broken. And since in some cases 'CONFIG_SYSCTL'
could be included into application space via the kernel config option
of the same name, nasty compilation problems could result.
2005-09-12 21:26:42 +00:00
Eric Andersen e76da05b75 Kunihiko IMAI writes:
Hi,

We're using busybox and thank the authors.

I found a short buffer allocation at busybox/sysklod/syslod.c.  It
mis-declares length of filenames, seems to forget for '\0' or two
column numbered suffix of backup files (ex. messages.10).

Here is a patch for the problem.

Thanks.
2005-09-12 19:17:03 +00:00
Rob Landley ab76d3acfd Update unzip to -current, mostly to get the integer overflow bug (commit 11299)
but the rest shouldn't hurt.
2005-09-01 01:34:05 +00:00
Rob Landley 258685a2e5 Dirk Clemens made tar cj work while upgrading the Siemens M740AV to
busybox 1.01.
2005-08-26 03:27:45 +00:00
Eric Andersen d3986eb7ec When doing 'make release' nuke the .svn directories, not the
CVS dirs (since they are no longer present)
2005-08-17 00:01:38 +00:00
Eric Andersen 9e78a1772d We don't need no stinkin changelog 2005-08-16 23:59:17 +00:00
Mike Frysinger f7c7dde158 Bernhard Fischer writes: fix devfsd usage 2005-08-15 22:13:21 +00:00
Rob Landley 830c040f6f Patch from Stephane Billiart to improve ash error message. 2005-08-14 19:17:31 +00:00
Rob Landley 045dedad91 A complete rewrite of the README. Probably broke stuff, but it's unlikely
to affect the compile, now is it?
2005-08-14 00:19:32 +00:00
Rob Landley b309ec71c8 Delete the patches directory from 1.0. 2005-08-13 04:05:50 +00:00
Rob Landley 866bad310f And 10922.
Ick.
2005-08-13 03:10:29 +00:00
Rob Landley 5e1f2d429d 11043 and 11011 2005-08-13 02:28:34 +00:00
Rob Landley 0be69b1693 More backports:
10957 start-stop-daemon -q
10981, 10982, 10994, 10996, 10997: dumpkmap cleanup
10983: top tweak
11000 traceroute
2005-08-13 01:22:03 +00:00
Rob Landley c7cba1ae3b This is published from trunk, remove from 1.0 branch. 2005-08-13 01:12:49 +00:00
Rob Landley be3dae145f Makefile related backports:
10945, 10946 Make compile much, much faster.
10923 big makefile change.  Nervous.
10946, 10991, 10998, 11003 small makefile fixes.
2005-08-13 01:10:27 +00:00
Rob Landley 6022fc8723 Backport:
10882 tar fix
10884, 10920, 11128 tail fixes
10885 tftp -g fix
10900 dpkg fix (script support)
And I guess 10918 isn't relevant?
2005-08-13 00:46:00 +00:00
Rob Landley fc455b2101 1.0 backports of:
10861, 10875, 10881, 10888 ash fix
10865 suid thing?  (look at this)
10886 telnet bugfix
10866 ftp fix for RFC 959 compliance.
10867 Remove spurious newline from cp -i prompt.
10874 ksyslogd fix
10876 msh fix
10877 httpd fix
10880, 10889, 11005 dhcp fixes
2005-08-13 00:26:01 +00:00
Rob Landley 365a345e92 Backport 10864 and 10999. 2005-08-12 06:08:41 +00:00
Rob Landley d5138f44fe Backport 10853, 10860/10870, and 10862. 2005-08-12 06:06:54 +00:00
Rob Landley 9344d8aa10 And 10873. 2005-08-12 06:02:30 +00:00
Eric Andersen 44dbd4bc65 Do not define 'AUTOCONF_INCLUDED' 2005-08-02 01:00:20 +00:00
Mike Frysinger 25b8652b4f patch by srowe in Bug 359 to fix fgrep aliasing 2005-07-31 22:41:05 +00:00
Eric Andersen 091a3e510e The change in getty.c in Busybox 1.01 caused the /etc/issue file to not
be displayed unless CONFIG_FEATURE_UTMP is set.  This was not the intended
result.
2005-07-27 06:03:24 +00:00
Mike Frysinger ffaa3deeeb no longer used as reported by apgo in Bug 348 2005-07-26 22:53:35 +00:00
Rob Landley 5f07779aca Shaun Jackman points out that we shouldn't depend on netdb.h to include
netinet.h for us, although what strange compiler this is expected to 
cause problems with wasn't specified...
2005-07-25 08:09:51 +00:00
Rob Landley ab6399a4c6 Tweak from Sean Jackman: use socklen_t instead of size_t for a declaration. 2005-07-25 01:46:24 +00:00
Eric Andersen ca17c937c2 Bump the version to 1.01 2005-07-19 00:01:10 +00:00
Eric Andersen d62df011a0 Backport 10849 and 10851 2005-07-18 23:54:47 +00:00
Eric Andersen 164a716f96 busybox-1.0.1-rc1.patch
http://busybox.net/lists/busybox/2005-July/014974.html
2005-07-18 23:51:27 +00:00
nobody 8c59a0bf0e This commit was manufactured by cvs2svn to create tag 'busybox_1_00'. 2004-10-13 09:42:10 +00:00
192 changed files with 2521 additions and 8546 deletions

No files matched your search

-7
View File
@@ -1,7 +0,0 @@
busybox
busybox.links
_install
.config
.menuconfig.log
.config.cmd
.config.old
+12 -4
View File
@@ -2,7 +2,7 @@ List of the authors of code contained in BusyBox.
If you have code in BusyBox, you should be listed here. If you should be
listed, or the description of what you have done needs more detail, or is
incorect, _please_ let me know.
incorrect, _please_ let me know.
-Erik
@@ -23,6 +23,9 @@ Laurence Anderson <l.d.anderson@warwick.ac.uk>
Jeff Angielski <jeff@theptrgroup.com>
ftpput, ftpget
Jim Bauer <jfbauer@nfr.com>
modprobe shell dependency
Edward Betts <edward@debian.org>
expr, hostid, logname, whoami
@@ -69,6 +72,11 @@ Daniel Jacobowitz <dan@debian.org>
Matt Kraai <kraai@alumni.cmu.edu>
documentation, bugfixes, test suite
Rob Landley <rob@landley.net>
sed (major rewrite in 2003, and I now maintain the thing).
bunzip2 (complete from-scratch rewrite, then mjn3 optimized the result.)
I've patched lots of other applets, but don't maintain 'em.
Stephan Linz <linz@li-pro.net>
ipcalc, Red Hat equivalence
@@ -76,9 +84,9 @@ John Lombardo <john@deltanet.com>
tr
Glenn McGrath <bug1@iinet.net.au>
Common unarchving code and unarchiving applets, ifupdown, ftpgetput,
nameif, sed, patch, fold, install, uudecode.
Various bugfixes, review and apply numerous patches.
Common unarchiving code and unarchiving applets, ifupdown, ftpgetput,
nameif, sed, patch, fold, install, uudecode.
Various bugfixes, review and apply numerous patches.
Manuel Novoa III <mjn3@codepoet.org>
cat, head, mkfifo, mknod, rmdir, sleep, tee, tty, uniq, usleep, wc, yes,
-1381
View File
File diff suppressed because it is too large. Load diff
+26 -28
View File
@@ -22,7 +22,7 @@
#--------------------------------------------------------------
noconfig_targets := menuconfig config oldconfig randconfig \
defconfig allyesconfig allnoconfig clean distclean \
release tags
release tags
ifndef TOPDIR
TOPDIR=$(CURDIR)/
@@ -34,7 +34,7 @@ ifndef top_builddir
top_builddir=$(CURDIR)
endif
srctree=$(top_srcdir)
export srctree=$(top_srcdir)
vpath %/Config.in $(srctree)
include $(top_builddir)/Rules.mak
@@ -47,8 +47,7 @@ DIRS:=applets archival archival/libunarchive coreutils console-tools \
SRC_DIRS:=$(patsubst %,$(top_srcdir)/%,$(DIRS))
ifeq ($(strip $(CONFIG_SELINUX)),y)
CFLAGS += -I/usr/include/selinux
LIBRARIES += -lsecure
LIBRARIES += -lselinux
endif
CONFIG_CONFIG_IN = $(top_srcdir)/sysdeps/$(TARGET_OS)/Config.in
@@ -147,7 +146,7 @@ uninstall: busybox.links
rm -f $(PREFIX)/bin/busybox
for i in `cat busybox.links` ; do rm -f $(PREFIX)$$i; done
install-hardlinks: applets/install.sh busybox busybox.links
install-hardlinks: $(top_srcdir)/applets/install.sh busybox busybox.links
$(SHELL) $< $(PREFIX) --hardlinks
check: busybox
@@ -164,9 +163,9 @@ docs/busybox.pod : $(top_srcdir)/docs/busybox_header.pod $(top_srcdir)/include/u
cat $(top_srcdir)/docs/busybox_footer.pod ) > docs/busybox.pod
docs/BusyBox.txt: docs/busybox.pod
@echo
@echo BusyBox Documentation
@echo
$(SECHO)
$(SECHO) BusyBox Documentation
$(SECHO)
-mkdir -p docs
-pod2text $< > $@
@@ -193,7 +192,7 @@ scripts/mkdep: $(top_srcdir)/scripts/mkdep.c
scripts/split-include: $(top_srcdir)/scripts/split-include.c
$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
.depend: scripts/mkdep
.depend: scripts/mkdep include/config.h
rm -f .depend .hdepend;
mkdir -p include/config;
scripts/mkdep -I include -- \
@@ -201,7 +200,7 @@ scripts/split-include: $(top_srcdir)/scripts/split-include.c
scripts/mkdep -I include -- \
`find $(top_srcdir) -name \*.h -print | sed -e "s,^./,,"` >> .hdepend;
depend dep: include/config.h .depend
depend dep: .depend
include/config/MARKER: depend scripts/split-include
scripts/split-include include/config.h include/config
@@ -214,9 +213,9 @@ include/config.h: .config
@$(top_builddir)/scripts/config/conf -o $(CONFIG_CONFIG_IN)
finished2:
@echo
@echo Finished installing...
@echo
$(SECHO)
$(SECHO) Finished installing...
$(SECHO)
else # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
@@ -286,20 +285,20 @@ distclean: clean
- $(MAKE) -C scripts/config clean
release: distclean #doc
cd ..; \
rm -rf $(PROG)-$(VERSION); \
cp -a busybox $(PROG)-$(VERSION); \
\
find $(PROG)-$(VERSION)/ -type d \
-name CVS \
-print \
-exec rm -rf {} \; ; \
\
find $(PROG)-$(VERSION)/ -type f \
-name .\#* \
-print \
-exec rm -f {} \; ; \
\
cd ..; \
rm -rf $(PROG)-$(VERSION); \
cp -a busybox $(PROG)-$(VERSION); \
\
find $(PROG)-$(VERSION)/ -type d \
-name .svn \
-print \
-exec rm -rf {} \; ; \
\
find $(PROG)-$(VERSION)/ -type f \
-name .\#* \
-print \
-exec rm -f {} \; ; \
\
tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/;
tags:
@@ -312,4 +311,3 @@ endif # ifeq ($(skip-makefile),)
.PHONY: dummy subdirs release distclean clean config oldconfig \
menuconfig tags check test depend buildtree
+155 -86
View File
@@ -1,127 +1,196 @@
Please see the LICENSE file for details on copying and usage.
BusyBox combines tiny versions of many common UNIX utilities into a single
small executable. It provides minimalist replacements for most of the utilities
you usually find in GNU coreutils, util-linux, etc. The utilities in BusyBox
generally have fewer options than their full-featured GNU cousins; however, the
options that are included provide the expected functionality and behave very
much like their GNU counterparts.
What is busybox:
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, /etc, and a Linux kernel.
BusyBox provides a fairly complete POSIX environment for any small or embedded
system.
BusyBox combines tiny versions of many common UNIX utilities into a single
small executable. It provides minimalist replacements for most of the
utilities you usually find in bzip2, coreutils, file, findutils, gawk, grep,
inetutils, modutils, net-tools, procps, sed, shadow, sysklogd, sysvinit, tar,
util-linux, and vim. The utilities in BusyBox often have fewer options than
their full-featured cousins; however, the options that are included provide
the expected functionality and behave very much like their larger
counterparts.
BusyBox is extremely configurable. This allows you to include only the
components you need, thereby reducing binary size. Run 'make config' or
'make menuconfig' to select the functionality that you wish to enable.
BusyBox has been written with size-optimization and limited resources in
mind, both to produce small binaries and to reduce run-time memory usage.
Busybox is also extremely modular so you can easily include or exclude
commands (or features) at compile time. This makes it easy to customize
embedded systems; to create a working system, just add /dev, /etc, and a
Linux kernel. Busybox (usually together with uClibc) has also been used as
a component of "thin client" desktop systems, live-CD distributions, rescue
disks, installers, and so on.
After the build is complete, a busybox.links file is generated. This is
used by 'make install' to create symlinks to the BusyBox binary for all
compiled in functions. By default, 'make install' will place the symlink
forest into `pwd`/_install unless you have defined the PREFIX environment
variable (i.e., 'make PREFIX=/tmp/foo install')
If you wish to install hard links, rather than symlinks, you can use
'make PREFIX=/tmp/foo install-hardlinks' instead.
BusyBox provides a fairly complete POSIX environment for any small system,
both embedded environments and more full featured systems concerned about
space. Busybox is slowly working towards implementing the full Single Unix
Specification V3 (http://www.opengroup.org/onlinepubs/009695399/), but isn't
there yet (and for size reasons will probably support at most UTF-8 for
internationalization). We are also interested in passing the Linux Test
Project (http://ltp.sourceforge.net).
----------------
Supported architectures:
Using busybox:
BusyBox in general will build on any architecture supported by gcc.
Kernel module loading for 2.2 and 2.4 Linux kernels is currently
limited to ARM, CRIS, H8/300, x86, ia64, x86_64, m68k, MIPS, PowerPC,
S390, SH3/4/5, Sparc, v850e, and x86_64 for 2.4.x kernels. For 2.6.x
kernels, kernel module loading support should work on all architectures.
BusyBox is extremely configurable. This allows you to include only the
components and options you need, thereby reducing binary size. Run 'make
config' or 'make menuconfig' to select the functionality that you wish to
enable.
The behavior of busybox is determined by the name it's called under: as
"cp" it behaves like cp, as "sed" it behaves like sed, and so on. Called
as "busybox" it takes the second argument as the name of the applet to
run (I.E. "./busybox ls -l /proc").
Supported C Libraries:
The "standalone shell" mode is an easy way to try out busybox; this is a
command shell that calls the builtin applets without needing them to be
installed in the path. (Note that this requires /proc to be mounted, if
testing from a boot floppy or in a chroot environment.)
uClibc and glibc are supported. People have been looking at newlib and
dietlibc, but they are currently considered unsupported, untested, or
worse. Linux-libc5 is no longer supported -- you should probably use uClibc
instead if you want a small C library.
Supported kernels:
Full functionality requires Linux 2.2.x or better. A large fraction of the
code should run on just about anything. While the current code is fairly
Linux specific, it should be fairly easy to port the majority of the code
to support, say, FreeBSD or Solaris, or Mac OS X, or even Windows (if you
are into that sort of thing).
The build automatically generates a file "busybox.links", which is used by
'make install' to create symlinks to the BusyBox binary for all compiled in
commands. Use the PREFIX environment variable to specify where to install
the busybox binary and symlink forest. (i.e., 'make PREFIX=/tmp/foo install',
or 'make PREFIX=/tmp/foo install-hardlinks' if you prefer hard links.)
----------------
Getting help:
Downloading the current source code:
When you find you need help, you can check out the BusyBox mailing list
archives at http://busybox.net/lists/busybox/ or even join
the mailing list if you are interested.
Source for the latest released version, as well as daily snapshots, can always
be downloaded from
http://busybox.net/downloads/
You can browse the up to the minute source code and change history online
at:
http://www.busybox.net/cgi-bin/viewcvs.cgi/branches/busybox_1_00_stable/busybox/
Anonymous SVN access is available. For instructions, check out:
http://busybox.net/subversion.html
For those that are actively contributing and would like to check files in,
see:
http://busybox.net/developer.html
The developers also have a bug and patch tracking system
(http://bugs.busybox.net) although posting a bug/patch to the mailing list
is generally a faster way of getting it fixed, and the complete archive of
what happened is the subversion changelog.
----------------
Bugs:
getting help:
If you find bugs, please submit a detailed bug report to the BusyBox mailing
list at busybox@mail.busybox.net. A well-written bug report should include a
transcript of a shell session that demonstrates the bad behavior and enables
anyone else to duplicate the bug on their own machine. The following is such
an example:
when you find you need help, you can check out the busybox mailing list
archives at http://busybox.net/lists/busybox/ or even join
the mailing list if you are interested.
To: busybox@mail.busybox.net
From: diligent@testing.linux.org
Subject: /bin/date doesn't work
----------------
Package: BusyBox
Version: 1.00
bugs:
When I execute BusyBox 'date' it produces unexpected results.
With GNU date I get the following output:
if you find bugs, please submit a detailed bug report to the busybox mailing
list at busybox@busybox.net. a well-written bug report should include a
transcript of a shell session that demonstrates the bad behavior and enables
anyone else to duplicate the bug on their own machine. the following is such
an example:
to: busybox@mail.busybox.net
from: diligent@testing.linux.org
subject: /bin/date doesn't work
package: busybox
version: 1.00
when i execute busybox 'date' it produces unexpected results.
with gnu date i get the following output:
$ date
Fri Oct 8 14:19:41 MDT 2004
fri oct 8 14:19:41 mdt 2004
But when I use BusyBox date I get this instead:
but when i use busybox date i get this instead:
$ date
illegal instruction
I am using Debian unstable, kernel version 2.4.25-vrs2 on a Netwinder,
and the latest uClibc from CVS. Thanks for the wonderful program!
i am using debian unstable, kernel version 2.4.25-vrs2 on a netwinder,
and the latest uclibc from cvs. thanks for the wonderful program!
-Diligent
-diligent
Note the careful description and use of examples showing not only what BusyBox
does, but also a counter example showing what an equivalent GNU app does. Bug
reports lacking such detail may never be fixed... Thanks for understanding.
note the careful description and use of examples showing not only what
busybox does, but also a counter example showing what an equivalent app
does (or pointing to the text of a relevant standard). Bug reports lacking
such detail may never be fixed... Thanks for understanding.
----------------
Downloads:
Portability:
Source for the latest released version, as well as daily snapshots, can always
be downloaded from
http://busybox.net/downloads/
Busybox is developed and tested on Linux 2.4 and 2.6 kernels, linked
against uClibc (0.9.27 or greater) and glibc (2.2 or greater). In such
an environment, the full set of busybox features should work (and if
anything doesn't we want to know about it so we can fix it). Note that
the 2.6 kernel can be trimmed down considerably with the aid of Matt
Mackall's -tiny work (http://www.selenic.com/tiny-about/).
Since busybox consists of a large number of more or less independent
applets, portability is a question of which features work where. Some
busybox applets (such as cat and rm) are highly portable and likely to work
just about anywhere, while others (such as insmod and losetup) are only
likely to work under fairly recent Linux kernels with recent C libraries.
Earlier versions of Linux and glibc may or may not work, for any given
configuration. Linux 2.2 or earlier should mostly work, but this is no
longer regularly tested and inherently won't support certain features (such
as long files and --bind mounts). The same is true for glibc 2.0 and 2.1,
expect a higher testing and debugging burden using such old infrastructure.
(The busybox developers are not very interested in supporting these older
versions, but can probably be talked into accepting small patches to fix
simple problems.)
Some environments are not recommended. Early versions of uClibc were buggy
and missing many features: upgrade. Linking against libc5 or dietlibc is
not supported and not interesting to the busybox developers. (The first is
obsolete and has no known size or feature advantages over uClibc, the second
has known bugs that its developers have actively refused to fix.) Ancient
Linux kernels (2.0.x and earlier) are similarly uninteresting.
In theory it's possible to use Busybox under other operating systems (such as
MacOS X, Solaris, Cygwin, or the BSD Fork Du Jour). This generally involves
a different kernel and a different C library at the same time. While it
should be possible to port the majority of the code to work in one of
these environments, don't be suprised if it doesn't work out of the box. If
you're into that sort of thing, start small (selecting just a few applets)
and work your way up.
Shaun Jackman has recently (2005) ported busybox to a combination of newlib
and libgloss, and some of his patches have been integrated. This platform
may join glibc/uclibc and Linux as a supported combination with the 1.1
release, but is not supported in 1.0.
Supported hardware:
BusyBox in general will build on any architecture supported by gcc. We
support both 32 and 64 bit platforms, and both big and little endian
systems.
Under 2.4 Linux kernels, kernel module loading was implemented in a
platform-specific manner. Busybox's insmod utility has been reported to
work under ARM, CRIS, H8/300, x86, ia64, x86_64, m68k, MIPS, PowerPC, S390,
SH3/4/5, Sparc, v850e, and x86_64. Anything else probably won't work.
The module loading mechanism for the 2.6 kernel is much more generic, and
we believe 2.6.x kernel module loading support should work on all
architectures supported by the kernel.
----------------
CVS:
BusyBox now has its own publicly browsable CVS tree at:
http://busybox.net/cgi-bin/cvsweb/busybox/
Anonymous CVS access is available. For instructions, check out:
http://busybox.net/cvs_anon.html
For those that are actively contributing there is even CVS write access:
http://busybox.net/cvs_write.html
----------------
Please feed suggestions, bug reports, insults, and bribes back to:
Please feed suggestions, bug reports, insults, and bribes back to the busybox
maintainer:
Erik Andersen
<andersen@codepoet.org>
+20 -16
View File
@@ -17,9 +17,14 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Pull in the user's busybox configuration
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
-include $(top_builddir)/.config
endif
#--------------------------------------------------------
PROG := busybox
VERSION := 1.00
VERSION := 1.01
BUILDTIME := $(shell TZ=UTC date -u "+%Y.%m.%d-%H:%M%z")
@@ -81,12 +86,12 @@ BB_SRC_DIR=
WARNINGS=-Wall -Wstrict-prototypes -Wshadow
CFLAGS=-I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)
ARFLAGS=-r
ARFLAGS=cru
#--------------------------------------------------------
export VERSION BUILDTIME TOPDIR HOSTCC HOSTCFLAGS CROSS CC AR AS LD NM STRIP CPP
ifeq ($(strip $(TARGET_ARCH)),)
TARGET_ARCH=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
-e 's/i.86/i386/' \
-e 's/sparc.*/sparc/' \
-e 's/arm.*/arm/g' \
@@ -100,23 +105,26 @@ TARGET_ARCH=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
)
endif
# Pull in the user's busybox configuration
ifeq ($(filter $(noconfig_targets),$(MAKECMDGOALS)),)
-include $(top_builddir)/.config
endif
# A nifty macro to make testing gcc features easier
check_gcc=$(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; \
then echo "$(1)"; else echo "$(2)"; fi)
# Setup some shortcuts so that silent mode is silent like it should be
ifeq ($(subst s,,$(MAKEFLAGS)),$(MAKEFLAGS))
export MAKE_IS_SILENT=n
SECHO=@echo
else
export MAKE_IS_SILENT=y
SECHO=-@false
endif
#--------------------------------------------------------
# Arch specific compiler optimization stuff should go here.
# Unless you want to override the defaults, do not set anything
# for OPTIMIZATION...
# use '-Os' optimization if available, else use -O2
OPTIMIZATION=
OPTIMIZATION=${call check_gcc,-Os,-O2}
OPTIMIZATION:=${call check_gcc,-Os,-O2}
# Some nice architecture specific optimizations
ifeq ($(strip $(TARGET_ARCH)),arm)
@@ -158,8 +166,8 @@ ifeq ($(strip $(CONFIG_DEBUG)),y)
STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
else
CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG
LDFLAGS += -s -Wl,-warn-common
STRIPCMD:=$(STRIP) --remove-section=.note --remove-section=.comment
LDFLAGS += -Wl,-warn-common
STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment
endif
ifeq ($(strip $(CONFIG_STATIC)),y)
LDFLAGS += --static
@@ -190,7 +198,3 @@ endif
CFLAGS += $(CFLAGS_EXTRA)
.PHONY: dummy
.EXPORT_ALL_VARIABLES:
+1 -1
View File
@@ -29,7 +29,7 @@ APPLET_OBJ:= $(patsubst %.c,$(APPLETS_DIR)%.o, $(APPLET_SRC))
libraries-y+=$(APPLETS_DIR)$(APPLETS_AR)
$(APPLETS_DIR)$(APPLETS_AR): $(APPLET_OBJ)
$(AR) -ro $@ $(APPLET_OBJ)
$(AR) $(ARFLAGS) $@ $(APPLET_OBJ)
$(APPLET_OBJ): $(top_builddir)/.config
$(APPLET_OBJ): $(APPLETS_DIR)%.o: $(srcdir)/%.c
+12 -12
View File
@@ -144,25 +144,25 @@ int busybox_main(int argc, char **argv)
output_width -= 20;
#endif
fprintf(stderr, "%s\n\n"
"Usage: busybox [function] [arguments]...\n"
" or: [function] [arguments]...\n\n"
"\tBusyBox is a multi-call binary that combines many common Unix\n"
"\tutilities into a single executable. Most people will create a\n"
"\tlink to busybox for each function they wish to use, and BusyBox\n"
"\twill act like whatever it was invoked as.\n"
"\nCurrently defined functions:\n", bb_msg_full_version);
printf("%s\n\n"
"Usage: busybox [function] [arguments]...\n"
" or: [function] [arguments]...\n\n"
"\tBusyBox is a multi-call binary that combines many common Unix\n"
"\tutilities into a single executable. Most people will create a\n"
"\tlink to busybox for each function they wish to use and BusyBox\n"
"\twill act like whatever it was invoked as!\n"
"\nCurrently defined functions:\n", bb_msg_full_version);
while (a->name != 0) {
col +=
fprintf(stderr, "%s%s", ((col == 0) ? "\t" : ", "),
(a++)->name);
printf("%s%s", ((col == 0) ? "\t" : ", "),
(a++)->name);
if (col > output_width && a->name != 0) {
fprintf(stderr, ",\n");
printf(",\n");
col = 0;
}
}
fprintf(stderr, "\n\n");
printf("\n\n");
exit(0);
}
+1 -1
View File
@@ -41,7 +41,7 @@ ARCHIVAL-$(CONFIG_UNZIP) += unzip.o
libraries-y+=$(ARCHIVAL_DIR)$(ARCHIVAL_AR)
$(ARCHIVAL_DIR)$(ARCHIVAL_AR): $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
$(AR) -ro $@ $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
$(ARCHIVAL_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+8 -3
View File
@@ -56,19 +56,21 @@ static void header_verbose_list_ar(const file_header_t *file_header)
#define AR_OPT_PRESERVE_DATE 0x08
#define AR_OPT_VERBOSE 0x10
#define AR_OPT_CREATE 0x20
#define AR_OPT_INSERT 0x40
extern int ar_main(int argc, char **argv)
{
archive_handle_t *archive_handle;
unsigned long opt;
char *msg_unsupported_err = "Archive %s not supported. Install binutils 'ar'.";
char magic[8];
archive_handle = init_handle();
bb_opt_complementaly = "p~tx:t~px:x~pt";
opt = bb_getopt_ulflags(argc, argv, "ptxovc");
opt = bb_getopt_ulflags(argc, argv, "ptxovcr");
if ((opt & 0x80000000UL) || (optind == argc)) {
if ((opt & BB_GETOPT_ERROR) || (opt == 0) || (optind == argc)) {
bb_show_usage();
}
@@ -88,7 +90,10 @@ extern int ar_main(int argc, char **argv)
archive_handle->action_header = header_verbose_list_ar;
}
if (opt & AR_OPT_CREATE) {
bb_error_msg_and_die("Archive creation not supported. Install binutils 'ar'.");
bb_error_msg_and_die(msg_unsupported_err, "creation");
}
if (opt & AR_OPT_INSERT) {
bb_error_msg_and_die(msg_unsupported_err, "insertion");
}
archive_handle->src_fd = bb_xopen(argv[optind++], O_RDONLY);
+3 -1
View File
@@ -1327,7 +1327,7 @@ void free_array(char **array)
* the status_hashtable to retrieve the info. This results in smaller code than
* scanning the status file. The resulting list, however, is unsorted.
*/
void list_packages(void)
static void list_packages(void)
{
int i;
@@ -1520,6 +1520,7 @@ static char *deb_extract_control_file_to_buffer(archive_handle_t *ar_handle, lli
{
ar_handle->sub_archive->action_data = data_extract_to_buffer;
ar_handle->sub_archive->accept = myaccept;
ar_handle->sub_archive->filter = filter_accept_list;
unpack_ar_archive(ar_handle);
close(ar_handle->src_fd);
@@ -1714,6 +1715,7 @@ int dpkg_main(int argc, char **argv)
if (package_num == -1) {
bb_error_msg("Invalid control file in %s", argv[optind]);
optind++;
continue;
}
deb_file[deb_count]->package = (unsigned int) package_num;
+1 -1
View File
@@ -88,7 +88,7 @@ extern int dpkg_deb_main(int argc, char **argv)
argcount = 2;
}
if ((optind + argcount != argc) || (opt & 0x80000000UL)) {
if ((optind + argcount != argc) || (opt & BB_GETOPT_ERROR)) {
bb_show_usage();
}
+14 -33
View File
@@ -51,12 +51,6 @@
#include <time.h>
#include "busybox.h"
#define memzero(s, n) memset ((void *)(s), 0, (n))
#ifndef RETSIGTYPE
# define RETSIGTYPE void
#endif
typedef unsigned char uch;
typedef unsigned short ush;
typedef unsigned long ulg;
@@ -214,9 +208,6 @@ typedef int file_t; /* Do not use stdio */
static int zip(int in, int out);
static int file_read(char *buf, unsigned size);
/* from gzip.c */
static RETSIGTYPE abort_gzip(void);
/* from deflate.c */
static void lm_init(ush * flags);
static ulg deflate(void);
@@ -335,7 +326,7 @@ static void put_short(ush w)
/* ========================================================================
* Signal and error handler.
*/
static void abort_gzip()
static void abort_gzip(int ignored)
{
exit(ERROR);
}
@@ -350,13 +341,6 @@ static void clear_bufs(void)
bytes_in = 0L;
}
static void write_bb_error_msg(void)
{
fputc('\n', stderr);
bb_perror_nomsg();
abort_gzip();
}
/* ===========================================================================
* Does the same as write(), but also handles partial pipe writes and checks
* for error return.
@@ -366,9 +350,7 @@ static void write_buf(int fd, void *buf, unsigned cnt)
unsigned n;
while ((n = write(fd, buf, cnt)) != cnt) {
if (n == (unsigned) (-1)) {
write_bb_error_msg();
}
if (n == (unsigned) (-1)) bb_error_msg_and_die("can't write");
cnt -= n;
buf = (void *) ((char *) buf + n);
}
@@ -559,7 +541,7 @@ static unsigned bi_reverse(unsigned code, int len)
/* ===========================================================================
* Write out any remaining bits in an incomplete byte.
*/
static void bi_windup()
static void bi_windup(void)
{
if (bi_valid > 8) {
put_short(bi_buf);
@@ -846,7 +828,7 @@ static void lm_init(ush * flags)
register unsigned j;
/* Initialize the hash table. */
memzero((char *) head, HASH_SIZE * sizeof(*head));
memset(head, 0, HASH_SIZE * sizeof(*head));
/* prev will be initialized on the fly */
*flags |= SLOW;
@@ -996,7 +978,7 @@ static void check_match(IPos start, IPos match, int length)
* file reads are performed for at least two bytes (required for the
* translate_eol option).
*/
static void fill_window()
static void fill_window(void)
{
register unsigned n, m;
unsigned more =
@@ -1060,7 +1042,7 @@ static void fill_window()
* evaluation for matches: a match is finally adopted only if there is
* no better match at the next window position.
*/
static ulg deflate()
static ulg deflate(void)
{
IPos hash_head; /* head of hash chain */
IPos prev_match; /* previous match */
@@ -1188,8 +1170,6 @@ static ulg deflate()
typedef struct dirent dir_type;
typedef RETSIGTYPE(*sig_type) (int);
/* ======================================================================== */
int gzip_main(int argc, char **argv)
{
@@ -1235,16 +1215,16 @@ int gzip_main(int argc, char **argv)
foreground = signal(SIGINT, SIG_IGN) != SIG_IGN;
if (foreground) {
(void) signal(SIGINT, (sig_type) abort_gzip);
(void) signal(SIGINT, abort_gzip);
}
#ifdef SIGTERM
if (signal(SIGTERM, SIG_IGN) != SIG_IGN) {
(void) signal(SIGTERM, (sig_type) abort_gzip);
(void) signal(SIGTERM, abort_gzip);
}
#endif
#ifdef SIGHUP
if (signal(SIGHUP, SIG_IGN) != SIG_IGN) {
(void) signal(SIGHUP, (sig_type) abort_gzip);
(void) signal(SIGHUP, abort_gzip);
}
#endif
@@ -1271,6 +1251,7 @@ int gzip_main(int argc, char **argv)
for (i = optind; i < argc; i++) {
char *path = NULL;
clear_bufs();
if (strcmp(argv[i], "-") == 0) {
time_stamp = 0;
ifile_size = -1L;
@@ -1749,7 +1730,7 @@ static void ct_init(ush * attr, int *methodp)
/* ===========================================================================
* Initialize a new block.
*/
static void init_block()
static void init_block(void)
{
int n; /* iterates over tree elements */
@@ -2162,7 +2143,7 @@ static void send_tree(ct_data * tree, int max_code)
* Construct the Huffman tree for the bit lengths and return the index in
* bl_order of the last bit length code to send.
*/
static const int build_bl_tree()
static int build_bl_tree(void)
{
int max_blindex; /* index of last bit length code of non zero freq */
@@ -2425,7 +2406,7 @@ static void compress_block(ct_data * ltree, ct_data * dtree)
* IN assertion: the fields freq of dyn_ltree are set and the total of all
* frequencies does not exceed 64K (to fit in an int on 16 bit machines).
*/
static void set_file_type()
static void set_file_type(void)
{
int n = 0;
unsigned ascii_freq = 0;
@@ -2538,7 +2519,7 @@ static int file_read(char *buf, unsigned size)
* Write the output buffer outbuf[0..outcnt-1] and update bytes_out.
* (used for the compressed data only)
*/
static void flush_outbuf()
static void flush_outbuf(void)
{
if (outcnt == 0)
return;
+1 -1
View File
@@ -77,7 +77,7 @@ LIBUNARCHIVE-$(CONFIG_UNZIP) += $(GUNZIP_FILES)
libraries-y+=$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR)
$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR): $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
$(AR) -ro $@ $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
$(LIBUNARCHIVA_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
@@ -26,7 +26,7 @@ extern ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned
size = bb_full_read(archive_handle->src_fd, buf, count);
if ((size != 0) && (size != count)) {
bb_perror_msg_and_die("Short read, read %d of %d", size, count);
bb_perror_msg_and_die("Short read, read %ld of %ld", (long)size, (long)count);
}
return(size);
}
+13 -12
View File
@@ -134,8 +134,6 @@ static unsigned int get_bits(bunzip_data *bd, char bits_wanted)
static int get_next_block(bunzip_data *bd)
{
/* Note: Ignore the warning about hufGroup, base and limit being used uninitialized.
* They will be initialized on the fist pass of the loop. */
struct group_data *hufGroup;
int dbufCount,nextSym,dbufSize,groupCount,*base,*limit,selector,
i,j,k,t,runPos,symCount,symTotal,nSelectors,byteCount[256];
@@ -286,16 +284,15 @@ static int get_next_block(bunzip_data *bd)
mtfSymbol[i]=(unsigned char)i;
}
/* Loop through compressed symbols. */
runPos=dbufCount=symCount=selector=0;
runPos=dbufCount=selector=0;
for(;;) {
/* Determine which Huffman coding group to use. */
if(!(symCount--)) {
symCount=GROUP_SIZE-1;
if(selector>=nSelectors) return RETVAL_DATA_ERROR;
hufGroup=bd->groups+selectors[selector++];
base=hufGroup->base-1;
limit=hufGroup->limit-1;
}
/* fetch next Huffman coding group from list. */
symCount=GROUP_SIZE-1;
if(selector>=nSelectors) return RETVAL_DATA_ERROR;
hufGroup=bd->groups+selectors[selector++];
base=hufGroup->base-1;
limit=hufGroup->limit-1;
continue_this_group:
/* Read next Huffman-coded symbol. */
/* Note: It is far cheaper to read maxLen bits and back up than it is
to read minLen bits and then an additional bit at a time, testing
@@ -346,7 +343,7 @@ got_huff_bits:
context). Thus space is saved. */
t += (runPos << nextSym); /* +runPos if RUNA; +2*runPos if RUNB */
runPos <<= 1;
continue;
goto end_of_huffman_loop;
}
/* When we hit the first non-run symbol after a run, we now know
how many times to repeat the last literal, so append that many
@@ -384,6 +381,10 @@ got_huff_bits:
/* We have our literal byte. Save it into dbuf. */
byteCount[uc]++;
dbuf[dbufCount++] = (unsigned int)uc;
/* Skip group initialization if we're not done with this group. Done this
* way to avoid compiler warning. */
end_of_huffman_loop:
if(symCount--) goto continue_this_group;
}
/* At this point, we've read all the Huffman-coded symbols (and repeated
runs) for this block from the input stream, and decoded them into the
+86 -81
View File
@@ -16,6 +16,11 @@
*
* read_gz interface + associated hacking by Laurence Anderson
*
* Fixed huft_build() so decoding end-of-block code does not grab more bits
* than necessary (this is required by unzip applet), added inflate_cleanup()
* to free leaked bytebuffer memory (used in unzip.c), and some minor style
* guide cleanups by Ed Clark
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -116,26 +121,26 @@ static const unsigned short mask_bits[] = {
/* Copy lengths for literal codes 257..285 */
static const unsigned short cplens[] = {
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59,
67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
};
/* note: see note #13 above about the 258 in this list. */
/* Extra bits for literal codes 257..285 */
static const unsigned char cplext[] = {
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5,
5, 5, 5, 0, 99, 99
5, 5, 5, 0, 99, 99
}; /* 99==invalid */
/* Copy offsets for distance codes 0..29 */
static const unsigned short cpdist[] = {
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513,
769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577
769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577
};
/* Extra bits for distance codes */
static const unsigned char cpdext[] = {
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10,
11, 11, 12, 12, 13, 13
11, 11, 12, 12, 13, 13
};
/* Tables for deflate from PKZIP's appnote.txt. */
@@ -151,7 +156,10 @@ static unsigned int fill_bitbuffer(unsigned int bitbuffer, unsigned int *current
/* Leave the first 4 bytes empty so we can always unwind the bitbuffer
* to the front of the bytebuffer, leave 4 bytes free at end of tail
* so we can easily top up buffer in check_trailer_gzip() */
bytebuffer_size = 4 + bb_xread(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 8);
if (!(bytebuffer_size = bb_xread(gunzip_src_fd, &bytebuffer[4], bytebuffer_max - 8))) {
bb_error_msg_and_die("unexpected end of file");
}
bytebuffer_size += 4;
bytebuffer_offset = 4;
}
bitbuffer |= ((unsigned int) bytebuffer[bytebuffer_offset]) << *current;
@@ -168,7 +176,7 @@ static void make_gunzip_crc_table(void)
/* initial shift register value */
gunzip_crc = 0xffffffffL;
gunzip_crc_table = (unsigned int *) malloc(256 * sizeof(unsigned int));
gunzip_crc_table = (unsigned int *) xmalloc(256 * sizeof(unsigned int));
/* Compute and print table of CRC's, five per line */
for (i = 0; i < 256; i++) {
@@ -184,8 +192,8 @@ static void make_gunzip_crc_table(void)
table_entry = (table_entry >> 1) ^ poly;
} else {
table_entry >>= 1;
}
}
}
}
gunzip_crc_table[i] = table_entry;
}
}
@@ -225,70 +233,59 @@ static int huft_free(huft_t * t)
* t: result: starting table
* m: maximum lookup bits, returns actual
*/
static int huft_build(unsigned int *b, const unsigned int n,
const unsigned int s, const unsigned short *d,
const unsigned char *e, huft_t ** t, int *m)
int huft_build(unsigned int *b, const unsigned int n,
const unsigned int s, const unsigned short *d,
const unsigned char *e, huft_t ** t, int *m)
{
unsigned a; /* counter for codes of length k */
unsigned a; /* counter for codes of length k */
unsigned c[BMAX + 1]; /* bit length count table */
unsigned f; /* i repeats in table every f entries */
int g; /* maximum code length */
int h; /* table level */
unsigned eob_len; /* length of end-of-block code (value 256) */
unsigned f; /* i repeats in table every f entries */
int g; /* maximum code length */
int h; /* table level */
register unsigned i; /* counter, current code */
register unsigned j; /* counter */
register int k; /* number of bits in current code */
int l; /* bits per table (returned in m) */
register int k; /* number of bits in current code */
register unsigned *p; /* pointer into c[], b[], or v[] */
register huft_t *q; /* points to current table */
huft_t r; /* table entry for structure assignment */
huft_t *u[BMAX]; /* table stack */
unsigned v[N_MAX]; /* values in order of bit length */
register int w; /* bits before this table == (l * h) */
register huft_t *q; /* points to current table */
huft_t r; /* table entry for structure assignment */
huft_t *u[BMAX]; /* table stack */
unsigned v[N_MAX]; /* values in order of bit length */
int ws[BMAX+1]; /* bits decoded stack */
register int w; /* bits decoded */
unsigned x[BMAX + 1]; /* bit offsets, then code stack */
unsigned *xp; /* pointer into x */
int y; /* number of dummy codes added */
unsigned z; /* number of entries in current table */
unsigned *xp; /* pointer into x */
int y; /* number of dummy codes added */
unsigned z; /* number of entries in current table */
/* Length of EOB code, if any */
eob_len = n > 256 ? b[256] : BMAX;
/* Generate counts for each bit length */
memset((void *) (c), 0, sizeof(c));
memset((void *)c, 0, sizeof(c));
p = b;
i = n;
do {
c[*p]++; /* assume all entries <= BMAX */
p++; /* Can't combine with above line (Solaris bug) */
c[*p]++; /* assume all entries <= BMAX */
p++; /* Can't combine with above line (Solaris bug) */
} while (--i);
if (c[0] == n) { /* null input--all zero length codes */
if (c[0] == n) { /* null input--all zero length codes */
*t = (huft_t *) NULL;
*m = 0;
return 0;
}
/* Find minimum and maximum length, bound *m by those */
l = *m;
for (j = 1; j <= BMAX; j++) {
if (c[j]) {
break;
}
}
k = j; /* minimum code length */
if ((unsigned) l < j) {
l = j;
}
for (i = BMAX; i; i--) {
if (c[i]) {
break;
}
}
g = i; /* maximum code length */
if ((unsigned) l > i) {
l = i;
}
*m = l;
for (j = 1; (c[j] == 0) && (j <= BMAX); j++);
k = j; /* minimum code length */
for (i = BMAX; (c[i] == 0) && i; i--);
g = i; /* maximum code length */
*m = (*m < j) ? j : ((*m > i) ? i : *m);
/* Adjust last length count to fill out codes, if needed */
for (y = 1 << j; j < i; j++, y <<= 1) {
if ((y -= c[j]) < 0) {
return 2; /* bad input: more codes than bits */
return 2; /* bad input: more codes than bits */
}
}
if ((y -= c[i]) < 0) {
@@ -300,7 +297,7 @@ static int huft_build(unsigned int *b, const unsigned int n,
x[1] = j = 0;
p = c + 1;
xp = x + 2;
while (--i) { /* note that i == g from above */
while (--i) { /* note that i == g from above */
*xp++ = (j += *p++);
}
@@ -314,13 +311,13 @@ static int huft_build(unsigned int *b, const unsigned int n,
} while (++i < n);
/* Generate the Huffman codes and for each, make the table entries */
x[0] = i = 0; /* first Huffman code is zero */
p = v; /* grab values in bit order */
h = -1; /* no tables yet--level -1 */
w = -l; /* bits decoded == (l * h) */
x[0] = i = 0; /* first Huffman code is zero */
p = v; /* grab values in bit order */
h = -1; /* no tables yet--level -1 */
w = ws[0] = 0; /* bits decoded */
u[0] = (huft_t *) NULL; /* just to keep compilers happy */
q = (huft_t *) NULL; /* ditto */
z = 0; /* ditto */
z = 0; /* ditto */
/* go through the bit lengths (k already is bits in shortest code) */
for (; k <= g; k++) {
@@ -328,52 +325,52 @@ static int huft_build(unsigned int *b, const unsigned int n,
while (a--) {
/* here i is the Huffman code of length k bits for value *p */
/* make tables up to required level */
while (k > w + l) {
h++;
w += l; /* previous table always l bits */
while (k > ws[h + 1]) {
w = ws[++h];
/* compute minimum size table less than or equal to l bits */
z = (z = g - w) > (unsigned) l ? l : z; /* upper limit on table size */
if ((f = 1 << (j = k - w)) > a + 1) { /* try a k-w bit table *//* too few codes for k-w bit table */
f -= a + 1; /* deduct codes from patterns left */
/* compute minimum size table less than or equal to *m bits */
z = (z = g - w) > *m ? *m : z; /* upper limit on table size */
if ((f = 1 << (j = k - w)) > a + 1) { /* try a k-w bit table */
/* too few codes for k-w bit table */
f -= a + 1; /* deduct codes from patterns left */
xp = c + k;
while (++j < z) { /* try smaller tables up to z bits */
while (++j < z) { /* try smaller tables up to z bits */
if ((f <<= 1) <= *++xp) {
break; /* enough codes to use up j bits */
break; /* enough codes to use up j bits */
}
f -= *xp; /* else deduct codes from patterns */
f -= *xp; /* else deduct codes from patterns */
}
}
j = (w + j > eob_len && w < eob_len) ? eob_len - w : j; /* make EOB code end at table */
z = 1 << j; /* table entries for j-bit table */
ws[h+1] = w + j; /* set bits decoded in stack */
/* allocate and link in new table */
q = (huft_t *) xmalloc((z + 1) * sizeof(huft_t));
*t = q + 1; /* link to list for huft_free() */
*(t = &(q->v.t)) = NULL;
u[h] = ++q; /* table starts after link */
/* connect to last table, if there is one */
if (h) {
x[h] = i; /* save pattern for backing up */
r.b = (unsigned char) l; /* bits to dump before this table */
r.e = (unsigned char) (16 + j); /* bits in this table */
r.v.t = q; /* pointer to this table */
j = i >> (w - l); /* (get around Turbo C bug) */
u[h - 1][j] = r; /* connect to last table */
x[h] = i; /* save pattern for backing up */
r.b = (unsigned char) (w - ws[h - 1]); /* bits to dump before this table */
r.e = (unsigned char) (16 + j); /* bits in this table */
r.v.t = q; /* pointer to this table */
j = (i & ((1 << w) - 1)) >> ws[h - 1];
u[h - 1][j] = r; /* connect to last table */
}
}
/* set up table entry in r */
r.b = (unsigned char) (k - w);
if (p >= v + n) {
r.e = 99; /* out of values--invalid code */
r.e = 99; /* out of values--invalid code */
} else if (*p < s) {
r.e = (unsigned char) (*p < 256 ? 16 : 15); /* 256 is end-of-block code */
r.v.n = (unsigned short) (*p); /* simple code is just the value */
p++; /* one compiler does not like *p++ */
r.e = (unsigned char) (*p < 256 ? 16 : 15); /* 256 is EOB code */
r.v.n = (unsigned short) (*p++); /* simple code is just the value */
} else {
r.e = (unsigned char) e[*p - s]; /* non-simple--look up in lists */
r.e = (unsigned char) e[*p - s]; /* non-simple--look up in lists */
r.v.n = d[*p++ - s];
}
@@ -391,11 +388,14 @@ static int huft_build(unsigned int *b, const unsigned int n,
/* backup over finished tables */
while ((i & ((1 << w) - 1)) != x[h]) {
h--; /* don't need to update q */
w -= l;
w = ws[--h];
}
}
}
/* return actual size of base table */
*m = ws[1];
/* Return true (1) if we were given an incomplete table */
return y != 0 && g != 1;
}
@@ -901,6 +901,11 @@ extern void inflate_init(unsigned int bufsize)
bytebuffer_size = 0;
}
extern void inflate_cleanup(void)
{
free(bytebuffer);
}
extern int inflate_unzip(int in, int out)
{
ssize_t nwrote;
@@ -951,7 +956,7 @@ extern int inflate_unzip(int in, int out)
extern int inflate_gunzip(int in, int out)
{
unsigned int stored_crc = 0;
unsigned char count;
unsigned int count;
inflate_unzip(in, out);
+10
View File
@@ -62,6 +62,7 @@ extern char get_header_tar(archive_handle_t *archive_handle)
} tar;
long sum = 0;
long i;
static int end = 0;
/* Align header */
data_align(archive_handle, 512);
@@ -74,8 +75,17 @@ extern char get_header_tar(archive_handle_t *archive_handle)
/* If there is no filename its an empty header */
if (tar.formated.name[0] == 0) {
if (end) {
/* This is the second consecutive empty header! End of archive!
* Read until the end to empty the pipe from gz or bz2
*/
while (bb_full_read(archive_handle->src_fd, tar.raw, 512) == 512);
return(EXIT_FAILURE);
}
end = 1;
return(EXIT_SUCCESS);
}
end = 0;
/* Check header has valid magic, "ustar" is for the proper tar
* 0's are for the old tar format
+10 -7
View File
@@ -479,7 +479,10 @@ static inline int writeTarFile(const int tar_fd, const int verboseFlag,
close(gzipStatusPipe[0]);
fcntl(gzipStatusPipe[1], F_SETFD, FD_CLOEXEC); /* close on exec shows sucess */
execl("/bin/gzip", "gzip", "-f", 0);
if (gzip == 1)
execlp("gzip", "gzip", "-f", 0);
else
execlp("bzip2", "bzip2", "-f", 0);
vfork_exec_errno = errno;
close(gzipStatusPipe[1]);
@@ -538,7 +541,7 @@ static inline int writeTarFile(const int tar_fd, const int verboseFlag,
freeHardLinkInfo(&tbInfo.hlInfoHead);
#ifdef CONFIG_FEATURE_TAR_GZIP
if (gzip && gzipPid) {
if (gzipPid) {
if (waitpid(gzipPid, NULL, 0) == -1)
printf("Couldnt wait ?");
}
@@ -724,7 +727,7 @@ int tar_main(int argc, char **argv)
);
/* Check one and only one context option was given */
if(opt & 0x80000000UL) {
if(opt & BB_GETOPT_ERROR) {
bb_show_usage();
}
#ifdef CONFIG_FEATURE_TAR_CREATE
@@ -846,16 +849,16 @@ int tar_main(int argc, char **argv)
/* create an archive */
if (opt & CTX_CREATE) {
int verboseFlag = FALSE;
int gzipFlag = FALSE;
int zipMode = 0;
# ifdef CONFIG_FEATURE_TAR_GZIP
if (get_header_ptr == get_header_tar_gz) {
gzipFlag = TRUE;
zipMode = 1;
}
# endif /* CONFIG_FEATURE_TAR_GZIP */
# ifdef CONFIG_FEATURE_TAR_BZIP2
if (get_header_ptr == get_header_tar_bz2) {
bb_error_msg_and_die("Creating bzip2 compressed archives is not currently supported.");
zipMode = 2;
}
# endif /* CONFIG_FEATURE_TAR_BZIP2 */
@@ -864,7 +867,7 @@ int tar_main(int argc, char **argv)
verboseFlag = TRUE;
}
writeTarFile(tar_handle->src_fd, verboseFlag, opt & TAR_OPT_DEREFERNCE, tar_handle->accept,
tar_handle->reject, gzipFlag);
tar_handle->reject, zipMode);
} else
#endif /* CONFIG_FEATURE_TAR_CREATE */
{
+1 -1
View File
@@ -37,7 +37,7 @@ CONSOLETOOLS_DIR-$(CONFIG_SETKEYCODES) += setkeycodes.o
libraries-y+=$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR)
$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR): $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
$(AR) -ro $@ $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
$(CONSOLETOOLS_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+18 -25
View File
@@ -35,11 +35,11 @@ struct kbentry {
unsigned char kb_index;
unsigned short kb_value;
};
static const int KDGKBENT = 0x4B46; /* gets one entry in translation table */
#define KDGKBENT 0x4B46 /* gets one entry in translation table */
/* From <linux/keyboard.h> */
static const int NR_KEYS = 128;
static const int MAX_NR_KEYMAPS = 256;
#define NR_KEYS 128
#define MAX_NR_KEYMAPS 256
int dumpkmap_main(int argc, char **argv)
{
@@ -47,28 +47,21 @@ int dumpkmap_main(int argc, char **argv)
int i, j, fd;
char flags[MAX_NR_KEYMAPS], magic[] = "bkeymap";
if (argc>=2 && *argv[1]=='-') {
if (argc >= 2 && *argv[1] == '-')
bb_show_usage();
}
fd=bb_xopen(CURRENT_VC, O_RDWR);
fd = bb_xopen(CURRENT_VC, O_RDWR);
write(1, magic, 7);
for (i=0; i < MAX_NR_KEYMAPS; i++) flags[i]=0;
flags[0]=1;
flags[1]=1;
flags[2]=1;
flags[4]=1;
flags[5]=1;
flags[6]=1;
flags[8]=1;
flags[9]=1;
flags[10]=1;
flags[12]=1;
/* Here we want to set everything to 0 except for indexes:
* [0-2] [4-6] [8-10] [12] */
memset(flags, 0x00, MAX_NR_KEYMAPS);
memset(flags, 0x01, 13);
flags[3] = flags[7] = flags[11] = 0;
/* dump flags */
for (i=0; i < MAX_NR_KEYMAPS; i++) write(1,&flags[i],1);
write(1, flags, MAX_NR_KEYMAPS);
for (i = 0; i < MAX_NR_KEYMAPS; i++) {
if (flags[i] == 1) {
@@ -76,13 +69,13 @@ int dumpkmap_main(int argc, char **argv)
ke.kb_index = j;
ke.kb_table = i;
if (ioctl(fd, KDGKBENT, &ke) < 0) {
bb_error_msg("ioctl returned: %m, %s, %s, %xqq", (char *)&ke.kb_index,(char *)&ke.kb_table,(int)&ke.kb_value);
}
else {
write(1,(void*)&ke.kb_value,2);
}
bb_perror_msg("ioctl failed with %s, %s, %p",
(char *)&ke.kb_index,
(char *)&ke.kb_table,
&ke.kb_value);
} else {
write(1, (void*)&ke.kb_value, 2);
}
}
}
}
+1 -1
View File
@@ -545,7 +545,7 @@ config CONFIG_WC
config CONFIG_WHO
bool "who"
default n
select CONFIG_FEATURE_U_W_TMP
select CONFIG_FEATURE_UTMP
help
who is used to show who is logged on.
+1 -1
View File
@@ -91,7 +91,7 @@ COREUTILS-$(CONFIG_YES) += yes.o
libraries-y+=$(COREUTILS_DIR)$(COREUTILS_AR)
$(COREUTILS_DIR)$(COREUTILS_AR): $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
$(AR) -ro $@ $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
$(COREUTILS_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+7 -1
View File
@@ -42,7 +42,7 @@
#include "libcoreutils/coreutils.h"
/* WARNING!! ORDER IS IMPORTANT!! */
static const char cp_opts[] = "pdRfiar";
static const char cp_opts[] = "pdRfiarP";
extern int cp_main(int argc, char **argv)
{
@@ -73,6 +73,12 @@ extern int cp_main(int argc, char **argv)
*/
flags |= FILEUTILS_RECUR;
}
if (flags & 128) {
/* Make -P a synonym for -d,
* -d is the GNU option while -P is the POSIX 2003 option
*/
flags |= FILEUTILS_DEREFERENCE;
}
flags ^= FILEUTILS_DEREFERENCE; /* The sense of this flag was reversed. */
+1 -1
View File
@@ -300,7 +300,7 @@ extern int cut_main(int argc, char **argv)
part = opt & (OPT_BYTE_FLGS|OPT_CHAR_FLGS|OPT_FIELDS_FLGS);
if(part == 0)
bb_error_msg_and_die("you must specify a list of bytes, characters, or fields");
if(opt & 0x80000000UL)
if(opt & BB_GETOPT_ERROR)
bb_error_msg_and_die("only one type of list may be specified");
parse_lists(sopt);
if((opt & (OPT_DELIM_FLGS))) {
+8 -6
View File
@@ -136,7 +136,6 @@ int date_main(int argc, char **argv)
{
char *date_str = NULL;
char *date_fmt = NULL;
char *t_buff;
int set_time;
int utc;
int use_arg = 0;
@@ -166,7 +165,7 @@ int date_main(int argc, char **argv)
bb_error_msg_and_die(bb_msg_memory_exhausted);
}
use_arg = opt & DATE_OPT_DATE;
if(opt & 0x80000000UL)
if(opt & BB_GETOPT_ERROR)
bb_show_usage();
#ifdef CONFIG_FEATURE_DATE_ISOFMT
if(opt & DATE_OPT_TIMESPEC) {
@@ -283,10 +282,13 @@ int date_main(int argc, char **argv)
date_fmt = "%Y.%m.%d-%H:%M:%S";
}
/* Print OUTPUT (after ALL that!) */
t_buff = xmalloc(201);
strftime(t_buff, 200, date_fmt, &tm_time);
puts(t_buff);
{
/* Print OUTPUT (after ALL that!) */
RESERVE_CONFIG_BUFFER(t_buff, 201);
strftime(t_buff, 200, date_fmt, &tm_time);
puts(t_buff);
RELEASE_CONFIG_BUFFER(t_buff);
}
return EXIT_SUCCESS;
}
+14 -21
View File
@@ -245,10 +245,9 @@ static int arithmetic_common (VALUE *l, VALUE *r, int op)
static VALUE *docolon (VALUE *sv, VALUE *pv)
{
VALUE *v;
const char *errmsg;
struct re_pattern_buffer re_buffer;
struct re_registers re_regs;
int len;
regex_t re_buffer;
const int NMATCH = 2;
regmatch_t re_regs[NMATCH];
tostring (sv);
tostring (pv);
@@ -260,27 +259,22 @@ of a basic regular expression is not portable; it is being ignored",
pv->u.s);
}
len = strlen (pv->u.s);
memset (&re_buffer, 0, sizeof (re_buffer));
memset (&re_regs, 0, sizeof (re_regs));
re_buffer.allocated = 2 * len;
re_buffer.buffer = (unsigned char *) xmalloc (re_buffer.allocated);
re_buffer.translate = 0;
re_syntax_options = RE_SYNTAX_POSIX_BASIC;
errmsg = re_compile_pattern (pv->u.s, len, &re_buffer);
if (errmsg) {
bb_error_msg_and_die("%s", errmsg);
}
memset (re_regs, 0, sizeof (*re_regs));
if( regcomp (&re_buffer, pv->u.s, 0) != 0 )
bb_error_msg_and_die("Invalid regular expression");
len = re_match (&re_buffer, sv->u.s, strlen (sv->u.s), 0, &re_regs);
if (len >= 0) {
/* expr uses an anchored pattern match, so check that there was a
* match and that the match starts at offset 0. */
if (regexec (&re_buffer, sv->u.s, NMATCH, re_regs, 0) != REG_NOMATCH &&
re_regs[0].rm_so == 0) {
/* Were \(...\) used? */
if (re_buffer.re_nsub > 0) { /* was (re_regs.start[1] >= 0) */
sv->u.s[re_regs.end[1]] = '\0';
v = str_value (sv->u.s + re_regs.start[1]);
if (re_buffer.re_nsub > 0) {
sv->u.s[re_regs[1].rm_eo] = '\0';
v = str_value (sv->u.s + re_regs[1].rm_so);
}
else
v = int_value (len);
v = int_value (re_regs[0].rm_eo);
}
else {
/* Match failed -- return the right kind of null. */
@@ -289,7 +283,6 @@ of a basic regular expression is not portable; it is being ignored",
else
v = int_value (0);
}
free (re_buffer.buffer);
return v;
}
+17 -13
View File
@@ -32,8 +32,7 @@
#include <sys/types.h>
#ifdef CONFIG_SELINUX
#include <proc_secure.h>
#include <flask_util.h>
#include <selinux/selinux.h>
#endif
#define PRINT_REAL 1
@@ -61,14 +60,12 @@ extern int id_main(int argc, char **argv)
gid_t gid;
unsigned long flags;
short status;
#ifdef CONFIG_SELINUX
int is_flask_enabled_flag = is_flask_enabled();
#endif
bb_opt_complementaly = "u~g:g~u";
flags = bb_getopt_ulflags(argc, argv, "rnug");
if ((flags & 0x80000000UL)
if ((flags & BB_GETOPT_ERROR)
/* Don't allow -n -r -nr */
|| (flags <= 3 && flags > 0)
/* Don't allow more than one username */
@@ -110,13 +107,20 @@ extern int id_main(int argc, char **argv)
/* my_getgrgid doesn't exit on failure here */
status|=printf_full(gid, my_getgrgid(NULL, gid, 0), 'g');
#ifdef CONFIG_SELINUX
if(is_flask_enabled_flag) {
security_id_t mysid = getsecsid();
char context[80];
int len = sizeof(context);
context[0] = '\0';
if(security_sid_to_context(mysid, context, &len))
strcpy(context, "unknown");
if ( is_selinux_enabled() ) {
security_context_t mysid;
char context[80];
int len = sizeof(context);
getcon(&mysid);
context[0] = '\0';
if (mysid) {
len = strlen(mysid)+1;
safe_strncpy(context, mysid, len);
freecon(mysid);
}else{
safe_strncpy(context, "unknown",8);
}
bb_printf(" context=%s", context);
}
#endif
+1 -1
View File
@@ -69,7 +69,7 @@ extern int install_main(int argc, char **argv)
flags = bb_getopt_ulflags(argc, argv, "cdpsg:m:o:", &gid_str, &mode_str, &uid_str); /* 'a' must be 2nd */
/* Check valid options were given */
if(flags & 0x80000000UL) {
if(flags & BB_GETOPT_ERROR) {
bb_show_usage();
}
+1 -1
View File
@@ -30,7 +30,7 @@ LIBCOREUTILS_OBJS=$(patsubst %.c,$(LIBCOREUTILS_DIR)%.o, $(LIBCOREUTILS_SRC))
libraries-y+=$(LIBCOREUTILS_DIR)$(LIBCOREUTILS_AR)
$(LIBCOREUTILS_DIR)$(LIBCOREUTILS_AR): $(LIBCOREUTILS_OBJS)
$(AR) -ro $@ $(LIBCOREUTILS_OBJS)
$(AR) $(ARFLAGS) $@ $(LIBCOREUTILS_OBJS)
$(LIBCOREUTILS_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+25 -22
View File
@@ -64,9 +64,7 @@ enum {
#include <sys/sysmacros.h> /* major() and minor() */
#include "busybox.h"
#ifdef CONFIG_SELINUX
#include <fs_secure.h>
#include <flask_util.h>
#include <ss.h>
#include <selinux/selinux.h>
#endif
#ifdef CONFIG_FEATURE_LS_TIMESTAMPS
@@ -182,7 +180,7 @@ struct dnode { /* the basic node */
char *fullname; /* the dir entry name */
struct stat dstat; /* the file stat info */
#ifdef CONFIG_SELINUX
security_id_t sid;
security_context_t sid;
#endif
struct dnode *next; /* point at the next node */
};
@@ -195,7 +193,7 @@ static int list_single(struct dnode *);
static unsigned int all_fmt;
#ifdef CONFIG_SELINUX
static int is_flask_enabled_flag;
static int selinux_enabled= 0;
#endif
#ifdef CONFIG_FEATURE_AUTOWIDTH
@@ -213,18 +211,19 @@ static struct dnode *my_stat(char *fullname, char *name)
struct stat dstat;
struct dnode *cur;
#ifdef CONFIG_SELINUX
security_id_t sid;
security_context_t sid=NULL;
#endif
int rc;
#ifdef CONFIG_FEATURE_LS_FOLLOWLINKS
if (all_fmt & FOLLOW_LINKS) {
#ifdef CONFIG_SELINUX
if(is_flask_enabled_flag)
rc = stat_secure(fullname, &dstat, &sid);
else
if (is_selinux_enabled()) {
rc=0; /* Set the number which means success before hand. */
rc = getfilecon(fullname,&sid);
}
#endif
rc = stat(fullname, &dstat);
rc = stat(fullname, &dstat);
if(rc)
{
bb_perror_msg("%s", fullname);
@@ -235,9 +234,12 @@ static struct dnode *my_stat(char *fullname, char *name)
#endif
{
#ifdef CONFIG_SELINUX
if(is_flask_enabled_flag)
rc = lstat_secure(fullname, &dstat, &sid);
else
if (is_selinux_enabled()) {
rc=0; /* Set the number which means success before hand. */
rc = lgetfilecon(fullname,&sid);
}
#endif
rc = lstat(fullname, &dstat);
if(rc)
@@ -736,12 +738,16 @@ static int list_single(struct dnode *dn)
#ifdef CONFIG_SELINUX
case LIST_CONTEXT:
{
char context[64];
int len = sizeof(context);
if(security_sid_to_context(dn->sid, context, &len))
{
strcpy(context, "unknown");
len = 7;
char context[80];
int len;
if (dn->sid) {
/* I assume sid initilized with NULL */
len = strlen(dn->sid)+1;
safe_strncpy(context, dn->sid, len);
freecon(dn->sid);
}else {
safe_strncpy(context, "unknown",8);
}
printf("%-32s ", context);
column += MAX(33, len);
@@ -963,9 +969,6 @@ extern int ls_main(int argc, char **argv)
char *terminal_width_str = NULL;
#endif
#ifdef CONFIG_SELINUX
is_flask_enabled_flag = is_flask_enabled();
#endif
all_fmt = LIST_SHORT | DISP_NORMAL | STYLE_AUTO
#ifdef CONFIG_FEATURE_LS_TIMESTAMPS
+17 -30
View File
@@ -42,41 +42,28 @@ static unsigned char *hash_bin_to_hex(unsigned char *hash_value,
max = (hash_length * 2) + 2;
hex_value = xmalloc(max);
for (x = len = 0; x < hash_length; x++) {
len += snprintf(hex_value + len, max - len, "%02x", hash_value[x]);
len += snprintf((char*)(hex_value + len), max - len, "%02x", hash_value[x]);
}
return (hex_value);
}
static uint8_t *hash_file(const char *filename, uint8_t hash_algo)
{
uint8_t *hash_value_bin;
uint8_t *hash_value = NULL;
uint8_t hash_length;
int src_fd;
if (strcmp(filename, "-") == 0) {
src_fd = STDIN_FILENO;
} else {
src_fd = open(filename, O_RDONLY);
}
if (hash_algo == HASH_MD5) {
hash_length = 16;
} else {
hash_length = 20;
}
hash_value_bin = xmalloc(hash_length);
if ((src_fd != -1) && (hash_fd(src_fd, -1, hash_algo, hash_value_bin) != -2)) {
hash_value = hash_bin_to_hex(hash_value_bin, hash_length);
} else {
int src_fd = strcmp(filename, "-") == 0 ? STDIN_FILENO :
open(filename, O_RDONLY);
if (src_fd == -1) {
bb_perror_msg("%s", filename);
return NULL;
} else {
uint8_t *hash_value;
RESERVE_CONFIG_UBUFFER(hash_value_bin, 20);
hash_value = hash_fd(src_fd, -1, hash_algo, hash_value_bin) != -2 ?
hash_bin_to_hex(hash_value_bin, hash_algo == HASH_MD5 ? 16 : 20) :
NULL;
RELEASE_CONFIG_BUFFER(hash_value_bin);
close(src_fd);
return hash_value;
}
close(src_fd);
return(hash_value);
}
/* This could become a common function for md5 as well, by using md5_stream */
@@ -111,7 +98,7 @@ extern int hash_files(int argc, char **argv, const uint8_t hash_algo)
FILE *pre_computed_stream;
int count_total = 0;
int count_failed = 0;
unsigned char *file_ptr = argv[optind];
char *file_ptr = argv[optind];
char *line;
if (optind + 1 != argc) {
@@ -142,7 +129,7 @@ extern int hash_files(int argc, char **argv, const uint8_t hash_algo)
hash_value = hash_file(filename_ptr, hash_algo);
if (hash_value && (strcmp(hash_value, line) == 0)) {
if (hash_value && (strcmp((char*)hash_value, line) == 0)) {
if (!(flags & FLAG_SILENT))
printf("%s: OK\n", filename_ptr);
} else {
@@ -175,7 +162,7 @@ extern int hash_files(int argc, char **argv, const uint8_t hash_algo)
hash_value = xmalloc(hash_length);
while (optind < argc) {
unsigned char *file_ptr = argv[optind++];
char *file_ptr = argv[optind++];
hash_value = hash_file(file_ptr, hash_algo);
if (hash_value == NULL) {
+3 -3
View File
@@ -99,10 +99,10 @@ DO_MOVE:
struct stat source_stat;
int source_exists;
if (errno != EXDEV) {
if (errno != EXDEV ||
(source_exists = cp_mv_stat(*argv, &source_stat)) < 1) {
bb_perror_msg("unable to rename `%s'", *argv);
}
else if ((source_exists = cp_mv_stat(*argv, &source_stat)) >= 0) {
} else {
if (dest_exists) {
if (dest_exists == 3) {
if (source_exists != 3) {
+6
View File
@@ -79,7 +79,13 @@ static void tail_xbb_full_write(const char *buf, size_t len)
static ssize_t tail_read(int fd, char *buf, size_t count)
{
ssize_t r;
off_t current,end;
struct stat sbuf;
end = current = lseek(fd, 0, SEEK_CUR);
if (!fstat(fd, &sbuf))
end = sbuf.st_size;
lseek(fd, end < current ? 0 : current, SEEK_SET);
if ((r = safe_read(fd, buf, count)) < 0) {
bb_perror_msg("read");
status = EXIT_FAILURE;
+2 -2
View File
@@ -304,7 +304,7 @@ static arith_t primary(enum token n)
return strlen(*t_wp) > 0;
}
static int binop()
static int binop(void)
{
const char *opnd1, *opnd2;
struct t_op const *op;
@@ -531,7 +531,7 @@ static int test_eaccess(char *path, int mode)
return (-1);
}
static void initialize_group_array()
static void initialize_group_array(void)
{
ngroups = getgroups(0, NULL);
group_array = xrealloc(group_array, ngroups * sizeof(gid_t));
+5 -7
View File
@@ -82,7 +82,7 @@ extern int watch_main(int argc, char **argv)
header[len] = 0;
/* thanks to lye, who showed me how to redirect stdin/stdout */
old_stdout = dup(1);
old_stdout = dup(STDOUT_FILENO);
while (1) {
time(&t);
@@ -98,13 +98,11 @@ extern int watch_main(int argc, char **argv)
sleep(period);
} else if (0 == pid) {
//child
close(1);
dup(old_stdout);
if (execvp(*watched_argv, watched_argv)) {
bb_error_msg_and_die("Couldn't run command\n");
}
dup2(old_stdout, STDOUT_FILENO);
execvp(*watched_argv, watched_argv);
bb_perror_msg_and_die(*watched_argv);
} else {
bb_error_msg_and_die("Couldn't vfork\n");
bb_perror_msg_and_die("vfork");
}
}
}
+1 -1
View File
@@ -74,7 +74,7 @@ extern int who_main(int argc, char **argv)
} else
printf("%-8s ", "?");
printf("%-12.12s %s\n", ctime(&(ut->ut_tv.tv_sec)) + 4, ut->ut_host);
printf("%-12.12s %s\n", ctime((time_t*)&(ut->ut_tv.tv_sec)) + 4, ut->ut_host);
}
}
endutent();
+1 -1
View File
@@ -34,7 +34,7 @@ DEBIANUTILS-$(CONFIG_WHICH) += which.o
libraries-y+=$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR)
$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR): $(patsubst %,$(DEBIANUTILS_DIR)%, $(DEBIANUTILS-y))
$(AR) -ro $@ $(patsubst %,$(DEBIANUTILS_DIR)%, $(DEBIANUTILS-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(DEBIANUTILS_DIR)%, $(DEBIANUTILS-y))
$(DEBIANUTILS_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+4 -1
View File
@@ -238,10 +238,13 @@ start_stop_daemon_main(int argc, char **argv)
&startas, &cmdname, &signame, &userspec, &execname, &pidfile);
/* Check one and only one context option was given */
if ((opt & 0x80000000UL) || (opt & (SSD_CTX_STOP | SSD_CTX_START)) == 0) {
if ((opt & BB_GETOPT_ERROR) || (opt & (SSD_CTX_STOP | SSD_CTX_START)) == 0) {
bb_show_usage();
}
if (opt & SSD_OPT_QUIET)
quiet = 1;
if (signame) {
signal_nr = bb_xgetlarg(signame, 10, 0, NSIG);
}
-8
View File
@@ -1,8 +0,0 @@
BusyBox.txt
BusyBox.1
BusyBox.html
busybox.txt
busybox.ps
busybox.pdf
busybox
busybox.pod
-2
View File
@@ -1,2 +0,0 @@
BusyBox.html
busybox.tar.gz
-324
View File
@@ -1,324 +0,0 @@
<!--#include file="header.html" -->
<h3>Frequently Asked Questions</h3>
This is a collection of some of the more frequently asked questions
about BusyBox. Some of the questions even have answers. If you
have additions to this FAQ document, we would love to add them,
<ol>
<li><a href="#kernel">Which Linux kernel versions are supported?</a>
<li><a href="#arch">Which architectures does BusyBox run on?</a>
<li><a href="#libc">Which C libraries are supported?</a>
<li><a href="#commercial">Can I include BusyBox as part of the software on my device?</a>
<li><a href="#bugs">I think I found a bug in BusyBox! What should I do?!</a>
<li><a href="#job_control">Why do I keep getting "sh: can't access tty; job control
turned off" errors? Why doesn't Control-C work within my shell?</a>
<li><a href="#demanding">I demand that you to add &lt;favorite feature&gt; right now! How come
you don't answer all my questions on the mailing list instantly? I demand
that you help me with all of my problems <em>Right Now</em>!</a>
<li><a href="#getting_started">How can I get started using BusyBox?</a>
<li><a href="#helpme">I need help with BusyBox! What should I do?</a>
<li><a href="#contracts">I need you to add &lt;favorite feature&gt;! Are the BusyBox developers willing to
be paid in order to fix bugs or add in &lt;favorite feature&gt;? Are you willing to provide
support contracts?</a>
<li><a href="#support">I think you guys are great and I want to help support your work!</a>
</ol>
<hr />
<p>
<h2><a name="kernel">Which Linux kernel versions are supported?</a></h2>
<p>
Full functionality requires Linux 2.2.x or better. A large fraction of the
code should run on just about anything. While the current code is fairly
Linux specific, it should be fairly easy to port the majority of the code
to support, say, FreeBSD or Solaris, or Mac OS X, or even Windows (if you
are into that sort of thing).
<hr />
<p>
<h2><a name="arch">Which architectures does BusyBox run on?</a></h2>
<p>
BusyBox in general will build on any architecture supported by gcc.
Kernel module loading for 2.2 and 2.4 Linux kernels is currently
limited to ARM, CRIS, H8/300, x86, ia64, x86_64, m68k, MIPS, PowerPC,
S390, SH3/4/5, Sparc, v850e, and x86_64 for 2.4.x kernels.
With 2.6.x kernels, module loading support should work on all architectures.
<hr />
<p>
<h2><a name="libc">Which C libraries are supported?</a></h2>
<p>
uClibc and glibc are supported. People have been looking at newlib and
dietlibc, but they are currently considered unsupported, untested, or
worse. Linux-libc5 is no longer supported. If you require a small C
library, you should probably use uClibc.
<hr />
<p>
<h2><a name="commercial">Can I include BusyBox as part of the software on my device?</h2>
Yes. As long as you <a href="http://busybox.net/license.html">fully comply
with the generous terms of the GPL BusyBox license</a> you can ship BusyBox
as part of the software on your device.
<a href="#support">Please consider sharing some of the money you make.</a>
<hr />
<p>
<h2><a name="bugs">I think I found a bug in BusyBox! What should I do?</h2>
<p>
If you find a problem with BusyBox, please submit a detailed bug report to
the BusyBox mailing list at <a href="mailto:busybox@mail.busybox.net">
busybox@mail.busybox.net</a>. Please do not send private email to Erik
(the maintainer of BusyBox) asking for private help unless you are planning
on paying for consulting services. When we answer questions on the BusyBox
mailing list, it helps everyone, while private answers help only you...
<p>
If you find bugs, please submit a detailed bug report to the BusyBox mailing
list at busybox@mail.busybox.net. A well-written bug report should include a
transcript of a shell session that demonstrates the bad behavior and enables
anyone else to duplicate the bug on their own machine. The following is such
an example:
<pre>
To: busybox@mail.busybox.net
From: diligent@testing.linux.org
Subject: /bin/date doesn't work
Package: BusyBox
Version: 1.00
When I execute BusyBox 'date' it produces unexpected results.
With GNU date I get the following output:
$ date
Fri Oct 8 14:19:41 MDT 2004
But when I use BusyBox date I get this instead:
$ date
illegal instruction
I am using Debian unstable, kernel version 2.4.27 on a x86 system,
and the latest uClibc from CVS. Thanks for the wonderful program!
-Diligent
</pre>
Note the careful description and use of examples showing not only what BusyBox
does, but also a counter example showing what an equivalent GNU app does. Bug
reports lacking proper detail may never be fixed... Thanks for understanding.
<hr />
<p>
<h2><a name="job_control">Why do I keep getting "sh: can't access tty; job control
turned off" errors? Why doesn't Control-C work within my shell?</a></h2>
<p>
Job control will be turned off since your shell can not obtain a controlling
terminal. This typically happens when you run your shell on /dev/console.
The kernel will not provide a controlling terminal on the /dev/console
device. Your should run your shell on a normal tty such as tty1 or ttyS0
and everything will work perfectly. If you <em>REALLY</em> want your shell
to run on /dev/console, then you can hack your kernel (if you are into that
sortof thing) by changing drivers/char/tty_io.c to change the lines where
it sets "noctty = 1;" to instead set it to "0". I recommend you instead
run your shell on a real console...
<hr />
<p>
<h2><a name="getting_started">How can I get started using BusyBox?</a></h2>
<p>
An easy method to build your own basic BusyBox based system, is to
follow these simple steps:
<ul>
<li> Point your web browser <a href="/cgi-bin/cvsweb/buildroot/">here</a>
<li> Click on "Download tarball"
<li> Unpack the tarball on your Linux system somewhere
<li> run 'make' and configure things to taste.
<li> run 'unset CC'. Some Linux systems (i.e. Gentoo) set 'CC'
in the system environment which messes up cross compiles.
<li> run 'make'
<li> go have lunch, drink a pop, call a friend, play a video game, etc
till it finishes downloading software and compiling things.
<li> You should now have a shiny new BusyBox based system.
</ul>
<hr />
<p>
<h2><a name="demanding">I demand that you to add &lt;favorite feature&gt; right now! How come
you don't answer all my questions on the mailing list instantly? I demand
that you help me with all of my problems <em>Right Now</em>!</a></h2>
<p>
You have not paid us a single cent and yet you still have the product of
many years of our work. We are not your slaves! We work on BusyBox
because we find it useful and interesting. If you go off flaming us, we
will ignore you.
<hr />
<p>
<h2><a name="helpme">I need help with BusyBox! What should I do?</a></h2>
<p>
If you find that you need help with BusyBox, you can ask for help on the
BusyBox mailing list at busybox@mail.busybox.net. In addition to the BusyBox
mailing list, Erik (andersee), Manuel (mjn3) and others are known to hang out
on the uClibc IRC channel: #uclibc on irc.freenode.net.
<p>
<b>Please do not send private email to Erik, Manuel, or the other BusyBox
contributors asking for private help unless you are planning on paying for
consulting services.</b>
<p>
When we answer questions on the BusyBox mailing list, it helps everyone
since people with similar problems in the future will be able to get help
by searching the mailing list archives. Private help is reserved as a paid
service. If you need to use private communication, or if you are serious
about getting timely assistance with BusyBox, you should seriously consider
paying for consulting services.
<p>
<hr />
<p>
<h2><a name="contracts">I need you to add &lt;favorite feature&gt;! Are the BusyBox
developers willing to be paid in order to fix bugs or add in &lt;favorite feature&gt;?
Are you willing to provide support contracts?</a></h2>
<p>
Sure! Now you have our attention! What you should do is contact <a
href="mailto:andersen@codepoet.org">Erik Andersen</a> of <a
href="http://codepoet-consulting.com/">CodePoet Consulting</a> to bid
on your project. If Erik is too busy to personally add your feature, there
are many other active BusyBox contributors who will almost certainly be able
to help you out. Erik can contact them privatly, and may even let you to
post your request for services on the mailing list.
<hr />
<p>
<h2><a name="support">I think you guys are great and I want to help support your work!</a></h2>
<p>
Wow, that would be great! Erik personally pays for all the bandwidth, and
all servers used for busybox.net out of his own pocket. If you would like
to make a donation to help support BusyBox, and/or request features, you
can click here:
<!-- Begin PayPal Logo -->
<center>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="andersen@codepoet.org">
<input type="hidden" name="item_name" value="Support BusyBox">
<input type="hidden" name="image_url" value="http://codepoet-consulting.com/images/codepoet.png">
<input type="hidden" name="no_shipping" value="1">
<input type="image" src="images/donate.png" name="submit" alt="Make donation using PayPal">
</form>
</center>
<!-- End PayPal Logo -->
If you prefer to contact Erik directly to make a donation, donate hardware,
request support, etc, you can contact
<a href="http://codepoet-consulting.com/">CodePoet Consulting</a> here.
CodePoet Consulting can accept both Visa and MasterCard for those that do not
trust PayPal...
<hr />
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<!--#include file="footer.html" -->
-63
View File
@@ -1,63 +0,0 @@
<!--#include file="header.html" -->
<!-- Begin Introduction section -->
<h3>BusyBox: The Swiss Army Knife of Embedded Linux</h3>
BusyBox combines tiny versions of many common UNIX utilities into a single
small executable. It provides replacements for most of the utilities you
usually find in GNU fileutils, shellutils, etc. The utilities in BusyBox
generally have fewer options than their full-featured GNU cousins; however,
the options that are included provide the expected functionality and behave
very much like their GNU counterparts. BusyBox provides a fairly complete
environment for any small or embedded system.
<p>
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 some device
nodes in /dev, a few configuration files in /etc, and a Linux kernel.
<p>
BusyBox is maintained by <a href=
"http://codepoet.org/andersen/erik/erik.html">Erik Andersen</a>, and
licensed under the
<a href= "http://www.gnu.org/copyleft/gpl.html">GNU GENERAL PUBLIC LICENSE</a>
<p>
<p>
<h3>Sponsors</h3>
Please visit our sponsors and thank them for their
support! They have provided money for equipment and
bandwidth. Next time you need help with a project,
consider these fine companies!
<ul>
<li><a href="http://www.penguru.net">Penguru Consulting</a><br>
Custom development for embedded Linux systems and multimedia platforms
</li>
<li><a href="http://opensource.se/">opensource.se</a><br>
Embedded open source consulting in Europe.
</li>
<li><a href="http://www.codepoet-consulting.com">Codepoet Consulting</a><br>
Custom Linux, embedded Linux, BusyBox, and uClibc
development.
</li>
</ul>
If you wish to be a sponsor, or if you have already contributed and would like
your name added here, email <a href= "mailto:andersen@codepoet.org">Erik</a>.
<!--#include file="footer.html" -->
-404
View File
@@ -1,404 +0,0 @@
%!PS-Adobe-2.0
%%Title: busybox-growth.ps
%%Creator: gnuplot 3.5 (pre 3.6) patchlevel beta 347
%%CreationDate: Tue Apr 10 14:03:36 2001
%%DocumentFonts: (atend)
%%BoundingBox: 50 40 554 770
%%Orientation: Landscape
%%Pages: (atend)
%%EndComments
/gnudict 120 dict def
gnudict begin
/Color true def
/Solid true def
/gnulinewidth 5.000 def
/userlinewidth gnulinewidth def
/vshift -46 def
/dl {10 mul} def
/hpt_ 31.5 def
/vpt_ 31.5 def
/hpt hpt_ def
/vpt vpt_ def
/M {moveto} bind def
/L {lineto} bind def
/R {rmoveto} bind def
/V {rlineto} bind def
/vpt2 vpt 2 mul def
/hpt2 hpt 2 mul def
/Lshow { currentpoint stroke M
0 vshift R show } def
/Rshow { currentpoint stroke M
dup stringwidth pop neg vshift R show } def
/Cshow { currentpoint stroke M
dup stringwidth pop -2 div vshift R show } def
/UP { dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def
/hpt2 hpt 2 mul def /vpt2 vpt 2 mul def } def
/DL { Color {setrgbcolor Solid {pop []} if 0 setdash }
{pop pop pop Solid {pop []} if 0 setdash} ifelse } def
/BL { stroke gnulinewidth 2 mul setlinewidth } def
/AL { stroke gnulinewidth 2 div setlinewidth } def
/UL { gnulinewidth mul /userlinewidth exch def } def
/PL { stroke userlinewidth setlinewidth } def
/LTb { BL [] 0 0 0 DL } def
/LTa { AL [1 dl 2 dl] 0 setdash 0 0 0 setrgbcolor } def
/LT0 { PL [] 1 0 0 DL } def
/LT1 { PL [4 dl 2 dl] 0 1 0 DL } def
/LT2 { PL [2 dl 3 dl] 0 0 1 DL } def
/LT3 { PL [1 dl 1.5 dl] 1 0 1 DL } def
/LT4 { PL [5 dl 2 dl 1 dl 2 dl] 0 1 1 DL } def
/LT5 { PL [4 dl 3 dl 1 dl 3 dl] 1 1 0 DL } def
/LT6 { PL [2 dl 2 dl 2 dl 4 dl] 0 0 0 DL } def
/LT7 { PL [2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 1 0.3 0 DL } def
/LT8 { PL [2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 0.5 0.5 0.5 DL } def
/Pnt { stroke [] 0 setdash
gsave 1 setlinecap M 0 0 V stroke grestore } def
/Dia { stroke [] 0 setdash 2 copy vpt add M
hpt neg vpt neg V hpt vpt neg V
hpt vpt V hpt neg vpt V closepath stroke
Pnt } def
/Pls { stroke [] 0 setdash vpt sub M 0 vpt2 V
currentpoint stroke M
hpt neg vpt neg R hpt2 0 V stroke
} def
/Box { stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M
0 vpt2 neg V hpt2 0 V 0 vpt2 V
hpt2 neg 0 V closepath stroke
Pnt } def
/Crs { stroke [] 0 setdash exch hpt sub exch vpt add M
hpt2 vpt2 neg V currentpoint stroke M
hpt2 neg 0 R hpt2 vpt2 V stroke } def
/TriU { stroke [] 0 setdash 2 copy vpt 1.12 mul add M
hpt neg vpt -1.62 mul V
hpt 2 mul 0 V
hpt neg vpt 1.62 mul V closepath stroke
Pnt } def
/Star { 2 copy Pls Crs } def
/BoxF { stroke [] 0 setdash exch hpt sub exch vpt add M
0 vpt2 neg V hpt2 0 V 0 vpt2 V
hpt2 neg 0 V closepath fill } def
/TriUF { stroke [] 0 setdash vpt 1.12 mul add M
hpt neg vpt -1.62 mul V
hpt 2 mul 0 V
hpt neg vpt 1.62 mul V closepath fill } def
/TriD { stroke [] 0 setdash 2 copy vpt 1.12 mul sub M
hpt neg vpt 1.62 mul V
hpt 2 mul 0 V
hpt neg vpt -1.62 mul V closepath stroke
Pnt } def
/TriDF { stroke [] 0 setdash vpt 1.12 mul sub M
hpt neg vpt 1.62 mul V
hpt 2 mul 0 V
hpt neg vpt -1.62 mul V closepath fill} def
/DiaF { stroke [] 0 setdash vpt add M
hpt neg vpt neg V hpt vpt neg V
hpt vpt V hpt neg vpt V closepath fill } def
/Pent { stroke [] 0 setdash 2 copy gsave
translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
closepath stroke grestore Pnt } def
/PentF { stroke [] 0 setdash gsave
translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
closepath fill grestore } def
/Circle { stroke [] 0 setdash 2 copy
hpt 0 360 arc stroke Pnt } def
/CircleF { stroke [] 0 setdash hpt 0 360 arc fill } def
/C0 { BL [] 0 setdash 2 copy moveto vpt 90 450 arc } bind def
/C1 { BL [] 0 setdash 2 copy moveto
2 copy vpt 0 90 arc closepath fill
vpt 0 360 arc closepath } bind def
/C2 { BL [] 0 setdash 2 copy moveto
2 copy vpt 90 180 arc closepath fill
vpt 0 360 arc closepath } bind def
/C3 { BL [] 0 setdash 2 copy moveto
2 copy vpt 0 180 arc closepath fill
vpt 0 360 arc closepath } bind def
/C4 { BL [] 0 setdash 2 copy moveto
2 copy vpt 180 270 arc closepath fill
vpt 0 360 arc closepath } bind def
/C5 { BL [] 0 setdash 2 copy moveto
2 copy vpt 0 90 arc
2 copy moveto
2 copy vpt 180 270 arc closepath fill
vpt 0 360 arc } bind def
/C6 { BL [] 0 setdash 2 copy moveto
2 copy vpt 90 270 arc closepath fill
vpt 0 360 arc closepath } bind def
/C7 { BL [] 0 setdash 2 copy moveto
2 copy vpt 0 270 arc closepath fill
vpt 0 360 arc closepath } bind def
/C8 { BL [] 0 setdash 2 copy moveto
2 copy vpt 270 360 arc closepath fill
vpt 0 360 arc closepath } bind def
/C9 { BL [] 0 setdash 2 copy moveto
2 copy vpt 270 450 arc closepath fill
vpt 0 360 arc closepath } bind def
/C10 { BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill
2 copy moveto
2 copy vpt 90 180 arc closepath fill
vpt 0 360 arc closepath } bind def
/C11 { BL [] 0 setdash 2 copy moveto
2 copy vpt 0 180 arc closepath fill
2 copy moveto
2 copy vpt 270 360 arc closepath fill
vpt 0 360 arc closepath } bind def
/C12 { BL [] 0 setdash 2 copy moveto
2 copy vpt 180 360 arc closepath fill
vpt 0 360 arc closepath } bind def
/C13 { BL [] 0 setdash 2 copy moveto
2 copy vpt 0 90 arc closepath fill
2 copy moveto
2 copy vpt 180 360 arc closepath fill
vpt 0 360 arc closepath } bind def
/C14 { BL [] 0 setdash 2 copy moveto
2 copy vpt 90 360 arc closepath fill
vpt 0 360 arc } bind def
/C15 { BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill
vpt 0 360 arc closepath } bind def
/Rec { newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto
neg 0 rlineto closepath } bind def
/Square { dup Rec } bind def
/Bsquare { vpt sub exch vpt sub exch vpt2 Square } bind def
/S0 { BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare } bind def
/S1 { BL [] 0 setdash 2 copy vpt Square fill Bsquare } bind def
/S2 { BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare } bind def
/S3 { BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare } bind def
/S4 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare } bind def
/S5 { BL [] 0 setdash 2 copy 2 copy vpt Square fill
exch vpt sub exch vpt sub vpt Square fill Bsquare } bind def
/S6 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare } bind def
/S7 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill
2 copy vpt Square fill
Bsquare } bind def
/S8 { BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare } bind def
/S9 { BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare } bind def
/S10 { BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill
Bsquare } bind def
/S11 { BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill
Bsquare } bind def
/S12 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare } bind def
/S13 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
2 copy vpt Square fill Bsquare } bind def
/S14 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill
2 copy exch vpt sub exch vpt Square fill Bsquare } bind def
/S15 { BL [] 0 setdash 2 copy Bsquare fill Bsquare } bind def
/D0 { gsave translate 45 rotate 0 0 S0 stroke grestore } bind def
/D1 { gsave translate 45 rotate 0 0 S1 stroke grestore } bind def
/D2 { gsave translate 45 rotate 0 0 S2 stroke grestore } bind def
/D3 { gsave translate 45 rotate 0 0 S3 stroke grestore } bind def
/D4 { gsave translate 45 rotate 0 0 S4 stroke grestore } bind def
/D5 { gsave translate 45 rotate 0 0 S5 stroke grestore } bind def
/D6 { gsave translate 45 rotate 0 0 S6 stroke grestore } bind def
/D7 { gsave translate 45 rotate 0 0 S7 stroke grestore } bind def
/D8 { gsave translate 45 rotate 0 0 S8 stroke grestore } bind def
/D9 { gsave translate 45 rotate 0 0 S9 stroke grestore } bind def
/D10 { gsave translate 45 rotate 0 0 S10 stroke grestore } bind def
/D11 { gsave translate 45 rotate 0 0 S11 stroke grestore } bind def
/D12 { gsave translate 45 rotate 0 0 S12 stroke grestore } bind def
/D13 { gsave translate 45 rotate 0 0 S13 stroke grestore } bind def
/D14 { gsave translate 45 rotate 0 0 S14 stroke grestore } bind def
/D15 { gsave translate 45 rotate 0 0 S15 stroke grestore } bind def
/DiaE { stroke [] 0 setdash vpt add M
hpt neg vpt neg V hpt vpt neg V
hpt vpt V hpt neg vpt V closepath stroke } def
/BoxE { stroke [] 0 setdash exch hpt sub exch vpt add M
0 vpt2 neg V hpt2 0 V 0 vpt2 V
hpt2 neg 0 V closepath stroke } def
/TriUE { stroke [] 0 setdash vpt 1.12 mul add M
hpt neg vpt -1.62 mul V
hpt 2 mul 0 V
hpt neg vpt 1.62 mul V closepath stroke } def
/TriDE { stroke [] 0 setdash vpt 1.12 mul sub M
hpt neg vpt 1.62 mul V
hpt 2 mul 0 V
hpt neg vpt -1.62 mul V closepath stroke } def
/PentE { stroke [] 0 setdash gsave
translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
closepath stroke grestore } def
/CircE { stroke [] 0 setdash
hpt 0 360 arc stroke } def
/Opaque { gsave closepath 1 setgray fill grestore 0 setgray closepath } def
/DiaW { stroke [] 0 setdash vpt add M
hpt neg vpt neg V hpt vpt neg V
hpt vpt V hpt neg vpt V Opaque stroke } def
/BoxW { stroke [] 0 setdash exch hpt sub exch vpt add M
0 vpt2 neg V hpt2 0 V 0 vpt2 V
hpt2 neg 0 V Opaque stroke } def
/TriUW { stroke [] 0 setdash vpt 1.12 mul add M
hpt neg vpt -1.62 mul V
hpt 2 mul 0 V
hpt neg vpt 1.62 mul V Opaque stroke } def
/TriDW { stroke [] 0 setdash vpt 1.12 mul sub M
hpt neg vpt 1.62 mul V
hpt 2 mul 0 V
hpt neg vpt -1.62 mul V Opaque stroke } def
/PentW { stroke [] 0 setdash gsave
translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
Opaque stroke grestore } def
/CircW { stroke [] 0 setdash
hpt 0 360 arc Opaque stroke } def
/BoxFill { gsave Rec 1 setgray fill grestore } def
end
%%EndProlog
%%Page: 1 1
gnudict begin
gsave
50 50 translate
0.100 0.100 scale
90 rotate
0 -5040 translate
0 setgray
newpath
(Helvetica) findfont 140 scalefont setfont
1.000 UL
LTb
560 420 M
63 0 V
6409 0 R
-63 0 V
476 420 M
(0) Rshow
560 1056 M
63 0 V
6409 0 R
-63 0 V
-6493 0 R
(100) Rshow
560 1692 M
63 0 V
6409 0 R
-63 0 V
-6493 0 R
(200) Rshow
560 2328 M
63 0 V
6409 0 R
-63 0 V
-6493 0 R
(300) Rshow
560 2964 M
63 0 V
6409 0 R
-63 0 V
-6493 0 R
(400) Rshow
560 3600 M
63 0 V
6409 0 R
-63 0 V
-6493 0 R
(500) Rshow
560 4236 M
63 0 V
6409 0 R
-63 0 V
-6493 0 R
(600) Rshow
560 4872 M
63 0 V
6409 0 R
-63 0 V
-6493 0 R
(700) Rshow
1531 420 M
0 63 V
0 4389 R
0 -63 V
0 -4529 R
(400) Cshow
2825 420 M
0 63 V
0 4389 R
0 -63 V
0 -4529 R
(600) Cshow
4120 420 M
0 63 V
0 4389 R
0 -63 V
0 -4529 R
(800) Cshow
5414 420 M
0 63 V
0 4389 R
0 -63 V
0 -4529 R
(1000) Cshow
6708 420 M
0 63 V
0 4389 R
0 -63 V
0 -4529 R
(1200) Cshow
1.000 UL
LTb
560 420 M
6472 0 V
0 4452 V
-6472 0 V
560 420 L
0 2646 M
currentpoint gsave translate 90 rotate 0 0 M
(tar.gz size \(Kb\)) Cshow
grestore
3796 140 M
(time \(days since Jan 1, 1998\)) Cshow
1.000 UL
LT0
696 420 M
0 593 V
1255 0 V
0 15 V
214 0 V
0 6 V
958 0 V
0 1 V
-84 0 V
0 37 V
168 0 V
0 262 V
13 0 V
0 56 V
91 0 V
0 33 V
6 0 V
0 1 V
19 0 V
0 11 V
20 0 V
0 13 V
32 0 V
0 104 V
52 0 V
0 27 V
65 0 V
0 15 V
39 0 V
0 126 V
174 0 V
0 103 V
52 0 V
0 49 V
175 0 V
0 56 V
433 0 V
0 661 V
415 0 V
0 857 V
123 0 V
0 -291 V
498 0 V
0 208 V
505 0 V
0 66 V
291 0 V
0 115 V
311 0 V
0 449 V
162 0 V
0 309 V
stroke
grestore
end
showpage
%%Trailer
%%DocumentFonts: Helvetica
%%Pages: 1
-29
View File
@@ -1,29 +0,0 @@
The code and graphics on this website (and it's mirror sites, if any) are
Copyright (c) 1999-2004 by Erik Andersen. All rights reserved.
Documents on this Web site including their graphical elements, design, and
layout are protected by trade dress and other laws and MAY BE COPIED OR
IMITATED IN WHOLE OR IN PART. THIS WEBSITE IS LICENSED FREE OF CHARGE, THERE
IS NO WARRANTY FOR THE WEBSITE TO THE EXTENT PERMITTED BY APPLICABLE LAW.
SHOULD THIS WEBSITE PROVE DEFECTIVE, YOU MAY ASSUME THAT SOMEONE MIGHT GET
AROUND TO SERVICING, REPAIRING OR CORRECTING IT SOMETIME WHEN THEY HAVE NOTHING
BETTER TO DO. REGARDLESS, YOU GET TO KEEP BOTH PIECES.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY
COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THIS
WEBSITE AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
INABILITY TO USE THIS WEBSITE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
LOSS OF HAIR, LOSS OF LIFE, LOSS OF MEMORY, LOSS OF YOUR CARKEYS, MISPLACEMENT
OF YOUR PAYCHECK, OR COMMANDER DATA BEING RENDERED UNABLE TO ASSIST THE
STARFLEET OFFICERS ABORD THE STARSHIP ENTERPRISE TO RECALIBRATE THE MAIN
DEFLECTOR ARRAY, LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE
WEBSITE TO OPERATE WITH YOUR WEBBROWSER), EVEN IF SUCH HOLDER OR OTHER PARTY
HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
You have been warned.
You can contact the webmaster at <andersen@codepoet.org> if you have some sort
of problem with this.
-57
View File
@@ -1,57 +0,0 @@
<!--#include file="header.html" -->
<h3>Anonymous CVS</h3>
We allow anonymous (read-only) CVS access to everyone. The first command you
need to run for anonymous CVS access is:
<pre>
cvs -d:pserver:anonymous@busybox.net:/var/cvs login</pre>
<p>
CVS will prompt you for a password. Just press the Enter key (there is no
password for anonymous access). This step only needs to be done once, the first
time you attempt to access CVS.
<p>
Once the login is complete, you can then check the list of available
CVS modules by running the following command (all on one line):
<pre>
cvs -z3 -d:pserver:anonymous@busybox.net:/var/cvs co -c </pre>
<p>
If you wish, you can then check out a local copy of any of the
available modules. The following is an example of how to grab
a copy of busybox and tinylogin:
<pre>
cvs -z3 -d:pserver:anonymous@busybox.net:/var/cvs co -P busybox tinylogin</pre>
This will create a directory called <b>busybox</b> and a directory called
<b>tinylogin</b> in the current directory. These directories contain the
latest and greatest source code for busybox and tinylogin.
<p>
If you are not already familiar with using CVS, I recommend you visit
this quick <a href="/cvs_howto.html">Introduction to CVS</a>.
<p>
I usually create a ~/.cvsrc file with the following things in it, and I
recommend you should use the same:
<pre>
-z3
update -dP
rdiff -u
diff -ubBwpN
checkout -P</pre>
<p>
Once you've checked out a copy of the source tree, you can update your
source tree at any time so it is in sync with the latest and greatest by
running the command:
<pre>
cvs update</pre>
Because you've only been granted anonymous access to the tree, you won't be
able to commit any changes. Changes can be submitted for inclusion by posting
them to the appropriate mailing list. For those that are actively contributing
<a href="cvs_write.html">CVS write access</a> can be made available.
<!--#include file="footer.html" -->
-44
View File
@@ -1,44 +0,0 @@
<!--#include file="header.html" -->
<h3>How to use CVS</h3>
If you want to know all the gory details, you will want to visit
<a href="http://www.cvshome.org/">the CVS main web page</a>.<p>
For the impatient, the following is probably about all you need to know:
<p>
<dl>
<dt><pre>cvs checkout -c</pre>
<dd>Will list the modules available for checkout
<dt><pre>cvs checkout &lt module name &gt</pre>
<dd>Will checkout the named module
<dt><pre>cvs co &lt module name &gt</pre>
<dd>Same thing
<dt><pre>cvs update</pre>
<dd>Updates your local archive so it is in sync with the repository
-- your local updates are left intact. Tries to merge upstream updates
into your local updates. You will see the following tags when it is
updating your local repository: C means conflict, U means update,
P means patched, and M means modified.
<dt><pre>cvs up</pre>
<dd>Same thing
<dt><pre>cvs update &lt file name &gt</pre>
<dd>Same thing but for just the named file(s)/directory(s).
<dt><pre>cvs commit</pre>
<dd>Will check in all your work.
<dt><pre>cvs add &lt file name &gt</pre>
<dd>Adds the named file/directory into CVS
<dt><pre>cvs remove &lt file name &gt</pre>
<dd>Removes the named file/directory from the upstream repository.
<dt><pre>cvs rm &lt file name &gt</pre>
<dd>Same thing
<dt><pre>cvs log &lt file name &gt</pre>
</dl>
<!--#include file="footer.html" -->
-32
View File
@@ -1,32 +0,0 @@
<!--#include file="header.html" -->
<h3>CVS Read/Write Access</h3>
If you want to be able to commit things to CVS, first contribute some
stuff to show you are serious. Then, very nicely ask
<a href="mailto:andersen@codepoet.org">Erik Andersen</a> if he will set you up with
an account. To access CVS, you will want to add the following to set up your environment:
<pre>
$ export CVS_RSH=/usr/bin/ssh
$ export CVSROOT='username@cvs.busybox.net:/var/cvs'</pre>
<br>
It goes without saying you must change <em>username</em> to your own
username...
<p>
To obtain commit access, you will need to demonstrate you are
serious by submitting a few good patches first. Then, you will need to
select a user-name to use when committing stuff, and finally, you will
need to send me the username you have selected, an ssh key, and the email
address where you prefer email to be sent (I will forward any email sent
to you, but not store it).
<p>
Note that if you would prefer to keep your communications with me
private, you can encrypt your email using my
<a href="http://www.codepoet.org/andersen/erik/gpg.asc">public key</a>.
<!--#include file="footer.html" -->
-27
View File
@@ -1,27 +0,0 @@
<!--#include file="header.html" -->
<h3>Documentation</h3>
Current documentation for BusyBox includes:
<ul>
<li><a href=
"downloads/BusyBox.html">BusyBox.html</a>. This is a
list of the all the available commands in BusyBox
with complete usage information and examples of how
to use each app. I have spent a <em>lot</em> of time
updating these docs and trying to make them fairly
comprehensive. If you find any errors (factual,
grammatical, whatever) please let me know.</li>
<li><a href="downloads/README">README</a>. This is
the README file included in the busybox source
release.</li>
<li>If you need more help, the BusyBox <a href=
"lists/busybox/">mailing list</a> is a good place to
start.</li>
</ul>
<!--#include file="footer.html" -->
-38
View File
@@ -1,38 +0,0 @@
<!--#include file="header.html" -->
<h3>Download</h3>
Source for the latest release can always be
downloaded from <a href="downloads">http://www.busybox.net/downloads</a>.
<p>
You can also obtain <a href= "downloads/snapshots/">Daily Snapshots</a> of
the latest stable, and the latest development CVS source trees.
<p>
BusyBox now has <b>two</b> CVS trees. The "busybox-stable" tree
contains the older 0.60.x stable series. The "busybox" tree contains
the latest 1.0.0-preX development version of busybox.<br>
<ul>
<li> Click here to browse the <a href="/cgi-bin/cvsweb/busybox/">
CVS tree for the 1.0.0-preX development version of BusyBox</a>
</li>
<li>Click here to browse the <a href="/cgi-bin/cvsweb/busybox.stable/">
CVS tree for the stable 0.60.x version of BusyBox</a>.
</li>
<li>Anonymous <a href="cvs_anon.html">CVS access</a> is available.
</li>
<li>For those that are actively contributing there is
even <a href="cvs_write.html">CVS write access</a>.
</li>
</ul>
<!--#include file="footer.html" -->
-20
View File
@@ -1,20 +0,0 @@
<!-- Footer -->
</td>
</tr>
</table>
<hr />
<p>
<font face="arial, helvetica, sans-serif" size="-1">
<a HREF="/copyright.txt">Copyright &copy; 1999-2003 Erik Andersen</a>
<br>
Mail all comments, insults, suggestions and bribes to
<br>
Erik Andersen <A HREF="mailto:andersen@codepoet.org">andersen@codepoet.org</A><BR>
</font>
</body>
</html>
-81
View File
@@ -1,81 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>BusyBox</title>
<style type="text/css">
body {
background-color: #DEE2DE;
color: #000000;
}
:link { color: #660000 }
:visited { color: #660000 }
:active { color: #660000 }
td.c2 {font-family: arial, helvetica, sans-serif; font-size: 80%}
td.c1 {font-family: lucida, helvetica; font-size: 248%}
</style>
</head>
<body>
<basefont face="lucida, helvetica, arial" size="3">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<div class="c3">
<table border="0" cellspacing="1" cellpadding="2">
<tr>
<td class="c1">BUSYBOX</td>
</tr>
</table>
</div>
<a href="/"><IMG SRC="images/busybox1.png" alt="BusyBox" border="0"></a><BR>
</td>
</tr>
<tr>
<td valign="TOP">
<br><a href="/about.html">About</a>
<br><a href="/screenshot.html">Screenshot</a>
<br><a href="/lists.html">Mailing Lists</a>
<br><a href="/news.html">Latest News</a>
<br><a href="/download.html">Download</a>
<br><a href="/FAQ.html">FAQ</a>
<br><a href="/cvs_anon.html">Accessing CVS</a>
<br><a href="/cgi-bin/cvsweb/busybox/">Browse CVS</a>
<br><a href="/docs.html">Documentation</a>
<br><a href="/products.html">Products</a>
<br><a href="/shame.html">Hall of Shame</a>
<br><a href="/license.html">License</a>
<p><b>Related Sites</b>
<br><a href="http://uclibc.org/">uClibc.org</a>
<br><a href="http://udhcp.busybox.net/">udhcp</a>
<br><a href="http://tinylogin.busybox.net/">tinylogin</a>
<br><a href="http://www.ucdot.org/">uCdot</a>
<br><a href="http://www.linuxdevices.com">LinuxDevices</a>
<br><a href="http://slashdot.org/">Slashdot</a>
<br><a href="http://freshmeat.net/">Freshmeat</a>
<br><a href="http://linuxtoday.com/">Linux Today</a>
<br><a href="http://lwn.net/">Linux Weekly News</a>
<br><a href="http://www.tldp.org/HOWTO">Linux HOWTOs</a>
<!--
<a href="http://validator.w3.org/check/referer"><img
src="/images/vh40.gif" height=31 width=88
align=left border=0 alt="Valid HTML 4.0!"></a>
-->
</td>
<td Valign="TOP">
Binary file not shown.

Before

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

-1
View File
@@ -1 +0,0 @@
<!--#include file="news.html" -->
-135
View File
@@ -1,135 +0,0 @@
<!--#include file="header.html" -->
<h3>The GPL BusyBox license</h3>
There has been some confusion in the past as to exactly what is
required to safely distribute GPL'd software such as BusyBox as
part of a product. To ensure that there is no confusion
whatsoever, this page attempts to summarize what you should do to
ensure you do not accidentally violate the law.
<p>
<h3>Complying with the BusyBox license is easy and completely free.</h3>
U.S. and International Law protects copyright owners from the unauthorized
reproduction, adaptation, display, distribution, etc of copyright protected
works. Copyright violations (such as shipping BusyBox in a manner contrary to
its license) are subject to severe penalties. The courts can award up to
$150,000 per product shipped without even showing any actual loss by the
copyright holder. Criminal penalties are available for intentional acts
undertaken for purposes of "commercial advantage" or "private financial gain."
In addition, if it comes to my attention that you are violating the BusyBox
license, I will list you on the <a href="/shame.html">BusyBox Hall of Shame</a>
webpage.
<p>
Nobody wants that to happen. Do everyone a favor and don't break the law -- if
you use BusyBox, you <b>must comply with the BusyBox license</b>.
<p>
<h3>BusyBox is licensed under the GNU General Public License</h3>
BusyBox is licensed under the GNU General Public License , which
is generally just abbreviated as the GPL license, or
just the GPL.
<p>
<a href="/products.html">Anyone thinking of shipping
BusyBox as part of a product</a> should be familiar with the
licensing terms under which they are allowed to use and
distribute BusyBox. You are advised to take a look over the
<ul>
<li><a href="http://www.gnu.org/licenses/gpl.html">full text of
the GNU General Public License</a>, and
<li><a href="http://www.gnu.org/licenses/gpl-faq.html">
Frequently Asked Questions about the GNU GPL</a>
</ul>
to be sure you (and your lawyers) fully understand them.
<p>
The following is a quick summary for the impatient. If you
carefully follow these steps, it will ensure that you are 100%
authorized to ship BusyBox with your product, and have no reason
to worry about lawsuits or being listed on the <a
href="/shame.html">BusyBox Hall of Shame</a> page. You will be
able to sleep peacefully at night knowing you have fulfilled all
your licensing obligations.
<p>
If you distribute a product, it should either be accompanied by
<b>full source for all GPL'd products</b> (including BusyBox)
and/or a <b>written offer</b> to supply the source for all
GPL'd products for the cost of shipping and handling. The source
has to be in its preferred machine readable form, so you cannot
encrypt or obfuscate it. You are not required to provide full
source for all the closed source applications that happen to be
part of the system with BusyBox, though you can certainly do so
if you feel like it. But providing source for the GPL licensed
applications such as BusyBox is mandatory.
<p>
<b>Accompanied by source</b> generally means you distribute the full
source code for all GPL'd products including BusyBox along with your
product, such as by placing it somewhere on a driver CD. Full source
code includes the BusyBox ".config" file used when your shipping BusyBox
binary was compiled, and any and all modifications you made to the
BusyBox source code.
<p>
<b>A written offer</b> generally means that somewhere in the
documentation for your product, you write something like
<blockquote>
The GPL source code contained in this product is available as a
free download from http://blah.blah.blah/
</blockquote>
Alternatively, you can offer the source code by writing
somewhere in the documentation for your product something like
<blockquote>
If you would like a copy of the GPL source code contained in this
product shipped to you on CD, please send $9.99 to &lt;address&gt;
which covers the cost of preparing and mailing a CD to you.
</blockquote>
<p>
Keep in mind though that if you distribute GPL'd binaries online (as is often
done when supplying firmware updates), it is <b>highly</b> recommended that you
make the corresponding source available online at the same place. Regardless,
if you distribute a binary copy of BusyBox online (such as part of a firmware
update) you <b>must</b> either make source available online (i.e.
<b>accompanied by source</b>) and/or inform those downloading firmware updates
of their right to obtain source (i.e. <b>a written offer</b>). Failure to do
so is a violation of your licensing obligations.
<p>
Some people have the mistaken understanding that if they use unmodified
GPL'd source code, they do not need to distribute anything. This belief
is not correct, and is not supported by the
<a href="http://www.gnu.org/licenses/gpl.html">text of GPL</a>.
Please do re-read it -- you will find there is no such provision.
If you distribute any GPL'd binaries, you must also make source available
as discussed on this webpage.
<p>
<h3>A Good Example</h3>
These days, <a href="http://www.linksys.com/">Linksys</a> is
doing a good job at complying with the GPL, they get to be an
example of how to do things right. Please take a moment and
check out what they do with
<a href="http://www.linksys.com/download/firmware.asp?fwid=178">
distributing the firmware for their WRT54G Router.</a>
Following their example would be a fine way to ensure that you
have also fulfilled your licensing obligations.
<!--#include file="footer.html" -->
-45
View File
@@ -1,45 +0,0 @@
<!--#include file="header.html" -->
<!-- Begin Introduction section -->
<h3>Mailing List Information</h3>
BusyBox has a <a href="/lists/busybox/">mailing list</a> for discussion and
development. You can subscribe by visiting
<a href="http://codepoet.org/mailman/listinfo/busybox">this page</a>.
Only subscribers to the BusyBox mailing list are allowed to post
to this list.
<p>
There is also a mailing list for <a href="/lists/busybox-cvs/">active developers</a>
wishing to read the complete diff of each and every change to busybox -- not for the
faint of heart. Active developers can subscribe by visiting
<a href="http://codepoet.org/mailman/listinfo/busybox-cvs">this page</a>.
The CVS server is the only one permtted to post to this list.
<p>
<h3>Search the List Archives</h3>
Please search the mailing list archives before asking questions on the mailing
list, since there is a good chance someone else has asked the same question
before. Checking the archives is a great way to avoid annoying everyone on the
list with frequently asked questions...
<p>
<center>
<form method="GET" action="http://www.google.com/custom">
<input type="hidden" name="domains" value="busybox.net">
<input type="hidden" name="sitesearch" value="busybox.net">
<input type="text" name="q" size="31" maxlength="255" value="">
<br>
<input type="submit" name="sa" value="search the mailing list archives">
<br>
<a href="http://www.google.com"><img src="http://www.google.com/logos/Logo_25wht.gif" border="0" alt="Google" height="32" width="75" align="middle"></a>
<br>
</form>
</center>
<!--#include file="footer.html" -->
-52
View File
@@ -1,52 +0,0 @@
<!--#include file="header.html" -->
<ul>
<li><b>13 October 2004 -- BusyBox 1.00 released</b><p>
When you take a careful look at nearly every embedded Linux device or
software distribution shipping today, you will find a copy of BusyBox.
With countless routers, set top boxes, wireless access points, PDAs, and
who knows what else, the future for Linux and BusyBox on embedded devices
is looking very bright.
<p>
It is therefore with great satisfaction that I declare each and every
device already shipping with BusyBox is now officially out of date.
The highly anticipated release of BusyBox 1.00 has arrived!
<p>
Over three years in development, BusyBox 1.00 represents a tremendous
improvement over the old 0.60.x stable series. Now featuring a Linux
KernelConf based configuration system (as used by the Linux kernel),
Linux 2.6 kernel support, many many new applets, and the development
work and testing of thousands of people from around the world.
<p>
If you are already using BusyBox, you are strongly encouraged to upgrade to
BusyBox 1.00. If you are considering developing an embedded Linux device
or software distribution, you may wish to investigate if using BusyBox is
right for your application. If you need help getting started using
BusyBox, if you wish to donate to help cover expenses, or if you find a bug
and need help reporting it, you are invited to visit the <a
href="FAQ.html">BusyBox FAQ</a>.
<p>
As usual you can <a href="downloads">download busybox here</a>.
<p>Have Fun!
<p>
<li><b>Old News</b><p>
<a href="/oldnews.html">Click here to read older news</a>
</ul>
<!--#include file="footer.html" -->
File diff suppressed because it is too large. Load diff
-166
View File
@@ -1,166 +0,0 @@
<!--#include file="header.html" -->
<h3>Products/Projects Using BusyBox</h3>
Do you use BusyBox? I'd love to know about it and
I'd be happy to link to you.
<p>
I know of the following products and/or projects that use BusyBox --
listed in the order I happen to add them to the web page:
<ul>
<li><a href="/cgi-bin/cvsweb/buildroot/">buildroot</a><br>A configurable
means for building your own busybox/uClibc based system systems.
<li><a href="http://www.pengutronix.de/software/ptxdist_en.html">PTXdist</a><br>another
configurable means for building your own busybox based system systems.
</li><li><a href=
"http://cvs.debian.org/boot-floppies/">
Debian installer (boot floppies) project</a>
</li><li><a href="http://redhat.com/">Red Hat installer</a>
</li><li><a href=
"http://distro.ibiblio.org/pub/Linux/distributions/slackware/slackware-current/source/rootdisks/">
Slackware Installer</a>
</li><li><a href="http://www.gentoo.org/">Gentoo Linux install/boot CDs</a>
</li><li><a href="http://www.mandrake.com/">The Mandrake installer</a>
</li><li><a href="http://Leaf.SourceForge.net">Linux Embedded Appliance Firewall</a><br>The sucessor of the Linux Router Project, supporting all sorts of embedded Linux gateways, routers, wireless routers, and firewalls.
</li><li><a href=
"http://www.toms.net/rb/">tomsrtbt</a>
</li><li><a href="http://www.stormix.com/">Stormix
Installer</a>
</li><li><a href=
"http://www.emacinc.com/linux2_sbc.htm">EMAC Linux
2.0 SBC</a>
</li><li><a href="http://www.trinux.org/">Trinux</a>
</li><li><a href="http://oddas.sourceforge.net/">ODDAS
project</a>
</li><li><a href="http://byld.sourceforge.net/">Build Your
Linux Disk</a>
</li><li><a href=
"http://ibiblio.org/pub/Linux/system/recovery">Zdisk</a>
</li><li><a href="http://www.adtran.com">AdTran -
VPN/firewall VPN Linux Distribution</a>
</li><li><a href="http://mkcdrec.ota.be/">mkCDrec - make
CD-ROM recovery</a>
</li><li><a href=
"http://recycle.lbl.gov/~ldoolitt/bse/">Linux on
nanoEngine</a>
</li><li><a href=
"http://www.zelow.no/floppyfw/">Floppyfw</a>
</li><li><a href="http://www.ltsp.org/">Linux Terminal
Server Project</a>
</li><li><a href="http://www.devil-linux.org/">Devil-Linux</a>
</li><li><a href="http://dutnux.sourceforge.net/">DutNux</a>
</li><li><a href="http://www.microwerks.net/~hugo/mindi/">Mindi</a>
</li><li><a href="http://www.minimalinux.org/ttylinux/">ttylinux</a>
</li><li><a href="http://www.coyotelinux.com/">Coyote Linux</a>
</li><li><a href="http://www.partimage.org/">Partition
Image</a>
</li><li><a href="http://www.fli4l.de/">fli4l the on(e)-disk-router</a>
</li><li><a href="http://tinfoilhat.cultists.net/">Tinfoil
Hat Linux</a>
</li><li><a href="http://sourceforge.net/projects/gp32linux/">gp32linux</a>
</li><li><a href="http://familiar.handhelds.org/">Familiar Linux</a><br>A linux distribution for handheld computers
</li><li><a href="http://rescuecd.sourceforge.net/">Timo's Rescue CD Set</a>
</li><li><a href="http://sf.net/projects/netstation/">Netstation</a>
</li><li><a href="http://www.fiwix.org/">GNU/Fiwix Operating System</a>
</li><li><a href="http://www.softcraft.com/">Generations Linux</a>
</li><li><a href="http://systemimager.org/relatedprojects/">SystemImager / System Installation Suite</a>
</li><li><a href="http://www.bablokb.de/gendist/">GENDIST distribution generator</a>
</li><li><a href="http://diet-pc.sourceforge.net/">DIET-PC embedded Linux thin client distribution</a>
</li><li><a href="http://byzgl.sourceforge.net/">BYZantine Gnu/Linux</a>
</li><li><a href="http://dban.sourceforge.net/">Darik's Boot and Nuke</a>
</li><li><a href="http://www.timesys.com/">TimeSys real-time Linux</a>
</li><li><a href="http://movix.sf.net/">MoviX</a><br>Boots from CD and automatically plays every video file on the CD
</li><li><a href="http://katamaran.sourceforge.net">katamaran</a><br>Linux, X11, xfce windowmanager, based on BusyBox
</li><li><a href="http://www.sourceforge.net/projects/simplygnustep">Prometheus SimplyGNUstep</a>
</li><li><a href="http://www.renyi.hu/~ekho/lowlife/">lowlife</a><br>A documentation project on how to make your own uClibc-based systems and floppy.
</li><li><a href="http://metadistros.hispalinux.es/">Metadistros</a><br>a project to allow you easily make Live-CD distributions.
</li><li><a href="http://salvare.sourceforge.net/">Salvare</a><br>More Linux than tomsrtbt but less than Knoppix, aims to provide a useful workstation as well as a rescue disk.
</li><li><a href="http://www.stresslinux.org/">stresslinux</a><br>minimal linux distribution running from a bootable cdrom or via PXE.
</li><li><a href="http://thinstation.sourceforge.net/">thinstation</a><br>convert standard PCs into full-featured diskless thinclients.
</li><li><a href="http://www.uhulinux.hu/">UHU-Linux Hungary</a>
</li><li><a href="http://deep-water.berlios.de/">Deep-Water Linux</a>
</li><li><a href="http://www.freesco.org/">Freesco router</a>
</li><li><a href="http://Sentry.SourceForge.net/">Sentry Firewall CD</a>
</li><li><a href="http://tuxscreen.net">Tuxscreen Linux Phone</a>
</li><li><a href="http://www.kerbango.com/">The Kerbango Internet Radio</a>
</li><li><a href="http://www.linuxmagic.com/vpn/">LinuxMagic VPN Firewall</a>
</li><li><a href="http://www.isilver-inc.com/">I-Silver Linux appliance servers</a>
</li><li><a href="http://zaurus.sourceforge.net/">Sharp Zaurus PDA</a>
</li><li><a href="http://www.cyclades.com/">Cyclades-TS and other Cyclades products</a>
</li><li><a href="http://www.linksys.com/products/product.asp?prid=508">Linksys WRT54G - Wireless-G Broadband Router</a>
</li><li><a href="http://www.dell.com/us/en/biz/topics/sbtopic_005_truemobile.htm">Dell TrueMobile 1184</a>
</li><li><a href="http://actiontec.com/products/modems/dual_pcmodem/dpm_overview.html">Actiontec Dual PC Modem</a>
</li><li><a href="http://www.kiss-technology.com/">Kiss DP Series DVD players</a>
</li><li><a href="http://www.netgear.com/products/prod_details.asp?prodID=170">NetGear WG602 wireless router</a>
<br>with sources <a href="http://www.netgear.com/support/support_details.asp?dnldID=453">here</a>
</li><li><a href="http://www.trendware.com/products/TEW-411BRP.htm">TRENDnet TEW-411BRP 802.11g Wireless AP/Router/Switch</a>
<br>Source for busybox and udhcp <a href="http://www.trendware.com/asp/download/fileinfo.asp?file_id=277&B1=Search">here</a> though no kernel source is provided.
</li><li><a href="http://www.buffalo-technology.com/webcontent/products/wireless/wbr-g54.htm">Buffalo WBR-G54 wireless router</a>
</li><li><a href="http://www.asus.com/products/communication/wireless/wl-300g/overview.htm">ASUS WL-300g Wireless LAN Access Point</a>
<br>with source<a href="http://www.asus.com.tw/support/download/item.aspx?ModelName=WL-300G">here</a>
</li><li><a href="http://catalog.belkin.com/IWCatProductPage.process?Merchant_Id=&Section_Id=201522&pcount=&Product_Id=136493">Belkin 54g Wireless DSL/Cable Gateway Router</a>
<br>with source<a href="http://web.belkin.com/support/gpl.asp">here</a>
<li><a href="http://www.acronis.com/products/partitionexpert/">Acronis PartitionExpert 2003</a>
<br>includes a heavily modified BusyBox v0.60.5 with built in
cardmgr, device detection, gpm, lspci, etc. Also includes udhcp,
uClibc 0.9.26, a heavily patched up linux kernel, etc. Source
can only be obtained <a href="http://www.acronis.com/files/gpl/linux.tar.bz2">here</a>
</li><li><a href="http://www.usr.com/">U.S. Robotics Sureconnect 4-port ADSL router</a><br>
with source <a href="http://www.usr.com/support/s-gpl-code.asp">here</a>
</li><li><a href="http://www.actiontec.com/products/broadband/54mbps_wireless_gateway_1p/index.html">
ActionTec GT701-WG Wireless Gateway/DSL Modem</a>
with source <a href="http://128.121.226.214/gtproducts/index.html">here</a>
</li><li><a href="http://smartlinux.sourceforge.net/">S.M.A.R.T. Linux</a>
</li><li><a href="http://www.dlink.com/">DLink - Model GSL-G604T, DSL-300T, and possibly other models</a>
with source <a href="ftp://ftp.dlink.co.uk/dsl_routers_modems/">here,</a>
with source <a href="ftp://ftp.dlink.de/dsl-products/">and here,</a>
and quite possibly other places as well. You may need to dig down a bit
to find the source, but it does seem to be there.
</li><li><a href="http://www.siemens-mobile.de/cds/frontdoor/0,2241,de_de_0_42931_rArNrNrNrN,00.html">Siemens SE515 DSL router</a>
with source <a href="http://now-portal.c-lab.de/projects/gigaset/">here, I think...</a>
with some details <a href="http://heinz.hippenstiel.org/familie/hp/hobby/gigaset_se515dsl.html">here.</a>
</li><li><a href="http://frwt.stim.ru/">Free Remote Windows Terminal</a>
</li>
</ul>
<!--#include file="footer.html" -->
-57
View File
@@ -1,57 +0,0 @@
<!--#include file="header.html" -->
<!-- Begin Screenshot -->
<h3> Busybox Screenshot! </h3>
Everybody loves to look at screenshots, so here is a live action screenshot of BusyBox.
<pre style="background-color: black; color: lightgreen; padding: 5px;
font-family: monospace; font-size: smaller;" width="100">
$ ./busybox
BusyBox v1.00 (2004.10.13-04:49+0000) multi-call binary
Usage: busybox [function] [arguments]...
or: [function] [arguments]...
BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable. Most people will create a
link to busybox for each function they wish to use, and BusyBox
will act like whatever it was invoked as.
Currently defined functions:
[, addgroup, adduser, adjtimex, ar, arping, ash, awk, basename, bunzip2,
busybox, bzcat, cal, cat, chgrp, chmod, chown, chroot, chvt, clear, cmp,
cp, cpio, crond, crontab, cut, date, dc, dd, deallocvt, delgroup, deluser,
devfsd, df, dirname, dmesg, dos2unix, dpkg, dpkg-deb, du, dumpkmap,
dumpleases, echo, egrep, env, expr, false, fbset, fdflush, fdformat, fdisk,
fgrep, find, fold, free, freeramdisk, fsck.minix, ftpget, ftpput, getopt,
getty, grep, gunzip, gzip, halt, hdparm, head, hexdump, hostid, hostname,
httpd, hush, hwclock, id, ifconfig, ifdown, ifup, inetd, init, insmod,
install, ip, ipaddr, ipcalc, iplink, iproute, iptunnel, kill, killall,
klogd, lash, last, length, linuxrc, ln, loadfont, loadkmap, logger, login,
logname, logread, losetup, ls, lsmod, makedevs, md5sum, mesg, mkdir,
mkfifo, mkfs.minix, mknod, mkswap, mktemp, modprobe, more, mount, msh, mt,
mv, nameif, nc, netstat, nslookup, od, openvt, passwd, patch, pidof, ping,
ping6, pipe_progress, pivot_root, poweroff, printf, ps, pwd, rdate,
readlink, realpath, reboot, renice, reset, rm, rmdir, rmmod, route, rpm,
rpm2cpio, run-parts, rx, sed, seq, setkeycodes, sha1sum, sleep, sort,
start-stop-daemon, strings, stty, su, sulogin, swapoff, swapon, sync,
sysctl, syslogd, tail, tar, tee, telnet, telnetd, test, tftp, time, top,
touch, tr, traceroute, true, tty, udhcpc, udhcpd, umount, uname,
uncompress, uniq, unix2dos, unzip, uptime, usleep, uudecode, uuencode,
vconfig, vi, vlock, watch, watchdog, wc, wget, which, who, whoami, xargs,
yes, zcat
$ <blink>_</blink>
</pre>
<!--#include file="footer.html" -->
-77
View File
@@ -1,77 +0,0 @@
<!--#include file="header.html" -->
<h3>Hall of Shame!!!</h3>
The following products and/or projects appear to use BusyBox, but do not
appear to release source code as required by the <a
href="/license.html">BusyBox license</a>. This is a violation of the law!
The distributors of these products are invited to contact <a href=
"mailto:andersen@codepoet.org">Erik Andersen</a> if they have any confusion
as to what is needed to bring their products into compliance, or if they have
already brought their product into compliance and wish to be removed from the
Hall of Shame.
<p>
Here are the details of <a href="/license.html">exactly how to comply
with the BusyBox license</a>, so there should be no question as to
exactly what is expected.
Complying with the Busybox license is easy and completely free, so the
companies listed below should be ashamed of themselves. Furthermore, each
product listed here is subject to being legally ordered to cease and desist
distribution for violation of copyright law, and the distributor of each
product is subject to being sued for statutory copyright infringement damages
of up to $150,000 per work plus legal fees. Nobody wants to be sued, and <a
href="mailto:andersen@codepoet.org">Erik</a> certainly would prefer to spend
his time doing better things than sue people. But he will sue if forced to
do so to maintain compliance.
<p>
Do everyone a favor and don't break the law -- if you use busybox, comply with
the busybox license by releasing the source code with your product.
<p>
<ul>
<li><a href="http://www.trittontechnologies.com/products.html">Tritton Technologies NAS120</a>
<br>see <a href="http://www.ussg.iu.edu/hypermail/linux/kernel/0404.0/1611.html">here for details</a>
<li><a href="http://www.macsense.com/product/homepod/">Macsense HomePod</a>
<br>with details
<a href="http://developer.gloolabs.com/modules.php?op=modload&name=Forums&file=viewtopic&topic=123&forum=7">here</a>
<li><a href="http://www.cpx.com/products.asp?c=Wireless+Products">Compex Wireless Products</a>
<br>appears to be running v0.60.5 with Linux version 2.4.20-uc0 on ColdFire,
but no source code is mentioned or offered.
<li><a href="http://www.inventel.com/en/product/datasheet/10/">Inventel DW 200 wireless/ADSL router</a>
<li><a href="http://www.sweex.com/product.asp">Sweex DSL router</a>
<br>appears to be running BusyBox v1.00-pre2 and udhcpd, but no source
code is mentioned or offered.
<li><a href="http://www.trendware.com/products/TEW-410APB.htm">TRENDnet TEW-410APB</a>
</li><li><a href="http://www.hauppauge.com/Pages/products/data_mediamvp.html">Hauppauge Media MVP</a>
<br>Hauppauge contacted me on 16 Dec 2003, and claims to be working on resolving this problem.
</li><li><a href="http://www.hitex.com/download/adescom/data/">TriCore</a>
</li><li><a href="http://www.allnet.de/">ALLNET 0186 wireless router</a>
</li><li><a href="http://www.dmmtv.com/">Dreambox DM7000S DVB Satellite Receiver</a>
<br> Dream Multimedia contacted me on 22 Dec 2003 and is working on resolving this problem.
<br> Source _may_ be here: http://cvs.tuxbox.org/cgi-bin/viewcvs.cgi/tuxbox/cdk/
</li><li><a href="http://testing.lkml.org/slashdot.php?mid=331690">Sigma Designs EM8500 based DVD players</a>
<br>Source for the Sigma Designs reference platform is found here<br>
<a href="http://www.uclinux.org/pub/uClinux/ports/arm/EM8500/uClinux-2.4-sigma.tar.gz">uClinux-2.4-sigma.tar.gz</a>, so while Sigma Designs itself appears to be in compliance, as far as I can tell,
no vendors of Sigma Designs EM8500 based devices actually comply with the GPL....
</li><li><a href="http://testing.lkml.org/slashdot.php?mid=433790">Liteon LVD2001 DVD player using the Sigma Designs EM8500</a>
</li><li><a href="http://www.rimax.net/">Rimax DVD players using the Sigma Designs EM8500</a>
</li><li><a href="http://www.vinc.us/">Bravo DVD players using the Sigma Designs EM8500</a>
</li><li><a href="http://www.hb-direct.com/">H&B DX3110 Divx player based on Sigma Designs EM8500</a>
</li><li><a href="http://www.recospa.it/mdpro1/index.php">United *DVX4066 mpeg4 capable DVD players</a>
</li><li><a href="http://www.a-link.com/RR64AP.html">Avaks alink Roadrunner 64</a>
<br> Partial source available, based on source distributed under NDA from <a href="http://www.lsilogic.com/products/dsl_platform_solutions/hb_linuxr2_2.html"> LSILogic</a>. Why the NDA LSILogic, what are you hiding ?
<br>To verify the Avaks infrigment see my slashdot <a href="http://slashdot.org/~bug1/journal/">journal</a>.
</li><li>Undoubtedly there are others... Please report them so we can shame them (or if necessary sue them) into compliance.
</ul>
<!--#include file="footer.html" -->
+2 -7
View File
@@ -52,10 +52,10 @@ int mu_main(int argc, char **argv)
char mu;
if ((fd = open("/dev/random", O_RDONLY)) < 0)
perror_msg_and_die("/dev/random");
bb_perror_msg_and_die("/dev/random");
if ((n = safe_read(fd, &mu, 1)) < 1)
perror_msg_and_die("/dev/random");
bb_perror_msg_and_die("/dev/random");
return mu;
}
@@ -137,11 +137,6 @@ algorithm in busybox.c and the Gods of BusyBox smite you. Yea, verily:
/* all programs below here are alphabetically "greater than" 'mu' */
Finally, add a define for your applet to include/config.h
#undef CONFIG_MU
Documentation
-------------
+1 -1
View File
@@ -41,7 +41,7 @@ ifeq ($(needlibm-y),y)
endif
$(EDITOR_DIR)$(EDITOR_AR): $(patsubst %,$(EDITOR_DIR)%, $(EDITOR-y))
$(AR) -ro $@ $(patsubst %,$(EDITOR_DIR)%, $(EDITOR-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(EDITOR_DIR)%, $(EDITOR-y))
$(EDITOR_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+1 -2
View File
@@ -1084,7 +1084,7 @@ static node *parse_expr(unsigned long iexp) {
cn->a.n = vn;
xtc = TC_OPERAND | TC_UOPPRE | TC_REGEXP;
if (tc & (TC_OPERAND | TC_REGEXP)) {
xtc = TC_UOPPRE | TC_BINOP | TC_OPERAND | iexp;
xtc = TC_UOPPRE | TC_UOPPOST | TC_BINOP | TC_OPERAND | iexp;
/* one should be very careful with switch on tclass -
* only simple tclasses should be used! */
switch (tc) {
@@ -1101,7 +1101,6 @@ static node *parse_expr(unsigned long iexp) {
cn->info |= xS;
cn->r.n = parse_expr(TC_ARRTERM);
}
xtc = TC_UOPPOST | TC_UOPPRE | TC_BINOP | TC_OPERAND | iexp;
break;
case TC_NUMBER:
+63 -49
View File
@@ -34,7 +34,10 @@
resulting sed_cmd_t structures are appended to a linked list
(sed_cmd_head/sed_cmd_tail).
process_file() does actual sedding, reading data lines from an input FILE *
add_input_file() adds a FILE * to the list of input files. We need to
know them all ahead of time to find the last line for the $ match.
process_files() does actual sedding, reading data lines from each input FILE *
(which could be stdin) and applying the sed command list (sed_cmd_head) to
each of the resulting lines.
@@ -112,17 +115,20 @@ typedef struct sed_cmd_s {
/* globals */
/* options */
static int be_quiet = 0, in_place=0, regex_type=0;
static int be_quiet, in_place, regex_type;
FILE *nonstdout;
char *outname;
char *outname,*hold_space;
/* List of input files */
int input_file_count,current_input_file;
FILE **input_file_list;
static const char bad_format_in_subst[] =
"bad format in substitution expression";
const char *const semicolon_whitespace = "; \n\r\t\v";
regmatch_t regmatch[10];
static regex_t *previous_regex_ptr = NULL;
static regex_t *previous_regex_ptr;
/* linked list of sed commands */
static sed_cmd_t sed_cmd_head;
@@ -169,6 +175,11 @@ static void free_and_close_stuff(void)
free(sed_cmd);
sed_cmd = sed_cmd_next;
}
if(hold_space) free(hold_space);
while(current_input_file<input_file_count)
fclose(input_file_list[current_input_file++]);
}
#endif
@@ -563,6 +574,8 @@ void add_cmd(char *cmdstr)
}
}
/* Append to a string, reallocating memory as necessary. */
struct pipeline {
char *buf; /* Space to hold string */
int idx; /* Space used */
@@ -716,20 +729,29 @@ static void flush_append(void)
append_head=append_tail=NULL;
}
/* Get next line of input, flushing append buffer and noting if we hit EOF
* without a newline on the last line.
*/
static char *get_next_line(FILE * file, int *no_newline)
void add_input_file(FILE *file)
{
char *temp;
input_file_list=xrealloc(input_file_list,(input_file_count+1)*sizeof(FILE *));
input_file_list[input_file_count++]=file;
}
/* Get next line of input from input_file_list, flushing append buffer and
* noting if we ran out of files without a newline on the last line we read.
*/
static char *get_next_line(int *no_newline)
{
char *temp=NULL;
int len;
flush_append();
temp=bb_get_line_from_file(file);
if(temp) {
len=strlen(temp);
if(len && temp[len-1]=='\n') temp[len-1]=0;
else *no_newline=1;
while(current_input_file<input_file_count) {
temp=bb_get_line_from_file(input_file_list[current_input_file]);
if(temp) {
len=strlen(temp);
*no_newline=!(len && temp[len-1]=='\n');
if(!*no_newline) temp[len-1]=0;
break;
} else fclose(input_file_list[current_input_file++]);
}
return temp;
@@ -755,15 +777,15 @@ static int puts_maybe_newline(char *s, FILE *file, int missing_newline, int no_n
#define sed_puts(s,n) missing_newline=puts_maybe_newline(s,nonstdout,missing_newline,n)
static void process_file(FILE *file)
static void process_files(void)
{
char *pattern_space, *next_line, *hold_space=NULL;
static int linenum = 0, missing_newline=0;
char *pattern_space, *next_line;
int linenum = 0, missing_newline=0;
int no_newline,next_no_newline=0;
next_line = get_next_line(file,&next_no_newline);
next_line = get_next_line(&next_no_newline);
/* go through every line in the file */
/* go through every line in each file */
for(;;) {
sed_cmd_t *sed_cmd;
int substituted=0;
@@ -773,7 +795,7 @@ static void process_file(FILE *file)
no_newline=next_no_newline;
/* Read one line in advance so we can act on the last line, the '$' address */
next_line = get_next_line(file,&next_no_newline);
next_line = get_next_line(&next_no_newline);
linenum++;
restart:
/* for every line, go through all the commands */
@@ -908,7 +930,7 @@ restart:
/* Cut and paste text (replace) */
case 'c':
/* Only triggers on last line of a matching range. */
if (!sed_cmd->in_match) sed_puts(sed_cmd->string,1);
if (!sed_cmd->in_match) sed_puts(sed_cmd->string,0);
goto discard_line;
/* Read file, append contents to output */
@@ -942,7 +964,7 @@ restart:
free(pattern_space);
pattern_space = next_line;
no_newline=next_no_newline;
next_line = get_next_line(file,&next_no_newline);
next_line = get_next_line(&next_no_newline);
linenum++;
break;
}
@@ -972,7 +994,7 @@ restart:
pattern_space[len]='\n';
strcpy(pattern_space+len+1, next_line);
no_newline=next_no_newline;
next_line = get_next_line(file,&next_no_newline);
next_line = get_next_line(&next_no_newline);
linenum++;
}
break;
@@ -1007,10 +1029,7 @@ restart:
}
case 'g': /* Replace pattern space with hold space */
free(pattern_space);
if (hold_space) {
pattern_space = strdup(hold_space);
no_newline=0;
}
pattern_space = strdup(hold_space ? hold_space : "");
break;
case 'G': /* Append newline and hold space to pattern space */
{
@@ -1096,9 +1115,7 @@ static void add_cmd_block(char *cmdstr)
extern int sed_main(int argc, char **argv)
{
int status = EXIT_SUCCESS;
int opt;
uint8_t getpat = 1;
int status = EXIT_SUCCESS, opt, getpat = 1;
#ifdef CONFIG_FEATURE_CLEAN_UP
/* destroy command strings on exit */
@@ -1153,8 +1170,7 @@ extern int sed_main(int argc, char **argv)
}
}
/* if we didn't get a pattern from a -e and no command file was specified,
* argv[optind] should be the pattern. no pattern, no worky */
/* if we didn't get a pattern from -e or -f, use argv[optind] */
if(getpat) {
if (argv[optind] == NULL)
bb_show_usage();
@@ -1171,49 +1187,47 @@ extern int sed_main(int argc, char **argv)
* files were specified or '-' was specified, take input from stdin.
* Otherwise, we process all the files specified. */
if (argv[optind] == NULL) {
if(in_place) {
fprintf(stderr,"sed: Filename required for -i\n");
exit(1);
}
process_file(stdin);
if(in_place) bb_error_msg_and_die("Filename required for -i");
add_input_file(stdin);
process_files();
} else {
int i;
FILE *file;
for (i = optind; i < argc; i++) {
if(!strcmp(argv[i], "-") && !in_place) {
process_file(stdin);
add_input_file(stdin);
process_files();
} else {
file = bb_wfopen(argv[i], "r");
if (file) {
if(in_place) {
struct stat statbuf;
int nonstdoutfd;
outname=bb_xstrndup(argv[i],strlen(argv[i])+6);
strcat(outname,"XXXXXX");
if(-1==(nonstdoutfd=mkstemp(outname)))
bb_error_msg_and_die("no temp file");
nonstdout=fdopen(nonstdoutfd,"w");
/* Set permissions of output file */
fstat(fileno(file),&statbuf);
mkstemp(outname);
nonstdout=bb_wfopen(outname,"w");
/* Set permissions of output file */
fstat(fileno(file),&statbuf);
fchmod(fileno(nonstdout),statbuf.st_mode);
atexit(cleanup_outname);
}
process_file(file);
fclose(file);
if(in_place) {
fchmod(nonstdoutfd,statbuf.st_mode);
add_input_file(file);
process_files();
fclose(nonstdout);
nonstdout=stdout;
unlink(argv[i]);
rename(outname,argv[i]);
free(outname);
outname=0;
}
} else add_input_file(file);
} else {
status = EXIT_FAILURE;
}
}
}
if(input_file_count>current_input_file) process_files();
}
return status;
+55 -45
View File
@@ -166,7 +166,7 @@ static int vi_setops;
static int editing; // >0 while we are editing a file
static int cmd_mode; // 0=command 1=insert
static int cmd_mode; // 0=command 1=insert 2=replace
static int file_modified; // buffer contents changed
static int fn_start; // index of first cmd line file name
static int save_argc; // how many file names on cmd line
@@ -272,7 +272,7 @@ static void show_status_line(void); // put a message on the bottom line
static void psb(const char *, ...); // Print Status Buf
static void psbs(const char *, ...); // Print Status Buf in standout mode
static void ni(Byte *); // display messages
static void edit_status(void); // show file status on status line
static void compute_edit_status(void); // format file status on status line
static void redraw(int); // force a full screen refresh
static void format_line(Byte*, Byte*, int);
static void refresh(int); // update the terminal from screen[]
@@ -344,6 +344,7 @@ extern int vi_main(int argc, char **argv)
#endif /* CONFIG_FEATURE_VI_CRASHME */
status_buffer = STATUS_BUFFER;
*status_buffer = '\0'; // clear status buffer
#ifdef CONFIG_FEATURE_VI_READONLY
vi_readonly = readonly = FALSE;
@@ -449,7 +450,7 @@ static void edit_file(Byte * fn)
if (ch < 1) {
(void) char_insert(text, '\n'); // start empty buf with dummy line
}
file_modified = FALSE;
file_modified = 0;
#ifdef CONFIG_FEATURE_VI_YANKMARK
YDreg = 26; // default Yank/Delete reg
Ureg = 27; // hold orig line for "U" cmd
@@ -462,7 +463,6 @@ static void edit_file(Byte * fn)
last_forward_char = last_input_char = '\0';
crow = 0;
ccol = 0;
edit_status();
#ifdef CONFIG_FEATURE_VI_USE_SIGNALS
catch_sig(0);
@@ -833,7 +833,7 @@ static void colon(Byte * buf)
(void) char_insert(text, '\n');
ch= 1;
}
file_modified = FALSE;
file_modified = 0;
#ifdef CONFIG_FEATURE_VI_YANKMARK
if (Ureg >= 0 && Ureg < 28 && reg[Ureg] != 0) {
free(reg[Ureg]); // free orig line reg- for 'U'
@@ -870,7 +870,7 @@ static void colon(Byte * buf)
cfn = (Byte *) bb_xstrdup((char *) args);
} else {
// user wants file status info
edit_status();
/* no-op */;
}
} else if (strncasecmp((char *) cmd, "features", i) == 0) { // what features are available
// print out values of all features
@@ -976,7 +976,7 @@ static void colon(Byte * buf)
// if the insert is before "dot" then we need to update
if (q <= dot)
dot += ch;
file_modified = TRUE;
file_modified++;
}
} else if (strncasecmp((char *) cmd, "rewind", i) == 0) { // rewind cmd line args
if (file_modified && ! useforce) {
@@ -1108,7 +1108,7 @@ static void colon(Byte * buf)
}
psb("\"%s\" %dL, %dC", fn, li, l);
if (q == text && r == end - 1 && l == ch)
file_modified = FALSE;
file_modified = 0;
if ((cmd[0] == 'x' || cmd[1] == 'q') && l == ch) {
editing = 0;
}
@@ -1587,16 +1587,16 @@ static Byte *char_insert(Byte * p, Byte c) // insert the char c at 'p'
c = get_one_char();
*p = c;
p++;
file_modified = TRUE; // has the file been modified
file_modified++; // has the file been modified
} else if (c == 27) { // Is this an ESC?
cmd_mode = 0;
cmdcnt = 0;
end_cmd_q(); // stop adding to q
strcpy((char *) status_buffer, " "); // clear the status buffer
*status_buffer = '\0'; // clear the status buffer
if ((p[-1] != '\n') && (dot>text)) {
p--;
}
} else if (c == erase_char) { // Is this a BS
} else if (c == erase_char || c == 8 || c == 127) { // Is this a BS
// 123456789
if ((p[-1] != '\n') && (dot>text)) {
p--;
@@ -1642,7 +1642,7 @@ static Byte *stupid_insert(Byte * p, Byte c) // stupidly insert the char c at 'p
p = text_hole_make(p, 1);
if (p != 0) {
*p = c;
file_modified = TRUE; // has the file been modified
file_modified++; // has the file been modified
p++;
}
return (p);
@@ -1840,7 +1840,7 @@ static Byte *text_hole_make(Byte * p, int size) // at "p", make a 'size' byte ho
}
memset(p, ' ', size); // clear new hole
end = end + size; // adjust the new END
file_modified = TRUE; // has the file been modified
file_modified++; // has the file been modified
thm0:
return (p);
}
@@ -1876,7 +1876,7 @@ static Byte *text_hole_delete(Byte * p, Byte * q) // delete "p" thru "q", inclus
dest = end - 1; // make sure dest in below end-1
if (end <= text)
dest = end = text; // keep pointers valid
file_modified = TRUE; // has the file been modified
file_modified++; // has the file been modified
thd0:
return (dest);
}
@@ -2340,7 +2340,7 @@ static Byte readit(void) // read (maybe cursor) key from stdin
}
//----- IO Routines --------------------------------------------
static Byte get_one_char()
static Byte get_one_char(void)
{
static Byte c;
@@ -2495,7 +2495,7 @@ static int file_insert(Byte * fn, Byte * p, int size)
psbs("could not read all of file \"%s\"", fn);
}
if (cnt >= size)
file_modified = TRUE;
file_modified++;
fi0:
return (cnt);
}
@@ -2600,25 +2600,25 @@ static void place_cursor(int row, int col, int opti)
}
//----- Erase from cursor to end of line -----------------------
static void clear_to_eol()
static void clear_to_eol(void)
{
write1(Ceol); // Erase from cursor to end of line
}
//----- Erase from cursor to end of screen -----------------------
static void clear_to_eos()
static void clear_to_eos(void)
{
write1(Ceos); // Erase from cursor to end of screen
}
//----- Start standout mode ------------------------------------
static void standout_start() // send "start reverse video" sequence
static void standout_start(void) // send "start reverse video" sequence
{
write1(SOs); // Start reverse video mode
}
//----- End standout mode --------------------------------------
static void standout_end() // send "end reverse video" sequence
static void standout_end(void) // send "end reverse video" sequence
{
write1(SOn); // End reverse video mode
}
@@ -2648,7 +2648,7 @@ static void Indicate_Error(void)
//----- Screen[] Routines --------------------------------------
//----- Erase the Screen[] memory ------------------------------
static void screen_erase()
static void screen_erase(void)
{
memset(screen, ' ', screensize); // clear new screen
}
@@ -2659,7 +2659,7 @@ static void show_status_line(void)
static int last_cksum;
int l, cnt, cksum;
edit_status();
compute_edit_status();
cnt = strlen((char *) status_buffer);
for (cksum= l= 0; l < cnt; l++) { cksum += (int)(status_buffer[l]); }
// don't write the status line unless it changes
@@ -2681,8 +2681,7 @@ static void psbs(const char *format, ...)
va_start(args, format);
strcpy((char *) status_buffer, SOs); // Terminal standout mode on
vsprintf((char *) status_buffer + strlen((char *) status_buffer), format,
args);
vsprintf((char *) status_buffer + strlen((char *) status_buffer), format, args);
strcat((char *) status_buffer, SOn); // Terminal standout mode off
va_end(args);
@@ -2708,12 +2707,19 @@ static void ni(Byte * s) // display messages
psbs("\'%s\' is not implemented", buf);
}
static void edit_status(void) // show file status on status line
static void compute_edit_status(void) // show file status on status line
{
int cur, tot, percent;
int cur, percent;
static int tot;
static int last_file_modified = -1;
cur = count_lines(text, dot);
tot = count_lines(text, end - 1);
/* try and reduce counting */
if (file_modified != last_file_modified) {
tot = cur + count_lines(dot, end - 1) - 1;
last_file_modified = file_modified;
}
// current line percent
// ------------- ~~ ----------
// total lines 100
@@ -2723,17 +2729,21 @@ static void edit_status(void) // show file status on status line
cur = tot = 0;
percent = 100;
}
psb("\"%s\""
sprintf((char *) status_buffer,
"\"%s\""
#ifdef CONFIG_FEATURE_VI_READONLY
"%s"
"%s"
#endif /* CONFIG_FEATURE_VI_READONLY */
"%s line %d of %d --%d%%--",
(cfn != 0 ? (char *) cfn : "No file"),
"%s"
"%s line %d of %d --%d%%--",
(cfn != 0 ? (char *) cfn : "No file"),
#ifdef CONFIG_FEATURE_VI_READONLY
((vi_readonly || readonly) ? " [Read only]" : ""),
((vi_readonly || readonly) ? " [Read only]" : ""),
#endif /* CONFIG_FEATURE_VI_READONLY */
(file_modified ? " [modified]" : ""),
cur, tot, percent);
(cmd_mode ? (cmd_mode == 2 ? " [Replace]":" [Insert]") : ""),
(file_modified ? " [modified]" : ""),
cur, tot, percent);
}
//----- Force refresh of all Lines -----------------------------
@@ -2938,6 +2948,8 @@ static void do_cmd(Byte c)
p = q = save_dot = msg = buf; // quiet the compiler
memset(buf, '\0', 9); // clear buf
show_status_line();
/* if this is a cursor key, skip these checks */
switch (c) {
case VI_K_UP:
@@ -3057,12 +3069,11 @@ key_cmd_mode:
dot_scroll(rows - 2, 1);
break;
case 7: // ctrl-G show current status
edit_status();
break;
case 'h': // h- move left
case VI_K_LEFT: // cursor key Left
case 8: // ctrl-H- move left (This may be ERASE char)
case 127: // DEL- move left (This may be ERASE char)
case 8: // ctrl-H- move left (This may be ERASE char)
case 127: // DEL- move left (This may be ERASE char)
if (cmdcnt-- > 1) {
do_cmd(c);
} // repeat cnt
@@ -3225,7 +3236,7 @@ key_cmd_mode:
//
// dont separate these two commands. 'f' depends on ';'
//
//**** fall thru to ... 'i'
//**** fall thru to ... ';'
case ';': // ;- look at rest of line for last forward char
if (cmdcnt-- > 1) {
do_cmd(';');
@@ -3376,13 +3387,13 @@ key_cmd_mode:
strncasecmp((char *) p, "wq", cnt) == 0 ||
strncasecmp((char *) p, "x", cnt) == 0) {
cnt = file_write(cfn, text, end - 1);
file_modified = FALSE;
file_modified = 0;
psb("\"%s\" %dL, %dC", cfn, count_lines(text, end - 1), cnt);
if (p[0] == 'x' || p[1] == 'q') {
editing = 0;
}
} else if (strncasecmp((char *) p, "file", cnt) == 0 ) {
edit_status(); // show current file status
/* no-op */; // show current file status
} else if (sscanf((char *) p, "%d", &j) > 0) {
dot = find_line(j); // go to line # j
dot_skip_over_ws();
@@ -3483,7 +3494,6 @@ key_cmd_mode:
case VI_K_INSERT: // Cursor Key Insert
dc_i:
cmd_mode = 1; // start insrting
psb("-- Insert --");
break;
case 'J': // J- join current and next lines together
if (cmdcnt-- > 2) {
@@ -3492,6 +3502,7 @@ key_cmd_mode:
dot_end(); // move to NL
if (dot < end - 1) { // make sure not last char in text[]
*dot++ = ' '; // replace NL with space
file_modified++;
while (isblnk(*dot)) { // delete leading WS
dot_delete();
}
@@ -3532,7 +3543,6 @@ key_cmd_mode:
case 'R': // R- continuous Replace char
dc5:
cmd_mode = 2;
psb("-- Replace --");
break;
case 'X': // X- delete char before dot
case 'x': // x- delete the current char
@@ -3682,7 +3692,7 @@ key_cmd_mode:
c1 = get_one_char(); // get the replacement char
if (*dot != '\n') {
*dot = c1;
file_modified = TRUE; // has the file been modified
file_modified++; // has the file been modified
}
end_cmd_q(); // stop adding to q
break;
@@ -3727,10 +3737,10 @@ key_cmd_mode:
} // repeat cnt
if (islower(*dot)) {
*dot = toupper(*dot);
file_modified = TRUE; // has the file been modified
file_modified++; // has the file been modified
} else if (isupper(*dot)) {
*dot = tolower(*dot);
file_modified = TRUE; // has the file been modified
file_modified++; // has the file been modified
}
dot_right();
end_cmd_q(); // stop adding to q
+3 -3
View File
@@ -73,13 +73,13 @@ config CONFIG_FEATURE_GREP_EGREP_ALIAS
and various repetition operators.
config CONFIG_FEATURE_GREP_FGREP_ALIAS
bool " Alias fgrep to grep -f"
bool " Alias fgrep to grep -F"
default y
depends on CONFIG_GREP
help
fgrep sees the search pattern as a normal string rather than
fgrep sees the search pattern as a normal string rather than
regular expressions.
grep -f is always builtin, this just creates the fgrep alias.
grep -F is always builtin, this just creates the fgrep alias.
config CONFIG_FEATURE_GREP_CONTEXT
bool " Enable before and after context flags (-A, -B and -C)"
+1 -1
View File
@@ -31,7 +31,7 @@ FINDUTILS-$(CONFIG_XARGS) += xargs.o
libraries-y+=$(FINDUTILS_DIR)$(FINDUTILS_AR)
$(FINDUTILS_DIR)$(FINDUTILS_AR): $(patsubst %,$(FINDUTILS_DIR)%, $(FINDUTILS-y))
$(AR) -ro $@ $(patsubst %,$(FINDUTILS_DIR)%, $(FINDUTILS-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(FINDUTILS_DIR)%, $(FINDUTILS-y))
$(FINDUTILS_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+8 -3
View File
@@ -58,7 +58,7 @@ static char fgrep_flag;
#define GREP_OPT_L (1<<12)
static char print_files_without_matches;
#ifdef CONFIG_FEATURE_GREP_CONTEXT
#define GREP_OPT_CONTEXT "A:B:C"
#define GREP_OPT_CONTEXT "A:B:C:"
#define GREP_OPT_A (1<<13)
#define GREP_OPT_B (1<<14)
#define GREP_OPT_C (1<<15)
@@ -98,7 +98,7 @@ static void print_line(const char *line, int linenum, char decoration)
}
last_line_printed = linenum;
#endif
if (print_filename)
if (print_filename > 0)
printf("%s%c", cur_file, decoration);
if (print_line_num)
printf("%i%c", linenum, decoration);
@@ -219,7 +219,7 @@ static int grep_file(FILE *file)
/* grep -c: print [filename:]count, even if count is zero */
if (print_match_counts) {
if (print_filename)
if (print_filename > 0)
printf("%s:", cur_file);
printf("%d\n", nmatches);
}
@@ -326,6 +326,11 @@ extern int grep_main(int argc, char **argv)
if(opt & GREP_OPT_f)
load_regexes_from_file(fopt);
#ifdef CONFIG_FEATURE_GREP_FGREP_ALIAS
if(bb_applet_name[0] == 'f')
fgrep_flag = 1;
#endif
#ifdef CONFIG_FEATURE_GREP_EGREP_ALIAS
if(bb_applet_name[0] == 'e' || (opt & GREP_OPT_E))
reflags = REG_EXTENDED | REG_NOSUB;
-2
View File
@@ -1,2 +0,0 @@
config
config.h
+4 -4
View File
@@ -440,7 +440,7 @@
APPLET_NOUSAGE("pipe_progress", pipe_progress_main, _BB_DIR_BIN, _BB_SUID_NEVER)
#endif
#ifdef CONFIG_PIVOT_ROOT
APPLET(pivot_root, pivot_root_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
APPLET(pivot_root, pivot_root_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
#endif
#ifdef CONFIG_POWEROFF
APPLET(poweroff, poweroff_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
@@ -482,7 +482,7 @@
APPLET(rmmod, rmmod_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
#endif
#ifdef CONFIG_ROUTE
APPLET(route, route_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
APPLET(route, route_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
#endif
#ifdef CONFIG_RPM
APPLET(rpm, rpm_main, _BB_DIR_BIN, _BB_SUID_NEVER)
@@ -547,7 +547,7 @@
#ifdef CONFIG_SYNC
APPLET(sync, sync_main, _BB_DIR_BIN, _BB_SUID_NEVER)
#endif
#ifdef CONFIG_SYSCTL
#ifdef CONFIG_BB_SYSCTL
APPLET(sysctl, sysctl_main, _BB_DIR_SBIN, _BB_SUID_NEVER)
#endif
#ifdef CONFIG_SYSLOGD
@@ -672,7 +672,7 @@
#endif
#if !defined(PROTOTYPES) && !defined(MAKE_USAGE)
{ 0,NULL,0 }
{ 0,NULL,0,0 }
};
#endif
+4 -4
View File
@@ -32,10 +32,10 @@
#include <sys/stat.h>
#include <sys/types.h>
#if __GNU_LIBRARY__ < 5
#ifndef __dietlibc__
#error "Sorry, libc5 is not supported"
#endif
#if __GNU_LIBRARY__ < 5 && \
!defined(__dietlibc__) && \
!defined(_NEWLIB_VERSION)
#error "Sorry, this libc version is not supported :("
#endif
#ifndef BB_EXTRA_VERSION
+2
View File
@@ -29,5 +29,7 @@ extern int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirs
extern int INET_rresolve(char *name, size_t len, struct sockaddr_in *s_in,
int numeric, unsigned int netmask);
#ifdef CONFIG_FEATURE_IPV6
extern int INET6_resolve(const char *name, struct sockaddr_in6 *sin6);
extern int INET6_rresolve(char *name, size_t len, struct sockaddr_in6 *sin6, int numeric);
#endif
+9 -9
View File
@@ -34,6 +34,7 @@
#include <stdint.h>
#include <netdb.h>
#include <netinet/in.h>
#ifdef DMALLOC
#include <dmalloc.h>
@@ -43,7 +44,7 @@
#include "config.h"
#ifdef CONFIG_SELINUX
#include <proc_secure.h>
#include <selinux/selinux.h>
#endif
#include "pwd_.h"
@@ -150,6 +151,7 @@ extern FILE *bb_xfopen(const char *path, const char *mode);
extern int bb_fclose_nonstdin(FILE *f);
extern void bb_fflush_stdout_and_exit(int retval) __attribute__ ((noreturn));
#define BB_GETOPT_ERROR 0x80000000UL
extern const char *bb_opt_complementaly;
extern const struct option *bb_applet_long_options;
extern unsigned long bb_getopt_ulflags(int argc, char **argv, const char *applet_opts, ...);
@@ -323,6 +325,7 @@ extern const char * const bb_msg_full_version;
extern const char * const bb_msg_memory_exhausted;
extern const char * const bb_msg_invalid_date;
extern const char * const bb_msg_io_error;
extern const char * const bb_msg_read_error;
extern const char * const bb_msg_write_error;
extern const char * const bb_msg_name_longer_than_foo;
extern const char * const bb_msg_unknown;
@@ -421,11 +424,12 @@ void bb_xasprintf(char **string_ptr, const char *format, ...) __attribute__ ((fo
#define FAIL_DELAY 3
extern void change_identity ( const struct passwd *pw );
extern const char *change_identity_e2str ( const struct passwd *pw );
extern void run_shell ( const char *shell, int loginshell, const char *command, const char **additional_args
extern void run_shell ( const char *shell, int loginshell, const char *command, const char **additional_args);
#ifdef CONFIG_SELINUX
, security_id_t sid
extern void renew_current_security_context(void);
extern void set_current_security_context(security_context_t sid);
#endif
);
extern int run_parts(char **args, const unsigned char test_mode, char **env);
extern int restricted_shell ( const char *shell );
extern void setup_environment ( const char *shell, int loginshell, int changeenv, const struct passwd *pw );
@@ -456,11 +460,7 @@ typedef struct {
char short_cmd[16];
} procps_status_t;
extern procps_status_t * procps_scan(int save_user_arg0
#ifdef CONFIG_SELINUX
, int use_selinux, security_id_t *sid
#endif
);
extern procps_status_t * procps_scan(int save_user_arg0);
extern unsigned short compare_string_array(const char *string_array[], const char *key);
extern int my_query_module(const char *name, int which, void **buf, size_t *bufsize, size_t *ret);
+14 -15
View File
@@ -204,7 +204,7 @@
"Copies SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" \
"\n" \
"\t-a\tSame as -dpR\n" \
"\t-d\tPreserves links\n" \
"\t-d,-P\tPreserves links\n" \
"\t-p\tPreserves file attributes if possible\n" \
"\t-f\tforce (implied; ignored) - always set\n" \
"\t-i\tinteractive, prompt before overwrite\n" \
@@ -356,10 +356,10 @@
#endif
#define devfsd_trivial_usage \
"mntpnt [-v]"\
"devfsd [-v]"\
USAGE_DEVFSD_FG_NP("[-fg][-np]" )
#define devfsd_full_usage \
"Optional daemon for managing devfs permissions and old device name symlinks.\n" \
"Obsolete daemon for managing devfs permissions and old device name symlinks.\n" \
"\nOptions:\n" \
"\tmntpnt\tThe mount point where devfs is mounted.\n\n" \
"\t-v\tPrint the protocol version numbers for devfsd\n" \
@@ -522,13 +522,13 @@
"\t-e\tinterpret backslash-escaped characters (i.e., \\t=tab)\n" \
"\t-E\tdisable interpretation of backslash-escaped characters")
#define echo_example_usage \
"$ echo "Erik is cool"\n" \
"$ echo \"Erik is cool\"\n" \
"Erik is cool\n" \
USAGE_FANCY_ECHO("$ echo -e "Erik\\nis\\ncool"\n" \
USAGE_FANCY_ECHO("$ echo -e \"Erik\\nis\\ncool\"\n" \
"Erik\n" \
"is\n" \
"cool\n" \
"$ echo "Erik\\nis\\ncool"\n" \
"$ echo \"Erik\\nis\\ncool\"\n" \
"Erik\\nis\\ncool\n")
#define env_trivial_usage \
@@ -751,7 +751,7 @@
"$ cat getopt.test\n" \
"#!/bin/sh\n" \
"GETOPT=`getopt -o ab:c:: --long a-long,b-long:,c-long:: \\\n" \
" -n 'example.busybox' -- "$@"`\n" \
" -n 'example.busybox' -- \"$@\"`\n" \
"if [ $? != 0 ] ; then exit 1 ; fi\n" \
"eval set -- "$GETOPT"\n" \
"while true ; do\n" \
@@ -1940,7 +1940,7 @@
"Formats and prints ARGUMENT(s) according to FORMAT,\n" \
"Where FORMAT controls the output exactly as in C printf."
#define printf_example_usage \
"$ printf "Val=%d\\n" 5\n" \
"$ printf \"Val=%d\\n\" 5\n" \
"Val=5\n"
#ifdef CONFIG_SELINUX
@@ -2302,24 +2302,22 @@
#define USAGE_IPC_LOG(a)
#endif
#ifdef CONFIG_SYSCTL
#define sysctl_trivial_usage \
"[OPTIONS]... [VALUE]...\n"
#define sysctl_full_usage
"sysctl - configure kernel parameters at runtime\n\n" \
#define sysctl_full_usage \
"configure kernel parameters at runtime\n\n" \
"Options:\n" \
"\t-n\tUse this option to disable printing of the key name when printing values.\n" \
"\t-w\tUse this option when you want to change a sysctl setting.\n" \
"\t-p\tLoad in sysctl settings from the file specified or /etc/sysctl.conf if none given.\n" \
"\t-a\tDisplay all values currently available.\n" \
"\t-A\tDisplay all values currently available in table form."
#define sysctl_example_usage
#define sysctl_example_usage \
"sysctl [-n] variable ...\n" \
"sysctl [-n] -w variable=value ...\n" \
"sysctl [-n] -a\n" \
"sysctl [-n] -p <file>\t(default /etc/sysctl.conf)\n" \
"sysctl [-n] -A\n"
#endif
#define syslogd_trivial_usage \
"[OPTION]..."
@@ -2610,9 +2608,10 @@
"/dev/tty2\n"
#define udhcpc_trivial_usage \
"[-fbnqv] [-c CLIENTID] [-H HOSTNAME] [-i INTERFACE]\n[-p pidfile] [-r IP] [-s script]"
"[-Cfbnqv] [-c CLIENTID] [-H HOSTNAME] [-i INTERFACE]\n[-p pidfile] [-r IP] [-s script]"
#define udhcpc_full_usage \
"\t-c,\t--clientid=CLIENTID\tClient identifier\n" \
"\t-c,\t--clientid=CLIENTID\tSet client identifier\n" \
"\t-C,\t--clientid-none\tSuppress default client identifier\n" \
"\t-H,\t--hostname=HOSTNAME\tClient hostname\n" \
"\t-h,\t \tAlias for -H\n" \
"\t-f,\t--foreground\tDo not fork after getting lease\n" \
+8
View File
@@ -35,6 +35,14 @@ config CONFIG_FEATURE_INIT_COREDUMPS
core file sizes. If this option is disabled, processes
will not generate any core files.
config CONFIG_FEATURE_INIT_SWAPON
bool " Should init run swapon if short on memory?"
default y
depends on CONFIG_INIT
help
If the system has less than one megabyte of total memory, init
will run '/sbin/swapon -a' to add swap memory.
config CONFIG_FEATURE_EXTRA_QUIET
bool " Should init be _extra_ quiet on boot?"
default y
+1 -1
View File
@@ -55,7 +55,7 @@ endif
libraries-y+=$(INIT_DIR)$(INIT_AR)
$(INIT_DIR)$(INIT_AR): $(patsubst %,$(INIT_DIR)%, $(INIT-y))
$(AR) -ro $@ $(patsubst %,$(INIT_DIR)%, $(INIT-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(INIT_DIR)%, $(INIT-y))
$(INIT_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+24 -15
View File
@@ -39,7 +39,6 @@
#include <limits.h>
#include <sys/fcntl.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/reboot.h>
@@ -156,7 +155,7 @@ static struct init_action *init_action_list = NULL;
static char console[CONSOLE_BUFF_SIZE] = _PATH_CONSOLE;
#ifndef CONFIG_SYSLOGD
static char *log = VC_5;
static char *log_console = VC_5;
#endif
static sig_atomic_t got_cont = 0;
static const int LOG = 0x1;
@@ -239,9 +238,9 @@ static void message(int device, const char *fmt, ...)
/* Take full control of the log tty, and never close it.
* It's mine, all mine! Muhahahaha! */
if (log_fd < 0) {
if ((log_fd = device_open(log, O_RDWR | O_NDELAY | O_NOCTTY)) < 0) {
if ((log_fd = device_open(log_console, O_RDWR | O_NONBLOCK | O_NOCTTY)) < 0) {
log_fd = -2;
bb_error_msg("Bummer, can't write to log on %s!", log);
bb_error_msg("Bummer, can't write to log on %s!", log_console);
device = CONSOLE;
} else {
fcntl(log_fd, F_SETFD, FD_CLOEXEC);
@@ -254,7 +253,7 @@ static void message(int device, const char *fmt, ...)
if (device & CONSOLE) {
int fd = device_open(_PATH_CONSOLE,
O_WRONLY | O_NOCTTY | O_NDELAY);
O_WRONLY | O_NOCTTY | O_NONBLOCK);
/* Always send console messages to /dev/console so people will see them. */
if (fd >= 0) {
bb_full_write(fd, msg, l);
@@ -309,6 +308,7 @@ static void set_term(int fd)
tcsetattr(fd, TCSANOW, &tty);
}
#ifdef CONFIG_FEATURE_INIT_SWAPON
/* How much memory does this machine have?
Units are kBytes to avoid overflow on 4GB machines */
static unsigned int check_free_memory(void)
@@ -337,6 +337,7 @@ static unsigned int check_free_memory(void)
return(result * u);
}
}
#endif /* CONFIG_FEATURE_INIT_SWAPON */
static void console_init(void)
{
@@ -381,7 +382,7 @@ static void console_init(void)
if (fd < 0) {
/* Perhaps we should panic here? */
#ifndef CONFIG_SYSLOGD
log =
log_console =
#endif
safe_strncpy(console, "/dev/null", sizeof(console));
} else {
@@ -393,7 +394,7 @@ static void console_init(void)
if (s == NULL || strcmp(s, "linux") == 0)
putenv("TERM=vt102");
#ifndef CONFIG_SYSLOGD
log = console;
log_console = console;
#endif
} else {
if (s == NULL)
@@ -423,9 +424,8 @@ static void fixup_argv(int argc, char **argv, char *new_argv0)
static pid_t run(const struct init_action *a)
{
struct stat sb;
int i, junk;
pid_t pid, pgrp, tmp_pid;
pid_t pid;
char *s, *tmpCmd, *cmd[INIT_BUFFS_SIZE], *cmdpath;
char buf[INIT_BUFFS_SIZE + 6]; /* INIT_BUFFS_SIZE+strlen("exec ")+1 */
sigset_t nmask, omask;
@@ -441,6 +441,8 @@ static pid_t run(const struct init_action *a)
sigprocmask(SIG_BLOCK, &nmask, &omask);
if ((pid = fork()) == 0) {
struct stat sb;
/* Clean up */
close(0);
close(1);
@@ -453,6 +455,7 @@ static pid_t run(const struct init_action *a)
signal(SIGINT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
signal(SIGHUP, SIG_DFL);
signal(SIGQUIT, SIG_DFL);
signal(SIGCONT, SIG_DFL);
signal(SIGSTOP, SIG_DFL);
signal(SIGTSTP, SIG_DFL);
@@ -464,11 +467,10 @@ static pid_t run(const struct init_action *a)
/* Open the new terminal device */
if ((device_open(a->terminal, O_RDWR)) < 0) {
if (stat(a->terminal, &sb) != 0) {
message(LOG | CONSOLE, "device '%s' does not exist.",
a->terminal);
_exit(1);
message(LOG | CONSOLE, "device '%s' does not exist.", a->terminal);
} else {
message(LOG | CONSOLE, "Bummer, can't open %s", a->terminal);
}
message(LOG | CONSOLE, "Bummer, can't open %s", a->terminal);
_exit(1);
}
@@ -482,6 +484,7 @@ static pid_t run(const struct init_action *a)
/* If the init Action requires us to wait, then force the
* supplied terminal to be the controlling tty. */
if (a->action & (SYSINIT | WAIT | CTRLALTDEL | SHUTDOWN | RESTART)) {
pid_t pgrp, tmp_pid;
/* Now fork off another process to just hang around */
if ((pid = fork()) < 0) {
@@ -693,6 +696,7 @@ static void shutdown_system(void)
/* first disable all our signals */
sigemptyset(&block_signals);
sigaddset(&block_signals, SIGHUP);
sigaddset(&block_signals, SIGQUIT);
sigaddset(&block_signals, SIGCHLD);
sigaddset(&block_signals, SIGUSR1);
sigaddset(&block_signals, SIGUSR2);
@@ -730,13 +734,12 @@ static void exec_signal(int sig)
for (a = init_action_list; a; a = tmp) {
tmp = a->next;
if (a->action & RESTART) {
struct stat sb;
shutdown_system();
/* unblock all signals, blocked in shutdown_system() */
sigemptyset(&unblock_signals);
sigaddset(&unblock_signals, SIGHUP);
sigaddset(&unblock_signals, SIGQUIT);
sigaddset(&unblock_signals, SIGCHLD);
sigaddset(&unblock_signals, SIGUSR1);
sigaddset(&unblock_signals, SIGUSR2);
@@ -754,6 +757,7 @@ static void exec_signal(int sig)
/* Open the new terminal device */
if ((device_open(a->terminal, O_RDWR)) < 0) {
struct stat sb;
if (stat(a->terminal, &sb) != 0) {
message(LOG | CONSOLE, "device '%s' does not exist.", a->terminal);
} else {
@@ -907,6 +911,7 @@ static void delete_init_action(struct init_action *action)
}
}
#ifdef CONFIG_FEATURE_INIT_SWAPON
/* Make sure there is enough memory to do something useful. *
* Calls "swapon -a" if needed so be sure /etc/fstab is present... */
static void check_memory(void)
@@ -934,6 +939,9 @@ static void check_memory(void)
message(CONSOLE, "Sorry, your computer does not have enough memory.");
loop_forever();
}
#else
# define check_memory()
#endif /* CONFIG_FEATURE_INIT_SWAPON */
/* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined,
* then parse_inittab() simply adds in some default
@@ -1097,6 +1105,7 @@ extern int init_main(int argc, char **argv)
/* Set up sig handlers -- be sure to
* clear all of these in run() */
signal(SIGHUP, exec_signal);
signal(SIGQUIT, exec_signal);
signal(SIGUSR1, halt_signal);
signal(SIGUSR2, halt_signal);
signal(SIGINT, ctrlaltdel_signal);
-1
View File
@@ -1 +0,0 @@
loop.h
+2 -2
View File
@@ -53,7 +53,7 @@ LIBBB_OBJS=$(patsubst %.c,$(LIBBB_DIR)%.o, $(LIBBB_SRC))
LIBBB_MSRC0:=$(srcdir)/messages.c
LIBBB_MOBJ0:=full_version.o \
memory_exhausted.o invalid_date.o io_error.o \
write_error.o name_longer_than_foo.o unknown.o \
read_error.o write_error.o name_longer_than_foo.o unknown.o \
can_not_create_raw_socket.o perm_denied_are_you_root.o \
shadow_file.o passwd_file.o group_file.o gshadow_file.o nologin_file.o \
securetty_file.o motd_file.o \
@@ -84,7 +84,7 @@ libraries-y+=$(LIBBB_DIR)$(LIBBB_AR)
$(LIBBB_DIR)$(LIBBB_AR): $(LIBBB_OBJS) $(LIBBB_MOBJS0) $(LIBBB_MOBJS1) \
$(LIBBB_MOBJS2) $(LIBBB_MOBJS3) $(LIBBB_MOBJS4)
$(AR) -ro $@ $(LIBBB_OBJS) $(LIBBB_MOBJS0) $(LIBBB_MOBJS1) \
$(AR) $(ARFLAGS) $@ $(LIBBB_OBJS) $(LIBBB_MOBJS0) $(LIBBB_MOBJS1) \
$(LIBBB_MOBJS2) $(LIBBB_MOBJS3) $(LIBBB_MOBJS4)
$(LIBBB_DIR)%.o: $(srcdir)/%.c
+2 -2
View File
@@ -34,11 +34,11 @@ extern char *concat_path_file(const char *path, const char *filename)
char *lc;
if (!path)
path="";
path = "";
lc = last_char_is(path, '/');
while (*filename == '/')
filename++;
bb_xasprintf(&outbuf, "%s%s%s", path, (lc==NULL)? "/" : "", filename);
bb_xasprintf(&outbuf, "%s%s%s", path, (lc==NULL ? "/" : ""), filename);
return outbuf;
}
+8 -4
View File
@@ -146,7 +146,7 @@ int copy_file(const char *source, const char *dest, int flags)
if (dest_exists) {
if (flags & FILEUTILS_INTERACTIVE) {
bb_error_msg("overwrite `%s'? ", dest);
fprintf(stderr, "%s: overwrite `%s'? ", bb_applet_name, dest);
if (!bb_ask_confirmation()) {
close (src_fd);
return 0;
@@ -197,12 +197,16 @@ int copy_file(const char *source, const char *dest, int flags)
S_ISSOCK(source_stat.st_mode) || S_ISFIFO(source_stat.st_mode) ||
S_ISLNK(source_stat.st_mode)) {
if (dest_exists &&
((flags & FILEUTILS_FORCE) == 0 || unlink(dest) < 0)) {
if (dest_exists) {
if((flags & FILEUTILS_FORCE) == 0) {
fprintf(stderr, "`%s' exists\n", dest);
return -1;
}
if(unlink(dest) < 0) {
bb_perror_msg("unable to remove `%s'", dest);
return -1;
}
}
} else {
bb_error_msg("internal error: unrecognized file type");
return -1;
+46 -32
View File
@@ -2,7 +2,7 @@
/*
* Utility routines.
*
* Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
* Copyright (C) 1999-2005 by Erik Andersen <andersen@codepoet.org>
*
* 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
@@ -25,6 +25,7 @@
#include <unistd.h>
#include "busybox.h"
#include "libbb.h"
#if BUFSIZ < 4096
@@ -33,46 +34,59 @@
#endif
/* If size is 0 copy until EOF */
static size_t bb_full_fd_action(int src_fd, int dst_fd, const size_t size)
static size_t bb_full_fd_action(int src_fd, int dst_fd, const size_t size2)
{
size_t read_total = 0;
RESERVE_CONFIG_BUFFER(buffer,BUFSIZ);
int status;
size_t xread, wrote, total, size = size2;
while ((size == 0) || (read_total < size)) {
size_t read_try;
ssize_t read_actual;
if (src_fd < 0) {
return -1;
}
if ((size == 0) || (size - read_total > BUFSIZ)) {
read_try = BUFSIZ;
} else {
read_try = size - read_total;
}
if (size == 0) {
/* If size is 0 copy until EOF */
size = ULONG_MAX;
}
read_actual = safe_read(src_fd, buffer, read_try);
if (read_actual > 0) {
if ((dst_fd >= 0) && (bb_full_write(dst_fd, buffer, (size_t) read_actual) != read_actual)) {
bb_perror_msg(bb_msg_write_error); /* match Read error below */
{
RESERVE_CONFIG_BUFFER(buffer,BUFSIZ);
total = 0;
wrote = 0;
status = -1;
while (total < size)
{
xread = BUFSIZ;
if (size < (total + BUFSIZ))
xread = size - total;
xread = bb_full_read(src_fd, buffer, xread);
if (xread > 0) {
if (dst_fd < 0) {
/* A -1 dst_fd means we need to fake it... */
wrote = xread;
} else {
wrote = bb_full_write(dst_fd, buffer, xread);
}
if (wrote < xread) {
bb_perror_msg(bb_msg_write_error);
break;
}
total += wrote;
} else if (xread < 0) {
bb_perror_msg(bb_msg_read_error);
break;
} else if (xread == 0) {
/* All done. */
status = 0;
break;
}
}
else if (read_actual == 0) {
if (size) {
bb_error_msg("Unable to read all data");
}
break;
} else {
/* read_actual < 0 */
bb_perror_msg("Read error");
break;
}
read_total += read_actual;
RELEASE_CONFIG_BUFFER(buffer);
}
RELEASE_CONFIG_BUFFER(buffer);
return(read_total);
if (status == 0 || total)
return total;
/* Some sortof error occured */
return -1;
}
+2 -5
View File
@@ -45,11 +45,8 @@ extern long* find_pid_by_name( const char* pidName)
procps_status_t * p;
pidList = xmalloc(sizeof(long));
#ifdef CONFIG_SELINUX
while ((p = procps_scan(0, 0, NULL)) != 0) {
#else
while ((p = procps_scan(0)) != 0) {
#endif
while ((p = procps_scan(0)) != 0)
{
if (strncmp(p->short_cmd, pidName, COMM_LEN-1) == 0) {
pidList=xrealloc( pidList, sizeof(long) * (i+2));
pidList[i++]=p->pid;
+238 -114
View File
@@ -26,146 +26,270 @@
#include <stdlib.h>
#include "libbb.h"
/*
You can set bb_opt_complementaly as string with one or more
complementaly or incongruously options.
If sequential founded option haved from this string
then your incongruously pairs unsets and complementaly make add sets.
Format:
one char - option for check,
chars - complementaly option for add sets.
- chars - option triggered for unsets.
~ chars - option incongruously.
* - option list, called add_to_list(*ptr_from_usaged, optarg)
: - separator.
Example: du applet can have options "-s" and "-d size"
If getopt found -s then -d option flag unset or if found -d then -s unset.
For this result you must set bb_opt_complementaly = "s-d:d-s".
Result have last option flag only from called arguments.
Warning! You can check returned flag, pointer to "d:" argument seted
to own optarg always.
Example two: cut applet must only one type of list may be specified,
and -b, -c and -f incongruously option, overwited option is error also.
You must set bb_opt_complementaly = "b~cf:c~bf:f~bc".
If called have more one specified, return value have error flag -
high bite set (0x80000000UL).
Example three: grep applet can have one or more "-e pattern" arguments.
You should use bb_getopt_ulflags() as
llist_t *paterns;
bb_opt_complementaly = "e*";
bb_getopt_ulflags (argc, argv, "e:", &paterns);
/* Documentation !
unsigned long
bb_getopt_ulflags (int argc, char **argv, const char *applet_opts, ...)
The command line options must be declared in const char
*applet_opts as a string of chars, for example:
flags = bb_getopt_ulflags(argc, argv, "rnug");
If one of the given options is found, a flag value is added to
the return value (an unsigned long).
The flag value is determined by the position of the char in
applet_opts string. For example, in the above case:
flags = bb_getopt_ulflags(argc, argv, "rnug");
"r" will add 1 (bit 1 : 0x01)
"n" will add 2 (bit 2 : 0x02)
"u will add 4 (bit 3 : 0x03)
"g" will add 8 (bit 4 : 0x04)
and so on. You can also look at the return value as a bit
field and each option sets one of bits.
":" If one of the options requires an argument, then add a ":"
after the char in applet_opts and provide a pointer to store
the argument. For example:
char *pointer_to_arg_for_a;
char *pointer_to_arg_for_b;
char *pointer_to_arg_for_c;
char *pointer_to_arg_for_d;
flags = bb_getopt_ulflags(argc, argv, "a:b:c:d:",
&pointer_to_arg_for_a, &pointer_to_arg_for_b,
&pointer_to_arg_for_c, &pointer_to_arg_for_d);
The type of the pointer (char* or llist_t *) may be controlled
by the "*" special character that is set in the external string
bb_opt_complementaly (see below for more info).
static const struct option bb_default_long_options[]
This struct allows you to define long options. The syntax for
declaring the array is just like that of getopt's longopts.
static const struct option applet_long_options[] = {
{ "verbose", 0, 0, "v" },
{ 0, 0, 0, 0 }
};
bb_applet_long_options = applet_long_options;
The first parameter is the long option name that you would pass
to the applet (without the dashes).
The second field determines whether the option has an argument.
You can set this to 0, 1, or 2, or you can use the long named
defines of no_argument, required_argument, and optional_argument.
The third argument is used only when the long option does not
have a corresponding short option. In that case, it should be
an integer pointer. Otherwise (and normally), it should just
bet set to NULL.
The last argument is the corresponding short option (if there
is one of course).
Note: a good applet will make long options configurable via the
config process and not a required feature. The current standard
is to name the config option CONFIG_FEATURE_<applet>_LONG_OPTIONS.
const char *bb_opt_complementaly
":" The colon (":") is used to separate groups of two or more chars
and/or groups of chars and special characters (stating some
conditions to be checked).
"abc" If groups of two or more chars are specified, the first char
is the main option and the other chars are secondary options.
Their flags will be turned on if the main option is found even
if they are not specifed on the command line. For example:
bb_opt_complementaly = "abc";
flags = bb_getopt_ulflags(argc, argv, "abcd")
If getopt() finds "-a" on the command line, then
bb_getopt_ulflags's return value will be as if "-a -b -c" were
found.
Special characters:
"-" A dash between two options causes the second of the two
to be unset (and ignored) if it is given on the command line.
For example:
The du applet has the options "-s" and "-d depth". If
bb_getopt_ulflags finds -s, then -d is unset or if it finds -d
then -s is unset. (Note: busybox implements the GNU
"--max-depth" option as "-d".) To obtain this behavior, you
set bb_opt_complementaly = "s-d:d-s". Only one flag value is
added to bb_getopt_ulflags's return value depending on the
position of the options on the command line. If one of the
two options requires an argument pointer (":" in applet_opts
as in "d:") optarg is set accordingly.
char *smax_print_depth;
bb_opt_complementaly = "s-d:d-s";
opt = bb_getopt_ulflags(argc, argv, "sd:", &smax_print_depth);
if (opt & 2) {
max_print_depth = bb_xgetularg10_bnd(smax_print_depth,
0, INT_MAX);
}
"~" A tilde between two options, or between an option and a group
of options, means that they are mutually exclusive. Unlike
the "-" case above, an error will be forced if the options
are used together.
For example:
The cut applet must have only one type of list specified, so
-b, -c and -f are mutally exclusive and should raise an error
if specified together. In this case you must set
bb_opt_complementaly = "b~cf:c~bf:f~bc". If two of the
mutually exclusive options are found, bb_getopt_ulflags's
return value will have the error flag set (BB_GETOPT_ERROR) so
that we can check for it:
if (flags & BB_GETOPT_ERROR)
bb_show_usage();
"*" A star after a char in bb_opt_complementaly means that the
option can occur multiple times:
For example:
The grep applet can have one or more "-e pattern" arguments.
In this case you should use bb_getopt_ulflags() as follows:
llist_t *patterns = NULL;
(this pointer must be initializated to NULL if the list is empty
as required by *llist_add_to(llist_t *old_head, char *new_item).)
bb_opt_complementaly = "e*";
bb_getopt_ulflags(argc, argv, "e:", &patterns);
$ grep -e user -e root /etc/passwd
root:x:0:0:root:/root:/bin/bash
user:x:500:500::/home/user:/bin/bash
*/
const char *bb_opt_complementaly;
typedef struct
{
typedef struct {
unsigned char opt;
char list_flg;
unsigned long switch_on;
unsigned long switch_off;
unsigned long incongruously;
void **optarg; /* char **optarg or llist_t **optarg */
void **optarg; /* char **optarg or llist_t **optarg */
} t_complementaly;
/* You can set bb_applet_long_options for parse called long options */
static const struct option bb_default_long_options[] = {
/* { "help", 0, NULL, '?' }, */
/* { "help", 0, NULL, '?' }, */
{ 0, 0, 0, 0 }
};
const struct option *bb_applet_long_options = bb_default_long_options;
unsigned long
bb_getopt_ulflags (int argc, char **argv, const char *applet_opts, ...)
{
unsigned long flags = 0;
t_complementaly complementaly[sizeof(flags) * 8 + 1];
int c;
const unsigned char *s;
t_complementaly *on_off;
va_list p;
unsigned long flags = 0;
t_complementaly complementaly[sizeof(flags) * 8 + 1];
int c;
const unsigned char *s;
t_complementaly *on_off;
va_list p;
va_start (p, applet_opts);
va_start (p, applet_opts);
/* skip GNU extension */
s = applet_opts;
if(*s == '+' || *s == '-')
s++;
c = 0;
on_off = complementaly;
for (; *s; s++) {
if(c >= (sizeof(flags)*8))
break;
on_off->opt = *s;
on_off->switch_on = (1 << c);
on_off->list_flg = 0;
on_off->switch_off = 0;
on_off->incongruously = 0;
on_off->optarg = NULL;
if (s[1] == ':') {
on_off->optarg = va_arg (p, void **);
do
/* skip GNU extension */
s = applet_opts;
if(*s == '+' || *s == '-')
s++;
while (s[1] == ':');
}
on_off++;
c++;
}
on_off->opt = 0;
c = 0;
for (s = bb_opt_complementaly; s && *s; s++) {
t_complementaly *pair;
if (*s == ':') {
c = 0;
continue;
}
if (c)
continue;
for (on_off = complementaly; on_off->opt; on_off++)
if (on_off->opt == *s)
break;
pair = on_off;
for(s++; *s && *s != ':'; s++) {
if (*s == '-' || *s == '~') {
c = *s;
} else if(*s == '*') {
pair->list_flg++;
} else {
unsigned long *pair_switch = &(pair->switch_on);
if(c)
pair_switch = c == '-' ? &(pair->switch_off) : &(pair->incongruously);
for (on_off = complementaly; on_off->opt; on_off++)
if (on_off->opt == *s) {
*pair_switch |= on_off->switch_on;
break;
}
}
}
s--;
}
while ((c = getopt_long (argc, argv, applet_opts,
bb_applet_long_options, NULL)) > 0) {
for (on_off = complementaly; on_off->opt != c; on_off++) {
if(!on_off->opt)
bb_show_usage ();
c = 0;
on_off = complementaly;
for (; *s; s++) {
if(c >= (sizeof(flags)*8))
break;
on_off->opt = *s;
on_off->switch_on = (1 << c);
on_off->list_flg = 0;
on_off->switch_off = 0;
on_off->incongruously = 0;
on_off->optarg = NULL;
if (s[1] == ':') {
on_off->optarg = va_arg (p, void **);
do
s++;
while (s[1] == ':');
}
on_off++;
c++;
}
if(flags & on_off->incongruously)
flags |= 0x80000000UL;
flags &= ~on_off->switch_off;
flags |= on_off->switch_on;
if(on_off->list_flg) {
*(llist_t **)(on_off->optarg) =
llist_add_to(*(llist_t **)(on_off->optarg), optarg);
} else if (on_off->optarg) {
*(char **)(on_off->optarg) = optarg;
on_off->opt = 0;
c = 0;
for (s = bb_opt_complementaly; s && *s; s++) {
t_complementaly *pair;
if (*s == ':') {
c = 0;
continue;
}
if (c)
continue;
for (on_off = complementaly; on_off->opt; on_off++)
if (on_off->opt == *s)
break;
pair = on_off;
for(s++; *s && *s != ':'; s++) {
if (*s == '-' || *s == '~') {
c = *s;
} else if(*s == '*') {
pair->list_flg++;
} else {
unsigned long *pair_switch = &(pair->switch_on);
if(c)
pair_switch = c == '-' ? &(pair->switch_off) : &(pair->incongruously);
for (on_off = complementaly; on_off->opt; on_off++)
if (on_off->opt == *s) {
*pair_switch |= on_off->switch_on;
break;
}
}
}
s--;
}
}
return flags;
while ((c = getopt_long (argc, argv, applet_opts,
bb_applet_long_options, NULL)) > 0) {
for (on_off = complementaly; on_off->opt != c; on_off++) {
if(!on_off->opt)
bb_show_usage ();
}
if(flags & on_off->incongruously)
flags |= BB_GETOPT_ERROR;
flags &= ~on_off->switch_off;
flags |= on_off->switch_on;
if(on_off->list_flg) {
*(llist_t **)(on_off->optarg) =
llist_add_to(*(llist_t **)(on_off->optarg), optarg);
} else if (on_off->optarg) {
*(char **)(on_off->optarg) = optarg;
}
}
return flags;
}
+23 -11
View File
@@ -888,6 +888,20 @@ static int sockets_open(int family)
return sfd;
}
#ifdef CONFIG_FEATURE_CLEAN_UP
static void sockets_close(void)
{
struct aftype **aft;
for (aft = aftypes; *aft != NULL; aft++) {
struct aftype *af = *aft;
if( af->fd != -1 ) {
close(af->fd);
af->fd = -1;
}
}
}
#endif
/* like strcmp(), but knows about numbers */
static int nstrcmp(const char *a, const char *b)
{
@@ -1223,17 +1237,13 @@ static int if_fetch(struct interface *ife)
}
#endif
#ifdef SIOCGIFMAP
strcpy(ifr.ifr_name, ifname);
if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0)
memset(&ife->map, 0, sizeof(struct ifmap));
else
memcpy(&ife->map, &ifr.ifr_map, sizeof(struct ifmap));
strcpy(ifr.ifr_name, ifname);
if (ioctl(skfd, SIOCGIFMAP, &ifr) < 0)
memset(&ife->map, 0, sizeof(struct ifmap));
else
if (ioctl(skfd, SIOCGIFMAP, &ifr) == 0)
ife->map = ifr.ifr_map;
else
#endif
memset(&ife->map, 0, sizeof(struct ifmap));
#ifdef HAVE_TXQUEUELEN
strcpy(ifr.ifr_name, ifname);
@@ -1374,7 +1384,7 @@ static struct hwtype loop_hwtype = {
#if HAVE_HWETHER
#include <net/if_arp.h>
#if __GLIBC__ >=2 && __GLIBC_MINOR >= 1
#if (__GLIBC__ >=2 && __GLIBC_MINOR >= 1) || defined(_NEWLIB_VERSION)
#include <net/ethernet.h>
#else
#include <linux/if_ether.h>
@@ -2078,6 +2088,8 @@ int display_interfaces(char *ifname)
/* Do we have to show the current setup? */
status = if_print(ifname);
close(skfd);
#ifdef CONFIG_FEATURE_CLEAN_UP
sockets_close();
#endif
exit(status < 0);
}
Loaded 100 of 192 files, more files were not shown because too many files have changed in this diff. Show more