Edward Betts <edward@debian.org>
expr, hostid, logname, whoami
-
+
John Beppu <beppu@codepoet.org>
du, nslookup, sort
Randolph Chung <tausq@debian.org>
fbset, ping, hostname
-Dave Cinege <dcinege@psychosis.com>
- more(v2), makedevs, dutmp, modularization, auto links file,
+Dave Cinege <dcinege@psychosis.com>
+ more(v2), makedevs, dutmp, modularization, auto links file,
various fixes, Linux Router Project maintenance
Jordan Crouse <jordan@cosmicpenguin.net>
Stephan Linz <linz@li-pro.net>
ipcalc, Red Hat equivalence
-John Lombardo <john@deltanet.com>
+John Lombardo <john@deltanet.com>
tr
Glenn McGrath <bug1@optushome.com.au>
and irreconcilable critic of everything not perfect.
Bruce Perens <bruce@pixar.com>
- Original author of BusyBox in 1995, 1996. Some of his code can
+ Original author of BusyBox in 1995, 1996. Some of his code can
still be found hiding here and there...
Tim Riker <Tim@Rikers.org>
---------------------
-PatchSet 3926
+PatchSet 3926
Date: 2004/02/09 10:01:01
Author: andersen
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Buffalo appears to have resolved their GPL problems
-Members:
- docs/busybox.net/products.html:1.5->1.6
- docs/busybox.net/shame.html:1.7->1.8
+Members:
+ docs/busybox.net/products.html:1.5->1.6
+ docs/busybox.net/shame.html:1.7->1.8
---------------------
-PatchSet 3927
+PatchSet 3927
Date: 2004/02/09 10:57:04
Author: andersen
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Update URL
-Members:
- docs/busybox.net/products.html:1.6->1.7
+Members:
+ docs/busybox.net/products.html:1.6->1.7
---------------------
-PatchSet 3928
+PatchSet 3928
Date: 2004/02/10 01:07:45
Author: andersen
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Support disabling pipe and redirect support
-Members:
- shell/lash.c:1.151->1.152
+Members:
+ shell/lash.c:1.151->1.152
---------------------
-PatchSet 3929
+PatchSet 3929
Date: 2004/02/10 01:28:36
Author: andersen
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Initial effort at disabling job control as well
-Members:
- shell/lash.c:1.152->1.153
+Members:
+ shell/lash.c:1.152->1.153
---------------------
-PatchSet 3930
+PatchSet 3930
Date: 2004/02/10 01:30:21
Author: andersen
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
oops. Leave the default feature set enbled for now...
-Members:
- shell/lash.c:1.153->1.154
+Members:
+ shell/lash.c:1.153->1.154
---------------------
-PatchSet 3931
+PatchSet 3931
Date: 2004/02/13 08:09:43
Author: andersen
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Accomodate the fact that newer libc versions may in fact not
contain query_module and friends and more
-Members:
- libbb/module_syscalls.c:1.13->1.14
+Members:
+ libbb/module_syscalls.c:1.13->1.14
---------------------
-PatchSet 3932
+PatchSet 3932
Date: 2004/02/14 21:33:39
Author: andersen
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Avoid naming conflict with symbol in newer glibc headers
-Members:
- miscutils/hdparm.c:1.9->1.10
+Members:
+ miscutils/hdparm.c:1.9->1.10
---------------------
-PatchSet 3933
+PatchSet 3933
Date: 2004/02/17 07:51:31
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
define option names to be clearer, simplify nested if statements, remove
un-needed if statement, minor indenting change
-Members:
- coreutils/date.c:1.41->1.42
+Members:
+ coreutils/date.c:1.41->1.42
---------------------
-PatchSet 3934
+PatchSet 3934
Date: 2004/02/17 07:58:04
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Woops, im getting ahead of myself, we dont have the -r (refernece)
option yet
-Members:
- coreutils/date.c:1.42->1.43
+Members:
+ coreutils/date.c:1.42->1.43
---------------------
-PatchSet 3935
+PatchSet 3935
Date: 2004/02/17 10:16:21
Author: mjn3
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Patch from Florian Schirmer <jolt@tuxbox.org>. When I rewrote the parser,
I overlooked the case of someone wanting to use a valid but empty suid
config file.
-Members:
- applets/applets.c:1.21->1.22
+Members:
+ applets/applets.c:1.21->1.22
---------------------
-PatchSet 3936
+PatchSet 3936
Date: 2004/02/17 11:55:06
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Dont strip trailing '/' until _after_ i test to set if its there !
-Members:
- archival/libunarchive/get_header_tar.c:1.30->1.31
+Members:
+ archival/libunarchive/get_header_tar.c:1.30->1.31
---------------------
-PatchSet 3937
+PatchSet 3937
Date: 2004/02/17 12:04:13
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Remove debugging
-Members:
- archival/libunarchive/get_header_tar.c:1.31->1.32
+Members:
+ archival/libunarchive/get_header_tar.c:1.31->1.32
---------------------
-PatchSet 3938
+PatchSet 3938
Date: 2004/02/17 12:22:21
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Add the -r option, patch from Rob with some help from myself.
-Members:
- coreutils/date.c:1.43->1.44
+Members:
+ coreutils/date.c:1.43->1.44
---------------------
-PatchSet 3939
+PatchSet 3939
Date: 2004/02/17 20:04:34
Author: andersen
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Mark Lord writes:
Mark Lord
Real-Time Remedies Inc.
-Members:
- networking/inetd.c:1.14->1.15
+Members:
+ networking/inetd.c:1.14->1.15
---------------------
-PatchSet 3940
+PatchSet 3940
Date: 2004/02/17 20:08:11
Author: andersen
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Remove the unused CONFIG_FEATURE_HTTPD_SET_CGI_VARS_TO_ENV option.
-Members:
- networking/Config.in:1.25->1.26
+Members:
+ networking/Config.in:1.25->1.26
---------------------
-PatchSet 3941
+PatchSet 3941
Date: 2004/02/18 09:40:41
Author: mjn3
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Fix vstype[] to match VS* defines. Patch from OpenWrt by mbm.
-Members:
- shell/ash.c:1.89->1.90
+Members:
+ shell/ash.c:1.89->1.90
---------------------
-PatchSet 3942
+PatchSet 3942
Date: 2004/02/18 09:54:15
Author: landley
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Add -i option to sed, to edit files in-place.
-Members:
- editors/sed.c:1.159->1.160
+Members:
+ editors/sed.c:1.159->1.160
---------------------
-PatchSet 3943
+PatchSet 3943
Date: 2004/02/18 10:14:17
Author: mjn3
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Patch from OpenWrt.
-Members:
- modutils/insmod.c:1.111->1.112
+Members:
+ modutils/insmod.c:1.111->1.112
---------------------
-PatchSet 3944
+PatchSet 3944
Date: 2004/02/18 12:58:00
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
remove debugging
-Members:
- networking/inetd.c:1.15->1.16
+Members:
+ networking/inetd.c:1.15->1.16
---------------------
-PatchSet 3945
+PatchSet 3945
Date: 2004/02/18 13:12:53
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Formatting
-Members:
- networking/inetd.c:1.16->1.17
+Members:
+ networking/inetd.c:1.16->1.17
---------------------
-PatchSet 3946
+PatchSet 3946
Date: 2004/02/18 13:19:58
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Dont use same variable and struct name
-Members:
- networking/inetd.c:1.17->1.18
+Members:
+ networking/inetd.c:1.17->1.18
---------------------
-PatchSet 3947
+PatchSet 3947
Date: 2004/02/19 00:44:08
Author: andersen
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Chris Larson (kergoth) writes:
Coreutils cp on the other hand will error with "cannot copy a directory,
`out', into itself, `out'". Patch attached.
-Members:
- libbb/copy_file.c:1.28->1.29
+Members:
+ libbb/copy_file.c:1.28->1.29
---------------------
-PatchSet 3948
+PatchSet 3948
Date: 2004/02/19 01:52:29
Author: andersen
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Chris Larson (kergoth) writes:
Attached what appears to be a more sane fix. Apply on top of previous.
Please confirm sanity.
-Members:
- libbb/copy_file.c:1.29->1.30
+Members:
+ libbb/copy_file.c:1.29->1.30
---------------------
-PatchSet 3949
+PatchSet 3949
Date: 2004/02/19 08:48:30
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Add extra comments, freakout if a pax archive is encoutered.
-Members:
- archival/libunarchive/get_header_tar.c:1.32->1.33
+Members:
+ archival/libunarchive/get_header_tar.c:1.32->1.33
---------------------
-PatchSet 3950
+PatchSet 3950
Date: 2004/02/20 02:25:18
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
A strict interpretation of the ustar format requires the type flag to be
interpreted, we cannot depend on the file type being set in the mode
field.
-Members:
- archival/libunarchive/get_header_tar.c:1.33->1.34
+Members:
+ archival/libunarchive/get_header_tar.c:1.33->1.34
---------------------
-PatchSet 3951
+PatchSet 3951
Date: 2004/02/20 02:34:42
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Fix up hard links
-Members:
- archival/libunarchive/get_header_tar.c:1.34->1.35
+Members:
+ archival/libunarchive/get_header_tar.c:1.34->1.35
---------------------
-PatchSet 3952
+PatchSet 3952
Date: 2004/02/20 09:55:37
Author: andersen
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Document missing cp options
-Members:
- include/usage.h:1.187->1.188
+Members:
+ include/usage.h:1.187->1.188
---------------------
-PatchSet 3953
+PatchSet 3953
Date: 2004/02/21 07:49:54
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Use return instead of exit, use == instead of & ==, left justify labels,
adjustment of whitespace.
-Members:
- coreutils/mv.c:1.19->1.20
+Members:
+ coreutils/mv.c:1.19->1.20
---------------------
-PatchSet 3954
+PatchSet 3954
Date: 2004/02/21 09:20:56
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Sometimes i get carried away with the use of function pointers, im sure
it seemed like a good idea at the time.
-Members:
- archival/libunarchive/seek_by_char.c:1.3->1.4
- include/libbb.h:1.126->1.127
- libbb/copyfd.c:1.9->1.10
+Members:
+ archival/libunarchive/seek_by_char.c:1.3->1.4
+ include/libbb.h:1.126->1.127
+ libbb/copyfd.c:1.9->1.10
---------------------
-PatchSet 3955
+PatchSet 3955
Date: 2004/02/22 00:27:34
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
No need to check proxy env variable twice, ignore proxy env variable if
its set to 0
-Members:
- networking/wget.c:1.68->1.69
+Members:
+ networking/wget.c:1.68->1.69
---------------------
-PatchSet 3956
+PatchSet 3956
Date: 2004/02/22 02:58:57
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Return 1 upon failure
-Members:
- coreutils/md5_sha1_sum.c:1.4->1.5
+Members:
+ coreutils/md5_sha1_sum.c:1.4->1.5
---------------------
-PatchSet 3957
+PatchSet 3957
Date: 2004/02/22 03:33:53
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Ptch by Hideki IWAMOTO, fix a bug preventing tftp from getting or
putting more than 0xffff blocks.
-Members:
- networking/tftp.c:1.21->1.22
+Members:
+ networking/tftp.c:1.21->1.22
---------------------
-PatchSet 3958
+PatchSet 3958
Date: 2004/02/22 04:12:58
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Update usage for ftpget and ftpput
-Members:
- include/usage.h:1.188->1.189
+Members:
+ include/usage.h:1.188->1.189
---------------------
-PatchSet 3959
+PatchSet 3959
Date: 2004/02/22 04:17:26
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Thomas Geulig, remove duplicate header
-Members:
- init/init_shared.c:1.3->1.4
+Members:
+ init/init_shared.c:1.3->1.4
---------------------
-PatchSet 3960
+PatchSet 3960
Date: 2004/02/22 04:44:21
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Fixup braces (patch from Thomas Geulig), run through indent and manually
adjust.
-Members:
- miscutils/crond.c:1.12->1.13
+Members:
+ miscutils/crond.c:1.12->1.13
---------------------
-PatchSet 3961
+PatchSet 3961
Date: 2004/02/22 04:58:36
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
remove duplicate header declarations
-Members:
- networking/inetd.c:1.18->1.19
+Members:
+ networking/inetd.c:1.18->1.19
---------------------
-PatchSet 3962
+PatchSet 3962
Date: 2004/02/22 07:20:25
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Patch from Hideki IWAMOTO, output debugging messages to stderr
-Members:
- networking/tftp.c:1.22->1.23
+Members:
+ networking/tftp.c:1.22->1.23
---------------------
-PatchSet 3963
+PatchSet 3963
Date: 2004/02/22 07:38:36
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Patch from Florian Schirmer. compile fix for debug builds
-Members:
- miscutils/devfsd.c:1.7->1.8
+Members:
+ miscutils/devfsd.c:1.7->1.8
---------------------
-PatchSet 3964
+PatchSet 3964
Date: 2004/02/22 08:33:37
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Use /var/lib/hwclock for adjtime, its really a state file rather than a
config file, so it should be in /etc, FHS mentions it also.
-Members:
- util-linux/hwclock.c:1.6->1.7
+Members:
+ util-linux/hwclock.c:1.6->1.7
---------------------
-PatchSet 3965
+PatchSet 3965
Date: 2004/02/22 09:11:33
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Use bb_getopt_ulflags, marginal saving, better argument checking.
-Members:
- util-linux/hwclock.c:1.7->1.8
+Members:
+ util-linux/hwclock.c:1.7->1.8
---------------------
-PatchSet 3966
+PatchSet 3966
Date: 2004/02/22 09:45:57
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Patch from James Zhu, telnetd window resizing support.
-Members:
- networking/telnetd.c:1.9->1.10
+Members:
+ networking/telnetd.c:1.9->1.10
---------------------
-PatchSet 3967
+PatchSet 3967
Date: 2004/02/22 11:13:28
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Vodz. last_patch_128
- declare applet_using as static from applets.c
previous version cleared history after Ctrl-C
- small spelling correction (by Friedrich Lobenstock)
-Members:
- applets/applets.c:1.22->1.23
- shell/cmdedit.c:1.88->1.89
+Members:
+ applets/applets.c:1.22->1.23
+ shell/cmdedit.c:1.88->1.89
---------------------
-PatchSet 3968
+PatchSet 3968
Date: 2004/02/22 11:25:13
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Patch from Vodz, cleanup memory usage, send strdup error messages to
syslog.
-Members:
- networking/inetd.c:1.19->1.20
+Members:
+ networking/inetd.c:1.19->1.20
---------------------
-PatchSet 3969
+PatchSet 3969
Date: 2004/02/22 11:35:13
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Patch from Chris Larson (kergoth), to allow multiple directores to be
unmounted at once.
-Members:
- docs/busybox.sgml:1.52->1.53
- util-linux/umount.c:1.62->1.63
+Members:
+ docs/busybox.sgml:1.52->1.53
+ util-linux/umount.c:1.62->1.63
---------------------
-PatchSet 3970
+PatchSet 3970
Date: 2004/02/22 11:46:49
Author: andersen
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
For the time being, revert the changes for detecting copying
a directory into itself. It is harder to do this correctly
than it appears. Not trying at all seems a better compromise
for the time being, untill we can implement this correctly.
-Members:
- libbb/copy_file.c:1.30->1.31
+Members:
+ libbb/copy_file.c:1.30->1.31
---------------------
-PatchSet 3971
+PatchSet 3971
Date: 2004/02/22 11:55:09
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Patch from Dmitry Zakharov, this line was missedfrom the last patch
-Members:
- editors/awk.c:1.5->1.6
+Members:
+ editors/awk.c:1.5->1.6
---------------------
-PatchSet 3972
+PatchSet 3972
Date: 2004/02/22 12:17:33
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Fix from Paul Kortekaas for syslog -C option, size should be in kB.
-Members:
- sysklogd/syslogd.c:1.106->1.107
+Members:
+ sysklogd/syslogd.c:1.106->1.107
---------------------
-PatchSet 3973
+PatchSet 3973
Date: 2004/02/22 12:25:47
Author: andersen
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Fernando Silveira writes:
Thanks a lot!
-Members:
- include/usage.h:1.189->1.190
- networking/Config.in:1.26->1.27
- networking/telnet.c:1.41->1.42
+Members:
+ include/usage.h:1.189->1.190
+ networking/Config.in:1.26->1.27
+ networking/telnet.c:1.41->1.42
---------------------
-PatchSet 3974
+PatchSet 3974
Date: 2004/02/22 12:27:04
Author: andersen
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
Bump up version in preparation for -pre8
-Members:
- Rules.mak:1.27->1.28
+Members:
+ Rules.mak:1.27->1.28
---------------------
-PatchSet 3975
+PatchSet 3975
Date: 2004/02/23 08:11:07
Author: bug1
Branch: HEAD
-Tag: (none)
+Tag: (none)
Log:
bb_full_fd_action was incorrectly returning an error message causing
major breaking.
-Members:
- libbb/copyfd.c:1.10->1.11
+Members:
+ libbb/copyfd.c:1.10->1.11
-1) Run 'make config' or 'make menuconfig' and select the
+1) Run 'make config' or 'make menuconfig' and select the
functionality that you wish to enable.
2) Run 'make dep'
-3) Check the Makefile for any Makefile setting you wish
- to adjust for your system (things like like setting
+3) Check the Makefile for any Makefile setting you wish
+ to adjust for your system (things like like setting
your cross compiler, adjusting optimizations, etc)
4) Run 'make'
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
docs/busybox.net/BusyBox.html busybox.links libbb/loop.h \
.config.old .hdepend busybox
- rm -rf _install
- - find . -name .\*.flags -exec rm -f {} \;
+ - find . -name .\*.flags -exec rm -f {} \;
- find . -name \*.o -exec rm -f {} \;
- find . -name \*.a -exec rm -f {} \;
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 fileutils, shellutils, findutils, textutils, grep, gzip,
forest into `pwd`/_install unless you have defined the PREFIX environment
variable (i.e., 'make PREFIX=/tmp/foo install')
-If you wish to install hardlinks, rather than symlinks, you can use
+If you wish to install hardlinks, rather than symlinks, you can use
'make install-hardlinks' instead.
----------------
-
+
Supported architectures:
Busybox in general will build on any architecture supported by gcc. It has
a few specialized features added for __sparc__ and __alpha__. insmod
- functionality is currently limited to x86, ARM, SH3/4, powerpc, m68k,
+ functionality is currently limited to x86, ARM, SH3/4, powerpc, m68k,
MIPS, cris, and v850e.
Supported libcs:
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
+anyone else to duplicate the bug on their own machine. The following is such
an example:
To: busybox@mail.busybox.net
$ date
llegal instruction
- I am using Debian unstable, kernel version 2.4.19-rmk1 on an Netwinder,
+ I am using Debian unstable, kernel version 2.4.19-rmk1 on an Netwinder,
and the latest uClibc from CVS. Thanks for the wonderful program!
-Diligent
FTP:
-Source for the latest released version, as well as daily snapshots, can always
-be downloaded from
+Source for the latest released version, as well as daily snapshots, can always
+be downloaded from
http://busybox.net/downloads/
----------------
----------------
Please feed suggestions, bug reports, insults, and bribes back to:
- Erik Andersen
+ Erik Andersen
<andersen@codepoet.org>
<andersen@codepoet.org>
# Rules.make for busybox
#
-# Copyright (C) 2001-2003 Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
HOSTCC = gcc
HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
-# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
+# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
LC_ALL:= C
# If you want to add some simple compiler switches (like -march=i686),
# especially from the command line, use this instead of CFLAGS directly.
# For optimization overrides, it's better still to set OPTIMIZATION.
CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS)))
-
+
# If you have a "pristine" source directory, point BB_SRC_DIR to it.
# Experimental and incomplete; tell the mailing list
# <busybox@busybox.net> if you do or don't like it so far.
# by itself, instead of following it by the same half-dozen overrides
# every time. The stuff below, on the other hand, is probably less
# prone to casual user adjustment.
-#
+#
ifeq ($(strip $(CONFIG_LFS)),y)
# For large file summit support
-----------
-With sysvinit, reboot, poweroff and halt all used a named pipe,
+With sysvinit, reboot, poweroff and halt all used a named pipe,
/dev/initctl, to communicate with the init process. Busybox
currently uses signals to communicate with init. This makes
busybox incompatible with sysvinit. We should probably use
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
}
/* Now get the the user/group info. */
-
+
s = (char *) bb_skip_whitespace(e);
/* Note: We require whitespace between the mode and the
const char *bb_applet_name;
#ifdef CONFIG_FEATURE_INSTALLER
-/*
+/*
* directory table
* this should be consistent w/ the enum, busybox.h::Location,
* or else...
/* abstract link() */
typedef int (*__link_f)(const char *, const char *);
-/*
+/*
* Where in the filesystem is this busybox?
* [return]
* malloc'd string w/ full pathname of busybox's location
int i;
int rc;
- if (use_symbolic_links)
+ if (use_symbolic_links)
Link = symlink;
for (i = 0; applets[i].name != NULL; i++) {
bb_applet_name = s;
}
-#ifdef CONFIG_LOCALE_SUPPORT
+#ifdef CONFIG_LOCALE_SUPPORT
#ifdef CONFIG_INIT
if(getpid()!=1) /* Do not set locale for `init' */
#endif
{
int col = 0, len, i;
-#ifdef CONFIG_FEATURE_INSTALLER
- /*
- * This style of argument parsing doesn't scale well
+#ifdef CONFIG_FEATURE_INSTALLER
+ /*
+ * This style of argument parsing doesn't scale well
* in the event that busybox starts wanting more --options.
* If someone has a cleaner approach, by all means implement it.
*/
/* to use symlinks, or not to use symlinks... */
if (argc > 2) {
- if ((strcmp(argv[2], "-s") == 0)) {
- use_symbolic_links = 1;
+ if ((strcmp(argv[2], "-s") == 0)) {
+ use_symbolic_links = 1;
}
}
"\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"
+ "\twill act like whatever it was invoked as.\n"
"\nCurrently defined functions:\n", bb_msg_full_version);
while (a->name != 0) {
sorting text compression algorithm, and Huffman coding. Compression
is generally considerably better than that achieved by more
conventional LZ77/LZ78-based compressors, and approaches the
- performance of the PPM family of statistical compressors.
-
+ performance of the PPM family of statistical compressors.
+
The BusyBox bunzip2 applet is limited to de-compression only.
On an x86 system, this applet adds about 11K.
-
+
Unless you have a specific application which requires bunzip2, you
should probably say N here.
cpio has 110 bytes of overheads for every stored file.
This implementation of cpio can extract cpio archives created in the
- "newc" or "crc" format, it cannot create or modify them.
+ "newc" or "crc" format, it cannot create or modify them.
Unless you have a specific application which requires cpio, you should
probably say N here.
default n
help
dpkg is a medium-level tool to install, build, remove and manage Debian packages.
-
+
This implementation of dpkg has a number of limitations, you should use the
official dpkg if possible.
default n
help
dpkg-deb packs, unpacks and provides information about Debian archives.
-
+
This implementation of dpkg-deb cannot pack archives.
-
+
Unless you have a specific application which requires dpkg-deb, you should
probably say N here.
depends on CONFIG_DPKG_DEB
help
This reduces dpkg-deb to the equivalent of "ar -p <deb> data.tar.gz | tar -zx".
- However it saves space as none of the extra dpkg-deb, ar or tar options are
+ However it saves space as none of the extra dpkg-deb, ar or tar options are
needed, they are linked to internally.
config CONFIG_GUNZIP
default y
depends on CONFIG_TAR
help
- With this option busybox supports GNU long filenames and
+ With this option busybox supports GNU long filenames and
linknames.
config CONFIG_FEATURE_TAR_LONG_OPTIONS
depends on CONFIG_DPKG || CONFIG_DPKG_DEB
help
This is the default compression method inside the debian ar file.
-
+
If you want compatibility with standard .deb's you should say yes here.
config CONFIG_FEATURE_DEB_TAR_BZ2
help
This allows dpkg and dpkg-deb to extract deb's that are compressed internally
with bzip2 instead of gzip.
-
+
You only want this if you are creating your own custom debian packages that
use an internal control.tar.bz2 or data.tar.bz2.
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
/* vi: set sw=4 ts=4: */
/*
- * Mini ar implementation for busybox
+ * Mini ar implementation for busybox
*
* Copyright (C) 2000 by Glenn McGrath
* Written by Glenn McGrath <bug1@optushome.com.au> 1 June 2000
- *
+ *
* Based in part on BusyBox tar, Debian dpkg-deb and GNU ar.
*
* This program is free software; you can redistribute it and/or modify
/*
* Mini cpio implementation for busybox
*
- * Copyright (C) 2001 by Glenn McGrath
+ * Copyright (C) 2001 by Glenn McGrath
*
* 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
/* if both extract and test option are given, ignore extract option */
if (opt & CPIO_OPT_EXTRACT) {
opt &= ~CPIO_OPT_EXTRACT;
- }
+ }
archive_handle->action_header = header_list;
}
if (opt & CPIO_OPT_EXTRACT) {
*
* Written By Glenn McGrath with the help of others
* Copyright (C) 2001 by Glenn McGrath
- *
+ *
* Started life as a busybox implementation of udpkg
*
* This program is free software; you can redistribute it and/or modify
* int's and chaos is assured, 16381 is the max prime for 14 bit field
*/
-/* NAME_HASH_PRIME, Stores package names and versions,
+/* NAME_HASH_PRIME, Stores package names and versions,
* I estimate it should be at least 50% bigger than PACKAGE_HASH_PRIME,
* as there a lot of duplicate version numbers */
#define NAME_HASH_PRIME 16381
* shift amount is mod 24 because long int is 32 bit and data
* to be shifted is 8, dont want to shift data to where it has
* no effect*/
- hash_num += ((key[i] + key[i-1]) << ((key[i] * i) % 24));
+ hash_num += ((key[i] + key[i-1]) << ((key[i] * i) % 24));
}
*start = (unsigned int) hash_num % hash_prime;
*decrement = (unsigned int) 1 + (hash_num % (hash_prime - 1));
} else {
or_edge = NULL;
}
-
+
if ( or_edge ) {
or_edge->name = search_name_hashtable(field);
or_edge->version = 0; // tracks the number of altenatives
-
+
add_edge_to_node(parent_node, or_edge);
}
goto fill_package_struct_cleanup; /* Oh no, the dreaded goto statement ! */
}
- field_num = compare_string_array(field_names, field_name);
+ field_num = compare_string_array(field_names, field_name);
switch(field_num) {
case 0: /* Package */
new_node->name = search_name_hashtable(field_value);
return "is marked to be removed";
if ( status_want == search_name_hashtable("purge") )
return "is marked to be purged";
- }
+ }
if ( status_want == search_name_hashtable("unknown") )
return "is in an indeterminate state";
if ( status_want == search_name_hashtable("install") )
/* Create a seperate backfile to dpkg */
if (rename("/var/lib/dpkg/status", "/var/lib/dpkg/status.udeb.bak") == -1) {
- struct stat stat_buf;
+ struct stat stat_buf;
if (stat("/var/lib/dpkg/status", &stat_buf) == 0) {
bb_error_msg_and_die("Couldnt create backup status file");
}
- /* Its ok if renaming the status file fails becasue status
+ /* Its ok if renaming the status file fails becasue status
* file doesnt exist, maybe we are starting from scratch */
bb_error_msg("No status file found, creating new one");
}
const edge_t *package_edge = package_node->edge[j];
if (package_edge->type == EDGE_CONFLICTS) {
- const unsigned int package_num =
+ const unsigned int package_num =
search_package_hashtable(package_edge->name,
- package_edge->version,
- package_edge->operator);
+ package_edge->version,
+ package_edge->operator);
int result = 0;
if (package_hashtable[package_num] != NULL) {
status_num = search_status_hashtable(name_hashtable[package_hashtable[package_num]->name]);
}
}
i++;
- }
+ }
/* Check dependendcies */
/* If there is no status then this package is a
* virtual one provided by something else. In which
- * case there are no dependencies to check.
+ * case there are no dependencies to check.
*/
if ( status_hashtable[status_num] == NULL ) continue;
for (j = 0; j < package_node->num_of_edges; j++) {
const edge_t *package_edge = package_node->edge[j];
unsigned int package_num;
-
+
if ( package_edge->type == EDGE_OR_PRE_DEPENDS ||
package_edge->type == EDGE_OR_DEPENDS ) { /* start an EDGE_OR_ list */
number_of_alternatives = package_edge->version;
* this edge is the right type.
*
* EDGE_DEPENDS == OR_DEPENDS -1
- * EDGE_PRE_DEPENDS == OR_PRE_DEPENDS -1
+ * EDGE_PRE_DEPENDS == OR_PRE_DEPENDS -1
*/
if ( root_of_alternatives && package_edge->type != root_of_alternatives->type - 1)
bb_error_msg_and_die("Fatal error. Package dependencies corrupt: %d != %d - 1 \n",
package_edge->type, root_of_alternatives->type);
-
+
if (package_hashtable[package_num] != NULL)
result = !package_satisfies_dependency(package_num, package_edge->type);
if (result) { /* check for other package which provide what we are looking for */
int provider = -1;
-
+
while ( (provider = search_for_provides(package_edge->name, provider) ) > -1 ) {
if ( package_hashtable[provider] == NULL ) {
printf("Have a provider but no package information for it\n");
continue;
- }
+ }
result = !package_satisfies_dependency(provider, package_edge->type);
-
- if ( result == 0 )
+
+ if ( result == 0 )
break;
}
}
if (result && number_of_alternatives == 0) {
if ( root_of_alternatives )
bb_error_msg_and_die(
- "Package %s %sdepends on %s, "
+ "Package %s %sdepends on %s, "
"which cannot be satisfied",
name_hashtable[package_node->name],
package_edge->type == EDGE_PRE_DEPENDS ? "pre-" : "",
name_hashtable[root_of_alternatives->name]);
- else
+ else
bb_error_msg_and_die(
- "Package %s %sdepends on %s, which %s\n",
+ "Package %s %sdepends on %s, which %s\n",
name_hashtable[package_node->name],
package_edge->type == EDGE_PRE_DEPENDS ? "pre-" : "",
name_hashtable[package_edge->name],
/* we've found a package which
* satisfies the dependency,
* so skip over the rest of
- * the alternatives.
+ * the alternatives.
*/
j += number_of_alternatives;
number_of_alternatives = 0;
void free_array(char **array)
{
-
+
if (array) {
unsigned short i = 0;
while (array[i]) {
/* This function lists information on the installed packages. It loops through
* the status_hashtable to retrieve the info. This results in smaller code than
- * scanning the status file. The resulting list, however, is unsorted.
+ * scanning the status file. The resulting list, however, is unsorted.
*/
void list_packages(void)
{
printf(" Name Version\n");
printf("+++-==============-==============\n");
-
+
/* go through status hash, dereference package hash and finally strings */
for (i=0; i<STATUS_HASH_PRIME+1; i++) {
const char *name_str; /* package name */
const char *vers_str; /* version */
char s1, s2; /* status abbreviations */
- int spccnt; /* space count */
+ int spccnt; /* space count */
int j;
-
+
stat_str = name_hashtable[status_hashtable[i]->status];
name_str = name_hashtable[package_hashtable[status_hashtable[i]->package]->name];
vers_str = name_hashtable[package_hashtable[status_hashtable[i]->package]->version];
-
+
/* get abbreviation for status field 1 */
s1 = stat_str[0] == 'i' ? 'i' : 'r';
-
+
/* get abbreviation for status field 2 */
for (j=0, spccnt=0; stat_str[j] && spccnt<2; j++) {
if (stat_str[j] == ' ') spccnt++;
}
s2 = stat_str[j];
-
+
/* print out the line formatted like Debian dpkg */
printf("%c%c %-14s %s\n", s1, s2, name_str, vers_str);
}
char conffile_name[package_name_length + 30];
int return_value;
- if ( noisy )
+ if ( noisy )
printf("Removing %s (%s) ...\n", package_name, package_version);
/* run prerm script */
{
archive_handle_t *ar_handle;
- /* Setup an ar archive handle that refers to the gzip sub archive */
+ /* Setup an ar archive handle that refers to the gzip sub archive */
ar_handle = init_handle();
ar_handle->filter = filter_accept_list_reassign;
ar_handle->src_fd = bb_xopen(filename, O_RDONLY);
- return(ar_handle);
+ return(ar_handle);
}
static void init_archive_deb_control(archive_handle_t *ar_handle)
/* Assign the tar handle as a subarchive of the ar handle */
ar_handle->sub_archive = tar_handle;
- return;
+ return;
}
static void init_archive_deb_data(archive_handle_t *ar_handle)
/* Assign the tar handle as a subarchive of the ar handle */
ar_handle->sub_archive = tar_handle;
- return;
+ return;
}
static char *deb_extract_control_file_to_buffer(archive_handle_t *ar_handle, llist_t *myaccept)
if (run_package_script(package_name, "preinst") != 0) {
/* when preinst returns exit code != 0 then quit installation process */
bb_error_msg_and_die("subprocess pre-installation script returned error.");
- }
+ }
/* Extract data.tar.gz to the root directory */
archive_handle = init_archive_deb_ar(deb_file->filename);
/* Create the list file */
strcat(info_prefix, "list");
- out_stream = bb_xfopen(info_prefix, "w");
+ out_stream = bb_xfopen(info_prefix, "w");
while (archive_handle->sub_archive->passed) {
/* the leading . has been stripped by data_extract_all_prefix already */
fputs(archive_handle->sub_archive->passed->data, out_stream);
case 'F': // equivalent to --force in official dpkg
if (strcmp(optarg, "depends") == 0) {
dpkg_opt |= dpkg_opt_force_ignore_depends;
- }
+ }
break;
case 'i':
dpkg_opt |= dpkg_opt_install;
list_packages();
return(EXIT_SUCCESS);
}
-
+
/* Read arguments and store relevant info in structs */
while (optind < argc) {
/* deb_count = nb_elem - 1 and we need nb_elem + 1 to allocate terminal node [NULL pointer] */
/* Setup the tar archive handle */
tar_archive = init_handle();
- /* Setup an ar archive handle that refers to the gzip sub archive */
+ /* Setup an ar archive handle that refers to the gzip sub archive */
ar_archive = init_handle();
ar_archive->sub_archive = tar_archive;
ar_archive->filter = filter_accept_list_reassign;
}
if (opt & DPKG_DEB_OPT_FIELD) {
/* Print the entire control file
- * it should accept a second argument which specifies a
+ * it should accept a second argument which specifies a
* specific field to print */
ar_archive->accept = control_tar_llist;
tar_archive->accept = llist_add_to(NULL, "./control");;
*
* General cleanup to better adhere to the style guide and make use of standard
* busybox functions by Glenn McGrath <bug1@optushome.com.au>
- *
+ *
* 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
/* do the decompression, and cleanup */
if (bb_xread_char(src_fd) == 0x1f) {
unsigned char magic2;
-
+
magic2 = bb_xread_char(src_fd);
#ifdef CONFIG_FEATURE_GUNZIP_UNCOMPRESS
if (magic2 == 0x9d) {
status = uncompress(src_fd, dst_fd);
- } else
+ } else
#endif
if (magic2 == 0x8b) {
check_header_gzip(src_fd);
* only standard in to standard out with -9 compression. It also requires
* the zcat module for some important functions."
*
- * Adjusted further by Erik Andersen <andersen@codepoet.org> to support
- * files as well as stdin/stdout, and to generally behave itself wrt
+ * Adjusted further by Erik Andersen <andersen@codepoet.org> to support
+ * files as well as stdin/stdout, and to generally behave itself wrt
* command line handling.
*
* This program is free software; you can redistribute it and/or modify
*/
/* These defines are very important for BusyBox. Without these,
- * huge chunks of ram are pre-allocated making the BusyBox bss
+ * huge chunks of ram are pre-allocated making the BusyBox bss
* size Freaking Huge(tm), which is a bad thing.*/
#define SMALL_MEM
#define DYN_ALLOC
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
get_header_tar.o \
filter_accept_list_reassign.o
-LIBUNARCHIVE-$(CONFIG_AR) += get_header_ar.o unpack_ar_archive.o
+LIBUNARCHIVE-$(CONFIG_AR) += get_header_ar.o unpack_ar_archive.o
LIBUNARCHIVE-$(CONFIG_BUNZIP2) += decompress_bunzip2.o
LIBUNARCHIVE-$(CONFIG_CPIO) += get_header_cpio.o
LIBUNARCHIVE-$(CONFIG_DPKG) += $(DPKG_FILES)
LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_BZ2) += decompress_bunzip2.o get_header_tar_bz2.o
LIBUNARCHIVE-$(CONFIG_GUNZIP) += $(GUNZIP_FILES)
LIBUNARCHIVE-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += uncompress.o
-LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o
+LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o
LIBUNARCHIVE-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o
LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar.o
LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_BZIP2) += decompress_bunzip2.o get_header_tar_bz2.o
char *name = bb_xstrdup(file_header->name);
bb_make_directory (dirname(name), 0777, FILEUTILS_RECUR);
free(name);
- }
+ }
/* Check if the file already exists */
if (archive_handle->flags & ARCHIVE_EXTRACT_UNCONDITIONAL) {
}
}
- /* Handle hard links seperately
+ /* Handle hard links seperately
* We identified hard links as regular files of size 0 with a symlink */
if (S_ISREG(file_header->mode) && (file_header->link_name) && (file_header->size == 0)) {
/* hard link */
pp=0;
for(i=minLen;i<=maxLen;i++) {
temp[i]=limit[i]=0;
- for(t=0;t<symCount;t++)
+ for(t=0;t<symCount;t++)
if(length[t]==i) hufGroup->permute[pp++] = t;
}
/* Count symbols coded for at each bit length */
/* uncompress for busybox -- (c) 2002 Robert Griebl
*
- * based on the original compress42.c source
+ * based on the original compress42.c source
* (see disclaimer below)
*/
*
* General cleanup to better adhere to the style guide and make use of standard
* busybox functions by Glenn McGrath <bug1@optushome.com.au>
- *
+ *
* read_gz interface + associated hacking by Laurence Anderson
*
* This program is free software; you can redistribute it and/or modify
{
while (*current < required) {
if (bytebuffer_offset >= bytebuffer_size) {
- /* Leave the first 4 bytes empty so we can always unwind the bitbuffer
+ /* 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);
/*
* Free the malloc'ed tables built by huft_build(), which makes a linked
* list of the tables it made, with the links in a dummy first entry of
- * each table.
+ * each table.
* t: table to free
*/
static int huft_free(huft_t * t)
md = mask_bits[bd];
return 0; // Don't actually do anything the first time
}
-
+
if (resumeCopy) goto do_copy;
-
+
while (1) { /* do until end of block */
b = fill_bitbuffer(b, &k, bl);
if ((e = (t = tl + ((unsigned) b & ml))->e) > 16)
/* free the decoding tables, return */
huft_free(tl);
huft_free(td);
-
+
/* done */
return 0;
}
w = gunzip_outbuf_count; /* initialize gunzip_window position */
return 0; // Don't do anything first time
}
-
+
/* read and output the compressed data */
while (n--) {
b_stored = fill_bitbuffer(b_stored, &k_stored, 8);
inflate_stored(n, b_stored, k_stored, 1); // Setup inflate_stored
return -1;
}
- case 1: /* Inflate fixed
+ case 1: /* Inflate fixed
* decompress an inflated type 1 (fixed Huffman codes) block. We should
* either replace this with a custom decoder, or at least precompute the
* Huffman tables.
/* decompress until an end-of-block code */
inflate_codes(tl, td, bl, bd, 1); // Setup inflate_codes
-
+
/* huft_free code moved into inflate_codes */
-
+
return -2;
}
case 2: /* Inflate dynamic */
inflate_codes(tl, td, bl, bd, 1); // Setup inflate_codes
/* huft_free code moved into inflate_codes */
-
+
return -2;
}
default:
static int method = -1; // Method == -1 for stored, -2 for codes
static int e = 0;
static int needAnotherBlock = 1;
-
+
gunzip_outbuf_count = 0;
while(1) {
int ret;
-
+
if (needAnotherBlock) {
if(e) {
calculate_gunzip_crc();
method = inflate_block(&e);
needAnotherBlock = 0;
}
-
+
switch (method) {
case -1: ret = inflate_stored(0,0,0,0);
break;
make_gunzip_crc_table();
/* Allocate space for buffer */
- bytebuffer = xmalloc(bytebuffer_max);
+ bytebuffer = xmalloc(bytebuffer_max);
while(1) {
int ret = inflate_get_next_window();
(bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) {
bb_error_msg("Incorrect length");
}
-
+
return 0;
}
/*
* Reassign the subarchive metadata parser based on the filename extension
* e.g. if its a .tar.gz modify archive_handle->sub_archive to process a .tar.gz
- * or if its a .tar.bz2 make archive_handle->sub_archive handle that
+ * or if its a .tar.bz2 make archive_handle->sub_archive handle that
*/
extern char filter_accept_list_reassign(archive_handle_t *archive_handle)
{
archive_handle->action_data(archive_handle);
}
} else {
- data_skip(archive_handle);
+ data_skip(archive_handle);
}
archive_handle->offset += typed->size;
int namesize;
char dummy[16];
int major, minor, nlink, inode;
-
+
if (pending_hardlinks) { /* Deal with any pending hardlinks */
hardlinks_t *tmp;
hardlinks_t *oldtmp;
{
unsigned long tmpsize;
sscanf(cpio_header, "%6c%8x%8x%8x%8x%8x%8lx%8lx%16c%8x%8x%8x%8c",
- dummy, &inode, (unsigned int*)&file_header->mode,
+ dummy, &inode, (unsigned int*)&file_header->mode,
(unsigned int*)&file_header->uid, (unsigned int*)&file_header->gid,
&nlink, &file_header->mtime, &tmpsize,
dummy, &major, &minor, &namesize, dummy);
archive_handle->action_data(archive_handle);
archive_handle->action_header(archive_handle->file_header);
} else {
- data_skip(archive_handle);
+ data_skip(archive_handle);
}
archive_handle->offset += file_header->size;
file_header->gid = strtol(tar.formated.gid, NULL, 8);
file_header->size = strtol(tar.formated.size, NULL, 8);
file_header->mtime = strtol(tar.formated.mtime, NULL, 8);
- file_header->link_name = (tar.formated.linkname[0] != '\0') ?
+ file_header->link_name = (tar.formated.linkname[0] != '\0') ?
bb_xstrdup(tar.formated.linkname) : NULL;
file_header->device = (dev_t) ((strtol(tar.formated.devmajor, NULL, 8) << 8) +
strtol(tar.formated.devminor, NULL, 8));
archive_handle->action_data(archive_handle);
archive_handle->passed = llist_add_to(archive_handle->passed, file_header->name);
} else {
- data_skip(archive_handle);
+ data_skip(archive_handle);
}
archive_handle->offset += file_header->size;
/* uncompress for busybox -- (c) 2002 Robert Griebl
*
- * based on the original compress42.c source
+ * based on the original compress42.c source
* (see disclaimer below)
*/
*
* General cleanup to better adhere to the style guide and make use of standard
* busybox functions by Glenn McGrath <bug1@optushome.com.au>
- *
+ *
* read_gz interface + associated hacking by Laurence Anderson
*
* This program is free software; you can redistribute it and/or modify
{
while (*current < required) {
if (bytebuffer_offset >= bytebuffer_size) {
- /* Leave the first 4 bytes empty so we can always unwind the bitbuffer
+ /* 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);
/*
* Free the malloc'ed tables built by huft_build(), which makes a linked
* list of the tables it made, with the links in a dummy first entry of
- * each table.
+ * each table.
* t: table to free
*/
static int huft_free(huft_t * t)
md = mask_bits[bd];
return 0; // Don't actually do anything the first time
}
-
+
if (resumeCopy) goto do_copy;
-
+
while (1) { /* do until end of block */
b = fill_bitbuffer(b, &k, bl);
if ((e = (t = tl + ((unsigned) b & ml))->e) > 16)
/* free the decoding tables, return */
huft_free(tl);
huft_free(td);
-
+
/* done */
return 0;
}
w = gunzip_outbuf_count; /* initialize gunzip_window position */
return 0; // Don't do anything first time
}
-
+
/* read and output the compressed data */
while (n--) {
b_stored = fill_bitbuffer(b_stored, &k_stored, 8);
inflate_stored(n, b_stored, k_stored, 1); // Setup inflate_stored
return -1;
}
- case 1: /* Inflate fixed
+ case 1: /* Inflate fixed
* decompress an inflated type 1 (fixed Huffman codes) block. We should
* either replace this with a custom decoder, or at least precompute the
* Huffman tables.
/* decompress until an end-of-block code */
inflate_codes(tl, td, bl, bd, 1); // Setup inflate_codes
-
+
/* huft_free code moved into inflate_codes */
-
+
return -2;
}
case 2: /* Inflate dynamic */
inflate_codes(tl, td, bl, bd, 1); // Setup inflate_codes
/* huft_free code moved into inflate_codes */
-
+
return -2;
}
default:
static int method = -1; // Method == -1 for stored, -2 for codes
static int e = 0;
static int needAnotherBlock = 1;
-
+
gunzip_outbuf_count = 0;
while(1) {
int ret;
-
+
if (needAnotherBlock) {
if(e) {
calculate_gunzip_crc();
method = inflate_block(&e);
needAnotherBlock = 0;
}
-
+
switch (method) {
case -1: ret = inflate_stored(0,0,0,0);
break;
make_gunzip_crc_table();
/* Allocate space for buffer */
- bytebuffer = xmalloc(bytebuffer_max);
+ bytebuffer = xmalloc(bytebuffer_max);
while(1) {
int ret = inflate_get_next_window();
(bytebuffer[bytebuffer_offset+2] << 16) | (bytebuffer[bytebuffer_offset+3] << 24))) {
bb_error_msg("Incorrect length");
}
-
+
return 0;
}
archive_handle->flags |= ARCHIVE_CREATE_LEADING_DIRS;
archive_handle->src_fd = fd;
archive_handle->offset = 0;
-
+
bb_xread_all(archive_handle->src_fd, &magic, 2);
if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
bb_error_msg_and_die("Invalid gzip magic");
}
- check_header_gzip(archive_handle->src_fd);
+ check_header_gzip(archive_handle->src_fd);
chdir("/"); // Install RPM's to root
archive_handle->src_fd = open_transformer(archive_handle->src_fd, inflate_gunzip);
/* Skip the main header */
skip_header(rpm_fd);
-
+
bb_xread_all(rpm_fd, &magic, 2);
if ((magic[0] != 0x1f) || (magic[1] != 0x8b)) {
bb_error_msg_and_die("Invalid gzip magic");
/* vi: set sw=4 ts=4: */
/*
- * Mini tar implementation for busybox
+ * Mini tar implementation for busybox
*
* Modifed to use common extraction code used by ar, cpio, dpkg-deb, dpkg
* Glenn McGrath <bug1@optushome.com.au>
* ground up. It still has remnents of the old code lying about, but it is
* very different now (i.e., cleaner, less global variables, etc.)
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* Based in part in the tar implementation in sash
* Copyright (c) 1999 by David I. Bell
for the tarball */
struct stat statBuf; /* Stat info for the tarball, letting
us know the inode and device that the
- tarball lives, so we can avoid trying
+ tarball lives, so we can avoid trying
to include the tarball into itself */
int verboseFlag; /* Whether to print extra stuff or not */
const llist_t *excludeList; /* List of files to not include */
(void) &include;
(void) &errorFlag;
# endif
-
+
gzipPid = vfork();
if (gzipPid == 0) {
#endif
#ifdef CONFIG_FEATURE_TAR_BZIP2
-# define TAR_OPT_BZIP2 (1 << (8 + TAR_OPT_FLAG_CREATE))
+# define TAR_OPT_BZIP2 (1 << (8 + TAR_OPT_FLAG_CREATE))
# define TAR_OPT_STR_BZIP2 "j"
# define TAR_OPT_FLAG_BZIP2 1
#else
#ifdef CONFIG_FEATURE_TAR_COMPRESS
# define TAR_OPT_UNCOMPRESS (1 << (8 + TAR_OPT_FLAG_CREATE + TAR_OPT_FLAG_BZIP2 + TAR_OPT_FLAG_FROM + TAR_OPT_FLAG_GZIP))
# define TAR_OPT_STR_COMPRESS "Z"
-#else
+#else
# define TAR_OPT_STR_COMPRESS ""
#endif
bb_show_usage();
}
if(ctx_flag & CTX_TEST) {
- if ((tar_handle->action_header == header_list) ||
+ if ((tar_handle->action_header == header_list) ||
(tar_handle->action_header == header_verbose_list)) {
tar_handle->action_header = header_verbose_list;
} else {
tar_handle->action_data = data_extract_to_stdout;
}
if(opt & TAR_OPT_VERBOSE) {
- if ((tar_handle->action_header == header_list) ||
- (tar_handle->action_header == header_verbose_list))
+ if ((tar_handle->action_header == header_list) ||
+ (tar_handle->action_header == header_verbose_list))
{
tar_handle->action_header = header_verbose_list;
} else {
}
# endif /* CONFIG_FEATURE_TAR_BZIP2 */
- if ((tar_handle->action_header == header_list) ||
+ if ((tar_handle->action_header == header_list) ||
(tar_handle->action_header == header_verbose_list)) {
verboseFlag = TRUE;
}
writeTarFile(tar_handle->src_fd, verboseFlag, opt & TAR_OPT_DEREFERNCE, tar_handle->accept,
tar_handle->reject, gzipFlag);
- } else
+ } else
#endif /* CONFIG_FEATURE_TAR_CREATE */
{
while (get_header_ptr(tar_handle) == EXIT_SUCCESS);
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
/*
* Mini chvt implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Mini clear implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* Disallocate virtual terminal(s)
*
* Copyright (C) 2003 by Tito Ragusa <farmatito@tiscali.it>
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
write(1, magic, 7);
for (i=0; i < MAX_NR_KEYMAPS; i++) flags[i]=0;
- flags[0]=1;
+ flags[0]=1;
flags[1]=1;
flags[2]=1;
flags[4]=1;
flags[9]=1;
flags[10]=1;
flags[12]=1;
-
+
/* dump flags */
- for (i=0; i < MAX_NR_KEYMAPS; i++) write(1,&flags[i],1);
+ for (i=0; i < MAX_NR_KEYMAPS; i++) write(1,&flags[i],1);
for (i = 0; i < MAX_NR_KEYMAPS; i++) {
if (flags[i] == 1) {
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);
- }
-
+ write(1,(void*)&ke.kb_value,2);
+ }
+
}
}
}
}
}
- /* Don't bother to close files. Exit does that
+ /* Don't bother to close files. Exit does that
* automagically, so we can save a few bytes */
/* close(fd); */
return EXIT_SUCCESS;
if (setsid() < 0) {
#endif
- bb_perror_msg_and_die("Unable to set new session");
+ bb_perror_msg_and_die("Unable to set new session");
}
close(0); /* so that new vt becomes stdin */
/*
* Mini reset implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
* Written by Erik Andersen and Kent Robotti <robotti@metconnect.com>
*
* This program is free software; you can redistribute it and/or modify
};
static const int KDSETKEYCODE = 0x4B4D; /* write kernel keycode table entry */
-extern int
+extern int
setkeycodes_main(int argc, char** argv)
{
char *ep;
if (argc % 2 != 1 || argc < 2) {
bb_show_usage();
}
-
+
fd = get_console_fd();
while (argc > 2) {
default n
help
basename is used to strip the directory and suffix from filenames,
- leaving just the filename itself. Enable this option if you wish
+ leaving just the filename itself. Enable this option if you wish
to enable the 'basename' utility.
config CONFIG_CAL
help
dd copies a file (from standard input to standard output,
by default) using specific input and output blocksizes,
- while optionally performing conversions on it.
+ while optionally performing conversions on it.
config CONFIG_DF
bool "df"
default y
depends on CONFIG_ECHO
help
- This adds options (-n and -e) to echo.
+ This adds options (-n and -e) to echo.
config CONFIG_ENV
bool "env"
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
/*
* Mini basename implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
int row, len, days[MAXDAYS];
int *dp = days;
char lineout[30];
-
+
day_array(month, year, dp);
len = sprintf(lineout, "%s %d", month_names[month - 1], year);
bb_printf("%*s%s\n%s\n",
int row, which_cal, week_len, days[12][MAXDAYS];
int *dp;
char lineout[80];
-
+
sprintf(lineout, "%d", year);
center(lineout,
(WEEK_LEN * 3 + HEAD_SEP * 2)
static char *build_row(char *p, int *dp)
{
int col, val, day;
-
+
memset(p, ' ', (julian + DAY_LEN) * 7);
col = 0;
/*
* Mini chgrp implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/* Ok, ready to do the deed now */
do {
- if (! recursive_action (*argv, recursiveFlag, FALSE, FALSE,
+ if (! recursive_action (*argv, recursiveFlag, FALSE, FALSE,
fileAction, fileAction, &gid)) {
retval = EXIT_FAILURE;
}
/*
* Mini chmod implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* Reworked by (C) 2002 Vladimir Oleynik <dzo@simtreas.ru>
* to correctly parse '-rwxgoa'
/*
* Mini chown implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
uid = get_ug_id(*argv, my_getpwnam);
++argv;
-
+
/* Ok, ready to do the deed now */
do {
- if (! recursive_action (*argv, (flags & FLAG_R), FALSE, FALSE,
+ if (! recursive_action (*argv, (flags & FLAG_R), FALSE, FALSE,
fileAction, fileAction, NULL)) {
retval = EXIT_FAILURE;
}
/*
* Mini chroot implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* cut.c - minimalist version of cut
*
* Copyright (C) 1999,2000,2001 by Lineo, inc.
- * Written by Mark Whitley <markw@lineo.com>, <markw@codepoet.org>
+ * Written by Mark Whitley <markw@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
/*
* parse_lists() - parses a list and puts values into startpos and endpos.
- * valid list formats: N, N-, N-M, -M
+ * valid list formats: N, N-, N-M, -M
* more than one list can be seperated by commas
*/
static void parse_lists(char *lists)
s = strtoul(ntok, &junk, 10);
if(*junk != '\0' || s < 0)
bb_error_msg_and_die("invalid byte or field list");
-
+
/* account for the fact that arrays are zero based, while the user
* expects the first char on the line to be char # 1 */
if (s != 0)
/* if there's something left to tokenize, the user past an invalid list */
if (ltok)
bb_error_msg_and_die("invalid byte or field list");
-
+
/* add the new list */
cut_lists = xrealloc(cut_lists, sizeof(struct cut_list) * (++nlists));
cut_lists[nlists-1].startpos = s;
{
static int c = 0;
static int l = -1;
-
+
/* I can't initialize this above cuz the "initializer isn't
* constant" *sigh* */
if (l == -1)
* Mini date implementation for busybox
*
* by Matthew Grant <grantma@anathoth.gen.nz>
- *
+ *
* iso-format handling added by Robert Griebl <griebl@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
#include "busybox.h"
-/* This 'date' command supports only 2 time setting formats,
+/* This 'date' command supports only 2 time setting formats,
all the GNU strftime stuff (its in libc, lets use it),
setting time using UTC and displaying int, as well as
an RFC 822 complient date output for shell scripting
/*
* Mini df implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
* based on original code by (I think) Bruce Perens <bruce@pixar.com>.
*
* This program is free software; you can redistribute it and/or modify
long blocks_used;
long blocks_percent_used;
#ifdef CONFIG_FEATURE_HUMAN_READABLE
- unsigned long df_disp_hr = KILOBYTE;
+ unsigned long df_disp_hr = KILOBYTE;
#endif
int status = EXIT_SUCCESS;
unsigned long opt;
bb_perror_msg("%s", mount_point);
goto SET_ERROR;
}
-
+
if ((s.f_blocks > 0) || !mount_table){
blocks_used = s.f_blocks - s.f_bfree;
blocks_percent_used = 0;
+ (blocks_used + s.f_bavail)/2
) / (blocks_used + s.f_bavail);
}
-
+
if (strcmp(device, "rootfs") == 0) {
continue;
} else if (strcmp(device, "/dev/root") == 0) {
goto SET_ERROR;
}
}
-
+
#ifdef CONFIG_FEATURE_HUMAN_READABLE
bb_printf("%-21s%9s ", device,
make_human_readable_str(s.f_blocks, s.f_bsize, df_disp_hr));
-
+
bb_printf("%9s ",
make_human_readable_str( (s.f_blocks - s.f_bfree),
s.f_bsize, df_disp_hr));
-
+
bb_printf("%9s %3ld%% %s\n",
make_human_readable_str(s.f_bavail, s.f_bsize, df_disp_hr),
blocks_percent_used, mount_point);
/*
* Mini dirname implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
// if fn is NULL then input is stdin and output is stdout
-static int convert(char *fn, int ConvType)
+static int convert(char *fn, int ConvType)
{
int c, fd;
struct timeval tv;
return 0;
}
-int dos2unix_main(int argc, char *argv[])
+int dos2unix_main(int argc, char *argv[])
{
int ConvType = CT_AUTO;
int o;
- //See if we are supposed to be doing dos2unix or unix2dos
+ //See if we are supposed to be doing dos2unix or unix2dos
if (argv[0][0]=='d') {
ConvType = CT_DOS2UNIX;
}
#else
disp_k = 0;
#endif
- }
+ }
#endif
/* Note: SUSv3 specifies that -a and -s options can not be used together
* that all of the options specified are actually valid.
* Otherwise, the string should just be echoed.
*/
-
+
if (!*(p = *argv + 1)) { /* A single '-', so echo it. */
goto just_echo;
}
while ((c = *(*argv)++)) {
if (c == eflag) { /* Check for escape seq. */
if (**argv == 'c') {
- /* '\c' means cancel newline and
+ /* '\c' means cancel newline and
* ignore all subsequent chars. */
goto DONE;
}
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
- * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
+ * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
+ * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
*
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* based on GNU expr Mike Parker.
* Copyright (C) 86, 1991-1997, 1999 Free Software Foundation, Inc.
*
- * Busybox modifications
+ * Busybox modifications
* Copyright (c) 2000 Edward Betts <edward@debian.org>.
* Aug 2003 Vladimir Oleynik - reduced 464 bytes.
*
/*
* Mini false implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#ifdef CONFIG_SELINUX
int is_flask_enabled_flag = is_flask_enabled();
#endif
-
+
flags = bb_getopt_ulflags(argc, argv, "ugrn");
if (((flags & (JUST_USER | JUST_GROUP)) == (JUST_USER | JUST_GROUP))
{ "owner", 0, NULL, 'o' },
{ 0, 0, 0, 0 }
};
-
+
extern int install_main(int argc, char **argv)
{
struct stat statbuf;
}
return(ret);
}
-
+
cp_mv_stat2(argv[argc - 1], &statbuf, lstat);
for (i = optind; i < argc - 1; i++) {
unsigned char *dest;
/* Set the user and group id */
if (lchown(dest, uid, gid) == -1) {
bb_perror_msg("cannot change ownership of %s", dest);
- ret = EXIT_FAILURE;
+ ret = EXIT_FAILURE;
}
if (flags & INSTALL_OPT_STRIP) {
if (execlp("strip", "strip", dest, NULL) == -1) {
bb_error_msg("strip failed");
- ret = EXIT_FAILURE;
+ ret = EXIT_FAILURE;
}
}
}
-
+
return(ret);
}
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
/*
* Mini ln implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
if (flag & LN_SYMLINK) {
link_func = symlink;
}
-
+
if (link_func(*argv, src) != 0) {
bb_perror_msg(src);
status = EXIT_FAILURE;
}
free(src_name);
-
+
} while ((++argv)[1]);
return status;
if (S_ISDIR(dn[i]->dstat.st_mode)
&& (notsubdirs
|| ((dn[i]->name[0] != '.')
- || (dn[i]->name[1]
+ || (dn[i]->name[1]
&& ((dn[i]->name[1] != '.')
|| dn[i]->name[2])))))
dirs++;
if ((all_fmt & STYLE_MASK) == STYLE_LONG && (all_fmt & LIST_ID_NUMERIC))
all_fmt &= ~LIST_ID_NAME; /* don't list names if numeric uid */
#endif
-
+
/* choose a display format */
if ((all_fmt & STYLE_MASK) == STYLE_AUTO)
#if STYLE_AUTO != 0
/*
* Copyright (C) 2003 Glenn L. McGrath
- * Copyright (C) 2003 Erik Andersen
- *
+ * Copyright (C) 2003-2004 Erik Andersen
+ *
* 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
dev = (bb_xgetularg10_bnd(argv[2], 0, 255) << 8)
+ bb_xgetularg10_bnd(argv[3], 0, 255);
}
-
+
if (argc == 2) {
name = *argv;
if (mknod(name, mode, dev) == 0) {
goto DO_MOVE;
}
}
-
+
do {
dest = concat_path_file(last, bb_get_last_path_component(*argv));
}
DO_MOVE:
-
+
if (dest_exists && !(flags & OPT_FILEUTILS_FORCE) &&
((access(dest, W_OK) < 0 && isatty(0)) ||
(flags & OPT_FILEUTILS_INTERACTIVE))) {
bb_perror_msg("cannot remove `%s'", dest);
goto RET_1;
}
- }
+ }
if ((copy_file(*argv, dest,
FILEUTILS_RECUR | FILEUTILS_PRESERVE_STATUS) >= 0) &&
(remove_file(*argv, FILEUTILS_RECUR | FILEUTILS_FORCE) >= 0)) {
RET_0:
if (dest != last) {
free((void *) dest);
- }
+ }
} while (*++argv != last);
return (status);
static int print_formatted __P((char *format, int argc, char **argv));
static long xstrtol __P((char *s));
static unsigned long xstrtoul __P((char *s));
-static void print_direc __P( (char *start, size_t length,
+static void print_direc __P( (char *start, size_t length,
int field_width, int precision, char *argument));
static void print_esc_char __P((int c));
static void print_esc_string __P((char *str));
++f;
++direc_length;
}
- /*
+ /*
if (!strchr ("diouxXfeEgGcs", *f))
fprintf(stderr, "%%%c: invalid directive", *f);
*/
}
break;
} while (1);
-
+
} while (*++argv);
return status;
/* Allow legacy syntax of an initial numeric option without -n. */
if (argc >=2 && ((argv[1][0] == '+') || ((argv[1][0] == '-')
/* && (isdigit)(argv[1][1]) */
- && (((unsigned int)(argv[1][1] - '0')) <= 9))))
+ && (((unsigned int)(argv[1][1] - '0')) <= 9))))
{
optind = 2;
optarg = argv[1];
}
#endif
- /* Now we need to check for i/o errors on stdin and the various
+ /* Now we need to check for i/o errors on stdin and the various
* output files. Since we know that the first entry in the output
* file table is stdout, we can save one "if ferror" test by
* setting the first entry to stdin and checking stdout error
/*
* test implementation for busybox
*
- * Copyright (c) by a whole pile of folks:
+ * Copyright (c) by a whole pile of folks:
*
* test(1); version 7-like -- author Erik Baalbergen
* modified by Eric Gisin to be used as built-in.
* (-x -c -b -p -u -g -k) plus Korn's -L -nt -ot -ef and new -S (socket).
* modified by J.T. Conklin for NetBSD.
* modified by Herbert Xu to be used as built-in in ash.
- * modified by Erik Andersen <andersen@codepoet.org> to be used
+ * modified by Erik Andersen <andersen@codepoet.org> to be used
* in busybox.
*
* This program is free software; you can redistribute it and/or modify
/*
* Mini touch implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* Copyright (c) Michiel Huisjes
*
- * This version of tr is adapted from Minix tr and was modified
+ * This version of tr is adapted from Minix tr and was modified
* by Erik Andersen <andersen@codepoet.org> to be used in busybox.
*
* This program is free software; you can redistribute it and/or modify
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ *
* Original copyright notice is retained at the end of this file.
*/
/*
* Copyright (c) 1987,1997, Prentice Hall
* All rights reserved.
- *
+ *
* Redistribution and use of the MINIX operating system in source and
* binary forms, with or without modification, are permitted provided
* that the following conditions are met:
- *
+ *
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
- *
+ *
* Neither the name of Prentice Hall nor the names of the software
* authors or contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
/*
* Mini true implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* Based on specification from
* http://www.opengroup.org/onlinepubs/007904975/utilities/uuencode.html
*
- * Bugs: the spec doesnt mention anything about "`\n`\n" prior to the "end" line
+ * Bugs: the spec doesnt mention anything about "`\n`\n" prior to the "end" line
*/
if (length > 60) {
bb_error_msg_and_die("Line too long");
}
-
+
line_ptr++;
/* Tolerate an overly long line to acomadate a possible exta '`' */
if (strlen(line_ptr) < length) {
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Rewritten to fix a number of problems and do some size optimizations.
- * Problems in the previous busybox implementation (besides bloat) included:
+ * Problems in the previous busybox implementation (besides bloat) included:
* 1) broken 'wc -c' optimization (read note below)
* 2) broken handling of '-' args
* 3) no checking of ferror on EOF returns
char status = EXIT_SUCCESS;
char in_word;
char print_type;
-
+
print_type = bb_getopt_ulflags(argc, argv, wc_opts);
-
+
if (print_type == 0) {
print_type = (1 << WC_LINES) | (1 << WC_WORDS) | (1 << WC_CHARS);
}
-
+
argv += optind;
if (!*argv) {
*--argv = (char *) bb_msg_standard_input;
}
-
+
memset(totals, 0, sizeof(totals));
-
+
pcounts = counts;
-
+
do {
++num_files;
if (!(fp = bb_wfopen_input(*argv))) {
status = EXIT_FAILURE;
continue;
}
-
+
memset(counts, 0, sizeof(counts));
linepos = 0;
in_word = 0;
-
+
do {
++counts[WC_CHARS];
c = getc(fp);
} else {
continue;
}
-
+
counts[WC_WORDS] += in_word;
in_word = 0;
if (c == EOF) {
break;
}
} while (1);
-
+
if (totals[WC_LENGTH] < counts[WC_LENGTH]) {
totals[WC_LENGTH] = counts[WC_LENGTH];
}
totals[WC_LENGTH] -= counts[WC_LENGTH];
-
+
bb_fclose_nonstdin(fp);
-
+
OUTPUT:
s = fmt_str + 1; /* Skip the leading space on 1st pass. */
u = 0;
}
totals[u] += pcounts[u];
} while (++u < 4);
-
+
s += 8; /* Set the format to the empty string. */
-
+
if (*argv != bb_msg_standard_input) {
s -= 3; /* We have a name, so do %s conversion. */
}
bb_printf(s, *argv);
-
+
} while (*++argv);
-
+
/* If more than one file was processed, we want the totals. To save some
* space, we set the pcounts ptr to the totals array. This has the side
* effect of trashing the totals array after outputting it, but that's
pcounts = totals;
goto OUTPUT;
}
-
+
bb_fflush_stdout_and_exit(status);
}
/* vi: set sw=4 ts=4: */
/*----------------------------------------------------------------------
- * Mini who is used to display user name, login time,
+ * Mini who is used to display user name, login time,
* idle time and host name.
*
* Author: Da Chen <dchen@ayrnetworks.com>
* as published by the Free Software Foundation:
* http://www.gnu.org/copyleft/gpl.html
*
- * Copyright (c) 2002 AYR Networks, Inc.
+ * Copyright (c) 2002 AYR Networks, Inc.
*----------------------------------------------------------------------
*/
struct utmp *ut;
struct stat st;
int devlen, len;
- time_t now, idle;
+ time_t now, idle;
- if (argc > 1)
+ if (argc > 1)
bb_show_usage();
setutent();
devlen = sizeof("/dev/") - 1;
- printf("USER TTY IDLE FROM HOST\n");
+ printf("USER TTY IDLE FROM HOST\n");
while ((ut = getutent()) != NULL) {
char name[40];
- if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) {
+ if (ut->ut_user[0] && ut->ut_type == USER_PROCESS) {
len = strlen(ut->ut_line);
- if (ut->ut_line[0] == '/') {
+ if (ut->ut_line[0] == '/') {
strncpy(name, ut->ut_line, len);
name[len] = '\0';
strcpy(ut->ut_line, ut->ut_line + devlen);
strncpy(name+devlen, ut->ut_line, len);
name[devlen+len] = '\0';
}
-
+
printf("%-10s %-8s ", ut->ut_user, ut->ut_line);
if (stat(name, &st) == 0) {
- now = time(NULL);
+ now = time(NULL);
idle = now - st.st_atime;
-
+
if (idle < 60)
printf("00:00m ");
- else if (idle < (60 * 60))
+ else if (idle < (60 * 60))
printf("00:%02dm ", (int)(idle / 60));
- else if (idle < (24 * 60 * 60))
+ else if (idle < (24 * 60 * 60))
printf("%02d:%02dm ", (int)(idle / (60 * 60)),
(int)(idle % (60 * 60)) / 60);
- else if (idle < (24 * 60 * 60 * 365))
+ else if (idle < (24 * 60 * 60 * 365))
printf("%03ddays ", (int)(idle / (24 * 60 * 60)));
- else
+ else
printf("%02dyears ", (int) (idle / (24 * 60 * 60 * 365)));
- } else
- printf("%-8s ", "?");
-
+ } else
+ printf("%-8s ", "?");
+
printf("%-12.12s %s\n", ctime(&(ut->ut_tv.tv_sec)) + 4, ut->ut_host);
}
}
busybox-cvs (0.60.99.cvs20030426-9) unstable; urgency=low
* modutils/depmod.c
- - fix base_dir for modules.dep
+ - fix base_dir for modules.dep
-- Bastian Blank <waldi@debian.org> Sat, 07 Jun 2003 14:52:54 +0200
busybox-cvs (0.60.99.cvs20030105-1) unstable; urgency=low
* Fix ip command build failure on ia64 (Closes: #172580
- * Dont build with BSD partition table support in fdisk, fails on m68k
+ * Dont build with BSD partition table support in fdisk, fails on m68k
-- Glenn McGrath <bug1@home> Sun, 5 Jan 2003 12:48:05 +1100
busybox-cvs (0.60.99.cvs20030104-2) unstable; urgency=low
- * floppy-retriever needs the cut command in the udeb
+ * floppy-retriever needs the cut command in the udeb
-- Glenn McGrath <bug1@debian.org> Sat, 4 Jan 2003 17:13:05 +1100
busybox (1:0.51-3) unstable; urgency=low
* This is the "I am an idiot" release.
- * Make cp and mv work again (closes: #97290)
+ * Make cp and mv work again (closes: #97290)
* Fix the version number.
-- Erik Andersen <andersee@debian.org> Sat, 12 May 2001 17:35:58 -0600
for complete details)
* Force USE_SYSTEM_PWD_GRP=false, so busybox bypasses
the glibc NSS libraries. (closes: #93362)
- * Fixed a bug in sed's address range handling (closes: #91758)
+ * Fixed a bug in sed's address range handling (closes: #91758)
* Removed irrelevant cruft from the bottem of debian/changelog
-- Erik Andersen <andersee@debian.org> Tue, 10 Apr 2001 14:07:29 -0600
busybox (0.50-2) unstable; urgency=low
-
+
* Enabled freeramdisk and pivot_root in the udeb (closes: #91336)
* Disabled lash (the busybox shell) in the udeb (closes: #91337)
* fixed a bug in syslog, a problem with rebooting when booted as
busybox (0.50-2) unstable; urgency=low
-
+
* Enabled freeramdisk and pivot_root in the udeb (closes: #91336)
* Disabled lash (the busybox shell) in the udeb (closes: #91337)
* fixed a bug in syslog, a problem with rebooting when booted as
busybox (0.48-1) unstable; urgency=low
* Lots more source updates and bug fixes. See changelog for details.
- * Now includes .udeb support for the debian-installer. The .udeb
+ * Now includes .udeb support for the debian-installer. The .udeb
probably needs some more work, but this should be a good start.
-- Erik Andersen <andersee@debian.org> Wed, 13 Dec 2000 08:36:07 -0700
busybox (0.45-1) unstable; urgency=low
- * First attempt at packaging BusyBox as a .deb. This has been in
+ * First attempt at packaging BusyBox as a .deb. This has been in
in the Debian boot-floppies CVS tree forever. Hopefully, having it as a
standalone app will make life easier for me, the debian-installer team, and
everyone else as well...
- * I have created a busybox-static that can be used as a rescue shell when you
+ * I have created a busybox-static that can be used as a rescue shell when you
hose your system. Just invoke "busybox sh" to fir up the shell. This has
every app provided by busybox staically linked in. There have been several
times in the past that I would have loved to have this sitting on my system
counterparts.
.
busybox-udeb is used by the debian-installer, so unless you are working
- on the debian-installer, this package is not for you. Installing this
+ on the debian-installer, this package is not for you. Installing this
on your Debian system is a very, very bad idea. You have been warned.
Package: busybox-cvs-floppy-udeb
counterparts.
.
busybox-udeb is used by the debian-installer, so unless you are working
- on the debian-installer, this package is not for you. Installing this
+ on the debian-installer, this package is not for you. Installing this
on your Debian system is a very, very bad idea. You have been warned.
It is useful to set up a directory like cron.daily, where you need to
execute all the scripts in that directory.
- In this implementation of run-parts some features (such as report mode)
+ In this implementation of run-parts some features (such as report mode)
are not implemented.
Unless you know that run-parts is used in some of your scripts
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
}
else if (opt != 'q') {
bb_show_usage();
- }
+ }
}
if (optind + 1 != argc) {
* Based on the Debian run-parts program, version 1.15
* Copyright (C) 1996 Jeff Noxon <jeff@router.patch.net>,
* Copyright (C) 1996-1999 Guy Maor <maor@debian.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
* attempt to write a program! :-) . */
/* This piece of code is heavily based on the original version of run-parts,
- * taken from debian-utils. I've only removed the long options and a the
+ * taken from debian-utils. I've only removed the long options and a the
* report mode. As the original run-parts support only long options, I've
- * broken compatibility because the BusyBox policy doesn't allow them.
- * The supported options are:
+ * broken compatibility because the BusyBox policy doesn't allow them.
+ * The supported options are:
* -t test. Print the name of the files to be executed, without
* execute them.
- * -a ARG argument. Pass ARG as an argument the program executed. It can
+ * -a ARG argument. Pass ARG as an argument the program executed. It can
* be repeated to pass multiple arguments.
* -u MASK umask. Set the umask of the program executed to MASK. */
-/* TODO
+/* TODO
* done - convert calls to error in perror... and remove error()
- * done - convert malloc/realloc to their x... counterparts
+ * done - convert malloc/realloc to their x... counterparts
* done - remove catch_sigchld
- * done - use bb's concat_path_file()
+ * done - use bb's concat_path_file()
* done - declare run_parts_main() as extern and any other function as static?
*/
/* Set the umask of the programs executed */
case 'u':
/* Check and set the umask of the program executed. As stated in the original
- * run-parts, the octal conversion in libc is not foolproof; it will take the
+ * run-parts, the octal conversion in libc is not foolproof; it will take the
* 8 and 9 digits under some circumstances. We'll just have to live with it.
*/
umask(bb_xgetlarg(optarg, 8, 0, 07777));
/*
* Which implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
count = 5;
}
- while (argc-- > 0) {
+ while (argc-- > 0) {
char *buf;
char *path_n;
char found = 0;
BusyBox is maintained by <a href=
"http://codepoet.org/andersen/erik/erik.html">Erik Andersen</a>, and
-licensed under the
+licensed under the
<a href= "http://www.gnu.org/copyleft/gpl.html">GNU GENERAL PUBLIC LICENSE</a>
<p>
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!
+consider these fine companies!
<ul>
</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>.
+your name added here, email <a href= "mailto:andersen@codepoet.org">Erik</a>.
<!--#include file="footer.html" -->
/PentE { stroke [] 0 setdash gsave
translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
closepath stroke grestore } def
-/CircE { stroke [] 0 setdash
+/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
/PentW { stroke [] 0 setdash gsave
translate 0 hpt M 4 {72 rotate 0 hpt L} repeat
Opaque stroke grestore } def
-/CircW { stroke [] 0 setdash
+/CircW { stroke [] 0 setdash
hpt 0 360 arc Opaque stroke } def
/BoxFill { gsave Rec 1 setgray fill grestore } def
end
The code and graphics on this website (and it's mirror sites, if any) are
-Copyright (c) 1999-2003 by Erik Andersen. All rights reserved.
+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
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
+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>
diff -ubBwpN
checkout -P</pre>
-<p>
+<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:
<dl>
<dt><pre>cvs checkout -c</pre>
<dd>Will list the modules available for checkout
- <dt><pre>cvs checkout < module name ></pre>
+ <dt><pre>cvs checkout < module name ></pre>
<dd>Will checkout the named module
- <dt><pre>cvs co < module name ></pre>
+ <dt><pre>cvs co < module name ></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
+ <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,
+ 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
<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
+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
<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
+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
<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>.
+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" -->
<h3>Documentation</h3>
-Current documentation for BusyBox includes:
+Current documentation for BusyBox includes:
<ul>
<li><a href=
downloaded from <a href="downloads">http://www.busybox.net/downloads</a>.
<p>
-You can also obtain <a href= "downloads/snapshots/">Daily Snapshots</a> of
+You can also obtain <a href= "downloads/snapshots/">Daily Snapshots</a> of
the latest stable, and the latest development CVS source trees.
<p>
<font face="arial, helvetica, sans-serif" size="-1">
<a HREF="/copyright.txt">Copyright © 1999-2003 Erik Andersen</a>
<br>
- Mail all comments, insults, suggestions and bribes to
+ Mail all comments, insults, suggestions and bribes to
<br>
Erik Andersen <A HREF="mailto:andersen@codepoet.org">andersen@codepoet.org</A><BR>
</font>
</head>
<body>
- <basefont face="lucida, helvetica, arial" size="3">
+ <basefont face="lucida, helvetica, arial" size="3">
<tr>
-<td valign="TOP">
+<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="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>
just the GPL. <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
+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.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>
<p>
-<b>A written offer</b> generally means that somewhere in the
-docs for your product, you write something like
+<b>A written offer</b> generally means that somewhere in the
+docs 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>
Or you can offer source by writing
-somewhere in the docs for your product something like
+somewhere in the docs for your product something like
<blockquote>
If you would like a copy of the GPL source code in this product
on a CD, please send $9.99 to <address> for the costs of
Additionally, 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
+supported by the
<a href="http://www.gnu.org/licenses/gpl.html">text of GPL</a>.
Please do re-read it, and you
will find there is no such provision. If you distribute any GPL'd
<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>.
+development. You can subscribe by visiting
+<a href="http://codepoet.org/mailman/listinfo/busybox">this page</a>.
<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>.
+faint of heart. Active developers can subscribe by visiting
+<a href="http://codepoet.org/mailman/listinfo/busybox-cvs">this page</a>.
<p>
<p>
- The <a href="downloads/Changelog">changelog</a> has all
- the details. And as usual you can
+ The <a href="downloads/Changelog">changelog</a> has all
+ the details. And as usual you can
<a href="downloads">download busybox here</a>.
<p>Have Fun!
<p>
- <li><b>Old News</b><p>
+ <li><b>Old News</b><p>
<a href="/oldnews.html">Click here to read older news</a>
<ul>
- <li><b>10 December 2003 -- BusyBox 1.0.0-pre4 released</b><p>
+ <li><b>10 December 2003 -- BusyBox 1.0.0-pre4 released</b><p>
Here goes the fourth pre-release for the new BusyBox stable
series. This release includes major rework to sed, lots of
common applet, the dpkg applets has been cleaned up, and tons
of random bugs have been fixed. Thanks everyone for all the
testing, bug reports, and patches! Once again, a big
- thank-you goes to Glenn McGrath (bug1) for stepping in and
+ thank-you goes to Glenn McGrath (bug1) for stepping in and
helping get patches merged!
<p>
<p>
- The <a href="downloads/Changelog">changelog</a> has all
- the details. And as usual you can
+ The <a href="downloads/Changelog">changelog</a> has all
+ the details. And as usual you can
<a href="downloads">download busybox here</a>.
<p>Have Fun!
<p>
- <li><b>12 Sept 2003 -- BusyBox 1.0.0-pre3 released</b><p>
+ <li><b>12 Sept 2003 -- BusyBox 1.0.0-pre3 released</b><p>
Here goes the third pre-release for the new BusyBox stable
series. The last prerelease has held up quite well under
the testing, bug reports, and patches!
<p>
-
+
If you have submitted a patch or a bug report to the busybox
mailing list and no one has emailed you explaining why your
patch was rejected, it is safe to say that your patch has
<p>
I had hoped this release would be out a month ago. And of
- course, it wasn't since Erik became busy getting a release of
- <a href="http://www.uclibc.org/">uClibc</a>
+ course, it wasn't since Erik became busy getting a release of
+ <a href="http://www.uclibc.org/">uClibc</a>
out the door. Many thanks to Glenn McGrath (bug1) for
stepping in and helping get a bunch of patches merged! I am
not even going to state a date for releasing BusyBox 1.0.0
-pre4 (or the final 1.0.0). We're aiming for late September...
But if this release proves as to be exceptionally stable (or
exceptionally unstable!), the next release may be very soon
- indeed.
+ indeed.
<p>
- The <a href="downloads/Changelog">changelog</a> has all
- the details. And as usual you can
+ The <a href="downloads/Changelog">changelog</a> has all
+ the details. And as usual you can
<a href="downloads">download busybox here</a>.
<p>Have Fun!
<p>
- <li><b>30 July 2003 -- BusyBox 1.0.0-pre2 released</b><p>
+ <li><b>30 July 2003 -- BusyBox 1.0.0-pre2 released</b><p>
Here goes another pre release for the new BusyBox stable
series. The last prerelease (pre1) was given quite a lot of
then...
<p>
- The <a href="downloads/Changelog">changelog</a> has all
+ The <a href="downloads/Changelog">changelog</a> has all
the details. As usual you can <a href="downloads">download busybox here</a>.
<p>Have Fun!
<p>
<p>
- <li><b>15 July 2003 -- BusyBox 1.0.0-pre1 released</b><p>
+ <li><b>15 July 2003 -- BusyBox 1.0.0-pre1 released</b><p>
The busybox development series has been under construction for
nearly two years now. Which is just entirely too long... So
up) the final BusyBox 1.0.0 release should be ready by the end
of July.
<p>
-
+
If you have submitted patches, and they are not in this release
and I have not emailed you explaining why your patch was
rejected, it is safe to say that I have lost your patch. That
<p>
As usual you can <a href="downloads">download busybox here</a>.
- You don't really need to bother with the
+ You don't really need to bother with the
<a href="downloads/Changelog">changelog</a>, as the changes
vs the stable version are way too extensive to easily enumerate.
But you can take a look if you really want too.
<p>
- <li><b>26 October 2002 -- BusyBox 0.60.5 released</b><p>
+ <li><b>26 October 2002 -- BusyBox 0.60.5 released</b><p>
I am very pleased to announce that the BusyBox 0.60.5 (stable)
is now available for download. This is a bugfix release for
0.60.x series. Well, it turns out I'm a liar. But this time I
mean it (just like last time ;-). This will be the last
release for the 0.60.x series -- all further development work
- will be done for the development busybox tree. Expect the development
+ will be done for the development busybox tree. Expect the development
version to have its first real release very very soon now...
<p>
<p>
<p>
- <li><b>18 September 2002 -- BusyBox 0.60.4 released</b><p>
+ <li><b>18 September 2002 -- BusyBox 0.60.4 released</b><p>
I am very pleased to announce that the BusyBox 0.60.4
- (stable) is now available for download. This is primarily
+ (stable) is now available for download. This is primarily
a bugfix release for the stable series to address all
the problems that have turned up since the last
release. This will be the last release for the 0.60.x series.
- I mean it this time -- all further development work will be done
+ I mean it this time -- all further development work will be done
on the development busybox tree, which is quite solid now and
should soon be getting its first real release.
<p>
- <li><b>27 April 2002 -- BusyBox 0.60.3 released</b><p>
+ <li><b>27 April 2002 -- BusyBox 0.60.3 released</b><p>
I am very pleased to announce that the BusyBox 0.60.3 (stable) is
now available for download. This is primarily a bugfix release
- for the stable series. A number of problems have turned up since
+ for the stable series. A number of problems have turned up since
the last release, and this should address most of those problems.
- This should be the last release for the 0.60.x series. The
+ This should be the last release for the 0.60.x series. The
development busybox tree has been progressing nicely, and will
hopefully be ready to become the next stable release.
<p>
- <li><b>6 March 2002 -- busybox.net now has mirrors!</b><p>
+ <li><b>6 March 2002 -- busybox.net now has mirrors!</b><p>
Busybox.net is now much more available, thanks to
the fine folks at <a href= "http://i-netinnovations.com/">http://i-netinnovations.com/</a>
who are providing hosting for busybox.net and
uclibc.org. In addition, we now have two mirrors:
<a href= "http://busybox.linuxmagic.com/">http://busybox.linuxmagic.com/</a>
- in Canada and
+ in Canada and
<a href= "http://busybox.csservers.de/">http://busybox.csservers.de/</a>
in Germany. I hope this makes things much more
accessible for everyone!
<li>
-<b>3 January 2002 -- Welcome to busybox.net!</b>
+<b>3 January 2002 -- Welcome to busybox.net!</b>
<p>Thanks to the generosity of a number of busybox
users, we have been able to purchase busybox.net
some of you will volunteer to set up some mirror
sites, to help to distribute the load a bit.</p>
-<p><!--
+<p><!--
<center>
Click here to help support busybox.net!
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
</li>
<li>
-<b>20 November 2001 -- BusyBox 0.60.2 released</b>
+<b>20 November 2001 -- BusyBox 0.60.2 released</b>
<p>We am very pleased to announce that the BusyBox
0.60.2 (stable) is now released to the world. This
for a couple of years and start paying for bandwidth, so this will
initially cost about $300. I would like to host busybox.net on my
home machine (codepoet.org) so I have full control over the system,
-but to do that would require that I increase the level of bandwidth
+but to do that would require that I increase the level of bandwidth
I am paying for. Did you know that so far this month, there
have been over 1.4 Gigabytes of busybox ftp downloads? I don't
even <em>know</em> how much CVS bandwidth it requires. For the
time being, Lineo has continued to graciously provide this
-bandwidth, despite the fact that I no longer work for them. If I
-start running this all on my home machine, paying for the needed bandwidth
+bandwidth, despite the fact that I no longer work for them. If I
+start running this all on my home machine, paying for the needed bandwidth
will start costing some money.
<p>
I was going to pay it all myself, but my wife didn't like that
idea at all (big surprise). It turns out <insert argument
-where she wins and I don't> she has better ideas
+where she wins and I don't> she has better ideas
about what we should spend our money on that don't involve
busybox. She suggested I should ask for contributions on the
mailing list and web page. So...
I am hoping that if everyone could contribute a bit, we could pick
up the busybox.net domain name and cover the bandwidth costs. I
know that busybox is being used by a lot of companies as well as
-individuals -- hopefully people and companies that are willing to
-contribute back a bit. So if everyone could please help out, that
+individuals -- hopefully people and companies that are willing to
+contribute back a bit. So if everyone could please help out, that
would be wonderful!
<p>
new features, no new applets. So without further ado,
here it is. Come and get it.
<p>
- The
+ The
<a href="downloads/Changelog">changelog</a> has all
- the details. As usual BusyBox 0.60.1 can be downloaded from
+ the details. As usual BusyBox 0.60.1 can be downloaded from
<a href="downloads">http://busybox.net/downloads</a>.
<p>Have Fun!
<p>
stable bug-free(tm) release out seems to be in order. This releases fixes
a memory leak in syslogd, a number of bugs in the ash and msh shells, and
cleans up a number of things.
-
+
<p>
- Those wanting an easy way to test the 0.60.0 release with uClibc can
+ Those wanting an easy way to test the 0.60.0 release with uClibc can
use <a href="http://user-mode-linux.sourceforge.net/">User-Mode Linux</a>
- to give it a try by downloading and compiling
+ to give it a try by downloading and compiling
<a href="ftp://busybox.net/buildroot.tar.gz">buildroot.tar.gz</a>.
You don't have to be root or reboot your machine to run test this way.
Preconfigured User-Mode Linux kernel source is also on busybox.net.
<p>
Another cool thing is the nifty <a href="downloads/tutorial/index.html">
- BusyBox Tutorial</a> contributed by K Computing. This requires
- a ShockWave plugin (or standalone viewer), so you may want to grab the
+ BusyBox Tutorial</a> contributed by K Computing. This requires
+ a ShockWave plugin (or standalone viewer), so you may want to grab the
the GPLed shockwave viewer from <a href="http://www.swift-tools.com/Flash/flash-0.4.10.tgz">here</a>
to view the tutorial.
<p>
-
+
Finally, In case you didn't notice anything odd about the
version number of this release, let me point out that this release
is <em>not</em> 0.53, because I bumped the version number up a
released as part of a new BusyBox development series that will
have some not-yet-decided-on odd version number. Once things
stabilize and the new build system is working for everyone, then
- I will release that as a new stable release series.
+ I will release that as a new stable release series.
<p>
- The
+ The
<a href="downloads/Changelog">changelog</a> has all
- the details. As usual BusyBox 0.60.0 can be downloaded from
+ the details. As usual BusyBox 0.60.0 can be downloaded from
<a href="downloads">http://busybox.net/downloads</a>.
<p>Have Fun!
<p>
and ash).
<p>
- The
- <a href="downloads/Changelog">changelog</a> covers
+ The
+ <a href="downloads/Changelog">changelog</a> covers
some of the more obvious details, but there are many many things that
are not mentioned, but have been improved in subtle ways. As usual,
- BusyBox 0.52 can be downloaded from
+ BusyBox 0.52 can be downloaded from
<a href="downloads">http://busybox.net/downloads</a>.
<p>Have Fun!
<p>
<li> <b>10 April 2001 - Graph of Busybox Growth </b>
-<br>
+<br>
The illustrious Larry Doolittle has made a PostScript chart of the growth
of the Busybox tarball size over time. It is available for downloading /
viewing <a href= "busybox-growth.ps"> right here</a>.
compiles on itanium systems (thanks to the Debian itanium porters
for letting me use their system!).
<p>
- You can read the
+ You can read the
<a href="downloads/Changelog">changelog</a> for
- complete details. BusyBox 0.51 can be downloaded from
+ complete details. BusyBox 0.51 can be downloaded from
<a href="downloads">http://busybox.net/downloads</a>.
<p>Have Fun!
<p>
<p> If you want to look at the contents of the initrd image, do this:
<pre>
- mount ./busybox.floppy.img /mnt -o loop -t msdos
- cp /mnt/initrd.gz /tmp
- umount /mnt
+ mount ./busybox.floppy.img /mnt -o loop -t msdos
+ cp /mnt/initrd.gz /tmp
+ umount /mnt
gunzip /tmp/initrd.gz
mount /tmp/initrd /mnt -o loop -t minix
</pre>
and tftp, and also fixes tons of bugs. Tab completion in the
shell is now working very well, and the shell's environment variable
expansion was fixed. Tons of other things were fixed or made
- smaller. For a fairly complete overview, see the
+ smaller. For a fairly complete overview, see the
<a href="downloads/Changelog">changelog</a>.
<p>
lash (the busybox shell) is still with us, fixed up a bit so it
this shell, while very usable, does not provide an extensible
framework for adding in full Bourne shell behavior. So the first order of
business as we begin working on the next BusyBox release will be to merge in the new shell
- currently in progress at
- <a href="http://doolittle.faludi.com/~larry/parser.html">Larry Doolittle's website</a>.
+ currently in progress at
+ <a href="http://doolittle.faludi.com/~larry/parser.html">Larry Doolittle's website</a>.
<p>
<li> <b>27 January 2001 -- BusyBox 0.49 released</b>
<br>
- Several new applets, lots of bug fixes, cleanups, and many smaller
+ Several new applets, lots of bug fixes, cleanups, and many smaller
things made nicer. Several cleanups and improvements to the shell.
- For a list of the most interesting changes
- you might want to look at the <a href="downloads/Changelog">changelog</a>.
+ For a list of the most interesting changes
+ you might want to look at the <a href="downloads/Changelog">changelog</a>.
<p>
Special thanks go out to Matt Kraai and Larry Doolittle for all their
- work on this release, and for keeping on top of things while I've been
+ work on this release, and for keeping on top of things while I've been
out of town.
<p>
<em>Special Note</em><br>
shell that will eventually replace lash is already under
construction. This new shell is being developed by Larry
Doolittle, and could use all of our help. Please see the work in
- progress on <a href="http://doolittle.faludi.com/~larry/parser.html">Larry's website</a>
- and help out if you can. This shell will be included in the next
+ progress on <a href="http://doolittle.faludi.com/~larry/parser.html">Larry's website</a>
+ and help out if you can. This shell will be included in the next
release of BusyBox.
<p>
that 'tar -X' and 'tar --exclude' are both now in. Applets are
now looked up using a binary search making lash (the busybox
shell) much faster. For the new debian-installer (for Debian
- woody) a .udeb can now be generated.
+ woody) a .udeb can now be generated.
<p>
- The curious can get a list of some of the more interesting changes by reading
- the <a href="downloads/Changelog">changelog</a>.
+ The curious can get a list of some of the more interesting changes by reading
+ the <a href="downloads/Changelog">changelog</a>.
<p>
- Many thanks go out to the many many people that have contributed to
+ Many thanks go out to the many many people that have contributed to
this release, especially Matt Kraai, Larry Doolittle, and Kent Robotti.
<p>
<p> <li> <b>26 September 2000 -- BusyBox 0.47 released</b>
This release fixes lots of bugs (including an ugly bug in 0.46
syslogd that could fork-bomb your system). Added several new
- apps: rdate, wget, getopt, dos2unix, unix2dos, reset, unrpm,
+ apps: rdate, wget, getopt, dos2unix, unix2dos, reset, unrpm,
renice, xargs, and expr. syslogd now supports network logging.
There are the usual tar updates. Most apps now use getopt for
more correct option parsing.
- See the <a href="downloads/Changelog">changelog</a>
+ See the <a href="downloads/Changelog">changelog</a>
for complete details.
<br>
This release fixes several bugs (including a ugly bug in tar,
- and fixes for NFSv3 mount support). Added a dumpkmap to allow
+ and fixes for NFSv3 mount support). Added a dumpkmap to allow
people to dump a binary keymaps for use with 'loadkmap', and a
completely reworked 'grep' and 'sed' which should behave better.
BusyBox shell can now also be used as a login shell.
- See the <a href="downloads/Changelog">changelog</a>
+ See the <a href="downloads/Changelog">changelog</a>
for complete details.
the <a href="downloads/Changelog">changelog</a> for
details).
<p>
- Also, some exciting infrastructure news! Busybox now has its own
- <a href="lists/busybox/">mailing list</a>,
+ Also, some exciting infrastructure news! Busybox now has its own
+ <a href="lists/busybox/">mailing list</a>,
publically browsable
- <a href="/cgi-bin/cvsweb/busybox/">CVS tree</a>,
+ <a href="/cgi-bin/cvsweb/busybox/">CVS tree</a>,
anonymous
<a href="cvs_anon.html">CVS access</a>, and
- for those that are actively contributing there is even
+ for those that are actively contributing there is even
<a href="cvs_write.html">CVS write access</a>.
I think this will be a huge help to the ongoing development of BusyBox.
<p>
from "A" would have been logged. This means that if init tries to log something
while say ppp has the syslog open, init would block (which is bad, bad, bad).
<p>
-Karl M. Hegbloom has created a fix for the problem.
+Karl M. Hegbloom has created a fix for the problem.
Thanks Karl!
I have finally gotten everything into a state where I feel pretty
good about things. This is definitely the most stable, solid release
so far. A lot of bugs have been fixed, and the following new apps
-have been added: sh, basename, dirname, killall, uptime,
+have been added: sh, basename, dirname, killall, uptime,
freeramdisk, tr, echo, test, and usleep. Tar has been completely
rewritten from scratch. Bss size has also been greatly reduced.
-More details are available in the
+More details are available in the
<a href="downloads/Changelog">changelog</a>.
Oh, and as a special bonus, I wrote some fairly comprehensive
<em>documentation</em>, complete with examples and full usage information.
<p>
Many thanks go out to the fine people that have helped by submitting patches
-and bug reports; particularly instrumental in helping for this release were
+and bug reports; particularly instrumental in helping for this release were
Karl Hegbloom, Pavel Roskin, Friedrich Vedder, Emanuele Caratti,
Bob Tinsley, Nicolas Pitre, Avery Pennarun, Arne Bernin, John Beppu, and Jim Gleason.
There were others so if I somehow forgot to mention you, I'm very sorry.
So now that I am done with my excuse for the slow release cycle...
Progress on the next release of BusyBox has been slow but steady. I expect
to have a release sometime during the first week of April. This release will
-include a number of important changes, including the addition of a shell, a
+include a number of important changes, including the addition of a shell, a
re-write of tar (to accommodate the Linux Router Project), and syslogd can now
-accept multiple concurrent connections, fixing lots of unexpected blocking
+accept multiple concurrent connections, fixing lots of unexpected blocking
problems.
<br>
This is the most solid BusyBox release so far. Many, many
- bugs have been fixed. See the
+ bugs have been fixed. See the
<a href="downloads/Changelog">changelog</a> for details.
- Of particular interest, init will now cleanly unmount
- filesystems on reboot, cp and mv have been rewritten and
- behave much better, and mount and umount no longer leak
- loop devices. Many thanks go out to Randolph Chung,
- Karl M. Hegbloom, Taketoshi Sano, and Pavel Roskin for
- their hard work on this release of BusyBox. Please pound
+ Of particular interest, init will now cleanly unmount
+ filesystems on reboot, cp and mv have been rewritten and
+ behave much better, and mount and umount no longer leak
+ loop devices. Many thanks go out to Randolph Chung,
+ Karl M. Hegbloom, Taketoshi Sano, and Pavel Roskin for
+ their hard work on this release of BusyBox. Please pound
on it and let me know if you find any bugs.
<p> <li> <b>19 January 2000 -- BusyBox 0.41 released</b>
<br>
This release includes bugfixes to cp, mv, logger, true, false,
- mkdir, syslogd, and init. New apps include wc, hostid,
+ mkdir, syslogd, and init. New apps include wc, hostid,
logname, tty, whoami, and yes. New features include loop device
support in mount and umount, and better TERM handling by init.
The changelog can be found <a href="downloads/Changelog">here</a>.
This release includes bugfixes to init (now includes inittab support),
syslogd, head, logger, du, grep, cp, mv, sed, dmesg, ls, kill, gunzip, and mknod.
New apps include sort, uniq, lsmod, rmmod, fbset, and loadacm.
- In particular, this release fixes an important bug in tar which
+ In particular, this release fixes an important bug in tar which
in some cases produced serious security problems.
As always, the changelog can be found <a href="downloads/Changelog">here</a>.
<br>
I have received permission from Bruce Perens (the original author of BusyBox)
to set up this site as the new primary website for BusyBox. This website
- will always contain pointers to the latest and greatest, and will also
+ will always contain pointers to the latest and greatest, and will also
contain the latest documentation on how to use BusyBox, what it can do,
what arguments its apps support, etc.
<p> <li> <b>10 December 1999 -- BusyBox 0.39 released</b>
<br>
- This release includes fixes to init, reboot, halt, kill, and ls, and contains
+ This release includes fixes to init, reboot, halt, kill, and ls, and contains
the new apps ping, hostname, mkfifo, free, tail, du, tee, and head. A full
changelog can be found <a href="downloads/Changelog">here</a>.
<p> <li> <b>5 December 1999 -- BusyBox 0.38 released</b>
<br>
- This release includes fixes to tar, cat, ls, dd, rm, umount, find, df,
- and make install, and includes new apps syslogd/klogd and logger.
+ This release includes fixes to tar, cat, ls, dd, rm, umount, find, df,
+ and make install, and includes new apps syslogd/klogd and logger.
</ul>
font-family: monospace; font-size: smaller;" width="100">
-$ ./busybox
+$ ./busybox
BusyBox v1.00-pre3 (2003.09.12-05:48+0000) multi-call binary
Usage: busybox [function] [arguments]...
<book id="BusyBoxDocumentation">
<bookinfo>
<title>BusyBox - The Swiss Army Knife of Embedded Linux</title>
-
+
<legalnotice>
<para>
This documentation is free software; you can redistribute
version 2 of the License, or (at your option) any later
version.
</para>
-
+
<para>
This program is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
</para>
-
+
<para>
You should have received a copy of the GNU General Public
License along with this program; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
</para>
-
+
<para>
For more details see the file COPYING in the source
distribution of Linux.
for any small or embedded system. 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.
+ like their GNU counterparts.
</para>
<para>
<para>
will cause BusyBox to behave as 'ls' (if the 'ls' command has been compiled
- into BusyBox).
+ into BusyBox).
</para>
<para>
</para>
<para>
- will also cause BusyBox to behave as 'ls'.
+ will also cause BusyBox to behave as 'ls'.
</para>
</sect1>
<title>Common options</title>
<para>
- Most BusyBox commands support the <emphasis>--help</emphasis> option to provide
- a terse runtime description of their behavior.
+ Most BusyBox commands support the <emphasis>--help</emphasis> option to provide
+ a terse runtime description of their behavior.
</para>
</sect1>
</chapter>
dpkg-deb, du, dumpkmap, dumpleases, dutmp, echo, egrep, env, expr,
false, fbset, fdflush, fdformat, fgrep, find, fold, free, freeramdisk,
fsck.minix, ftpget, ftpput, getopt, getty, grep, gunzip, gzip,
- halt, hdparm, head, hexdump, hostid, hostname, httpd, hush, hwclock,
+ halt, hdparm, head, hexdump, hostid, hostname, httpd, hush, hwclock,
id, ifconfig, ifdown, ifup, inetd, init, insmod, ip, ipcalc, iplink,
iproute, iptunnel, kill, killall, klogd, lash, length, linuxrc,
ln, loadfont, loadkmap, logger, login, logname, logread,
sha1sum, sleep, sort, start-stop-daemon, strings, stty, su, sulogin,
swapoff, swapon, sync, syslogd, tail, tar, tee, telnet, telnetd,
test, tftp, time, top, touch, tr, traceroute, true, tty, udhcpc,
- udhcpd, umount, uname, uncompress, uniq, unix2dos, unzip,
+ udhcpd, umount, uname, uncompress, uniq, unix2dos, unzip,
uptime, usleep, uudecode, uuencode, vconfig, vi, vlock, watch,
watchdog, wc, wget, which, who, whoami, xargs, yes, zcat, [
</screen>
</para>
</sect1>
-
+
<sect1 id="chown">
<title>chown</title>
<para>
</screen>
</para>
</sect1>
-
+
<sect1 id="dirname">
<title>dirname</title>
<title>dpkg-deb</title>
<para>
- Usage: dpkg-deb [OPTION] archive [directory]
+ Usage: dpkg-deb [OPTION] archive [directory]
</para>
<para>
- Debian package archive (.deb) manipulation tool
+ Debian package archive (.deb) manipulation tool
</para>
<para>
Options:
</para>
-
+
<para>
<screen>
- -c List the contents of the filesystem tree archive portion of the package
+ -c List the contents of the filesystem tree archive portion of the package
-e Extracts the control information files from a package archive into the specified directory.
If no directory is specified then a subdirectory DEBIAN in the current directory is used.
-x Silently extracts the filesystem tree from a package archive into the specified directory.
- -X Extracts the filesystem tree from a package archive into the specified directory, listing the files as it goes.
+ -X Extracts the filesystem tree from a package archive into the specified directory, listing the files as it goes.
If required the specified directory (but not its parents) will be created.
</screen>
<para>
</screen>
</para>
</sect1>
-
+
<sect1 id="getopt">
<title>getopt</title>
<para>
Prints out a unique 32-bit identifier for the current
machine. The 32-bit identifier is intended to be unique
- among all UNIX systems in existence.
+ among all UNIX systems in existence.
</para>
</sect1>
<para>
- Valid actions include: sysinit, respawn, askfirst, wait,
+ Valid actions include: sysinit, respawn, askfirst, wait,
once, and ctrlaltdel.
</para>
respawn, except that before running the specified process it
displays the line "Please press Enter to activate this console."
and then waits for the user to press enter before starting the
- specified process.
+ specified process.
</para>
<para>
</para>
<para>
-
+
</para>
<para>
<para>
<screen>
- $ mknod /dev/fd0 b 2 0
+ $ mknod /dev/fd0 b 2 0
$ mknod -m 644 /tmp/pipe p
</screen>
</para>
<sect1 id="run-parts">
<title>run-parts</title>
-
+
<para>
Usage: run-parts [-t] [-a ARG] [-u MASK] DIRECTORY
</para>
-
+
<para>
Run a bunch of scripts in a directory.
</para>
-
+
<para>
Options:
</para>
-
+
<para>
<screen>
-t Test only. It only print the file to be executed,
</screen>
</para>
</sect1>
-
-
+
+
<sect1 id="sed">
<title>sed</title>
</para>
<para>
- This command does not yet have proper documentation.
+ This command does not yet have proper documentation.
</para>
<para>
</para>
<para>
-
+
</para>
<para>
</para>
<para>
-
+
</para>
<para>
<para>
<screen>
- $ umount /dev/hdc1
+ $ umount /dev/hdc1
</screen>
</para>
</sect1>
</screen>
</para>
</sect1>
-
+
<sect1 id="unix2dos">
<title>unix2dos</title>
</para>
<para>
- Uncompress FILE (or stdin if FILE is '-') to stdout.
+ Uncompress FILE (or stdin if FILE is '-') to stdout.
</para>
<para>
<title>AUTHORS</title>
<para>
- The following people have made significant contributions to
+ The following people have made significant contributions to
BusyBox -- whether they know it or not.
</para>
</para>
<para>
- Dave Cinege <dcinege@psychosis.com>
+ Dave Cinege <dcinege@psychosis.com>
</para>
<para>
</para>
<para>
- John Lombardo <john@deltanet.com>
+ John Lombardo <john@deltanet.com>
</para>
<para>
tar, etc. BusyBox provides a fairly complete POSIX environment for any small
or embedded system. 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.
+the expected functionality and behave very much like their GNU counterparts.
BusyBox has been written with size-optimization and limited resources in mind.
It is also extremely modular so you can easily include or exclude commands (or
./ls
will cause BusyBox to behave as 'ls' (if the 'ls' command has been compiled
-into BusyBox).
+into BusyBox).
You can also invoke BusyBox by issuing the command as an argument on the
command line. For example, entering
./BusyBox ls
-will also cause BusyBox to behave as 'ls'.
+will also cause BusyBox to behave as 'ls'.
=head1 COMMON OPTIONS
Most BusyBox commands support the B<-h> option to provide a
-terse runtime description of their behavior.
+terse runtime description of their behavior.
=head1 COMMANDS
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
+anyone else to duplicate the bug on their own machine. The following is such
an example:
To: busybox@busybox.net
$ date
llegal instruction
- I am using Debian unstable, kernel version 2.4.19-rmk1 on an Netwinder,
+ I am using Debian unstable, kernel version 2.4.19-rmk1 on an Netwinder,
and the latest uClibc from CVS. Thanks for the wonderful program!
-Diligent
- "Ten Commandments" compliance: (this is a "maybe", certainly not as
important as any of the previous items.)
- http://www.lysator.liu.se/c/ten-commandments.html
+ http://www.lysator.liu.se/c/ten-commandments.html
Other useful links:
Usage String(s)
---------------
-Next, add usage information for you applet to include/usage.h.
+Next, add usage information for you applet to include/usage.h.
This should look like the following:
#define mu_trivial_usage \
Header Files
------------
-Next, add an entry to include/applets.h. Be *sure* to keep the list
-in alphabetical order, or else it will break the binary-search lookup
+Next, add an entry to include/applets.h. Be *sure* to keep the list
+in alphabetical order, or else it will break the binary-search lookup
algorithm in busybox.c and the Gods of BusyBox smite you. Yea, verily:
/* all programs above here are alphabetically "less than" 'mu' */
The Grand Announcement
----------------------
-Then create a diff -urN of the files you added (<appletdir/><applet>.c,
-include/usage.c, include/applets.h, include/config.h, <appletdir>/Makefile.in, <appletdir>/config.in)
+Then create a diff -urN of the files you added (<appletdir/><applet>.c,
+include/usage.c, include/applets.h, include/config.h, <appletdir>/Makefile.in, <appletdir>/config.in)
and send it to the mailing list:
-busybox@busybox.net.
+busybox@busybox.net.
Sending patches as attachments is preferred, but not required.
conversion.
- Compile and see if everything still works.
-
+
Please be aware of changes that have cascading effects into other files. For
example, if you're changing the name of something in, say utility.c, you
should probably run 'examples/mk2knr.pl utility.c' at first, but when you run
#define var 80
Do this instead, when the variable is in a header file and will be used in
- several source files:
+ several source files:
- const int var = 80;
+ const int var = 80;
Or do this when the variable is used only in a single source file:
- static const int var = 80;
+ static const int var = 80;
Declaring variables as '[static] const' gives variables an actual type and
makes the compiler do type checking for you; the preprocessor does _no_ type
Code cluttered with ifdefs is difficult to read and maintain. Don't do it.
Instead, put your ifdefs at the top of your .c file (or in a header), and
conditionally define 'static inline' functions, (or *maybe* macros), which are
-used in the code.
+used in the code.
Don't do this:
And a code block similar to the following near the top of your applet_main()
routine:
- while ((opt = getopt(argc, argv, "abc")) > 0) {
+ while ((opt = getopt(argc, argv, "abc")) > 0) {
switch (opt) {
case 'a':
do_a_opt = 1;
default n
help
'vi' is a text editor. More specifically, it is the One True
- text editor <grin>. It does, however, have a rather steep
+ text editor <grin>. It does, however, have a rather steep
learning curve. If you are not already comfortable with 'vi'
you may wish to use something else.
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
};
/* internal variable names and their initial values */
-/* asterisk marks SPECIAL vars; $ is just no-named Field0 */
+/* asterisk marks SPECIAL vars; $ is just no-named Field0 */
enum {
CONVFMT=0, OFMT, FS, OFS,
ORS, RS, RT, FILENAME,
static char * vNames =
"CONVFMT\0" "OFMT\0" "FS\0*" "OFS\0"
- "ORS\0" "RS\0*" "RT\0" "FILENAME\0"
+ "ORS\0" "RS\0*" "RT\0" "FILENAME\0"
"SUBSEP\0" "ARGIND\0" "ARGC\0" "ARGV\0"
"ERRNO\0" "FNR\0"
"NR\0" "NF\0*" "IGNORECASE\0*"
static xhash *hash_init(void) {
xhash *newhash;
-
+
newhash = (xhash *)xcalloc(1, sizeof(xhash));
newhash->csize = FIRST_PRIME;
newhash->items = (hash_item **)xcalloc(newhash->csize, sizeof(hash_item *));
/* for binary and postfix-unary operators, jump back over
* previous operators with higher priority */
vn = cn;
- while ( ((t.info & PRIMASK) > (vn->a.n->info & PRIMASK2)) ||
+ while ( ((t.info & PRIMASK) > (vn->a.n->info & PRIMASK2)) ||
((t.info == vn->info) && ((t.info & OPCLSMASK) == OC_COLON)) )
vn = vn->a.n;
if ((t.info & OPCLSMASK) == OC_TERNARY)
xtc = TC_OPERAND | TC_UOPPRE | TC_REGEXP;
if (tc & (TC_OPERAND | TC_REGEXP)) {
xtc = TC_UOPPRE | TC_BINOP | TC_OPERAND | iexp;
- /* one should be very careful with switch on tclass -
+ /* one should be very careful with switch on tclass -
* only simple tclasses should be used! */
switch (tc) {
case TC_VARIABLE:
}
xtc = TC_UOPPOST | TC_UOPPRE | TC_BINOP | TC_OPERAND | iexp;
break;
-
+
case TC_NUMBER:
case TC_STRING:
cn->info = OC_VAR;
s = f;
while (*f && (*f != '%' || *(++f) == '%'))
f++;
- while (*f && !isalpha(*f))
+ while (*f && !isalpha(*f))
f++;
incr = (f - s) + MAXVARFMT;
* - Non-interactive
* - Patches must apply cleanly or the hunk will fail.
* - Reject file isnt saved
- * -
+ * -
*/
#include <getopt.h>
bb_perror_msg_and_die("Error writing to new file");
}
free(line);
-
+
i++;
}
return(i);
}
}
- /* 0 = SUCCESS
+ /* 0 = SUCCESS
* 1 = Some hunks failed
* 2 = More serious problems
*/
/*
* index_of_next_unescaped_regexp_delim - walks left to right through a string
* beginning at a specified index and returns the index of the next regular
- * expression delimiter (typically a forward * slash ('/')) not preceeded by
+ * expression delimiter (typically a forward * slash ('/')) not preceeded by
* a backslash ('\').
*/
static int index_of_next_unescaped_regexp_delim(const char delimiter,
next = index_of_next_unescaped_regexp_delim(delimiter, ++pos);
if (next == -1)
bb_error_msg_and_die("unterminated match expression");
-
+
temp=copy_parsing_slashn(pos,next);
*regex = (regex_t *) xmalloc(sizeof(regex_t));
xregcomp(*regex, temp, REG_NEWLINE);
{
char *temp;
idx+=parse_file_cmd(sed_cmd,substr+idx,&temp);
-
+
break;
}
/* Ignore case (gnu exension) */
*/
static const char vi_Version[] =
- "$Id: vi.c,v 1.33 2004/02/06 10:36:08 andersen Exp $";
+ "$Id: vi.c,v 1.34 2004/03/15 08:28:32 andersen Exp $";
/*
* To compile for standalone use:
// char cm3[BUFSIZ];
int Rrow= last_row;
#endif /* CONFIG_FEATURE_VI_OPTIMIZE_CURSOR */
-
+
memset(cm1, '\0', BUFSIZ - 1); // clear the buffer
if (row < 0) row = 0;
if (row >= rows) row = rows - 1;
if (col < 0) col = 0;
if (col >= columns) col = columns - 1;
-
+
//----- 1. Try the standard terminal ESC sequence
sprintf((char *) cm1, CMrc, row + 1, col + 1);
cm= cm1;
//----- find the minimum # of chars to move cursor -------------
//----- 2. Try moving with discreet chars (Newline, [back]space, ...)
memset(cm2, '\0', BUFSIZ - 1); // clear the buffer
-
+
// move to the correct row
while (row < Rrow) {
// the cursor has to move up
strcat(cm2, CMdown);
Rrow++;
}
-
+
// now move to the correct column
strcat(cm2, "\r"); // start at col 0
// just send out orignal source char to get to correct place
{
int co;
Byte c;
-
+
for (co= 0; co < MAX_SCR_COLS; co++) {
c= ' '; // assume blank
if (li > 0 && co == 0) {
#else
place_cursor(crow, ccol, FALSE);
#endif /* CONFIG_FEATURE_VI_OPTIMIZE_CURSOR */
-
+
if (offset != old_offset)
old_offset = offset;
}
//case 0x1d: // gs
//case 0x1e: // rs
//case 0x1f: // us
- //case '!': // !-
- //case '#': // #-
- //case '&': // &-
- //case '(': // (-
- //case ')': // )-
- //case '*': // *-
- //case ',': // ,-
- //case '=': // =-
- //case '@': // @-
- //case 'F': // F-
- //case 'K': // K-
- //case 'Q': // Q-
- //case 'S': // S-
- //case 'T': // T-
- //case 'V': // V-
- //case '[': // [-
- //case '\\': // \-
- //case ']': // ]-
- //case '_': // _-
- //case '`': // `-
- //case 'g': // g-
+ //case '!': // !-
+ //case '#': // #-
+ //case '&': // &-
+ //case '(': // (-
+ //case ')': // )-
+ //case '*': // *-
+ //case ',': // ,-
+ //case '=': // =-
+ //case '@': // @-
+ //case 'F': // F-
+ //case 'K': // K-
+ //case 'Q': // Q-
+ //case 'S': // S-
+ //case 'T': // T-
+ //case 'V': // V-
+ //case '[': // [-
+ //case '\\': // \-
+ //case ']': // ]-
+ //case '_': // _-
+ //case '`': // `-
+ //case 'g': // g-
//case 'u': // u- FIXME- there is no undo
- //case 'v': // v-
+ //case 'v': // v-
default: // unrecognised command
buf[0] = c;
buf[1] = '\0';
break;
#endif /* CONFIG_FEATURE_VI_SEARCH */
case '0': // 0- goto begining of line
- case '1': // 1-
- case '2': // 2-
- case '3': // 3-
- case '4': // 4-
- case '5': // 5-
- case '6': // 6-
- case '7': // 7-
- case '8': // 8-
- case '9': // 9-
+ case '1': // 1-
+ case '2': // 2-
+ case '3': // 3-
+ case '4': // 4-
+ case '5': // 5-
+ case '6': // 6-
+ case '7': // 7-
+ case '8': // 8-
+ case '9': // 9-
if (c == '0' && cmdcnt < 1) {
dot_begin(); // this was a standalone zero
} else {
The following steps will create a root file system.
- Create an empty file that you can format as a filesystem:
-
+
dd if=/dev/zero of=rootfs bs=1k count=4000
- Set up the rootfs file we just created to be used as a loop device (may not
- be necessary)
+ be necessary)
- losetup /dev/loop0 rootfs
+ losetup /dev/loop0 rootfs
- Format the rootfs file with a filesystem:
Note: You will need to have the mtools package installed beforehand.
- Insert a floppy in the drive and format it with an MSDOS filesystem:
-
+
mformat a:
(if the system doesn't know what device 'a:' is, look at /etc/mtools.conf)
- Run syslinux on the floppy:
-
+
syslinux -s /dev/fd0
-
+
(the -s stands for "safe, slow, and stupid" and should work better with
buggy BIOSes; it can be omitted)
echo -n "Processing /etc/profile... "
# no-op
echo "Done"
-echo
+echo
# install uClibc
mkdir -p $TARGET_DIR/lib
cd $UCLIBC_DIR
-make INSTALL_DIR=
+make INSTALL_DIR=
cp -a libc.so* $BASE_DIR/$TARGET_DIR/lib
cp -a uClibc*.so $BASE_DIR/$TARGET_DIR/lib
-cp -a ld.so-1/d-link/ld-linux-uclibc.so* $BASE_DIR/$TARGET_DIR/lib
+cp -a ld.so-1/d-link/ld-linux-uclibc.so* $BASE_DIR/$TARGET_DIR/lib
cp -a ld.so-1/libdl/libdl.so* $BASE_DIR/$TARGET_DIR/lib
cp -a crypt/libcrypt.so* $BASE_DIR/$TARGET_DIR/lib
cd $BASE_DIR
prompt 1
label linux
kernel linux
- append initrd=rootfs.gz root=/dev/ram0
+ append initrd=rootfs.gz root=/dev/ram0
%Clean
rm -rf $RPM_BUILD_ROOT
-%Files
+%Files
%defattr(-,root,root)
/
# Copyright (c) 2001 Erik Andersen <andersen@codepoet.org>
# Copyright (c) 2001 Stuart Hughes <stuarth@lineo.com>
# Copyright (c) 2002 Steven J. Hill <shill@broadcom.com>
-# This program is free software; you can redistribute it and/or modify it
+# This program is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
# TODO -- use strict mode...
warn "WARNING: base directory does not match ..../lib/modules\n";
}
-# Find the list of .o files living under $basedir
+# Find the list of .o files living under $basedir
#if ($verbose) { printf "Locating all modules\n"; }
my($ofile) = "";
my($file) = "";
my(@liblist) = ();
-find sub {
- if ( -f $_ && ! -d $_ ) {
+find sub {
+ if ( -f $_ && ! -d $_ ) {
$file = $File::Find::name;
if ( $file =~ /.o$/ ) {
push(@liblist, $file);
foreach $module (keys %$dep) {
$mod->{$module} = {};
foreach (@{$dep->{$module}}) {
- if( $exp->{$_} ) {
+ if( $exp->{$_} ) {
warn "resolved symbol $_ in file $exp->{$_}\n" if $verbose;
next if $exp->{$_} =~ /vmlinux/;
$mod->{$module}{$exp->{$_}} = 1;
} else {
warn "unresolved symbol $_ in file $module\n";
}
- }
+ }
}
# resolve the dependancies for each module
=head1 COPYRIGHT
Copyright (c) 2001 David Schleef <ds@schleef.org>
-Copyright (c) 2001 Erik Andersen <andersen@lineo.com>
+Copyright (c) 2001 Erik Andersen <andersen@codepoet.org>
Copyright (c) 2001 Stuart Hughes <stuarth@lineo.com>
-This program is free software; you can redistribute it and/or modify it
+This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=head1 AUTHOR
=cut
-# $Id: depmod.pl,v 1.3 2003/07/14 21:20:51 andersen Exp $
+# $Id: depmod.pl,v 1.4 2004/03/15 08:28:33 andersen Exp $
# /etc/inittab init(8) configuration for BusyBox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
#
# Note, BusyBox init doesn't support runlevels. The runlevels field is
#
# <runlevels>: The runlevels field is completely ignored.
#
-# <action>: Valid actions include: sysinit, respawn, askfirst, wait, once,
+# <action>: Valid actions include: sysinit, respawn, askfirst, wait, once,
# restart, ctrlaltdel, and shutdown.
#
# Note: askfirst acts just like respawn, but before running the specified
#auto_time 7200 #default: 7200 (2 hours)
-# The amount of time that an IP will be reserved (leased) for if a
+# The amount of time that an IP will be reserved (leased) for if a
# DHCP decline message is received (seconds).
#decline_time 3600 #default: 3600 (1 hour)
echo "Usage: undeb -c package.deb <Print control file info>"
echo " undeb -l package.deb <List contents of deb package>"
echo " undeb -x package.deb /foo/boo <Extract deb package to this directory,"
-echo " put . for current directory>"
+echo " put . for current directory>"
exit
}
deb=$2
-
+
exist() {
if [ "$deb" = "" ]; then
usage
type more >/dev/null 2>&1 && pager=more
type less >/dev/null 2>&1 && pager=less
[ "$pager" = "" ] && echo "No pager found!" && exit
-(ar -p $deb control.tar.gz | tar -xzO *control ; echo -e "\nPress enter to scroll, q to Quit!\n" ; ar -p $deb data.tar.gz | tar -tzv) | $pager
+(ar -p $deb control.tar.gz | tar -xzO *control ; echo -e "\nPress enter to scroll, q to Quit!\n" ; ar -p $deb data.tar.gz | tar -tzv) | $pager
exit
elif [ "$1" = "-c" ]; then
exist
-ar -p $deb control.tar.gz | tar -xzO *control
+ar -p $deb control.tar.gz | tar -xzO *control
exit
elif [ "$1" = "-x" ]; then
exist
echo "No such directory $3!"
exit
fi
-ar -p $deb data.tar.gz | tar -xzvpf - -C $3 || exit
+ar -p $deb data.tar.gz | tar -xzvpf - -C $3 || exit
echo
echo "Extracted $deb to $3!"
exit
usage() {
echo "Usage: unrpm -l package.rpm <List contents of rpm package>"
echo " unrpm -x package.rpm /foo/boo <Extract rpm package to this directory,"
-echo " put . for current directory>"
+echo " put . for current directory>"
exit
}
rpm=$2
-
+
exist() {
if [ "$rpm" = "" ]; then
usage
default n
help
xargs is used to execute a specified command on
- every item from standard input.
+ every item from standard input.
config CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION
bool " Enable prompt and confirmation option -p"
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
/*
* Mini find implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* Reworked by David Douthitt <n9ubh@callsign.net> and
* Matt Kraai <kraai@alumni.carnegiemellon.edu>.
time_t mtime_secs = mtime_days * 24 * 60 * 60;
if (!((isdigit(mtime_char) && file_age >= mtime_secs &&
file_age < mtime_secs + 24 * 60 * 60) ||
- (mtime_char == '+' && file_age >= mtime_secs + 24 * 60 * 60) ||
+ (mtime_char == '+' && file_age >= mtime_secs + 24 * 60 * 60) ||
(mtime_char == '-' && file_age < mtime_secs)))
goto no_match;
}
xdev_dev [0] = stbuf. st_dev;
}
else {
-
+
for (i = 1; i < firstopt; i++) {
if ( stat ( argv [i], &stbuf ) < 0 )
bb_error_msg_and_die("could not stat '%s'", argv [i] );
xdev_dev [i-1] = stbuf. st_dev;
}
- }
+ }
#endif
#ifdef CONFIG_FEATURE_FIND_NEWER
} else if (strcmp(argv[i], "-newer") == 0) {
* Mini grep implementation for busybox using libc regex.
*
* Copyright (C) 1999,2000,2001 by Lineo, inc. and Mark Whitley
- * Copyright (C) 1999,2000,2001 by Mark Whitley <markw@codepoet.org>
+ * Copyright (C) 1999,2000,2001 by Mark Whitley <markw@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
int print_n_lines_after = 0;
int curpos = 0; /* track where we are in the circular 'before' buffer */
int idx = 0; /* used for iteration through the circular buffer */
-#endif /* CONFIG_FEATURE_GREP_CONTEXT */
+#endif /* CONFIG_FEATURE_GREP_CONTEXT */
while ((line = bb_get_chomped_line_from_file(file)) != NULL) {
llist_t *pattern_ptr = pattern_head;
/* make a note that we need to print 'after' lines */
print_n_lines_after = lines_after;
-#endif /* CONFIG_FEATURE_GREP_CONTEXT */
+#endif /* CONFIG_FEATURE_GREP_CONTEXT */
print_line(line, linenum, ':');
}
}
print_line(line, linenum, '-');
print_n_lines_after--;
}
-#endif /* CONFIG_FEATURE_GREP_CONTEXT */
+#endif /* CONFIG_FEATURE_GREP_CONTEXT */
free(line);
}
return 124;
}
if (WIFSTOPPED(status)) {
- bb_error_msg("%s: stopped by signal %d",
+ bb_error_msg("%s: stopped by signal %d",
args[0], WSTOPSIG(status));
return 125;
}
if (WIFSIGNALED(status)) {
- bb_error_msg("%s: terminated by signal %d",
+ bb_error_msg("%s: terminated by signal %d",
args[0], WTERMSIG(status));
return 125;
}
|| (c) == '\f' || (c) == '\v')
#ifdef CONFIG_FEATURE_XARGS_SUPPORT_QUOTES
-static xlist_t *process_stdin(xlist_t * list_arg,
+static xlist_t *process_stdin(xlist_t * list_arg,
const char *eof_str, size_t mc, char *buf)
{
#define NORM 0
}
if (state == SPACE) { /* word's delimiter or EOF detected */
if (q) {
- bb_error_msg_and_die("unmatched %s quote",
+ bb_error_msg_and_die("unmatched %s quote",
q == '\'' ? "single" : "double");
}
/* word loaded */
}
#else
/* The variant does not support single quotes, double quotes or backslash */
-static xlist_t *process_stdin(xlist_t * list_arg,
+static xlist_t *process_stdin(xlist_t * list_arg,
const char *eof_str, size_t mc, char *buf)
{
read_args = process0_stdin;
#endif
- while ((list = READ_ARGS(list, eof_str, n_max_chars, max_chars)) != NULL ||
- (opt & OPT_NO_EMPTY) == 0)
+ while ((list = READ_ARGS(list, eof_str, n_max_chars, max_chars)) != NULL ||
+ (opt & OPT_NO_EMPTY) == 0)
{
opt |= OPT_NO_EMPTY;
n = 0;
void bb_show_usage(void)
{
- fprintf(stderr, "Usage: %s [-p] [-r] [-t] -[x] [-n max_arg] [-s max_chars]\n",
+ fprintf(stderr, "Usage: %s [-p] [-r] [-t] -[x] [-n max_arg] [-s max_chars]\n",
bb_applet_name);
exit(1);
}
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
+ * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
* Permission has been granted to redistribute this code under the GPL.
*
*/
* applet usage strings. These are all of the form:
* extern int foo_main(int argc, char **argv);
* extern const char foo_usage[];
- * These are all autogenerated from the set of currently defined applets.
+ * These are all autogenerated from the set of currently defined applets.
*/
#define PROTOTYPES
#include "applets.h"
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
+ * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
* Permission has been granted to redistribute this code under the GPL.
*
*/
extern int get_console_fd(void);
extern struct mntent *find_mount_point(const char *name, const char *table);
-extern void write_mtab(char* blockDevice, char* directory,
+extern void write_mtab(char* blockDevice, char* directory,
char* filesystemType, long flags, char* string_flags);
extern void erase_mtab(const char * name);
extern long *find_pid_by_name( const char* pidName);
MEGABYTE = (KILOBYTE*1024),
GIGABYTE = (MEGABYTE*1024)
};
-const char *make_human_readable_str(unsigned long long size,
+const char *make_human_readable_str(unsigned long long size,
unsigned long block_size, unsigned long display_unit);
int bb_ask_confirmation(void);
/* process the data component, e.g. extract to filesystem */
void (*action_data)(struct archive_handle_s *);
-
+
/* How to process any sub archive, e.g. get_header_tar_gz */
char (*action_data_subarchive)(struct archive_handle_s *);
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
/*
* Mini halt implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* Mini init implementation for busybox
*
* Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
* Adjusted by so many folks, it's impossible to keep track.
*
* This program is free software; you can redistribute it and/or modify
*
*/
-/* Turn this on to disable all the dangerous
+/* Turn this on to disable all the dangerous
rebooting stuff when debugging.
#define DEBUG_INIT
*/
#if defined CONFIG_FEATURE_INIT_COREDUMPS
/*
- * When a file named CORE_ENABLE_FLAG_FILE exists, setrlimit is called
+ * When a file named CORE_ENABLE_FLAG_FILE exists, setrlimit is called
* before processes are spawned to set core file size as unlimited.
* This is for debugging only. Don't use this is production, unless
* you want core dumps lying about....
if ((s = getenv("CONSOLE")) != NULL || (s = getenv("console")) != NULL) {
safe_strncpy(console, s, sizeof(console));
#if #cpu(sparc)
- /* sparc kernel supports console=tty[ab] parameter which is also
+ /* sparc kernel supports console=tty[ab] parameter which is also
* passed to init, so catch it here */
/* remap tty[ab] to /dev/ttyS[01] */
if (strcmp(s, "ttya") == 0)
/*
Interactive shells want to see a dash in argv[0]. This
- typically is handled by login, argv will be setup this
- way if a dash appears at the front of the command path
+ typically is handled by login, argv will be setup this
+ way if a dash appears at the front of the command path
(like "-/bin/sh").
*/
* before the user wants it. This is critical if swap is not
* enabled and the system has low memory. Generally this will
* be run on the second virtual console, and the first will
- * be allowed to start a shell or whatever an init script
+ * be allowed to start a shell or whatever an init script
* specifies.
*/
messageD(LOG, "Waiting for enter to start '%s'"
}
#endif
- /* Now run it. The new program will take over this PID,
+ /* Now run it. The new program will take over this PID,
* so nothing further in init.c should be run. */
execv(cmdpath, cmd);
{
pid_t pid;
/* We have to fork here, since the kernel calls do_exit(0) in
- * linux/kernel/sys.c, which can cause the machine to panic when
+ * linux/kernel/sys.c, which can cause the machine to panic when
* the init process is killed.... */
if ((pid = fork()) == 0) {
reboot(magic);
/* Append to the end of the list */
for (a = init_action_list; a && a->next; a = a->next) {
/* don't enter action if it's already in the list */
- if ((strcmp(a->command, command) == 0) &&
+ if ((strcmp(a->command, command) == 0) &&
(strcmp(a->terminal, cons) ==0)) {
free(new_action);
return;
/* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined,
* then parse_inittab() simply adds in some default
- * actions(i.e., runs INIT_SCRIPT and then starts a pair
- * of "askfirst" shells). If CONFIG_FEATURE_USE_INITTAB
- * _is_ defined, but /etc/inittab is missing, this
+ * actions(i.e., runs INIT_SCRIPT and then starts a pair
+ * of "askfirst" shells). If CONFIG_FEATURE_USE_INITTAB
+ * _is_ defined, but /etc/inittab is missing, this
* results in the same set of default behaviors.
*/
static void parse_inittab(void)
run_actions(RESPAWN);
return;
}
-
+
extern int init_main(int argc, char **argv)
{
struct init_action *a;
signal(SIGSTOP, stop_handler);
signal(SIGTSTP, stop_handler);
- /* Turn off rebooting via CTL-ALT-DEL -- we get a
+ /* Turn off rebooting via CTL-ALT-DEL -- we get a
* SIGINT on CAD so we can shut things down gracefully... */
init_reboot(RB_DISABLE_CAD);
#endif
/* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined,
* then parse_inittab() simply adds in some default
- * actions(i.e., runs INIT_SCRIPT and then starts a pair
+ * actions(i.e., runs INIT_SCRIPT and then starts a pair
* of "askfirst" shells */
parse_inittab();
}
/*
* Stuff shared between init, reboot, halt, and poweroff
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Mini poweroff implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Mini reboot implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Please see the LICENSE file for copyright information (GPLv2)
-
+
libbb is BusyBox's utility library. All of this stuff used to be stuffed into
a single file named utility.c. When I split utility.c to create libbb, some of
the very oldest stuff ended up without their original copyright and licensing
information (which is now lost in the mists of time). If you see something
that you wrote that is mis-attributed, do let me know so we can fix that up.
- Erik Andersen
+ Erik Andersen
<andersen@codepoet.org>
{
va_list p;
int r;
-
+
va_start(p, format);
r = vasprintf(string_ptr, format, p);
va_end(p);
/*
* Utility routines.
*
- * Copyright (C) many different people.
+ * Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify
void chomp(char *s)
{
char *lc = last_char_is(s, '\n');
-
+
if(lc)
*lc = 0;
}
/*
* Utility routines.
*
- * Copyright (C) many different people.
+ * Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
int correct_password ( const struct passwd *pw )
{
char *unencrypted, *encrypted, *correct;
-
+
#ifdef CONFIG_FEATURE_SHADOWPASSWDS
if (( strcmp ( pw-> pw_passwd, "x" ) == 0 ) || ( strcmp ( pw-> pw_passwd, "*" ) == 0 )) {
struct spwd *sp = getspnam ( pw-> pw_name );
-
+
if ( !sp )
bb_error_msg_and_die ( "no valid shadow password" );
-
+
correct = sp-> sp_pwdp;
}
else
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
pr->cchar = pr->fmt + (p1 - fmtp);
/* DBU:[dave@cray.com] w/o this, trailing fmt text, space is lost.
- * Skip subsequent text and up to the next % sign and tack the
- * additional text onto fmt: eg. if fmt is "%x is a HEX number",
+ * Skip subsequent text and up to the next % sign and tack the
+ * additional text onto fmt: eg. if fmt is "%x is a HEX number",
* we lose the " is a HEX number" part of fmt.
*/
for (p3 = p2; *p3 && *p3 != '%'; p3++);
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) many different people.
+ * Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include <stdlib.h>
#include "libbb.h"
-#define COMM_LEN 16 /* synchronize with size of comm in struct task_struct
+#define COMM_LEN 16 /* synchronize with size of comm in struct task_struct
in /usr/include/linux/sched.h */
/* find_pid_by_name()
- *
+ *
* Modified by Vladimir Oleynik for use with libbb/procps.c
* This finds the pid of the specified process.
- * Currently, it's implemented by rummaging through
+ * Currently, it's implemented by rummaging through
* the proc filesystem.
*
* Returns a list of all matching PIDs
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
char *fileName = NULL;
dev_t dev;
- if (stat("/", &rootStat) != 0)
+ if (stat("/", &rootStat) != 0)
bb_perror_msg("could not stat '/'");
else {
/* This check is here in case they pass in /dev name */
dev = rootStat.st_dev;
dir = opendir("/dev");
- if (!dir)
+ if (!dir)
bb_perror_msg("could not open '/dev'");
else {
while((entry = readdir(dir)) != NULL) {
/* Some char devices have the same dev_t as block
* devices, so make sure this is a block device */
- if (stat(fileName, &statBuf) == 0 &&
+ if (stat(fileName, &statBuf) == 0 &&
S_ISBLK(statBuf.st_mode)!=0 &&
- statBuf.st_rdev == dev)
+ statBuf.st_rdev == dev)
break;
free(fileName);
fileName=NULL;
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
-/* From <linux/kd.h> */
+/* From <linux/kd.h> */
static const int KDGKBTYPE = 0x4B33; /* get keyboard type */
/*
* Utility routines.
*
- * Copyright (C) many different people.
+ * Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify
/*
* Determine the width and height of the terminal.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/* It is perfectly ok to pass in a NULL for either width or for
* height, in which case that value will not be set. It is also
- * perfectly ok to have CONFIG_FEATURE_AUTOWIDTH disabled, in
+ * perfectly ok to have CONFIG_FEATURE_AUTOWIDTH disabled, in
* which case you will always get 80x24 */
void get_terminal_width_height(int fd, int *width, int *height)
{
*
* Copyright (C) 2003 Glenn L. McGrath
* Copyright (C) 2003 Erik Andersen
- *
+ *
* 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
LICENSE TERMS
- The free distribution and use of this software in both source and binary
+ The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
- 1. distributions of this source code include the above copyright
+ 1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
- 3. the copyright holder's name is not used to endorse products
- built using this software without specific written permission.
+ 3. the copyright holder's name is not used to endorse products
+ built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
-
+
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
- in respect of its properties, including, but not limited to, correctness
+ in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.
---------------------------------------------------------------------------
Issue Date: 10/11/2002
cx = &md5_cx;
}
#endif
-
+
/* Initialize the computation context. */
#ifdef CONFIG_SHA1SUM
if (hash_algo == HASH_SHA1) {
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* representations (say, powers of 1024) and manipulating coefficients.
* The base ten "bytes" output could be handled similarly.
*
- * 2) This routine always outputs a decimal point and a tenths digit when
- * display_unit != 0. Hence, it isn't uncommon for the returned string
+ * 2) This routine always outputs a decimal point and a tenths digit when
+ * display_unit != 0. Hence, it isn't uncommon for the returned string
* to have a length of 5 or 6.
*
* It might be nice to add a flag to indicate no decimal digits in
#include <stdio.h>
#include "libbb.h"
-const char *make_human_readable_str(unsigned long long size,
+const char *make_human_readable_str(unsigned long long size,
unsigned long block_size, unsigned long display_unit)
{
/* The code will adjust for additional (appended) units. */
static const char fmt_tenths[] = "%Lu.%d%c";
static char str[21]; /* Sufficient for 64 bit unsigned integers. */
-
+
unsigned long long val;
int frac;
const char *u;
/*
* Utility routines.
*
- * Copyright (C) many different people.
+ * Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify
int i;
size_t s;
ino_dev_hashtable_bucket_t *bucket;
-
+
i = hash_inode(statbuf->st_ino);
s = name ? strlen(name) : 0;
bucket = xmalloc(sizeof(ino_dev_hashtable_bucket_t) + s);
/*
- * stolen from net-tools-1.59 and stripped down for busybox by
+ * stolen from net-tools-1.59 and stripped down for busybox by
* Erik Andersen <andersen@codepoet.org>
*
* Heavily modified by Manuel Novoa III Mar 12, 2001
* that either displays or sets the characteristics of
* one or more of the system's networking interfaces.
*
- * Version: $Id: interface.c,v 1.20 2003/08/29 11:34:08 bug1 Exp $
+ * Version: $Id: interface.c,v 1.21 2004/03/15 08:28:42 andersen Exp $
*
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* and others. Copyright 1993 MicroWalt Corporation
*
* {1.34} - 19980630 - Arnaldo Carvalho de Melo <acme@conectiva.com.br>
* - gettext instead of catgets for i18n
- * 10/1998 - Andi Kleen. Use interface list primitives.
- * 20001008 - Bernd Eckenfels, Patch from RH for setting mtu
+ * 10/1998 - Andi Kleen. Use interface list primitives.
+ * 20001008 - Bernd Eckenfels, Patch from RH for setting mtu
* (default AF was wrong)
*/
/* #define KEEP_UNUSED */
-/*
- *
+/*
+ *
* Protocol Families.
- *
+ *
*/
#define HAVE_AFINET 1
#undef HAVE_AFIPX
#undef HAVE_AFECONET
#undef HAVE_AFASH
-/*
- *
+/*
+ *
* Device Hardware types.
- *
+ *
*/
#define HAVE_HWETHER 1
#define HAVE_HWPPP 1
hw = get_hwntype(-1);
printf(_("%-9.9s Link encap:%s "), ptr->name, _(hw->title));
- /* For some hardware types (eg Ash, ATM) we don't print the
+ /* For some hardware types (eg Ash, ATM) we don't print the
hardware address if it's null. */
if (hw->print != NULL && (!(hw_null_address(hw, ptr->hwaddr) &&
hw->suppress_null_addr)))
printf(" ");
if (ptr->map.irq)
printf(_("Interrupt:%d "), ptr->map.irq);
- if (ptr->map.base_addr >= 0x100) /* Only print devices using it for
+ if (ptr->map.base_addr >= 0x100) /* Only print devices using it for
I/O maps */
printf(_("Base address:0x%lx "),
(unsigned long) ptr->map.base_addr);
/*
* Utility routines.
*
- * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
+ * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
* Permission has been granted to redistribute this code under the GPL.
*
* This program is free software; you can redistribute it and/or modify
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/* vi: set sw=4 ts=4: */
/*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* some system calls possibly missing from libc
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "libbb.h"
-/* Busybox mount uses either /proc/mounts or /etc/mtab to
- * get the list of currently mounted filesystems */
+/* Busybox mount uses either /proc/mounts or /etc/mtab to
+ * get the list of currently mounted filesystems */
#if defined CONFIG_FEATURE_MTAB_SUPPORT
const char bb_path_mtab_file[] = CONFIG_FEATURE_MTAB_FILENAME;
#else
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
extern int bb_parse_mode(const char *s, mode_t *current_mode)
{
- static const mode_t who_mask[] = {
+ static const mode_t who_mask[] = {
S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO, /* a */
S_ISUID | S_IRWXU, /* u */
S_ISGID | S_IRWXG, /* g */
unsigned long int r;
char *e;
int old_errno;
-
+
/* Since this is a lib function, we're not allowed to reset errno to 0.
* Doing so could break an app that is deferring checking of errno.
* So, save the old value so that we can restore it if successful. */
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include <stdarg.h>
#include "libbb.h"
-#if defined(__UCLIBC__)
+#if defined(__UCLIBC__)
# if defined(__FLAG_ERROR)
/* Using my newer stdio implementation. Unlocked macros are:
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- *
+ *
*/
#include <stdio.h>
unsigned int num_digits;
unsigned int r;
unsigned int n;
-
+
n = 0;
q = *ptr;
/*
* Utility routine.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) many different people.
+ * Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
- * Walk down all the directories under the specified
+ * Walk down all the directories under the specified
* location, and do something (something specified
* by the fileAction and dirAction function pointers).
*
- * Unfortunately, while nftw(3) could replace this and reduce
- * code size a bit, nftw() wasn't supported before GNU libc 2.1,
+ * Unfortunately, while nftw(3) could replace this and reduce
+ * code size a bit, nftw() wasn't supported before GNU libc 2.1,
* and so isn't sufficiently portable to take over since glibc2.1
* is so stinking huge.
*/
exitstatus = 1;
}
}
- }
+ }
else if (!S_ISDIR(st.st_mode)) {
bb_error_msg("component %s is not an executable plain file", filename);
exitstatus = 1;
free(filename);
}
free(namelist);
-
+
return(exitstatus);
}
const char **args;
int argno = 1;
int additional_args_cnt = 0;
-
+
for ( args = additional_args; args && *args; args++ )
additional_args_cnt++;
args = (const char **) xmalloc (sizeof (char *) * ( 4 + additional_args_cnt ));
-
+
args [0] = bb_get_last_path_component ( bb_xstrdup ( shell ));
-
+
if ( loginshell ) {
char *args0;
bb_xasprintf ( &args0, "-%s", args [0] );
args [0] = args0;
}
-
+
if ( command ) {
args [argno++] = "-c";
args [argno++] = command;
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
-/* Like strncpy but make sure the resulting string is always 0 terminated. */
+/* Like strncpy but make sure the resulting string is always 0 terminated. */
extern char * safe_strncpy(char *dst, const char *src, size_t size)
-{
+{
dst[size-1] = '\0';
- return strncpy(dst, src, size-1);
+ return strncpy(dst, src, size-1);
}
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
{
if ( loginshell ) {
const char *term;
-
+
/* Change the current working directory to be the home directory
* of the user. It is a fatal error for this process to be unable
* to change to that directory. There is no "default" home
* directory.
* Some systems default to HOME=/
- */
+ */
if ( chdir ( pw-> pw_dir )) {
if ( chdir ( "/" )) {
syslog ( LOG_WARNING, "unable to cd to %s' for user %s'\n", pw-> pw_dir, pw-> pw_name );
/*
* some system calls possibly missing from libc
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) many different people.
+ * Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify
/*
* Utility routines.
*
- * Copyright (C) many different people.
+ * Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
int fd;
char **vfork_args;
int a = 0;
-
+
setsid();
-
+
if (!nochdir)
chdir("/");
bb_perror_msg_and_die("vfork");
default: /* parent */
exit(0);
- }
+ }
}
#endif /* uClinux */
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
int s = socket(AF_INET, SOCK_STREAM, 0);
if (connect(s, (struct sockaddr_in *)s_addr, sizeof(struct sockaddr_in)) < 0)
{
- bb_perror_msg_and_die("Unable to connect to remote host (%s)",
+ bb_perror_msg_and_die("Unable to connect to remote host (%s)",
inet_ntoa(s_addr->sin_addr));
}
return s;
/*
* Utility routines.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
bb_error_msg_and_die("bb_xstrndup bug");
t = xmalloc(++n);
-
+
return safe_strncpy(t,s,n);
}
#endif
extern int bb_xopen(const char *pathname, int flags)
{
int ret;
-
+
ret = open(pathname, flags, 0777);
if (ret == -1) {
bb_perror_msg_and_die("%s", pathname);
extern unsigned char bb_xread_char(int fd)
{
char tmp;
-
+
bb_xread_all(fd, &tmp, 1);
- return(tmp);
+ return(tmp);
}
#endif
/* vi: set sw=4 ts=4: */
/*
- * Copyright (C) 2003 Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 2003-2004 Erik Andersen <andersen@codepoet.org>
*/
#include "libbb.h"
#ifdef L_xgetularg_bnd_sfx
-extern
+extern
unsigned long bb_xgetularg_bnd_sfx(const char *arg, int base,
unsigned long lower,
unsigned long upper,
bb_show_usage();
}
errno = old_errno; /* Ok. So restore errno. */
-
+
/* Do optional suffix parsing. Allow 'empty' suffix tables.
* Note that we also all nul suffixes with associated multipliers,
* to allow for scaling of the arg by some default multiplier. */
}
++suffixes;
}
- }
+ }
/* Finally, check for illegal trailing chars and range limits. */
/* Note: although we allow leading space (via stroul), trailing space
#endif
#ifdef L_xgetlarg_bnd_sfx
-extern
+extern
long bb_xgetlarg_bnd_sfx(const char *arg, int base,
long lower,
long upper,
#endif
#ifdef L_getlarg10_sfx
-extern
+extern
long bb_xgetlarg10_sfx(const char *arg, const struct suffix_mult *suffixes)
{
return bb_xgetlarg_bnd_sfx(arg, 10, LONG_MIN, LONG_MAX, suffixes);
#endif
#ifdef L_xgetularg_bnd
-extern
+extern
unsigned long bb_xgetularg_bnd(const char *arg, int base,
unsigned long lower,
unsigned long upper)
#endif
#ifdef L_xgetularg10_bnd
-extern
+extern
unsigned long bb_xgetularg10_bnd(const char *arg,
unsigned long lower,
unsigned long upper)
#endif
#ifdef L_xgetularg10
-extern
+extern
unsigned long bb_xgetularg10(const char *arg)
{
return bb_xgetularg10_bnd(arg, 0, ULONG_MAX);
#include "libbb.h"
extern char *xreadlink(const char *path)
-{
+{
static const int GROWBY = 80; /* how large we will grow strings by */
- char *buf = NULL;
+ char *buf = NULL;
int bufsize = 0, readsize = 0;
do {
bb_perror_msg("%s", path);
return NULL;
}
- }
+ }
while (bufsize < readsize + 1);
buf[readsize] = '\0';
return buf;
-}
+}
/*
* Utility routines.
*
- * Copyright (C) many different people.
+ * Copyright (C) many different people.
* If you wrote this, please acknowledge your work.
*
* This program is free software; you can redistribute it and/or modify
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
/*
* __getgrent.c - This file is part of the libc-8086/grp package for ELKS,
* Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
}
#else /* !GR_SCALE_DYNAMIC */
free(members);
- members = (char **) malloc((member_num + 1) * sizeof(char *));
+ members = (char **) malloc((member_num + 1) * sizeof(char *));
for ( ; field_begin && *field_begin != '\0'; field_begin = ptr) {
if ((ptr = strchr(field_begin, ',')) != NULL)
*ptr++ = '\0';
/*
* __getpwent.c - This file is part of the libc-8086/pwd package for ELKS,
* Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
/*
* fgetgrent.c - This file is part of the libc-8086/grp package for ELKS,
* Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
*
*/
-#include "busybox.h"
+#include "busybox.h"
#include <stdio.h>
#include <errno.h>
/*
* fgetpwent.c - This file is part of the libc-8086/pwd package for ELKS,
* Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
*
*/
-#include "busybox.h"
+#include "busybox.h"
#include <errno.h>
#include <stdio.h>
/*
* getgrgid.c - This file is part of the libc-8086/grp package for ELKS,
* Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
*
*/
-#include "busybox.h"
+#include "busybox.h"
#include <sys/types.h>
#include <unistd.h>
/*
* getgrnam.c - This file is part of the libc-8086/grp package for ELKS,
* Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
/*
* getpw.c - This file is part of the libc-8086/pwd package for ELKS,
* Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
*
*/
-#include "busybox.h"
+#include "busybox.h"
#include <sys/types.h>
#include <errno.h>
/*
* getpwnam.c - This file is part of the libc-8086/pwd package for ELKS,
* Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
*
*/
-#include "busybox.h"
+#include "busybox.h"
#include <unistd.h>
#include <string.h>
/*
* getpwuid.c - This file is part of the libc-8086/pwd package for ELKS,
* Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
/*
* grent.c - This file is part of the libc-8086/grp package for ELKS,
* Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* in together.
*/
-#include "busybox.h"
+#include "busybox.h"
#include <unistd.h>
#include <fcntl.h>
/*
* initgroups.c - This file is part of the libc-8086/grp package for ELKS,
* Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
*
*/
-#include "busybox.h"
+#include "busybox.h"
#include <unistd.h>
#include <string.h>
/*
* putpwent.c - This file is part of the libc-8086/pwd package for ELKS,
* Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
*
*/
-#include "busybox.h"
+#include "busybox.h"
#include <stdio.h>
#include <errno.h>
/*
* pwent.c - This file is part of the libc-8086/pwd package for ELKS,
* Copyright (C) 1995, 1996 Nat Friedman <ndf@linux.mit.edu>.
- *
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
/*
* Taken from the set of syscalls for uClibc
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published by
*
*/
-#include "busybox.h"
+#include "busybox.h"
#include <errno.h>
#include <unistd.h>
/* vi: set sw=4 ts=4: */
/*
- * Copyright 1989 - 1994, Julianne Frances Haugh
+ * Copyright 1989 - 1994, Julianne Frances Haugh
* <jockgrrl@austin.rr.com>, <jfh@austin.ibm.com>
* All rights reserved.
*
* SUCH DAMAGE.
*/
-/* TODO: fgetspent_r.c getspent_r.c getspnam_r.c sgetspent_r.c
- * lckpwdf ulckpwdf
+/* TODO: fgetspent_r.c getspent_r.c getspnam_r.c sgetspent_r.c
+ * lckpwdf ulckpwdf
*/
#include <stdio.h>
/*
* putspent - put a (struct spwd *) into the (FILE *) you provide.
- *
+ *
* this was described in shadow_.h but not implemented, so here
* I go. -beppu
*
sp->sp_min, /* minimum number of days between changes */
sp->sp_max, /* maximum number of days between changes */
sp->sp_warn, /* number of days of warning before password expires */
- sp->sp_inact, /* number of days after password expires until
+ sp->sp_inact, /* number of days after password expires until
the account becomes unusable */
sp->sp_expire, /* days since 1/1/70 until account expires */
"");
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
/*
* addgroup will take a login_name as its first parameter.
*
- * gid
+ * gid
*
* can be customized via command-line parameters.
* ________________________________________________________________________ */
} else {
bb_show_usage();
}
-
+
if (optind < argc) {
user = argv[optind];
optind++;
if ((p->pw_uid > max) || (p->pw_uid < min))
p->pw_uid = min;
- /* stuff to do:
+ /* stuff to do:
* make sure login isn't taken;
* find free uid and gid;
*/
*
* home
* shell
- * gecos
+ * gecos
*
* can be customized via command-line parameters.
* ________________________________________________________________________ */
be here. Now read the real man-page agetty.8 instead.
-f option added by Eric Rasmussen <ear@usfirst.org> - 12/28/95
-
+
1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
- added Native Language Support
1999-05-05 Thorsten Kranzkowski <dl8bcu@gmx.net>
- enable hardware flow control before displaying /etc/issue
-
+
*/
#include <stdio.h>
/*
* Things you may want to modify.
- *
+ *
* If ISSUE is not defined, agetty will never display the contents of the
* /etc/issue file. You will not want to spit out large "issue" files at the
* wrong baud rate. Relevant for System V only.
- *
+ *
* You may disagree with the default line-editing etc. characters defined
* below. Note, however, that DEL cannot be used for interrupt generation
* and for line editing at the same time.
case 'I':
if (!(op->initstring = strdup(optarg)))
error(bb_msg_memory_exhausted);
-
+
{
const char *p;
char *q;
* the DCD line, and if the computer is fast enough to set the proper
* baud rate before the message has gone by. We expect a message of the
* following format:
- *
+ *
* <junk><number><junk>
- *
+ *
* The number is interpreted as the baud rate of the incoming call. If the
* modem does not tell us the baud rate within one second, we will keep
* using the current baud rate. It is advisable to enable BREAK
int opt_preserve = 0;
int opt_fflag = 0;
char *opt_host = 0;
- int alarmstarted = 0;
+ int alarmstarted = 0;
#ifdef CONFIG_SELINUX
int flask_enabled = is_flask_enabled();
security_id_t sid = 0, old_tty_sid, new_tty_sid;
signal ( SIGALRM, alarm_handler );
alarm ( TIMEOUT );
alarmstarted = 1;
-
+
while (( flag = getopt(argc, argv, "f:h:p")) != EOF ) {
switch ( flag ) {
case 'p':
if ( !amroot ) /* Auth bypass only if real UID is zero */
bb_error_msg_and_die ( "-f permission denied" );
-
+
safe_strncpy(username, optarg, USERNAME_SIZE);
opt_fflag = 1;
break;
if (optind < argc) // user from command line (getty)
safe_strncpy(username, argv[optind], USERNAME_SIZE);
- if ( !isatty ( 0 ) || !isatty ( 1 ) || !isatty ( 2 ))
+ if ( !isatty ( 0 ) || !isatty ( 1 ) || !isatty ( 2 ))
return EXIT_FAILURE; /* Must be a terminal */
#ifdef CONFIG_FEATURE_U_W_TMP
if ( amroot )
memset ( utent.ut_host, 0, sizeof utent.ut_host );
#endif
-
+
if ( opt_host ) {
#ifdef CONFIG_FEATURE_U_W_TMP
safe_strncpy ( utent.ut_host, opt_host, sizeof( utent. ut_host ));
}
else
snprintf ( fromhost, sizeof( fromhost ) - 1, " on `%.100s'", tty );
-
+
setpgrp();
openlog ( "login", LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_AUTH );
pw_copy.pw_passwd = "!";
opt_fflag = 0;
failed = 1;
- } else
+ } else
pw_copy = *pw;
pw = &pw_copy;
if (( pw-> pw_passwd [0] == '!' ) || ( pw-> pw_passwd[0] == '*' ))
failed = 1;
-
+
if ( opt_fflag ) {
opt_fflag = 0;
goto auth_ok;
goto auth_ok;
failed = 1;
-
+
auth_ok:
- if ( !failed)
+ if ( !failed)
break;
{ // delay next try
time_t start, now;
-
+
time ( &start );
now = start;
while ( difftime ( now, start ) < FAIL_DELAY) {
return EXIT_FAILURE;
}
}
-
+
alarm ( 0 );
if ( check_nologin ( pw-> pw_uid == 0 ))
return EXIT_FAILURE;
sid = 0;
#endif
- if ( *tty != '/' )
+ if ( *tty != '/' )
snprintf ( full_tty, sizeof( full_tty ) - 1, "/dev/%s", tty);
else
safe_strncpy ( full_tty, tty, sizeof( full_tty ) - 1 );
-
- if ( !is_my_tty ( full_tty ))
+
+ if ( !is_my_tty ( full_tty ))
syslog ( LOG_ERR, "unable to determine TTY name, got %s\n", full_tty );
-
- /* Try these, but don't complain if they fail
+
+ /* Try these, but don't complain if they fail
* (for example when the root fs is read only) */
chown ( full_tty, pw-> pw_uid, pw-> pw_gid );
chmod ( full_tty, 0600 );
motd ( );
signal ( SIGALRM, SIG_DFL ); /* default alarm signal */
- if ( pw-> pw_uid == 0 )
+ if ( pw-> pw_uid == 0 )
syslog ( LOG_INFO, "root login %s\n", fromhost );
run_shell ( tmp, 1, 0, 0
#ifdef CONFIG_SELINUX
, sid
#endif
); /* exec the shell finally. */
-
+
return EXIT_FAILURE;
}
for ( sp = buf; isspace ( *sp ); sp++ ) { }
for ( ep = sp; isgraph ( *ep ); ep++ ) { }
- *ep = 0;
+ *ep = 0;
safe_strncpy(buf_name, sp, USERNAME_SIZE);
if(buf_name[0])
return 1;
}
if ( !amroot )
return 1;
-
+
puts ( "\r\n[Disconnect bypassed -- root login allowed.]\r" );
}
return 0;
if ( stat ( tty, &by_name ) || fstat ( 0, &by_fd ))
return 0;
-
+
if ( by_name. st_rdev != by_fd. st_rdev )
return 0;
else
register int c;
if (( fp = fopen ( bb_path_motd_file, "r" ))) {
- while (( c = getc ( fp )) != EOF )
- putchar ( c );
+ while (( c = getc ( fp )) != EOF )
+ putchar ( c );
fclose ( fp );
}
}
}
/* get user if specified */
- if ( optind < argc )
+ if ( optind < argc )
opt_username = argv [optind++];
if ( optind < argc )
opt_args = argv + optind;
-
+
#if defined( SYSLOG_SUCCESS ) || defined( SYSLOG_FAILURE )
#ifdef CONFIG_FEATURE_U_W_TMP
/* The utmp entry (via getlogin) is probably the best way to identify
openlog ( bb_applet_name, 0, LOG_AUTH );
#endif
-
+
pw = getpwnam ( opt_username );
if ( !pw )
bb_error_msg_and_die ( "user %s does not exist", opt_username );
-
+
/* Make sure pw->pw_shell is non-NULL. It may be NULL when NEW_USER
is a username that is retrieved via NIS (YP), but that doesn't have
a default shell listed. */
if ( !opt_shell )
opt_shell = pw->pw_shell;
- change_identity ( pw );
+ change_identity ( pw );
setup_environment ( opt_shell, opt_loginshell, !opt_preserve, pw );
run_shell ( opt_shell, opt_loginshell, opt_command, (const char**)opt_args
#ifdef CONFIG_SELINUX
, 0
#endif
);
-
+
return EXIT_FAILURE;
}
default n
help
Get/Set hard drive parameters. Primarily intended for ATA
- drives. Adds about 13k (or around 30k if you enable the
+ drives. Adds about 13k (or around 30k if you enable the
CONFIG_FEATURE_HDPARM_GET_IDENTITY option)....
config CONFIG_FEATURE_HDPARM_GET_IDENTITY
- bool " Support obtaining detailed information directly from drives"
+ bool " Support obtaining detailed information directly from drives"
default y
depends on CONFIG_HDPARM
help
feature set. Enabling this option will add about 16k...
config CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF
- bool " Register an IDE interface (DANGEROUS)"
+ bool " Register an IDE interface (DANGEROUS)"
default n
depends on CONFIG_HDPARM
help
This is dangerous stuff, so you should probably say N.
config CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF
- bool " Un-register an IDE interface (DANGEROUS)"
+ bool " Un-register an IDE interface (DANGEROUS)"
default n
depends on CONFIG_HDPARM
help
This is dangerous stuff, so you should probably say N.
config CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET
- bool " perform device reset (DANGEROUS)"
+ bool " perform device reset (DANGEROUS)"
default n
depends on CONFIG_HDPARM
help
This is dangerous stuff, so you should probably say N.
config CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF
- bool " tristate device for hotswap (DANGEROUS)"
+ bool " tristate device for hotswap (DANGEROUS)"
default n
depends on CONFIG_HDPARM
help
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#else
void usage(char *prog)
{
- fprintf(stderr,
+ fprintf(stderr,
"Usage: %s [ -q ] [ -o offset ] [ -f frequency ] [ -p timeconstant ] [ -t tick ]\n",
prog);
}
ret = adjtimex(&txc);
if (ret < 0) perror("adjtimex");
-
+
if (!quiet && ret>=0) {
printf(
" mode: %d\n"
static void set_output_base(void)
{
- base=(unsigned char)pop();
+ base=(unsigned char)pop();
if ((base != 10) && (base != 16)) {
fprintf(stderr, "Error: base = %d is not supported.\n", base);
base=10;
static void print_base(double print)
{
- if (base == 16)
+ if (base == 16)
printf("%x\n", (unsigned int)print);
else
printf("%g\n", print);
}
/* return pointer to next token in buffer and set *buffer to one char
- * past the end of the above mentioned token
+ * past the end of the above mentioned token
*/
static char *get_token(char **buffer)
{
static void print_ascii(uint16_t *p, uint8_t length) {
uint8_t ii;
char cl;
-
+
/* find first non-space & print it */
for(ii = 0; ii< length; ii++)
{
if_printf(((dev == ATAPI_DEV) && (eqpt != CDROM) && (val[CAPAB_0] & DMA_IL_SUP)),
"\t Interleaved DMA support\n");
- if((val[WHATS_VALID] & OK_W64_70) &&
+ if((val[WHATS_VALID] & OK_W64_70) &&
(val[DMA_TIME_MIN] || val[DMA_TIME_NORM]))
{
printf("\t Cycle time:");
static unsigned long set_readahead= 0, get_readahead= 0, bbreadahead= 0;
static unsigned long set_readonly = 0, get_readonly = 0, readonly = 0;
static unsigned long set_unmask = 0, get_unmask = 0, unmask = 0;
-static unsigned long set_mult = 0, get_mult = 0, mult = 0;
+static unsigned long set_mult = 0, get_mult = 0, mult = 0;
#ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA
static unsigned long set_dma = 0, get_dma = 0, dma = 0;
#endif
/*
* last implementation for busybox
*
- * Copyright (C) 2003 Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 2003-2004 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
else if (strncmp(ut.ut_user, "runlevel", 7) == 0)
ut.ut_type = RUN_LVL;
} else {
- if (!ut.ut_name[0] || strcmp(ut.ut_name, "LOGIN") == 0 ||
+ if (!ut.ut_name[0] || strcmp(ut.ut_name, "LOGIN") == 0 ||
ut.ut_name[0] == 0)
{
- /* Don't bother. This means we can't find how long
+ /* Don't bother. This means we can't find how long
* someone was logged in for. Oh well. */
continue;
}
/* vi: set sw=4 ts=4: */
/*
* public domain -- Dave 'Kill a Cop' Cinege <dcinege@psychosis.com>
- *
+ *
* makedevs
- * Make ranges of device files quickly.
+ * Make ranges of device files quickly.
* known bugs: can't deal with alpha ranges
*/
struct mtop op;
struct mtpos position;
int fd, mode;
-
+
if (argc < 2) {
bb_show_usage();
}
/*-------------------------------------------------------------------------
* Filename: xmodem.c
- * Version: $Id: rx.c,v 1.1 2003/12/20 07:30:35 bug1 Exp $
+ * Version: $Id: rx.c,v 1.2 2004/03/15 08:28:46 andersen Exp $
* Copyright: Copyright (C) 2001, Hewlett-Packard Company
* Author: Christopher Hoover <ch@hpl.hp.com>
- * Description: xmodem functionality for uploading of kernels
+ * Description: xmodem functionality for uploading of kernels
* and the like
* Created at: Thu Dec 20 01:58:08 PST 2001
*-----------------------------------------------------------------------*/
/*
- * xmodem.c: xmodem functionality for uploading of kernels and
+ * xmodem.c: xmodem functionality for uploading of kernels and
* the like
*
* Copyright (C) 2001 Hewlett-Packard Laboratories
#define TIMEOUT_LONG 10
#define MAXERRORS 10
-static inline void write_byte(int fd, char cc) {
+static inline void write_byte(int fd, char cc) {
write(fd, &cc, 1);
}
static inline void read_flush(int fd) {
tcflush(fd, TCIFLUSH);
}
-
+
static int read_byte(int fd, unsigned int timeout) {
char buf[1];
int n;
if (tcgetattr(ttyfd, &tty) < 0)
bb_error_msg_and_die("%s: tcgetattr failed: %m\n", argv[0]);
-
+
orig_tty = tty;
cfmakeraw(&tty);
tcsetattr(ttyfd, TCSAFLUSH, &tty);
-
+
memset(&act, 0, sizeof(act));
act.sa_handler = sigalrm_handler;
sigaction(SIGALRM, &act, 0);
* documentation and/or other materials provided with the distribution.
*
* 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
- * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
+ * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
*
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
02111-1307, USA. */
/* Originally written by David Keppel <pardo@cs.washington.edu>.
- Heavily modified by David MacKenzie <djm@gnu.ai.mit.edu>.
+ Heavily modified by David MacKenzie <djm@gnu.ai.mit.edu>.
Heavily modified for busybox by Erik Andersen <andersen@codepoet.org>
*/
fd = bb_xopen(argv[argc - 1], O_WRONLY);
while (1) {
- /*
+ /*
* Make sure we clear the counter before sleeping, as the counter value
* is undefined at this point -- PFM
*/
default n
depends on CONFIG_INSMOD && ( CONFIG_FEATURE_2_2_MODULES || CONFIG_FEATURE_2_4_MODULES )
help
- By adding module symbols to the kernel symbol table, Oops messages
+ By adding module symbols to the kernel symbol table, Oops messages
occuring within kernel modules can be properly debugged. By enabling
- this feature, module symbols will always be added to the kernel symbol
+ this feature, module symbols will always be added to the kernel symbol
table for properly debugging support. If you are not interested in
Oops messages from kernel modules, say N.
being loaded into memory.
config CONFIG_FEATURE_INSMOD_LOAD_MAP
- bool " Enable load map (-m) option"
+ bool " Enable load map (-m) option"
default n
depends on CONFIG_INSMOD && ( CONFIG_FEATURE_2_2_MODULES || CONFIG_FEATURE_2_4_MODULES )
help
depends on CONFIG_FEATURE_INSMOD_LOAD_MAP
help
Without this option, -m will only output section
- load map. With this option, -m will also output
+ load map. With this option, -m will also output
symbols load map.
config CONFIG_LSMOD
bool "modprobe"
default n
help
- Handle the loading of modules, and their dependancies on a high
+ Handle the loading of modules, and their dependancies on a high
level.
config CONFIG_RMMOD
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
/*
* Mini insmod implementation for busybox
*
- * This version of insmod supports x86, ARM, SH3/4/5, powerpc, m68k,
+ * This version of insmod supports x86, ARM, SH3/4/5, powerpc, m68k,
* MIPS, and v850e.
*
- * Copyright (C) 1999,2000 by Lineo, inc. and Erik Andersen
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
* and Ron Alder <alder@lineo.com>
*
* Miles Bader <miles@gnu.org> added NEC V850E support.
* These blocks should be easy maintain and sync with obj_xxx.c in modutils.
*
* Magnus Damm <damm@opensource.se> added PowerPC support 20-Feb-2001.
- * PowerPC specific code stolen from modutils-2.3.16,
+ * PowerPC specific code stolen from modutils-2.3.16,
* written by Paul Mackerras, Copyright 1996, 1997 Linux International.
* I've only tested the code on mpc8xx platforms in big-endian mode.
* Did some cleanup and added CONFIG_USE_xxx_ENTRIES...
#endif
#ifdef CONFIG_FEATURE_INSMOD_LOADINKMEM
-#define LOADBITS 0
+#define LOADBITS 0
#else
#define LOADBITS 1
#endif
#define ELFCLASSM ELFCLASS32
#endif
-#if defined(__mc68000__)
+#if defined(__mc68000__)
#define CONFIG_USE_GOT_ENTRIES
#define CONFIG_GOT_ENTRY_SIZE 4
#define CONFIG_USE_SINGLE
#define CONFIG_USE_PLT_ENTRIES
#define CONFIG_PLT_ENTRY_SIZE 16
#define CONFIG_USE_PLT_LIST
-#define CONFIG_LIST_ARCHTYPE ElfW(Addr)
+#define CONFIG_LIST_ARCHTYPE ElfW(Addr)
#define CONFIG_USE_LIST
#define MATCH_MACHINE(x) (x == EM_PPC)
#ifndef MODUTILS_MODULE_H
static const int MODUTILS_MODULE_H = 1;
-#ident "$Id: insmod.c,v 1.112 2004/02/18 10:14:17 mjn3 Exp $"
+#ident "$Id: insmod.c,v 1.113 2004/03/15 08:28:47 andersen Exp $"
/* This file contains the structures used by the 2.0 and 2.1 kernels.
We do not use the kernel headers directly because we do not wish
#ifndef MODUTILS_OBJ_H
static const int MODUTILS_OBJ_H = 1;
-#ident "$Id: insmod.c,v 1.112 2004/02/18 10:14:17 mjn3 Exp $"
+#ident "$Id: insmod.c,v 1.113 2004/03/15 08:28:47 andersen Exp $"
/* The relocatable object is manipulated using elfin types. */
static void arch_create_got (struct obj_file *f);
static int obj_gpl_license(struct obj_file *f, const char **license);
-
+
#ifdef CONFIG_FEATURE_2_4_MODULES
static int arch_init_module (struct obj_file *f, struct new_module *);
#endif
goto bb_use_got;
case R_ARM_GOTPC:
- /* relative reloc, always to _GLOBAL_OFFSET_TABLE_
- * (which is .got) similar to branch,
+ /* relative reloc, always to _GLOBAL_OFFSET_TABLE_
+ * (which is .got) similar to branch,
* but is full 32 bits relative */
assert(got);
case R_390_PC16DBL:
*(unsigned short *) loc += (v - dot) >> 1;
break;
- case R_390_PC16:
+ case R_390_PC16:
*(unsigned short *) loc += v - dot;
break;
pe = (struct arch_single_entry *) &isym->pltent;
assert(pe->allocated);
if (pe->inited == 0) {
- ip = (unsigned long *)(ifile->plt->contents + pe->offset);
+ ip = (unsigned long *)(ifile->plt->contents + pe->offset);
ip[0] = 0x0d105810; /* basr 1,0; lg 1,10(1); br 1 */
ip[1] = 0x100607f1;
if (ELF32_R_TYPE(rel->r_info) == R_390_PLT16DBL)
break;
#ifndef R_390_GOTOFF32
-#define R_390_GOTOFF32 R_390_GOTOFF
+#define R_390_GOTOFF32 R_390_GOTOFF
#endif
case R_390_GOTOFF32:
assert(got != 0);
case R_68K_PC8:
v -= dot;
- if ((Elf32_Sword)v > 0x7f ||
+ if ((Elf32_Sword)v > 0x7f ||
(Elf32_Sword)v < -(Elf32_Sword)0x80) {
ret = obj_reloc_overflow;
}
case R_68K_PC16:
v -= dot;
- if ((Elf32_Sword)v > 0x7fff ||
+ if ((Elf32_Sword)v > 0x7fff ||
(Elf32_Sword)v < -(Elf32_Sword)0x8000) {
ret = obj_reloc_overflow;
}
v -= dot;
/* if the target is too far away.... */
#if defined (__arm__) || defined (__powerpc__)
- if ((int)v < -0x02000000 || (int)v >= 0x02000000)
+ if ((int)v < -0x02000000 || (int)v >= 0x02000000)
#elif defined (__v850e__)
if ((Elf32_Sword)v > 0x1fffff || (Elf32_Sword)v < (Elf32_Sword)-0x200000)
#endif
}
-#if defined(CONFIG_USE_LIST)
+#if defined(CONFIG_USE_LIST)
static int arch_list_add(ElfW(RelM) *rel, struct arch_list_entry **list,
int offset, int size)
#endif
-#if defined(CONFIG_USE_SINGLE)
+#if defined(CONFIG_USE_SINGLE)
static int arch_single_init(ElfW(RelM) *rel, struct arch_single_entry *single,
int offset, int size)
#if defined(CONFIG_USE_GOT_ENTRIES) || defined(CONFIG_USE_PLT_ENTRIES)
-static struct obj_section *arch_xsect_init(struct obj_file *f, char *name,
+static struct obj_section *arch_xsect_init(struct obj_file *f, char *name,
int offset, int size)
{
struct obj_section *myrelsec = obj_find_section(f, name);
if (myrelsec) {
obj_extend_section(myrelsec, offset);
} else {
- myrelsec = obj_create_alloced_section(f, name,
+ myrelsec = obj_create_alloced_section(f, name,
size, offset);
assert(myrelsec);
}
#elif defined(__sh__)
case R_SH_GOT32:
- got_allocate = 1;
+ got_allocate = 1;
break;
case R_SH_GOTPC:
#if defined(CONFIG_USE_GOT_ENTRIES)
if (got_allocate) {
got_offset += arch_single_init(
- rel, &intsym->gotent,
+ rel, &intsym->gotent,
got_offset, CONFIG_GOT_ENTRY_SIZE);
got_needed = 1;
#endif
#if defined(CONFIG_USE_PLT_ENTRIES)
if (plt_allocate) {
-#if defined(CONFIG_USE_PLT_LIST)
+#if defined(CONFIG_USE_PLT_LIST)
plt_offset += arch_list_add(
- rel, &intsym->pltent,
+ rel, &intsym->pltent,
plt_offset, CONFIG_PLT_ENTRY_SIZE);
#else
plt_offset += arch_single_init(
- rel, &intsym->pltent,
+ rel, &intsym->pltent,
plt_offset, CONFIG_PLT_ENTRY_SIZE);
#endif
plt_needed = 1;
static void *obj_extend_section(struct obj_section *sec, unsigned long more)
{
unsigned long oldsize = sec->header.sh_size;
- if (more) {
+ if (more) {
sec->contents = xrealloc(sec->contents, sec->header.sh_size += more);
}
return sec->contents + oldsize;
struct obj_symbol *sym;
for (sym = f->symtab[i]; sym; sym = sym->next)
if (ELFW(ST_BIND) (sym->info) != STB_LOCAL
- && sym->secidx <= SHN_HIRESERVE)
+ && sym->secidx <= SHN_HIRESERVE)
{
sym->ksymidx = nsyms++;
strsize += strlen(sym->name) + 1;
tgt_long m_addr;
sec = obj_find_section(f, ".this");
- if (!sec || !sec->contents) {
+ if (!sec || !sec->contents) {
bb_perror_msg_and_die("corrupt module %s?",m_name);
}
module = (struct new_module *) sec->contents;
sec->contents = NULL;
break;
}
-#endif
+#endif
case SHT_SYMTAB:
case SHT_STRTAB:
case SHT_RELM:
#define TAINT_UNSAFE_SMP (1<<2)
#define TAINT_URL "http://www.tux.org/lkml/#export-tainted"
-static void set_tainted(struct obj_file *f, int fd, char *m_name,
+static void set_tainted(struct obj_file *f, int fd, char *m_name,
int kernel_has_tainted, int taint, const char *text1, const char *text2)
{
char buf[80];
* start of some sections. this info is used by ksymoops to do better
* debugging.
*/
-static void
+static void
add_ksymoops_symbols(struct obj_file *f, const char *filename,
const char *m_name)
{
#ifdef CONFIG_FEATURE_INSMOD_LOAD_MAP
while ((opt = getopt(argc, argv, "fkqsvxmLo:")) > 0)
#else
- while ((opt = getopt(argc, argv, "fkqsvxLo:")) > 0)
+ while ((opt = getopt(argc, argv, "fkqsvxLo:")) > 0)
#endif
{
switch (opt) {
/*
* Mini lsmod implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* Modified by Alcove, Julien Gaulmin <julien.gaulmin@alcove.fr> and
* Nicolas Ferre <nicolas.ferre@alcove.fr> to support pre 2.1 kernels
/*
* Mini rmmod implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
switch (n) {
case 'w': // --wait
flags &= ~O_NONBLOCK;
- break;
+ break;
case 'f': // --force
flags |= O_TRUNC;
- break;
+ break;
case 'a':
/* Unload _all_ unused modules via NULL delete_module() call */
/* until the number of modules does not change */
default n
depends on CONFIG_FEATURE_HTTPD_BASIC_AUTH
help
- Enables basic per url authentication from /etc/httpd.conf
+ Enables basic per url authentication from /etc/httpd.conf
using md5 passwords.
config CONFIG_FEATURE_IFUPDOWN_IP
bool " Use ip applet"
default n
- depends on CONFIG_IFUPDOWN
+ depends on CONFIG_IFUPDOWN
help
Use the iproute "ip" command to implement "ifup" and "ifdown", rather
than the default of using the older 'ifconfig' and 'route' utilities.
select CONFIG_IFCONFIG
select CONFIG_ROUTE
help
- Use the busybox iproute "ifconfig" and "route" applets to
+ Use the busybox iproute "ifconfig" and "route" applets to
implement the "ifup" and "ifdown" utilities.
If leave this disabled, you must install the full-blown ifconfig
- and route utilities, or the "ifup" and "ifdown" applets will not
+ and route utilities, or the "ifup" and "ifdown" applets will not
work.
config CONFIG_FEATURE_IFUPDOWN_IPV4
default y
depends on CONFIG_IP
help
- Add support for routing table management to "ip".
+ Add support for routing table management to "ip".
endif
if CONFIG_IP && CONFIG_IPTUNNEL
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
/* vi: set sw=4 ts=4: */
/*
- * ftpget
- *
+ * ftpget
+ *
* Mini implementation of FTP to retrieve a remote file.
*
* Copyright (C) 2002 Jeff Angielski, The PTR Group <jeff@theptrgroup.com>
}
#ifdef CONFIG_FTPGET
-static int ftp_recieve(ftp_host_info_t *server, FILE *control_stream,
+static int ftp_recieve(ftp_host_info_t *server, FILE *control_stream,
const char *local_path, char *server_path)
{
char buf[512];
bb_error_msg_and_die("ftp error: %s", buf + 4);
}
ftpcmd("QUIT", NULL, control_stream, buf);
-
+
return(EXIT_SUCCESS);
}
#endif
#ifdef CONFIG_FTPPUT
-static int ftp_send(ftp_host_info_t *server, FILE *control_stream,
+static int ftp_send(ftp_host_info_t *server, FILE *control_stream,
const char *server_path, char *local_path)
{
struct stat sbuf;
server->password = "busybox@";
verbose_flag = 0;
- /*
- * Decipher the command line
+ /*
+ * Decipher the command line
*/
bb_applet_long_options = ftpgetput_long_options;
opt = bb_getopt_ulflags(argc, argv, "cvu:p:P:", &server->user, &server->password, &port);
* for page display.
*
* httpd.conf has the following format:
- *
+ *
* A:172.20. # Allow address from 172.20.0.0/16
* A:10.0.0.0/25 # Allow any address from 10.0.0.0-10.0.0.127
* A:10.0.0.0/255.255.255.128 # Allow any address that previous set
* /adm:admin:setup # Require user admin, pwd setup on urls starting with /adm/
* /adm:toor:PaSsWd # or user toor, pwd PaSsWd on urls starting with /adm/
* .au:audio/basic # additional mime type for audio.au files
- *
+ *
* A/D may be as a/d or allow/deny - first char case unsensitive
* Deny IP rules take precedence over allow rules.
- *
- *
+ *
+ *
* The Deny/Allow IP logic:
- *
+ *
* - Default is to allow all. No addresses are denied unless
* denied with a D: rule.
* - Order of Deny/Allow rules is significant
* - If a deny all rule (D:*) is used it acts as a catch-all for unmatched
* addresses.
* - Specification of Allow all (A:*) is a no-op
- *
+ *
* Example:
* 1. Allow only specified addresses
* A:172.20 # Allow any address that begins with 172.20.
* A:10.10. # Allow any address that begins with 10.10.
* A:127.0.0.1 # Allow local loopback connections
* D:* # Deny from other IP connections
- *
+ *
* 2. Only deny specified addresses
* D:1.2.3. # deny from 1.2.3.0 - 1.2.3.255
* D:2.3.4. # deny from 2.3.4.0 - 2.3.4.255
* A:* # (optional line added for clarity)
- *
+ *
* If a sub directory contains a config file it is parsed and merged with
* any existing settings as if it was appended to the original configuration.
*
* subdir http request, any merge is discarded when the process exits. As a
* result, the subdir settings only have a lifetime of a single request.
*
- *
- * If -c is not set, an attempt will be made to open the default
+ *
+ * If -c is not set, an attempt will be made to open the default
* root configuration file. If -c is set and the file is not found, the
* server exits with an error.
- *
+ *
*/
> $Function: parse_conf()
*
* $Description: parse configuration file into in-memory linked list.
- *
+ *
* The first non-white character is examined to determine if the config line
* is one of the following:
* .ext:mime/type # new mime type not compiled into httpd
* checks.
* (int) flag . . . . . . the source of the parse request.
*
- * $Return: (None)
+ * $Return: (None)
*
****************************************************************************/
static void parse_conf(const char *path, int flag)
/* Properly wait for remote to closed */
FD_ZERO (&s_fd) ;
FD_SET (a_c_w, &s_fd) ;
-
+
do {
tv.tv_sec = 2 ;
tv.tv_usec = 0 ;
* Bjorn Wesen, Axis Communications AB
*
*
- * Authors of the original ifconfig was:
+ * Authors of the original ifconfig was:
* Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
*
* This program is free software; you can redistribute it
* Foundation; either version 2 of the License, or (at
* your option) any later version.
*
- * $Id: ifconfig.c,v 1.28 2004/03/06 22:11:44 andersen Exp $
+ * $Id: ifconfig.c,v 1.29 2004/03/15 08:28:48 andersen Exp $
*
*/
* a - at the end, since it's deleted already! - Roman
*
* Should really use regex.h here, not sure though how well
- * it'll go with the cross-platform support etc.
+ * it'll go with the cross-platform support etc.
*/
char *ptr;
short int found_colon = 0;
/*
* ifupdown for busybox
* Copyright (c) 2002 Glenn McGrath <bug1@optushome.com.au>
- * Copyright (c) 2003 Erik Andersen <andersen@codepoet.org>
+ * Copyright (c) 2003-2004 Erik Andersen <andersen@codepoet.org>
*
* Based on ifupdown v 0.6.4 by Anthony Towns
* Copyright (c) 1999 Anthony Towns <aj@azure.humbug.org.au>
#if 0
#define debug_noise(fmt, args...) printf(fmt, ## args)
#else
-#define debug_noise(fmt, args...)
+#define debug_noise(fmt, args...)
#endif
/* Forward declaration */
new_item = xmalloc(sizeof(llist_t));
new_item->data = data;
new_item->link = NULL;
-
+
prev = NULL;
tmp = list_head;
while(tmp) {
tmp = tmp->link;
}
if (prev) {
- prev->link = new_item;
+ prev->link = new_item;
} else {
list_head = new_item;
}
char *value;
};
-struct interface_defn_t
+struct interface_defn_t
{
struct interface_defn_t *prev;
struct interface_defn_t *next;
"-p /var/run/wvdial.%iface% -s 2", ifd, exec));
}
-static struct method_t methods[] =
+static struct method_t methods[] =
{
{ "wvdial", wvdial_up, wvdial_down, },
{ "ppp", ppp_up, ppp_down, },
{ "loopback", loopback_up, loopback_down, },
};
-struct address_family_t addr_inet =
+struct address_family_t addr_inet =
{
"inet",
sizeof(methods) / sizeof(struct method_t),
perror(filename);
return NULL;
}
- debug_noise("\t%s=%s\n", currif->option[currif->n_options].name,
+ debug_noise("\t%s=%s\n", currif->option[currif->n_options].name,
currif->option[currif->n_options].value);
currif->n_options++;
break;
}
}
}
-
+
bb_xasprintf(&buf, "run-parts /etc/network/if-%s.d", opt);
(*exec)(buf);
#ifdef CONFIG_FEATURE_IFUPDOWN_MAPPING
while ((i = getopt(argc, argv, "i:hvnamf")) != -1)
#else
- while ((i = getopt(argc, argv, "i:hvnaf")) != -1)
+ while ((i = getopt(argc, argv, "i:hvnaf")) != -1)
#endif
{
switch (i) {
if (!do_all) {
bb_show_usage();
}
- }
+ }
debug_noise("reading %s file:\n", interfaces);
defn = read_interfaces(interfaces);
list = list->link;
}
target_list = defn->autointerfaces;
-#endif
- }
+#endif
+ }
} else {
target_list = llist_add_to_end(target_list, argv[optind]);
}
} else {
iface_state->data = NULL;
iface_state->link = NULL;
- }
+ }
}
}
}
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
if (matches(opt, "-family") == 0) {
argc--;
argv++;
- if (! argv[1])
+ if (! argv[1])
bb_show_usage();
if (strcmp(argv[1], "inet") == 0)
preferred_family = AF_INET;
memset(&ifr, 0, sizeof(ifr));
strcpy(ifr.ifr_name, name);
- if (ioctl(s, SIOCGIFTXQLEN, &ifr) < 0) {
+ if (ioctl(s, SIOCGIFTXQLEN, &ifr) < 0) {
perror("SIOCGIFXQLEN");
close(s);
return;
#endif
if (filter.showqueue)
print_queuelen((char*)RTA_DATA(tb[IFLA_IFNAME]));
-
+
if (!filter.family || filter.family == AF_PACKET) {
SPRINT_BUF(b1);
fprintf(fp, "%s", _SL_);
if (n->nlmsg_len < NLMSG_LENGTH(sizeof(ifa)))
return -1;
- if (ifa->ifa_index != ifindex ||
+ if (ifa->ifa_index != ifindex ||
(filter.family && filter.family != ifa->ifa_family))
continue;
struct nlmsghdr *n = &a->h;
struct ifaddrmsg *ifa = NLMSG_DATA(n);
- if (ifa->ifa_index != ifi->ifi_index ||
+ if (ifa->ifa_index != ifi->ifi_index ||
(filter.family && filter.family != ifa->ifa_family))
continue;
if ((filter.scope^ifa->ifa_scope)&filter.scopemask)
return -1;
memset(&ifr, 0, sizeof(ifr));
- strcpy(ifr.ifr_name, dev);
- ifr.ifr_qlen = qlen;
+ strcpy(ifr.ifr_name, dev);
+ ifr.ifr_qlen = qlen;
if (ioctl(s, SIOCSIFTXQLEN, &ifr) < 0) {
perror("SIOCSIFXQLEN");
close(s);
}
close(s);
- return 0;
+ return 0;
}
static int set_mtu(char *dev, int mtu)
return -1;
memset(&ifr, 0, sizeof(ifr));
- strcpy(ifr.ifr_name, dev);
- ifr.ifr_mtu = mtu;
+ strcpy(ifr.ifr_name, dev);
+ ifr.ifr_mtu = mtu;
if (ioctl(s, SIOCSIFMTU, &ifr) < 0) {
perror("SIOCSIFMTU");
close(s);
}
close(s);
- return 0;
+ return 0;
}
static int get_address(char *dev, int *htype)
int s;
s = socket(PF_PACKET, SOCK_DGRAM, 0);
- if (s < 0) {
+ if (s < 0) {
perror("socket(PF_PACKET)");
return -1;
}
bb_error_msg("Wrong address (%s) length: expected %d bytes", lla, halen);
return -1;
}
- return 0;
+ return 0;
}
static int set_address(struct ifreq *ifr, int brd)
return -1;
}
close(s);
- return 0;
+ return 0;
}
}
if (newbrd) {
if (parse_address(dev, htype, halen, newbrd, &ifr1) < 0)
- return -1;
+ return -1;
}
}
return -1;
dev = newname;
}
- if (qlen != -1) {
+ if (qlen != -1) {
if (set_qlen(dev, qlen) < 0)
- return -1;
+ return -1;
}
- if (mtu != -1) {
+ if (mtu != -1) {
if (set_mtu(dev, mtu) < 0)
- return -1;
+ return -1;
}
if (newaddr || newbrd) {
if (newbrd) {
if (set_address(&ifr1, 1) < 0)
- return -1;
+ return -1;
}
if (newaddr) {
if (set_address(&ifr0, 0) < 0)
inet_prefix src;
int host_len = -1;
SPRINT_BUF(b1);
-
+
if (n->nlmsg_type != RTM_NEWROUTE && n->nlmsg_type != RTM_DELROUTE) {
fprintf(stderr, "Not a route: %08x %08x %08x\n",
fprintf(fp, "from 0/%u ", r->rtm_src_len);
}
if (tb[RTA_GATEWAY] && filter.rvia.bitlen != host_len) {
- fprintf(fp, "via %s ",
+ fprintf(fp, "via %s ",
format_host(r->rtm_family,
RTA_PAYLOAD(tb[RTA_GATEWAY]),
RTA_DATA(tb[RTA_GATEWAY]),
/* Do not use format_host(). It is our local addr
and symbolic name will not be useful.
*/
- fprintf(fp, " src %s ",
+ fprintf(fp, " src %s ",
rt_addr_n2a(r->rtm_family,
RTA_PAYLOAD(tb[RTA_PREFSRC]),
RTA_DATA(tb[RTA_PREFSRC]),
req.r.rtm_src_len = 0;
req.r.rtm_dst_len = 0;
req.r.rtm_tos = 0;
-
+
while (argc > 0) {
switch (compare_string_array(options, *argv)) {
case 0: /* from */
return do_add_ioctl(cmd, "gre0", &p);
case IPPROTO_IPV6:
return do_add_ioctl(cmd, "sit0", &p);
- default:
+ default:
bb_error_msg("cannot determine tunnel mode (ipip, gre or sit)");
return -1;
}
return do_del_ioctl("gre0", &p);
case IPPROTO_IPV6:
return do_del_ioctl("sit0", &p);
- default:
+ default:
return do_del_ioctl(p.name, &p);
}
return -1;
return -1;
switch (p.iph.protocol) {
- case IPPROTO_IPIP:
+ case IPPROTO_IPIP:
err = do_get_ioctl(p.name[0] ? p.name : "tunl0", &p);
break;
case IPPROTO_GRE:
}
}
-int rtnl_listen(struct rtnl_handle *rtnl,
+int rtnl_listen(struct rtnl_handle *rtnl,
int (*handler)(struct sockaddr_nl *,struct nlmsghdr *n, void *),
void *jarg)
{
}
}
-int rtnl_from_file(FILE *rtnl,
+int rtnl_from_file(FILE *rtnl,
int (*handler)(struct sockaddr_nl *,struct nlmsghdr *n, void *),
void *jarg)
{
#define TCA_SET_OFF TCA_GRED_PARMS
struct tc_gred_qopt
{
- __u32 limit; /* HARD maximal queue length (bytes)
+ __u32 limit; /* HARD maximal queue length (bytes)
*/
- __u32 qth_min; /* Min average length threshold (bytes)
+ __u32 qth_min; /* Min average length threshold (bytes)
*/
- __u32 qth_max; /* Max average length threshold (bytes)
+ __u32 qth_max; /* Max average length threshold (bytes)
*/
__u32 DP; /* upto 2^32 DPs */
- __u32 backlog;
- __u32 qave;
- __u32 forced;
- __u32 early;
- __u32 other;
- __u32 pdrop;
+ __u32 backlog;
+ __u32 qave;
+ __u32 forced;
+ __u32 early;
+ __u32 other;
+ __u32 pdrop;
unsigned char Wlog; /* log(W) */
unsigned char Plog; /* log(P_max/(qth_max-qth_min)) */
__u32 lends;
__u32 borrows;
__u32 giants; /* too big packets (rate will not be accurate) */
- __u32 injects; /* how many times leaf used injected bw */
+ __u32 injects; /* how many times leaf used injected bw */
__u32 tokens;
__u32 ctokens;
};
char *name;
} llproto_names[] = {
__PF(LOOP,loop)
-__PF(PUP,pup)
+__PF(PUP,pup)
#ifdef ETH_P_PUPAT
-__PF(PUPAT,pupat)
+__PF(PUPAT,pupat)
#endif
__PF(IP,ip)
__PF(X25,x25)
__PF(ARP,arp)
__PF(BPQ,bpq)
#ifdef ETH_P_IEEEPUP
-__PF(IEEEPUP,ieeepup)
+__PF(IEEEPUP,ieeepup)
#endif
#ifdef ETH_P_IEEEPUPAT
-__PF(IEEEPUPAT,ieeepupat)
+__PF(IEEEPUPAT,ieeepupat)
#endif
-__PF(DEC,dec)
-__PF(DNA_DL,dna_dl)
-__PF(DNA_RC,dna_rc)
-__PF(DNA_RT,dna_rt)
-__PF(LAT,lat)
-__PF(DIAG,diag)
-__PF(CUST,cust)
-__PF(SCA,sca)
-__PF(RARP,rarp)
-__PF(ATALK,atalk)
-__PF(AARP,aarp)
-__PF(IPX,ipx)
-__PF(IPV6,ipv6)
+__PF(DEC,dec)
+__PF(DNA_DL,dna_dl)
+__PF(DNA_RC,dna_rc)
+__PF(DNA_RT,dna_rt)
+__PF(LAT,lat)
+__PF(DIAG,diag)
+__PF(CUST,cust)
+__PF(SCA,sca)
+__PF(RARP,rarp)
+__PF(ATALK,atalk)
+__PF(AARP,aarp)
+__PF(IPX,ipx)
+__PF(IPV6,ipv6)
#ifdef ETH_P_PPP_DISC
-__PF(PPP_DISC,ppp_disc)
+__PF(PPP_DISC,ppp_disc)
#endif
#ifdef ETH_P_PPP_SES
-__PF(PPP_SES,ppp_ses)
+__PF(PPP_SES,ppp_ses)
#endif
#ifdef ETH_P_ATMMPOA
-__PF(ATMMPOA,atmmpoa)
+__PF(ATMMPOA,atmmpoa)
#endif
#ifdef ETH_P_ATMFATE
-__PF(ATMFATE,atmfate)
+__PF(ATMFATE,atmfate)
#endif
-__PF(802_3,802_3)
-__PF(AX25,ax25)
-__PF(ALL,all)
-__PF(802_2,802_2)
-__PF(SNAP,snap)
-__PF(DDCMP,ddcmp)
-__PF(WAN_PPP,wan_ppp)
-__PF(PPP_MP,ppp_mp)
-__PF(LOCALTALK,localtalk)
-__PF(PPPTALK,ppptalk)
-__PF(TR_802_2,tr_802_2)
-__PF(MOBITEX,mobitex)
-__PF(CONTROL,control)
-__PF(IRDA,irda)
+__PF(802_3,802_3)
+__PF(AX25,ax25)
+__PF(ALL,all)
+__PF(802_2,802_2)
+__PF(SNAP,snap)
+__PF(DDCMP,ddcmp)
+__PF(WAN_PPP,wan_ppp)
+__PF(PPP_MP,ppp_mp)
+__PF(LOCALTALK,localtalk)
+__PF(PPPTALK,ppptalk)
+__PF(TR_802_2,tr_802_2)
+__PF(MOBITEX,mobitex)
+__PF(CONTROL,control)
+__PF(IRDA,irda)
#ifdef ETH_P_ECONET
-__PF(ECONET,econet)
+__PF(ECONET,econet)
#endif
{ 0x8100, "802.1Q" },
#define AF_DECnet 12
#endif
-struct dn_naddr
+struct dn_naddr
{
unsigned short a_len;
unsigned char a_addr[DN_MAXADDL];
0.0.1 6K It works.
0.0.2 5K Smaller and you can also check the exit condition if you wish.
- 0.0.3 Uses select()
+ 0.0.3 Uses select()
19980918 Busy Boxed! Dave Cinege
19990512 Uses Select. Charles P. Wright
int do_listen = 0, lport = 0, delay = 0, tmpfd, opt, sfd, x;
char buf[BUFSIZ];
#ifdef GAPING_SECURITY_HOLE
- char * pr00gie = NULL;
+ char * pr00gie = NULL;
#endif
struct sockaddr_in address;
#ifdef GAPING_SECURITY_HOLE
if (pr00gie) {
/* won't need stdin */
- close (fileno(stdin));
+ close (fileno(stdin));
}
#endif /* GAPING_SECURITY_HOLE */
snprint_ip_port(local_addr, sizeof(local_addr),
(struct sockaddr *) &localaddr, local_port,
"tcp", flags&NETSTAT_NUMERIC);
-
+
snprint_ip_port(rem_addr, sizeof(rem_addr),
(struct sockaddr *) &remaddr, rem_port,
"tcp", flags&NETSTAT_NUMERIC);
snprint_ip_port(local_addr, sizeof(local_addr),
(struct sockaddr *) &localaddr, local_port,
"udp", flags&NETSTAT_NUMERIC);
-
+
snprint_ip_port(rem_addr, sizeof(rem_addr),
(struct sockaddr *) &remaddr, rem_port,
"udp", flags&NETSTAT_NUMERIC);
snprint_ip_port(local_addr, sizeof(local_addr),
(struct sockaddr *) &localaddr, local_port,
"raw", flags&NETSTAT_NUMERIC);
-
+
snprint_ip_port(rem_addr, sizeof(rem_addr),
(struct sockaddr *) &remaddr, rem_port,
"raw", flags&NETSTAT_NUMERIC);
{
int opt;
int new_flags=0;
- int showroute = 0, extended = 0;
+ int showroute = 0, extended = 0;
#ifdef CONFIG_FEATURE_IPV6
int inet=1;
int inet6=1;
bb_show_usage();
}
if ( showroute ) {
-#ifdef CONFIG_ROUTE
+#ifdef CONFIG_ROUTE
displayroutes ( flags & NETSTAT_NUMERIC, !extended );
- return 0;
+ return 0;
#else
bb_error_msg_and_die( "-r (display routing table) is not compiled in." );
#endif
- }
-
+ }
+
if (new_flags) {
flags &= ~(NETSTAT_TCP|NETSTAT_UDP|NETSTAT_RAW|NETSTAT_UNIX);
flags |= new_flags;
if (argc < 2 || *argv[1]=='-' || argc > 3)
bb_show_usage();
- else if(argc == 3)
+ else if(argc == 3)
set_default_dns(argv[2]);
server_print();
return EXIT_SUCCESS;
}
-/* $Id: nslookup.c,v 1.31 2004/01/30 22:40:05 andersen Exp $ */
+/* $Id: nslookup.c,v 1.32 2004/03/15 08:28:48 andersen Exp $ */
/* vi: set sw=4 ts=4: */
/*
- * $Id: ping.c,v 1.55 2003/07/22 08:56:51 andersen Exp $
+ * $Id: ping.c,v 1.56 2004/03/15 08:28:48 andersen Exp $
* Mini ping implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
*
* This code is derived from software contributed to Berkeley by
* Mike Muuss.
- *
+ *
* Original copyright notice is retained at the end of this file.
*/
if (dupflag)
printf(" (DUP!)");
printf("\n");
- } else
+ } else
if (icmppkt->icmp_type != ICMP_ECHO)
bb_error_msg("Warning: Got ICMP %d (%s)",
icmppkt->icmp_type, icmp_type_name (icmppkt->icmp_type));
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
- * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
+ * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
+ * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
*
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
/* vi: set sw=4 ts=4: */
/*
- * $Id: ping6.c,v 1.5 2003/05/22 07:10:22 andersen Exp $
+ * $Id: ping6.c,v 1.6 2004/03/15 08:28:48 andersen Exp $
* Mini ping implementation for busybox
*
* Copyright (C) 1999 by Randolph Chung <tausq@debian.org>
*
* This code is derived from software contributed to Berkeley by
* Mike Muuss.
- *
+ *
* Original copyright notice is retained at the end of this file.
*
* This version is an adaptation of ping.c from busybox.
static char rcvd_tbl[MAX_DUP_CHK / 8];
# ifdef CONFIG_FEATURE_FANCY_PING
-extern
+extern
# endif
struct hostent *hostent;
inet_ntop(AF_INET6, (struct in_addr6 *) &pingaddr.sin6_addr,
buf, sizeof(buf)),
icmppkt->icmp6_seq);
- printf(" ttl=%d time=%lu.%lu ms", hoplimit,
+ printf(" ttl=%d time=%lu.%lu ms", hoplimit,
triptime / 10, triptime % 10);
if (dupflag)
printf(" (DUP!)");
printf("\n");
- } else
+ } else
if (icmppkt->icmp6_type != ICMP6_ECHO_REQUEST)
bb_error_msg("Warning: Got ICMP %d (%s)",
icmppkt->icmp6_type, icmp6_type_name (icmppkt->icmp6_type));
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
- * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
+ * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
+ * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
*
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* Foundation; either version 2 of the License, or (at
* your option) any later version.
*
- * $Id: route.c,v 1.24 2004/03/10 07:42:38 mjn3 Exp $
+ * $Id: route.c,v 1.25 2004/03/15 08:28:49 andersen Exp $
*
* displayroute() code added by Vladimir N. Oleynik <dzo@simtreas.ru>
* adjustments by Larry Doolittle <LRDoolittle@lbl.gov>
#define KW_IPVx_DYN 042
#define KW_IPVx_REINSTATE 043
-static const char tbl_ipvx[] =
+static const char tbl_ipvx[] =
/* 020 is the "takes an arg" bit */
#if HAVE_NEW_ADDRT
"\011\020metric\0"
while (*args) {
int k = kw_lookup(tbl_ipvx, &args);
const char *args_m1 = args[-1];
-
+
if (k & KW_IPVx_FLAG_ONLY) {
rt.rt_flags |= flags_ipvx[k & 3];
continue;
p[0][0] = '#';
}
}
- }
+ }
opt = bb_getopt_ulflags(argc, argv, "A:ne", &family);
#include <arpa/inet.h> /* for inet_ntoa()... */
#define TRACE(x, y) do { if (x) printf y; } while (0)
#else
-#define TRACE(x, y)
+#define TRACE(x, y)
#endif
#if 0
/* buffer to handle telnet negotiations */
char iacbuf[IACBUFSIZE];
short iaclen; /* could even use byte */
- struct termios termios_def;
- struct termios termios_raw;
+ struct termios termios_def;
+ struct termios termios_raw;
} G;
#define xUSE_GLOBALVAR_PTR /* xUSE... -> don't use :D (makes smaller code) */
{
cookmode();
exit(ev);
-}
+}
static void conescape(void)
{
if (G.gotsig)
cookmode();
-
+
rrturn:
G.gotsig = 0;
-
+
}
static void handlenetoutput(int len)
{
G.charmode = CHM_TRY;
G.telflags |= (UF_ECHO | UF_SGA);
setConMode();
-
+
putiac2(DO, TELOPT_ECHO);
putiac2(DO, TELOPT_SGA);
iacflush();
/* if server requests ECHO, don't agree */
if (G.telwish == DO) { putiac2(WONT, TELOPT_ECHO); return; }
else if (G.telwish == DONT) return;
-
+
if (G.telflags & UF_ECHO)
{
if (G.telwish == WILL)
else
if (G.telwish == WONT)
return;
-
+
if ((G.telflags ^= UF_SGA) & UF_SGA) /* toggle */
putiac2(DO, TELOPT_SGA);
else
#ifdef CONFIG_FEATURE_AUTOWIDTH
static inline void to_naws(void)
-{
+{
/* Tell server we will do NAWS */
putiac2(WILL, TELOPT_NAWS);
return;
-}
+}
#endif
static void telopt(byte c)
static void rawmode(void)
{
tcsetattr(0, TCSADRAIN, &G.termios_raw);
-}
+}
static void cookmode(void)
{
struct sockaddr_in s_in;
#ifdef USE_POLL
struct pollfd ufds[2];
-#else
+#else
fd_set readfds;
int maxfd;
-#endif
+#endif
#ifdef CONFIG_FEATURE_TELNET_AUTOLOGIN
int opt;
if (tcgetattr(0, &G.termios_def) < 0)
exit(1);
-
+
G.termios_raw = G.termios_def;
cfmakeraw(&G.termios_raw);
-
+
if (argc < 2)
bb_show_usage();
-
+
#ifdef CONFIG_FEATURE_TELNET_AUTOLOGIN
autologin = NULL;
while ((opt = getopt(argc, argv, "al:")) != EOF) {
bb_lookup_host(&s_in, argv[1]);
s_in.sin_port = bb_lookup_port((argc == 3) ? argv[2] : "telnet", "tcp", 23);
#endif
-
+
G.netfd = xconnect(&s_in);
setsockopt(G.netfd, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof one);
#ifdef USE_POLL
ufds[0].fd = 0; ufds[1].fd = G.netfd;
ufds[0].events = ufds[1].events = POLLIN;
-#else
+#else
FD_ZERO(&readfds);
FD_SET(0, &readfds);
FD_SET(G.netfd, &readfds);
maxfd = G.netfd + 1;
#endif
-
+
while (1)
{
#ifndef USE_POLL
fd_set rfds = readfds;
-
+
switch (select(maxfd, &rfds, NULL, NULL, NULL))
#else
switch (poll(ufds, 2, -1))
-#endif
+#endif
{
case 0:
/* timeout */
#ifdef USE_POLL
if (ufds[0].revents) /* well, should check POLLIN, but ... */
-#else
+#else
if (FD_ISSET(0, &rfds))
-#endif
+#endif
{
len = read(0, G.buf, DATABUFSIZE);
doexit(0);
TRACE(0, ("Read con: %d\n", len));
-
+
handlenetoutput(len);
}
#ifdef USE_POLL
if (ufds[1].revents) /* well, should check POLLIN, but ... */
-#else
+#else
if (FD_ISSET(G.netfd, &rfds))
-#endif
+#endif
{
len = read(G.netfd, G.buf, DATABUFSIZE);
-/* $Id: telnetd.c,v 1.10 2004/02/22 09:45:57 bug1 Exp $
+/* $Id: telnetd.c,v 1.11 2004/03/15 08:28:53 andersen Exp $
*
* Simple telnet server
* Bjorn Wesen, Axis Communications AB (bjornw@axis.com)
#define BUFSIZE 4000
-static const char *loginpath
+static const char *loginpath
#ifdef CONFIG_LOGIN
= "/bin/login";
#else
#ifndef CONFIG_FEATURE_TELNETD_INETD
struct tsession *next = ts->next; /* in case we free ts. */
#endif /* CONFIG_FEATURE_TELNETD_INETD */
-
+
if (ts->size1 && FD_ISSET(ts->ptyfd, &wrfdset)) {
int num_totty;
char *ptr;
#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
-static int tftp_blocksize_check(int blocksize, int bufsize)
+static int tftp_blocksize_check(int blocksize, int bufsize)
{
- /* Check if the blocksize is valid:
+ /* Check if the blocksize is valid:
* RFC2348 says between 8 and 65464,
* but our implementation makes it impossible
* to use blocksizes smaller than 22 octets.
*/
- if ((bufsize && (blocksize > bufsize)) ||
+ if ((bufsize && (blocksize > bufsize)) ||
(blocksize < 8) || (blocksize > 65464)) {
bb_error_msg("bad blocksize");
return 0;
return blocksize;
}
-static char *tftp_option_get(char *buf, int len, char *option)
+static char *tftp_option_get(char *buf, int len, char *option)
{
int opt_val = 0;
int opt_found = 0;
int k;
-
+
while (len > 0) {
/* Make sure the options are terminated correctly */
if (strcasecmp(buf, option) == 0) {
opt_found = 1;
}
- }
+ }
else {
if (opt_found) {
return buf;
}
}
-
+
k++;
-
+
buf += k;
len -= k;
-
+
opt_val ^= 1;
}
-
+
return NULL;
}
if ((cmd_get && (opcode == TFTP_RRQ)) ||
(cmd_put && (opcode == TFTP_WRQ))) {
- int too_long = 0;
+ int too_long = 0;
/* see if the filename fits into buf */
/* and fill in packet */
if (buf[4] != '\0') {
msg = &buf[4];
buf[tftp_bufsize - 1] = '\0';
- } else if (tmp < (sizeof(tftp_bb_error_msg)
+ } else if (tmp < (sizeof(tftp_bb_error_msg)
/ sizeof(char *))) {
msg = (char *) tftp_bb_error_msg[tmp];
char *res;
- res = tftp_option_get(&buf[2], len-2,
+ res = tftp_option_get(&buf[2], len-2,
"blksize");
if (res) {
int blksize = atoi(res);
-
+
if (tftp_blocksize_check(blksize,
tftp_bufsize - 4)) {
if (cmd_get && (opcode == TFTP_DATA)) {
if (tmp == block_nr) {
-
+
len = write(localfd, &buf[4], len - 4);
if (len < 0) {
#ifdef CONFIG_FEATURE_TFTP_GET
#define GET "g"
#else
-#define GET
+#define GET
#endif
#ifdef CONFIG_FEATURE_TFTP_PUT
#define PUT "p"
#else
-#define PUT
+#define PUT
#endif
while ((opt = getopt(argc, argv, BS GET PUT "l:r:")) != -1) {
flags = O_RDONLY;
break;
#endif
- case 'l':
+ case 'l':
localfile = bb_xstrdup(optarg);
break;
case 'r':
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
-
+
#define MAXPACKET 65535 /* max ip packet size */
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 64
Other Credits:
--------------
Moreton Bay (http://www.moretonbay.com/)
-Lineo (http://opensource.lineo.com)
Vladimir Oleynik <dzo@simtrea.ru> Size optimizations
(Ted Lemon <Ted.Lemon@nominum.com>)
+ Improved (hopefully) NAKing behavior (me)
+ Added -b option (Jouni Malinen)
-+ Compute checksums correctly on big endian hosts
++ Compute checksums correctly on big endian hosts
(Jouni Malinen <jkmaline@cc.hut.fi>)
0.9.7 (020526)
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-------------------
The Makefile contains three of the compile time options:
-
+
UDHCP_DEBUG: If UDHCP_DEBUG is defined, udhcpd will output extra
debugging output, compile with -g, and not fork to the background when
run.
UDHCP_SYSLOG: If UDHCP_SYSLOG is defined, udhcpd will log all its
messages syslog, otherwise, it will attempt to log them to stdout.
-
+
COMBINED_BINARY: If COMBINED_BINARY is define, one binary, udhcpd,
is created. If called as udhcpd, the dhcp server will be started.
If called as udhcpc, the dhcp client will be started.
-
+
dhcpd.h contains the other three compile time options:
-
+
LEASE_TIME: The default lease time if not specified in the config
file.
LEASES_FILE: The default file for storing leases.
-
+
DHCPD_CONFIG_FILE: The defualt config file to use.
-
+
options.c contains a set of dhcp options for the client:
name[10]: The name of the option as it will appear in scripts
-
+
flags: The type of option, as well as if it will be requested
by the client (OPTION_REQ)
udhcp is now a drop-in component for busybox (http://busybox.net).
To update busybox to the latest revision, simply do a:
-cp *.[ch] README AUTHORS COPYING ChangeLog TODO \
+cp *.[ch] README AUTHORS COPYING ChangeLog TODO \
<busybox_source>/networking/udhcp
The only two files udhcp does not provide are config.in and
When an event occurs, udhcpc calls the action script. udhcpc never does
any configuration of the network interface itself, but instead relies on
-a set of scripts. The script by default is
+a set of scripts. The script by default is
/usr/share/udhcpc/default.script but this can be changed via the command
line arguments. The three possible arguments to the script are:
deconfig: This argument is used when udhcpc starts, and
when a leases is lost. The script must put the interface in an
up, but deconfigured state, ie: ifconfig $interface 0.0.0.0.
-
+
bound: This argument is used when udhcpc moves from an
unbound, to a bound state. All of the paramaters are set in
enviromental variables, The script should configure the interface,
- and set any other relavent parameters (default gateway, dns server,
+ and set any other relavent parameters (default gateway, dns server,
etc).
-
+
renew: This argument is used when a DHCP lease is renewed. All of
the paramaters are set in enviromental variables. This argument is
used when the interface is already configured, so the IP address,
options.c contains a set of dhcp options for the client:
name[10]: The name of the option as it will appear in scripts
-
+
flags: The type of option, as well as if it will be requested
by the client (OPTION_REQ)
The udhcpd.leases behavior is designed for an embedded system. The
file is written either every auto_time seconds, or when a SIGUSR1
-is received (the auto_time timer restarts if a SIGUSR1 is received).
+is received (the auto_time timer restarts if a SIGUSR1 is received).
If you send a SIGTERM to udhcpd directly after a SIGUSR1, udhcpd will
finish writing the leases file and wait for the aftermentioned script
to be executed and finish before quiting, so you do not need to sleep
compile time options
-------------------
-
+
dhcpd.h contains the other two compile time options:
-
+
LEASE_TIME: The default lease time if not specified in the config
file.
-
+
DHCPD_CONFIG_FILE: The defualt config file to use.
* interface - interface to use
* retn: 1 addr free
* 0 addr used
- * -1 error
- */
+ * -1 error
+ */
/* FIXME: match response against chaddr */
int arpping(uint32_t yiaddr, uint32_t ip, uint8_t *mac, char *interface)
#endif
return -1;
}
-
+
if (setsockopt(s, SOL_SOCKET, SO_BROADCAST, &optval, sizeof(optval)) == -1) {
LOG(LOG_ERR, "Could not setsocketopt on raw socket");
close(s);
memcpy(arp.sInaddr, &ip, sizeof(ip)); /* source IP address */
memcpy(arp.sHaddr, mac, 6); /* source hardware address */
memcpy(arp.tInaddr, &yiaddr, sizeof(yiaddr)); /* target IP address */
-
+
memset(&addr, 0, sizeof(addr));
strcpy(addr.sa_data, interface);
if (sendto(s, &arp, sizeof(arp), 0, &addr, sizeof(addr)) < 0)
rv = 0;
-
+
/* wait arp reply, and check it */
tm.tv_usec = 0;
time(&prevTime);
if (errno != EINTR) rv = 0;
} else if (FD_ISSET(s, &fdset)) {
if (recv(s, &arp, sizeof(arp), 0) < 0 ) rv = 0;
- if (arp.operation == htons(ARPOP_REPLY) &&
- bcmp(arp.tHaddr, mac, 6) == 0 &&
+ if (arp.operation == htons(ARPOP_REPLY) &&
+ bcmp(arp.tHaddr, mac, 6) == 0 &&
*((uint32_t *) arp.sInaddr) == yiaddr) {
DEBUG(LOG_INFO, "Valid arp reply receved for this address");
rv = 0;
time(&prevTime);
}
close(s);
- DEBUG(LOG_INFO, "%salid arp replies for this address", rv ? "No v" : "V");
+ DEBUG(LOG_INFO, "%salid arp replies for this address", rv ? "No v" : "V");
return rv;
}
u_char h_dest[6]; /* destination ether addr */
u_char h_source[6]; /* source ether addr */
u_short h_proto; /* packet type ID field */
-
+
/* ARP packet */
uint16_t htype; /* hardware type (must be ARPHRD_ETHER) */
uint16_t ptype; /* protocol type (must be ETH_P_IP) */
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <string.h>
#include <sys/socket.h>
#include <features.h>
char vendor, length;
char str[sizeof("udhcp "VERSION)];
} vendor_id = { DHCP_VENDOR, sizeof("udhcp "VERSION) - 1, "udhcp "VERSION};
-
+
init_header(packet, type);
memcpy(packet->chaddr, client_config.arp, 6);
add_option_string(packet->options, client_config.clientid);
add_requests(&packet);
LOG(LOG_DEBUG, "Sending discover...");
- return raw_packet(&packet, INADDR_ANY, CLIENT_PORT, INADDR_BROADCAST,
+ return raw_packet(&packet, INADDR_ANY, CLIENT_PORT, INADDR_BROADCAST,
SERVER_PORT, MAC_BCAST_ADDR, client_config.ifindex);
}
add_simple_option(packet.options, DHCP_REQUESTED_IP, requested);
add_simple_option(packet.options, DHCP_SERVER_ID, server);
-
+
add_requests(&packet);
addr.s_addr = requested;
LOG(LOG_DEBUG, "Sending select for %s...", inet_ntoa(addr));
- return raw_packet(&packet, INADDR_ANY, CLIENT_PORT, INADDR_BROADCAST,
+ return raw_packet(&packet, INADDR_ANY, CLIENT_PORT, INADDR_BROADCAST,
SERVER_PORT, MAC_BCAST_ADDR, client_config.ifindex);
}
add_requests(&packet);
LOG(LOG_DEBUG, "Sending renew...");
- if (server)
+ if (server)
ret = kernel_packet(&packet, ciaddr, CLIENT_PORT, server, SERVER_PORT);
else ret = raw_packet(&packet, INADDR_ANY, CLIENT_PORT, INADDR_BROADCAST,
SERVER_PORT, MAC_BCAST_ADDR, client_config.ifindex);
return ret;
-}
+}
/* Unicasts a DHCP release message */
init_packet(&packet, DHCPRELEASE);
packet.xid = random_xid();
packet.ciaddr = ciaddr;
-
+
add_simple_option(packet.options, DHCP_REQUESTED_IP, ciaddr);
add_simple_option(packet.options, DHCP_SERVER_ID, server);
usleep(500000); /* possible down interface, looping condition */
return -1;
}
-
+
if (bytes < (int) (sizeof(struct iphdr) + sizeof(struct udphdr))) {
DEBUG(LOG_INFO, "message too short, ignoring");
return -2;
}
-
+
if (bytes < ntohs(packet.ip.tot_len)) {
DEBUG(LOG_INFO, "Truncated packet");
return -2;
}
-
+
/* ignore any extra garbage bytes */
bytes = ntohs(packet.ip.tot_len);
-
+
/* Make sure its the right packet for us, and that it passes sanity checks */
if (packet.ip.protocol != IPPROTO_UDP || packet.ip.version != IPVERSION ||
packet.ip.ihl != sizeof(packet.ip) >> 2 || packet.udp.dest != htons(CLIENT_PORT) ||
DEBUG(LOG_INFO, "bad IP header checksum, ignoring");
return -1;
}
-
+
/* verify the UDP checksum by replacing the header with a psuedo header */
source = packet.ip.saddr;
dest = packet.ip.daddr;
DEBUG(LOG_ERR, "packet with bad UDP checksum received, ignoring");
return -2;
}
-
+
memcpy(payload, &(packet.data), bytes - (sizeof(packet.ip) + sizeof(packet.udp)));
-
+
if (ntohl(payload->cookie) != DHCP_MAGIC) {
LOG(LOG_ERR, "received bogus message (bad magic) -- ignoring");
return -2;
}
DEBUG(LOG_INFO, "oooooh!!! got some!");
return bytes - (sizeof(packet.ip) + sizeof(packet.udp));
-
+
}
void background(const char *pidfile)
{
#ifdef __uClinux__
- LOG(LOG_ERR, "Cannot background in uclinux (yet)");
+ LOG(LOG_ERR, "Cannot background in uclinux (yet)");
#else /* __uClinux__ */
int pid_fd;
void start_log_and_pid(const char *client_server, const char *pidfile);
void background(const char *pidfile);
void udhcp_logging(int level, const char *fmt, ...);
-
+
#define LOG(level, str, args...) udhcp_logging(level, str, ## args)
#ifdef UDHCP_DEBUG
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-
+
#include <sys/time.h>
#include <sys/file.h>
#include <unistd.h>
temp_addr.s_addr = server_addr;
sprintf(buffer, "%s", inet_ntoa(temp_addr));
temp_addr.s_addr = requested_ip;
- LOG(LOG_INFO, "Unicasting a release of %s to %s",
+ LOG(LOG_INFO, "Unicasting a release of %s to %s",
inet_ntoa(temp_addr), buffer);
send_release(server_addr, requested_ip); /* unicast */
run_script(NULL, "deconfig");
int option_index = 0;
c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:s:v", arg_options, &option_index);
if (c == -1) break;
-
+
switch (c) {
case 'c':
len = strlen(optarg) > 255 ? 255 : strlen(optarg);
/* Start the log, sanitize fd's, and write a pid file */
start_log_and_pid("udhcpc", client_config.pidfile);
- if (read_interface(client_config.interface, &client_config.ifindex,
+ if (read_interface(client_config.interface, &client_config.ifindex,
NULL, client_config.arp) < 0)
return 1;
-
+
if (!client_config.clientid) {
client_config.clientid = xmalloc(6 + 3);
client_config.clientid[OPT_CODE] = DHCP_CLIENT_ID;
}
/* setup the signal pipe */
- udhcp_sp_setup();
-
+ udhcp_sp_setup();
+
state = INIT_SELECTING;
run_script(NULL, "deconfig");
change_mode(LISTEN_RAW);
/* send discover packet */
send_discover(xid, requested_ip); /* broadcast */
-
+
timeout = now + ((packet_num == 2) ? 4 : 2);
packet_num++;
} else {
if (state == RENEW_REQUESTED)
send_renew(xid, server_addr, requested_ip); /* unicast */
else send_selecting(xid, server_addr, requested_ip); /* broadcast */
-
+
timeout = now + ((packet_num == 2) ? 10 : 2);
packet_num++;
} else {
} else {
/* send a request packet */
send_renew(xid, server_addr, requested_ip); /* unicast */
-
+
t1 = (t2 - t1) / 2 + t1;
timeout = t1 + start;
}
}
} else if (retval > 0 && listen_mode != LISTEN_NONE && FD_ISSET(fd, &rfds)) {
/* a packet is ready, read it */
-
+
if (listen_mode == LISTEN_KERNEL)
len = get_packet(&packet, fd);
else len = get_raw_packet(&packet, fd);
-
+
if (len == -1 && errno != EINTR) {
DEBUG(LOG_INFO, "error on read, %m, reopening socket");
change_mode(listen_mode); /* just close and reopen */
}
if (len < 0) continue;
-
+
if (packet.xid != xid) {
DEBUG(LOG_INFO, "Ignoring XID %lx (our xid is %lx)",
(unsigned long) packet.xid, xid);
continue;
}
-
+
if ((message = get_option(&packet, DHCP_MESSAGE_TYPE)) == NULL) {
DEBUG(LOG_ERR, "couldnt get option from packet -- ignoring");
continue;
}
-
+
switch (state) {
case INIT_SELECTING:
/* Must be a DHCPOFFER to one of our xid's */
memcpy(&server_addr, temp, 4);
xid = packet.xid;
requested_ip = packet.yiaddr;
-
+
/* enter requesting state */
state = REQUESTING;
timeout = now;
memcpy(&lease, temp, 4);
lease = ntohl(lease);
}
-
+
/* enter bound state */
t1 = lease / 2;
-
+
/* little fixed point for n * .875 */
t2 = (lease * 0x7) >> 3;
temp_addr.s_addr = packet.yiaddr;
- LOG(LOG_INFO, "Lease of %s obtained, lease time %ld",
+ LOG(LOG_INFO, "Lease of %s obtained, lease time %ld",
inet_ntoa(temp_addr), lease);
start = now;
timeout = t1 + start;
state = BOUND;
change_mode(LISTEN_NONE);
- if (client_config.quit_after_lease)
+ if (client_config.quit_after_lease)
return 0;
if (!client_config.foreground)
client_background();
}
break;
/* case BOUND, RELEASED: - ignore all packets */
- }
+ }
} else if (retval > 0 && (sig = udhcp_sp_read(&rfds))) {
switch (sig) {
- case SIGUSR1:
+ case SIGUSR1:
perform_renew();
break;
case SIGUSR2:
return 0;
}
} else if (retval == -1 && errno == EINTR) {
- /* a signal was caught */
+ /* a signal was caught */
} else {
/* An error occured */
DEBUG(LOG_ERR, "Error on select");
}
-
+
}
return 0;
}
struct server_config_t server_config;
-#ifdef COMBINED_BINARY
+#ifdef COMBINED_BINARY
int udhcpd_main(int argc, char *argv[])
#else
int main(int argc, char *argv[])
#endif
-{
+{
fd_set rfds;
struct timeval tv;
int server_socket = -1;
struct dhcpOfferedAddr *lease;
int max_sock;
unsigned long num_ips;
-
+
memset(&server_config, 0, sizeof(struct server_config_t));
read_config(argc < 2 ? DHCPD_CONF_FILE : argv[1]);
server_config.lease = ntohl(server_config.lease);
}
else server_config.lease = LEASE_TIME;
-
+
/* Sanity check */
num_ips = ntohl(server_config.end) - ntohl(server_config.start);
if (server_config.max_leases > num_ips) {
if ((server_socket = listen_socket(INADDR_ANY, SERVER_PORT, server_config.interface)) < 0) {
LOG(LOG_ERR, "FATAL: couldn't create server socket, %m");
return 2;
- }
+ }
max_sock = udhcp_sp_fd_set(&rfds, server_socket);
if (server_config.auto_time) {
tv.tv_usec = 0;
}
if (!server_config.auto_time || tv.tv_sec > 0) {
- retval = select(max_sock + 1, &rfds, NULL, NULL,
+ retval = select(max_sock + 1, &rfds, NULL, NULL,
server_config.auto_time ? &tv : NULL);
} else retval = 0; /* If we already timed out, fall through */
DEBUG(LOG_INFO, "error on select");
continue;
}
-
+
switch (udhcp_sp_read(&rfds)) {
case SIGUSR1:
LOG(LOG_INFO, "Received a SIGUSR1");
DEBUG(LOG_ERR, "couldn't get option from packet, ignoring");
continue;
}
-
+
/* ADDME: look for a static lease */
lease = find_lease_by_chaddr(packet.chaddr);
switch (state[0]) {
case DHCPDISCOVER:
DEBUG(LOG_INFO,"received DISCOVER");
-
+
if (sendOffer(&packet) < 0) {
LOG(LOG_ERR, "send OFFER failed");
}
- break;
+ break;
case DHCPREQUEST:
DEBUG(LOG_INFO, "received REQUEST");
if (requested) memcpy(&requested_align, requested, 4);
if (server_id) memcpy(&server_id_align, server_id, 4);
-
+
if (lease) { /*ADDME: or static lease */
if (server_id) {
/* SELECTING State */
DEBUG(LOG_INFO, "server_id = %08x", ntohl(server_id_align));
- if (server_id_align == server_config.server && requested &&
+ if (server_id_align == server_config.server && requested &&
requested_align == lease->yiaddr) {
sendACK(&packet, lease->yiaddr);
}
/* don't know what to do!!!! */
sendNAK(&packet);
}
- }
+ }
}
-
+
/* what to do if we have no record of the client */
} else if (server_id) {
/* SELECTING State */
memset(lease->chaddr, 0, 16);
/* make some contention for this address */
} else sendNAK(&packet);
- } else if (requested_align < server_config.start ||
+ } else if (requested_align < server_config.start ||
requested_align > server_config.end) {
sendNAK(&packet);
} /* else remain silent */
if (lease) {
memset(lease->chaddr, 0, 16);
lease->expires = time(0) + server_config.decline_time;
- }
+ }
break;
case DHCPRELEASE:
DEBUG(LOG_INFO,"received RELEASE");
case DHCPINFORM:
DEBUG(LOG_INFO,"received INFORM");
send_inform(&packet);
- break;
+ break;
default:
LOG(LOG_WARNING, "unsupported DHCP message (%02x) -- ignoring", state[0]);
}
uint32_t siaddr; /* next server bootp option */
char *sname; /* bootp server name */
char *boot_file; /* bootp boot file option */
-};
+};
extern struct server_config_t server_config;
extern struct dhcpOfferedAddr *leases;
-
+
#endif
const char *file = LEASES_FILE;
struct dhcpOfferedAddr lease;
struct in_addr addr;
-
+
static const struct option options[] = {
{"absolute", 0, 0, 'a'},
{"remaining", 0, 0, 'r'},
int option_index = 0;
c = getopt_long(argc, argv, "arf:", options, &option_index);
if (c == -1) break;
-
+
switch (c) {
case 'a': mode = ABSOLUTE; break;
case 'r': mode = REMAINING; break;
show_usage();
}
}
-
+
fp = xfopen(file, "r");
- printf("Mac Address IP-Address Expires %s\n", mode == REMAINING ? "in" : "at");
+ printf("Mac Address IP-Address Expires %s\n", mode == REMAINING ? "in" : "at");
/* "00:00:00:00:00:00 255.255.255.255 Wed Jun 30 21:49:08 1993" */
while (fread(&lease, sizeof(lease), 1, fp)) {
} else printf("%s", ctime(&expires));
}
fclose(fp);
-
+
return 0;
}
-/*
+/*
* files.c -- DHCP server file manipulation *
* Rewrite by Russ Dill <Russ.Dill@asu.edu> July 2001
*/
-
+
#include <sys/socket.h>
#include <arpa/inet.h>
#include <string.h>
#include "options.h"
#include "common.h"
-/*
+/*
* Domain names may have 254 chars, and string options can be 254
* chars long. However, 80 bytes will be enough for most, and won't
* hog up memory. If you have a special application, change it
int retval = 1;
if (!inet_aton(line, addr)) {
- if ((host = gethostbyname(line)))
+ if ((host = gethostbyname(line)))
addr->s_addr = *((unsigned long *) host->h_addr_list[0]);
else retval = 0;
}
static int read_str(const char *line, void *arg)
{
char **dest = arg;
-
+
if (*dest) free(*dest);
*dest = strdup(line);
-
+
return 1;
}
else if (!strcasecmp("no", line))
*dest = 0;
else retval = 0;
-
+
return retval;
}
/* Cheat, the only const line we'll actually get is "" */
line = (char *) const_line;
if (!(opt = strtok(line, " \t="))) return 0;
-
+
for (option = dhcp_options; option->code; option++)
if (!strcasecmp(option->name, opt))
break;
-
+
if (!option->code) return 0;
do {
retval = (endptr[0] == '\0');
break;
case OPTION_U32:
- *result_u32 = htonl(strtoul(val, &endptr, 0));
+ *result_u32 = htonl(strtoul(val, &endptr, 0));
retval = (endptr[0] == '\0');
break;
case OPTION_S32:
- *result_u32 = htonl(strtol(val, &endptr, 0));
+ *result_u32 = htonl(strtol(val, &endptr, 0));
retval = (endptr[0] == '\0');
break;
default:
break;
}
- if (retval)
+ if (retval)
attach_option(opt_list, option, opt, length);
} while (retval && option->flags & OPTION_LIST);
return retval;
LOG(LOG_ERR, "unable to open config file: %s", file);
return 0;
}
-
+
while (fgets(buffer, READ_CONFIG_BUF_SIZE, in)) {
lm++;
if (strchr(buffer, '\n')) *(strchr(buffer, '\n')) = '\0';
if (strchr(buffer, '#')) *(strchr(buffer, '#')) = '\0';
if (!(token = strtok(buffer, " \t"))) continue;
- if (!(line = strtok(NULL, ""))) continue;
-
+ if (!(line = strtok(NULL, ""))) continue;
+
/* eat leading whitespace */
line = line + strspn(line, " \t=");
/* eat trailing whitespace */
for (i = strlen(line); i > 0 && isspace(line[i - 1]); i--);
line[i] = '\0';
-
+
for (i = 0; keywords[i].keyword[0]; i++)
if (!strcasecmp(token, keywords[i].keyword))
if (!keywords[i].handler(line, keywords[i].var)) {
char buf[255];
time_t curr = time(0);
unsigned long tmp_time;
-
+
if (!(fp = fopen(server_config.lease_file, "w"))) {
LOG(LOG_ERR, "Unable to open %s for writing", server_config.lease_file);
return;
}
-
+
for (i = 0; i < server_config.max_leases; i++) {
if (leases[i].yiaddr != 0) {
}
}
fclose(fp);
-
+
if (server_config.notify_file) {
sprintf(buf, "%s %s", server_config.notify_file, server_config.lease_file);
system(buf);
FILE *fp;
unsigned int i = 0;
struct dhcpOfferedAddr lease;
-
+
if (!(fp = fopen(file, "r"))) {
LOG(LOG_ERR, "Unable to open %s for reading", file);
return;
}
-
+
while (i < server_config.max_leases && (fread(&lease, sizeof lease, 1, fp) == 1)) {
/* ADDME: is it a static lease */
if (lease.yiaddr >= server_config.start && lease.yiaddr <= server_config.end) {
if (!(add_lease(lease.chaddr, lease.yiaddr, lease.expires))) {
LOG(LOG_WARNING, "Too many leases while loading %s\n", file);
break;
- }
+ }
i++;
}
}
{
int ret = 0;
char *base = strrchr(argv[0], '/');
-
+
if (strstr(base ? (base + 1) : argv[0], "dhcpd"))
ret = udhcpd_main(argc, argv);
else ret = udhcpc_main(argc, argv);
-
+
return ret;
}
-/*
- * leases.c -- tools to manage DHCP leases
+/*
+ * leases.c -- tools to manage DHCP leases
* Russ Dill <Russ.Dill@asu.edu> July 2001
*/
void clear_lease(uint8_t *chaddr, uint32_t yiaddr)
{
unsigned int i, j;
-
+
for (j = 0; j < 16 && !chaddr[j]; j++);
-
+
for (i = 0; i < server_config.max_leases; i++)
if ((j != 16 && !memcmp(leases[i].chaddr, chaddr, 16)) ||
(yiaddr && leases[i].yiaddr == yiaddr)) {
struct dhcpOfferedAddr *add_lease(uint8_t *chaddr, uint32_t yiaddr, unsigned long lease)
{
struct dhcpOfferedAddr *oldest;
-
+
/* clean out any old ones */
clear_lease(chaddr, yiaddr);
-
+
oldest = oldest_expired_lease();
-
+
if (oldest) {
memcpy(oldest->chaddr, chaddr, 16);
oldest->yiaddr = yiaddr;
oldest->expires = time(0) + lease;
}
-
+
return oldest;
}
int lease_expired(struct dhcpOfferedAddr *lease)
{
return (lease->expires < (unsigned long) time(0));
-}
+}
/* Find the oldest expired lease, NULL if there are no expired leases */
unsigned long oldest_lease = time(0);
unsigned int i;
-
+
for (i = 0; i < server_config.max_leases; i++)
if (oldest_lease > leases[i].expires) {
oldest_lease = leases[i].expires;
oldest = &(leases[i]);
}
return oldest;
-
+
}
for (i = 0; i < server_config.max_leases; i++)
if (!memcmp(leases[i].chaddr, chaddr, 16)) return &(leases[i]);
-
+
return NULL;
}
for (i = 0; i < server_config.max_leases; i++)
if (leases[i].yiaddr == yiaddr) return &(leases[i]);
-
+
return NULL;
}
/* find an assignable address, it check_expired is true, we check all the expired leases as well.
* Maybe this should try expired leases by age... */
-uint32_t find_address(int check_expired)
+uint32_t find_address(int check_expired)
{
uint32_t addr, ret;
- struct dhcpOfferedAddr *lease = NULL;
+ struct dhcpOfferedAddr *lease = NULL;
addr = ntohl(server_config.start); /* addr is in host order here */
for (;addr <= ntohl(server_config.end); addr++) {
-/*
- * options.c -- DHCP server option packet tools
+/*
+ * options.c -- DHCP server option packet tools
* Rewrite by Russ Dill <Russ.Dill@asu.edu> July 2001
*/
-
+
#include <stdlib.h>
#include <string.h>
int i, length;
uint8_t *optionptr;
int over = 0, done = 0, curr = OPTION_FIELD;
-
+
optionptr = packet->options;
i = 0;
length = 308;
return NULL;
}
return optionptr + i + 2;
- }
+ }
switch (optionptr[i + OPT_CODE]) {
case DHCP_PADDING:
i++;
/* return the position of the 'end' option (no bounds checking) */
-int end_option(uint8_t *optionptr)
+int end_option(uint8_t *optionptr)
{
int i = 0;
-
+
while (optionptr[i] != DHCP_END) {
if (optionptr[i] == DHCP_PADDING) i++;
else i += optionptr[i + OPT_LEN] + 2;
int add_option_string(uint8_t *optionptr, uint8_t *string)
{
int end = end_option(optionptr);
-
+
/* end position + string length + option code/length + end option */
if (end + string[OPT_LEN] + 2 + 1 >= 308) {
LOG(LOG_ERR, "Option 0x%02x did not fit into the packet!", string[OPT_CODE]);
if (dhcp_options[i].code == code) {
length = option_lengths[dhcp_options[i].flags & TYPE_MASK];
}
-
+
if (!length) {
DEBUG(LOG_ERR, "Could not add option 0x%02x", code);
return 0;
}
-
+
option[OPT_CODE] = code;
option[OPT_LEN] = length;
DEBUG(LOG_INFO, "Attaching option %s to existing member of list", option->name);
if (option->flags & OPTION_LIST) {
if (existing->data[OPT_LEN] + length <= 255) {
- existing->data = realloc(existing->data,
+ existing->data = realloc(existing->data,
existing->data[OPT_LEN] + length + 2);
memcpy(existing->data + existing->data[OPT_LEN] + 2, buffer, length);
existing->data[OPT_LEN] += length;
} /* else, ignore the new data */
} else {
DEBUG(LOG_INFO, "Attaching option %s to list", option->name);
-
+
/* make a new option */
new = xmalloc(sizeof(struct option_set));
new->data = xmalloc(length + 2);
new->data[OPT_CODE] = option->code;
new->data[OPT_LEN] = length;
memcpy(new->data + 2, buffer, length);
-
+
curr = opt_list;
while (*curr && (*curr)->data[OPT_CODE] < option->code)
curr = &(*curr)->next;
-
+
new->next = *curr;
- *curr = new;
+ *curr = new;
}
}
return -2;
}
DEBUG(LOG_INFO, "Received a packet");
-
+
if (packet->op == BOOTREQUEST && (vendor = get_option(packet, DHCP_VENDOR))) {
for (i = 0; broken_vendors[i][0]; i++) {
if (vendor[OPT_LEN - 2] == (uint8_t) strlen(broken_vendors[i]) &&
}
}
}
-
+
return bytes;
}
DEBUG(LOG_ERR, "socket call failed: %m");
return -1;
}
-
+
memset(&dest, 0, sizeof(dest));
memset(&packet, 0, sizeof(packet));
-
+
dest.sll_family = AF_PACKET;
dest.sll_protocol = htons(ETH_P_IP);
dest.sll_ifindex = ifindex;
packet.ip.tot_len = packet.udp.len;
memcpy(&(packet.data), payload, sizeof(struct dhcpMessage));
packet.udp.check = checksum(&packet, sizeof(struct udp_dhcp_packet));
-
+
packet.ip.tot_len = htons(sizeof(struct udp_dhcp_packet));
packet.ip.ihl = sizeof(packet.ip) >> 2;
packet.ip.version = IPVERSION;
int n = 1;
int fd, result;
struct sockaddr_in client;
-
+
if ((fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
return -1;
-
+
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char *) &n, sizeof(n)) == -1)
return -1;
memset(&client, 0, sizeof(client));
client.sin_family = AF_INET;
client.sin_port = htons(dest_port);
- client.sin_addr.s_addr = dest_ip;
+ client.sin_addr.s_addr = dest_ip;
if (connect(fd, (struct sockaddr *)&client, sizeof(struct sockaddr)) == -1)
return -1;
result = write(fd, payload, sizeof(struct dhcpMessage));
close(fd);
return result;
-}
+}
uint8_t sname[64];
uint8_t file[128];
uint32_t cookie;
- uint8_t options[308]; /* 312 - cookie */
+ uint8_t options[308]; /* 312 - cookie */
};
struct udp_dhcp_packet {
/* script.c
*
- * Functions to call the DHCP client notification scripts
+ * Functions to call the DHCP client notification scripts
*
* Russ Dill <Russ.Dill@asu.edu> July 2001
*
if (!(over & FILE_FIELD) && packet->file[0]) num_options++;
if (!(over & SNAME_FIELD) && packet->sname[0]) num_options++;
}
-
+
envp = xcalloc(sizeof(char *), num_options + 5);
j = 0;
asprintf(&envp[j++], "interface=%s", client_config.interface);
return;
} else if (pid == 0) {
envp = fill_envp(packet);
-
+
/* close fd's? */
-
+
/* exec script */
execle(client_config.script, client_config.script,
name, NULL, envp);
LOG(LOG_ERR, "script %s failed: %m", client_config.script);
exit(1);
- }
+ }
}
{
uint8_t *chaddr;
uint32_t ciaddr;
-
+
if (force_broadcast) {
DEBUG(LOG_INFO, "broadcasting packet to client (NAK)");
ciaddr = INADDR_BROADCAST;
ciaddr = payload->yiaddr;
chaddr = payload->chaddr;
}
- return raw_packet(payload, server_config.server, SERVER_PORT,
+ return raw_packet(payload, server_config.server, SERVER_PORT,
ciaddr, CLIENT_PORT, chaddr, server_config.ifindex);
}
if (server_config.boot_file)
strncpy(packet->file, server_config.boot_file, sizeof(packet->file) - 1);
}
-
+
/* send a DHCP OFFER to a DHCP DISCOVER */
int sendOffer(struct dhcpMessage *oldpacket)
struct in_addr addr;
init_packet(&packet, oldpacket, DHCPOFFER);
-
+
/* ADDME: if static, short circuit */
/* the client is in our lease/offered table */
if ((lease = find_lease_by_chaddr(oldpacket->chaddr))) {
- if (!lease_expired(lease))
+ if (!lease_expired(lease))
lease_time_align = lease->expires - time(0);
packet.yiaddr = lease->yiaddr;
-
+
/* Or the client has a requested ip */
} else if ((req = get_option(oldpacket, DHCP_REQUESTED_IP)) &&
/* and the ip is in the lease range */
ntohl(req_align) >= ntohl(server_config.start) &&
ntohl(req_align) <= ntohl(server_config.end) &&
-
+
/* and its not already taken/offered */ /* ADDME: check that its not a static lease */
((!(lease = find_lease_by_yiaddr(req_align)) ||
-
+
/* or its taken, but expired */ /* ADDME: or maybe in here */
lease_expired(lease)))) {
packet.yiaddr = req_align; /* FIXME: oh my, is there a host using this IP? */
/* otherwise, find a free IP */ /*ADDME: is it a static lease? */
} else {
packet.yiaddr = find_address(0);
-
+
/* try for an expired lease */
if (!packet.yiaddr) packet.yiaddr = find_address(1);
}
-
+
if(!packet.yiaddr) {
LOG(LOG_WARNING, "no IP addresses to give -- OFFER abandoned");
return -1;
}
-
+
if (!add_lease(packet.chaddr, packet.yiaddr, server_config.offer_time)) {
LOG(LOG_WARNING, "lease pool is full -- OFFER abandoned");
return -1;
- }
+ }
if ((lease_time = get_option(oldpacket, DHCP_LEASE_TIME))) {
memcpy(&lease_time_align, lease_time, 4);
lease_time_align = ntohl(lease_time_align);
- if (lease_time_align > server_config.lease)
+ if (lease_time_align > server_config.lease)
lease_time_align = server_config.lease;
}
/* Make sure we aren't just using the lease time from the previous offer */
- if (lease_time_align < server_config.min_lease)
+ if (lease_time_align < server_config.min_lease)
lease_time_align = server_config.lease;
- /* ADDME: end of short circuit */
+ /* ADDME: end of short circuit */
add_simple_option(packet.options, DHCP_LEASE_TIME, htonl(lease_time_align));
curr = server_config.options;
}
add_bootp_options(&packet);
-
+
addr.s_addr = packet.yiaddr;
LOG(LOG_INFO, "sending OFFER of %s", inet_ntoa(addr));
return send_packet(&packet, 0);
struct dhcpMessage packet;
init_packet(&packet, oldpacket, DHCPNAK);
-
+
DEBUG(LOG_INFO, "sending NAK");
return send_packet(&packet, 1);
}
init_packet(&packet, oldpacket, DHCPACK);
packet.yiaddr = yiaddr;
-
+
if ((lease_time = get_option(oldpacket, DHCP_LEASE_TIME))) {
memcpy(&lease_time_align, lease_time, 4);
lease_time_align = ntohl(lease_time_align);
- if (lease_time_align > server_config.lease)
+ if (lease_time_align > server_config.lease)
lease_time_align = server_config.lease;
- else if (lease_time_align < server_config.min_lease)
+ else if (lease_time_align < server_config.min_lease)
lease_time_align = server_config.lease;
}
-
+
add_simple_option(packet.options, DHCP_LEASE_TIME, htonl(lease_time_align));
-
+
curr = server_config.options;
while (curr) {
if (curr->data[OPT_CODE] != DHCP_LEASE_TIME)
addr.s_addr = packet.yiaddr;
LOG(LOG_INFO, "sending ACK to %s", inet_ntoa(addr));
- if (send_packet(&packet, 0) < 0)
+ if (send_packet(&packet, 0) < 0)
return -1;
add_lease(packet.chaddr, packet.yiaddr, lease_time_align);
struct option_set *curr;
init_packet(&packet, oldpacket, DHCPACK);
-
+
curr = server_config.options;
while (curr) {
if (curr->data[OPT_CODE] != DHCP_LEASE_TIME)
ifr.ifr_addr.sa_family = AF_INET;
strcpy(ifr.ifr_name, interface);
- if (addr) {
+ if (addr) {
if (ioctl(fd, SIOCGIFADDR, &ifr) == 0) {
our_ip = (struct sockaddr_in *) &ifr.ifr_addr;
*addr = our_ip->sin_addr.s_addr;
return -1;
}
}
-
+
if (ioctl(fd, SIOCGIFINDEX, &ifr) == 0) {
DEBUG(LOG_INFO, "adapter index %d", ifr.ifr_ifindex);
*ifindex = ifr.ifr_ifindex;
DEBUG(LOG_ERR, "socket call failed: %m");
return -1;
}
-
+
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
close(fd);
return -1;
}
-
+
return fd;
}
unsigned int flag; /* Matches vlan_dev_info flags */
} u;
- short vlan_qos;
+ short vlan_qos;
};
#define VLAN_GROUP_ARRAY_LEN 4096
'_', 'P', 'L', 'U', 'S', '_', 'V', 'I', 'D',
0,
VLAN_NAME_TYPE_PLUS_VID_NO_PAD, 22,
- 'V', 'L', 'A', 'N',
+ 'V', 'L', 'A', 'N',
'_', 'P', 'L', 'U', 'S', '_', 'V', 'I', 'D',
'_', 'N', 'O', '_', 'P', 'A', 'D', 0,
VLAN_NAME_TYPE_RAW_PLUS_VID, 15,
/* For progressmeter() -- number of seconds before xfer considered "stalled" */
static const int STALLTIME = 5;
#endif
-
+
static void close_and_delete_outfile(FILE* output, char *fname_out, int do_continue)
{
if (output != stdout && do_continue==0) {
use_proxy = 0;
}
}
-
+
/* Guess an output filename */
if (!fname_out) {
- fname_out =
+ fname_out =
#ifdef CONFIG_FEATURE_WGET_STATUSBAR
- curfile =
+ curfile =
#endif
bb_get_last_path_component(target.path);
if (fname_out==NULL || strlen(fname_out)<1) {
- fname_out =
+ fname_out =
#ifdef CONFIG_FEATURE_WGET_STATUSBAR
- curfile =
+ curfile =
#endif
"index.html";
}
*/
if (sfp) fclose(sfp);
sfp = open_socket(&s_in);
-
+
/*
* Send HTTP request.
*/
read_response:
if (fgets(buf, sizeof(buf), sfp) == NULL)
close_delete_and_die("no response from server");
-
+
for (s = buf ; *s != '\0' && !isspace(*s) ; ++s)
;
for ( ; isspace(*s) ; ++s)
chomp(buf);
close_delete_and_die("server returned error %d: %s", atoi(s), buf);
}
-
+
/*
* Retrieve HTTP headers.
*/
}
}
} while(status >= 300);
-
+
dfp = sfp;
}
else
if (ftpcmd(NULL, NULL, sfp, buf) != 220)
close_delete_and_die("%s", buf+4);
- /*
+ /*
* Splitting username:password pair,
* trying to log in
*/
default:
close_delete_and_die("ftp login: %s", buf+4);
}
-
+
ftpcmd("CDUP", NULL, sfp, buf);
ftpcmd("TYPE I", NULL, sfp, buf);
-
+
/*
* Querying file size
*/
filesize = value;
got_clen = 1;
}
-
+
/*
* Entering passive mode
*/
} else
filesize -= beg_range;
}
-
+
if (ftpcmd("RETR /", target.path, sfp, buf) > 150)
close_delete_and_die("RETR: %s", buf+4);
static int ftpcmd(char *s1, char *s2, FILE *fp, char *buf)
{
char *p;
-
+
if (s1) {
if (!s2) s2="";
fprintf(fp, "%s%s\r\n", s1, s2);
fflush(fp);
}
-
+
do {
p = fgets(buf, 510, fp);
if (!p)
bb_perror_msg_and_die("fgets()");
} while (! isdigit(buf[0]) || buf[3] != ' ');
-
+
return atoi(buf);
}
#ifdef CONFIG_FEATURE_WGET_STATUSBAR
-/* Stuff below is from BSD rcp util.c, as added to openshh.
+/* Stuff below is from BSD rcp util.c, as added to openshh.
* Original copyright notice is retained at the end of this file.
- *
- */
+ *
+ */
static int
/* Original copyright notice which applies to the CONFIG_FEATURE_WGET_STATUSBAR stuff,
* much of which was blatently stolen from openssh. */
-
+
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
- * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
+ * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
+ * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
*
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: wget.c,v 1.70 2004/03/06 22:11:44 andersen Exp $
+ * $Id: wget.c,v 1.71 2004/03/15 08:28:53 andersen Exp $
*/
--- a/AUTHORS 9 Oct 2003 21:19:21 -0000 1.40
+++ b/AUTHORS 5 Mar 2004 07:23:17 -0000
@@ -8,6 +8,9 @@
-
+
-----------
-
+
+Peter Willis <psyphreak@phreaker.net>
+ eject
+
Emanuele Aina <emanuele.aina@tiscali.it>
run-parts
-
+
Index: coreutils/Config.in
===================================================================
RCS file: /var/cvs/busybox/coreutils/Config.in,v
@@ -164,6 +164,13 @@
a command; without options it displays the current
environment.
-
+
+config CONFIG_EJECT
+ bool "eject"
+ default n
@@ -537,6 +537,13 @@
"\t-, -i\tstart with an empty environment\n" \
"\t-u\tremove variable from the environment\n"
-
+
+#define eject_trivial_usage \
+ "[-t] [FILE]"
+#define eject_full_usage \
--- a/AUTHORS 9 Oct 2003 21:19:21 -0000 1.40
+++ b/AUTHORS 5 Mar 2004 15:45:47 -0000
@@ -92,6 +92,9 @@
- Original author of BusyBox in 1995, 1996. Some of his code can
+ Original author of BusyBox in 1995, 1996. Some of his code can
still be found hiding here and there...
-
+
+John Powers <jpp@ti.com>
+ Added multicast option (rfc2090) and timeout option (rfc2349) to tftp.
+
Tim Riker <Tim@Rikers.org>
bug fixes, member of fan club
-
+
Index: include/usage.h
===================================================================
RCS file: /var/cvs/busybox/include/usage.h,v
+#else
+ #define USAGE_TFTP_DEBUG(a)
+#endif
-
+
#define tftp_trivial_usage \
"[OPTION]... HOST [PORT]"
@@ -2508,6 +2523,16 @@
@@ -522,6 +522,13 @@
Add support for the GET command within the TFTP client. This allows
a client to retrieve a file from a TFTP server.
-
+
+config CONFIG_FEATURE_TFTP_MULTICAST
+ bool " Enable \"multicast\" option"
+ default n
default y
@@ -531,12 +538,19 @@
a client to transfer a file to a TFTP server.
-
+
config CONFIG_FEATURE_TFTP_BLOCKSIZE
- bool " Enable \"blocksize\" command"
+ bool " Enable \"blksize\" option"
depends on CONFIG_TFTP
help
Allow the client to specify the desired block size for transfers.
-
+
+config CONFIG_FEATURE_TFTP_TIMEOUT
+ bool " Enable \"timeout\" option"
+ default n
/* */
/* Parts of the code based on: */
@@ -46,8 +61,20 @@
-
+
#include "busybox.h"
-
+
+#if defined(CONFIG_FEATURE_TFTP_BLOCKSIZE) || defined(CONFIG_FEATURE_TFTP_MULTICAST) || defined(CONFIG_FEATURE_TFTP_TIMEOUT)
+ #define TFTP_OPTIONS
+#endif
+
//#define CONFIG_FEATURE_TFTP_DEBUG
-
+
+#ifdef CONFIG_FEATURE_TFTP_DEBUG
+ static void printtime(void);
+ #define dprintf(fmt...) if (debug) {printtime(); printf(fmt);}
+
#define TFTP_BLOCKSIZE_DEFAULT 512 /* according to RFC 1350, don't change */
#define TFTP_TIMEOUT 5 /* seconds */
-
+
@@ -68,12 +95,24 @@
"Illegal TFTP operation",
"Unknown transfer ID",
+ "Unsupported option",
+#endif
};
-
+
const int tftp_cmd_get = 1;
const int tftp_cmd_put = 2;
-
+
+
+struct tftp_option {
+ int multicast;
+
+
#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
-
- static int tftp_blocksize_check(int blocksize, int bufsize)
+
+ static int tftp_blocksize_check(int blocksize, int bufsize)
@@ -93,16 +132,158 @@
return blocksize;
}
-
+
+#endif
+
+#ifdef CONFIG_FEATURE_TFTP_TIMEOUT
+
+#ifdef TFTP_OPTIONS
+
- static char *tftp_option_get(char *buf, int len, char *option)
+ static char *tftp_option_get(char *buf, int len, char *option)
{
- int opt_val = 0;
+ int opt_val = 0;
int opt_found = 0;
int k;
--
+-
- while (len > 0) {
-
+
+ while (len > 0) {
/* Make sure the options are terminated correctly */
-
if (strcasecmp(buf, option) == 0) {
opt_found = 1;
}
-- }
+- }
- else {
- if (opt_found) {
+ } else {
}
@@ -138,7 +318,8 @@
#endif
-
+
static inline int tftp(const int cmd, const struct hostent *host,
- const char *remotefile, int localfd, const unsigned short port, int tftp_bufsize)
+ const char *remotefile, int localfd, const unsigned short port,
- int timeout = bb_tftp_num_retries;
+ int retry = bb_tftp_num_retries;
unsigned short block_nr = 1;
-
+
-#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
- int want_option_ack = 0;
+#ifdef CONFIG_FEATURE_TFTP_MULTICAST
+ #define master_client 1
+ #define ack_oack 0
#endif
-
+
/* Can't use RESERVE_CONFIG_BUFFER here since the allocation
* size varies meaning BUFFERS_GO_ON_STACK would fail */
- char *buf=xmalloc(tftp_bufsize + 4);
+ char *buf=xmalloc(option->blksize + 4);
-
+
- tftp_bufsize += 4;
+ int tftp_bufsize = option->blksize + 4;
-
+
if ((socketfd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {
bb_perror_msg("socket");
@@ -183,15 +375,21 @@
memcpy(&sa.sin_addr, (struct in_addr *) host->h_addr,
sizeof(sa.sin_addr));
-
+
- /* build opcode */
-
- if (cmd_get) {
+ memset(mcblockmap, 0, bmsize+1);
}
+#endif
-
+
- if (cmd_put) {
- opcode = TFTP_WRQ;
- }
+ /* build opcode */
+
+ opcode = cmd_get ? TFTP_RRQ : TFTP_WRQ;
-
+
while (1) {
-
+
@@ -203,7 +401,7 @@
-
+
cp += 2;
-
+
- /* add filename and mode */
+ /* First packet of file transfer includes file name, mode, and options */
-
+
if ((cmd_get && (opcode == TFTP_RRQ)) ||
(cmd_put && (opcode == TFTP_WRQ))) {
@@ -223,7 +421,7 @@
}
-
+
if (too_long || ((&buf[tftp_bufsize - 1] - cp) < 6)) {
- bb_error_msg("too long remote-filename");
+ bb_error_msg("too long: remote filename");
break;
}
-
+
@@ -238,8 +436,8 @@
-
+
if (len != TFTP_BLOCKSIZE_DEFAULT) {
-
+
- if ((&buf[tftp_bufsize - 1] - cp) < 15) {
- bb_error_msg("too long remote-filename");
+ if ((&buf[tftp_bufsize - 1] - cp) < 15) {
+ bb_error_msg("buffer too small for blksize option");
break;
}
-
+
@@ -249,16 +447,65 @@
cp += 8;
-
+
cp += snprintf(cp, 6, "%d", len) + 1;
+ }
+#endif
+ }
+
+ /* add "multicast" option */
-
+
- want_option_ack = 1;
+ memcpy(cp, "multicast\0", 11);
+ cp += 11;
+#endif
+
}
-
+
/* add ack and data */
-
+
- if ((cmd_get && (opcode == TFTP_ACK)) ||
- (cmd_put && (opcode == TFTP_DATA))) {
+#ifdef CONFIG_FEATURE_TFTP_MULTICAST
+#endif
+ else if ((cmd_get && opcode == TFTP_ACK) ||
+ (cmd_put && opcode == TFTP_DATA)) {
-
+
*((unsigned short *) cp) = htons(block_nr);
-
+
@@ -275,7 +522,7 @@
}
-
+
if (len != (tftp_bufsize - 4)) {
- finished++;
+ finished = 1;
}
-
+
cp += len;
@@ -283,82 +530,119 @@
}
-
-
+
+
- /* send packet */
+ /* send packet and receive reply */
-
-
+
+
- timeout = bb_tftp_num_retries; /* re-initialize */
+ retry = bb_tftp_num_retries; /* re-initialize */
do {
-
+ int selectrc;
len = cp - buf;
-
+
-#ifdef CONFIG_FEATURE_TFTP_DEBUG
- fprintf(stderr, "sending %u bytes\n", len);
- for (cp = buf; cp < &buf[len]; cp++)
-
+ /* send packet */
+ if ((len > 2) && (! option->multicast || master_client || ack_oack)) {
-
+
- if (finished && (opcode == TFTP_ACK)) {
- break;
+#ifdef CONFIG_FEATURE_TFTP_DEBUG
+ break;
+ }
}
-
+
- /* receive packet */
+ /* receive reply packet */
-
+
memset(&from, 0, sizeof(from));
fromlen = sizeof(from);
-
+
- tv.tv_sec = TFTP_TIMEOUT;
+ tv.tv_sec = option->client_timeout;
tv.tv_usec = 0;
-
+
FD_ZERO(&rfds);
FD_SET(socketfd, &rfds);
+ dprintf("set to receive from socketfd (%d)\n", socketfd);
+ dprintf("set to receive from mcfd (%d)\n", mcfd);
+ }
+#endif
-
+
- switch (select(FD_SETSIZE, &rfds, NULL, NULL, &tv)) {
- case 1:
- len = recvfrom(socketfd, buf, tftp_bufsize, 0,
+ }
+ }
}
-
+
- timeout = 0;
-
- if (sa.sin_port == port) {
- /* discard the packet - treat as timeout */
- timeout = bb_tftp_num_retries;
+#endif
-
+
- case 0:
+ } else if (selectrc == 0) {
+ /* Time out */
+ dprintf("timeout\n");
bb_error_msg("timeout");
-
+
- timeout--;
- if (timeout == 0) {
+ retry--;
bb_perror_msg("select");
len = -1;
}
-
+
- } while (timeout && (len >= 0));
+ } while (retry && len >= 0);
-
+
if ((finished) || (len < 0)) {
break;
@@ -370,9 +654,8 @@
opcode = ntohs(*((unsigned short *) buf));
tmp = ntohs(*((unsigned short *) &buf[2]));
-
+
-#ifdef CONFIG_FEATURE_TFTP_DEBUG
- fprintf(stderr, "received %d bytes: %04x %04x\n", len, opcode, tmp);
-#endif
+ dprintf("received %d bytes: %04x %04x\n", len, opcode, tmp);
+ dprintf("master_client=%d\n", master_client);
-
+
if (opcode == TFTP_ERROR) {
char *msg = NULL;
@@ -393,55 +676,116 @@
break;
}
-
+
-#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
- if (want_option_ack) {
+#ifdef TFTP_OPTIONS
-
+
- want_option_ack = 0;
+ if (opcode == TFTP_OACK) {
-
+
- if (opcode == TFTP_OACK) {
+ /* server seems to support options */
-
+
- /* server seems to support options */
+ char *res;
-+
++
+ block_nr = 0; /* acknowledge option packet with block number 0 */
+ opcode = cmd_put ? TFTP_DATA : TFTP_ACK;
-
+
- char *res;
-
-- res = tftp_option_get(&buf[2], len-2,
+
+- res = tftp_option_get(&buf[2], len-2,
- "blksize");
+#ifdef CONFIG_FEATURE_TFTP_BLOCKSIZE
+ res = tftp_option_get(&buf[2], len-2, "blksize");
-
+
- if (res) {
- int blksize = atoi(res);
--
+-
- if (tftp_blocksize_check(blksize,
- tftp_bufsize - 4)) {
+ if (res) {
+ int blksize = atoi(res);
-
+
- if (cmd_put) {
- opcode = TFTP_DATA;
- }
- bb_error_msg("bad server option");
- break;
- }
-
+
- bb_error_msg("warning: blksize not supported by server"
- " - reverting to 512");
-
+
- tftp_bufsize = TFTP_BLOCKSIZE_DEFAULT + 4;
+#ifdef CONFIG_FEATURE_TFTP_MULTICAST
+ res = tftp_option_get(&buf[2], len-2, "multicast");
}
+ else
#endif
-
+
if (cmd_get && (opcode == TFTP_DATA)) {
-
+
+#ifdef CONFIG_FEATURE_TFTP_MULTICAST
+ if (option->multicast) {
+ int bn = tmp - 1;
+#endif
+
if (tmp == block_nr) {
-
+
len = write(localfd, &buf[4], len - 4);
@@ -452,15 +796,14 @@
}
-
+
if (len != (tftp_bufsize - 4)) {
- finished++;
+ finished = 1;
}
-
+
opcode = TFTP_ACK;
- continue;
}
}
-
+
- if (cmd_put && (opcode == TFTP_ACK)) {
+ else if (cmd_put && opcode == TFTP_ACK) {
-
+
if (tmp == (unsigned short)(block_nr - 1)) {
if (finished) {
@@ -468,15 +811,19 @@
}
-
+
opcode = TFTP_DATA;
- continue;
}
}
}
-
+
#ifdef CONFIG_FEATURE_CLEAN_UP
close(socketfd);
+ free(buf);
+ if (mcblockmap != NULL)
+ free(mcblockmap);
+#endif
-
+
- free(buf);
#endif
-
+
return finished ? EXIT_SUCCESS : EXIT_FAILURE;
@@ -487,13 +834,18 @@
struct hostent *host = NULL;
+ .client_timeout = TFTP_TIMEOUT,
+ .server_timeout = TFTP_TIMEOUT,
+ };
-
+
/* figure out what to pass to getopt */
-
+
@@ -515,13 +867,45 @@
- #define PUT
+ #define PUT
#endif
-
+
- while ((opt = getopt(argc, argv, BS GET PUT "l:r:")) != -1) {
+#ifdef CONFIG_FEATURE_TFTP_TIMEOUT
+#define TO "T:t:"
+ debug = 1;
+ break;
+#endif
- case 'l':
+ case 'l':
localfile = bb_xstrdup(optarg);
break;
case 'r':
+ bb_show_usage();
}
}
-
+
if ((cmd == 0) || (optind == argc)) {
bb_show_usage();
}
@@ -566,14 +966,12 @@
host = xgethostbyname(argv[optind]);
port = bb_lookup_port(argv[optind + 1], "udp", 69);
-
+
-#ifdef CONFIG_FEATURE_TFTP_DEBUG
- fprintf(stderr, "using server \"%s\", remotefile \"%s\", "
+ dprintf("using server \"%s\", remotefile \"%s\", "
inet_ntoa(*((struct in_addr *) host->h_addr)),
remotefile, localfile);
-#endif
-
+
- result = tftp(cmd, host, remotefile, fd, port, blocksize);
+ result = tftp(cmd, host, remotefile, fd, port, &option);
-
+
#ifdef CONFIG_FEATURE_CLEAN_UP
if (!(fd == fileno(stdout) || fd == fileno(stdin))) {
@@ -582,3 +980,18 @@
+ "\t-R,\t--require=NAME\tAdd NAME to request\n" \
"\t-s,\t--script=file\tRun file at dhcp events (default: /usr/share/udhcpc/default.script)\n" \
"\t-v,\t--version\tDisplay version"
-
+
Index: networking/udhcp/README.udhcpc
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/README.udhcpc,v
/usr/share/udhcpc/default.script)
-v, --version Display version
@@ -101,6 +102,8 @@
-
+
additional options are easily added in options.c.
-
+
+By default, only a few basic items are requested. To request additional
+items use the -R option. Example: "-R rootpath"
-
+
note on udhcpc's random seed
---------------------------
Index: networking/udhcp/dhcpc.c
- c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:s:v", arg_options, &option_index);
+ c = getopt_long(argc, argv, "c:fbH:h:i:np:qr:R:s:v", arg_options, &option_index);
if (c == -1) break;
-
+
switch (c) {
@@ -254,6 +256,11 @@
case 'r':
@@ -57,7 +57,19 @@
[OPTION_S32] = 4
};
-
+
-
+/* find and mark requested item as required */
+int require_option(char *name)
+ }
+ return 1;
+}
-+
++
/* get an option with bounds checking (warning, not aligned). */
uint8_t *get_option(struct dhcpMessage *packet, int code)
{
@@ -30,6 +30,7 @@
extern struct dhcp_option dhcp_options[];
extern int option_lengths[];
-
+
+int require_option(char *name);
uint8_t *get_option(struct dhcpMessage *packet, int code);
int end_option(uint8_t *optionptr);
+ "\t-s,\t--script=file\tRun file at dhcp events (default: " \
+ CONFIG_UDHCPC_SCRIPT_PATH ")\n" \
"\t-v,\t--version\tDisplay version"
-
+
#define udhcpd_trivial_usage \
Index: networking/udhcp/AUTHORS
===================================================================
+++ b/networking/udhcp/AUTHORS 5 Mar 2004 13:20:11 -0000
@@ -10,5 +10,5 @@
Moreton Bay (http://www.moretonbay.com/)
- Lineo (http://opensource.lineo.com)
Vladimir Oleynik <dzo@simtrea.ru> Size optimizations
+
-
+Tony J. White <tjw@tjw.org> additional busybox build options
-
+
Index: networking/udhcp/Config.in
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/Config.in,v
--- a/networking/udhcp/Config.in 22 Oct 2003 09:58:38 -0000 1.5
+++ b/networking/udhcp/Config.in 5 Mar 2004 13:20:11 -0000
@@ -58,5 +58,62 @@
-
+
See http://udhcp.busybox.net for further details.
-
+
+menu "udhcpd Configuration Options"
+ depends on CONFIG_UDHCPD
-+
++
+config CONFIG_UDHCPD_CONF_PATH
+ string "Path to default udhcpd.conf"
-+ default "/etc/udhcpd.conf"
-+ depends on CONFIG_UDHCPD
++ default "/etc/udhcpd.conf"
++ depends on CONFIG_UDHCPD
+ help
+ The full path to udhcpd's default configuration file.
+ (default is: /etc/udhcpd.conf)
+
+config CONFIG_UDHCPD_LEASE_PATH
+ string "Path to default udhcpd.leases"
-+ default "/var/lib/misc/udhcpd.leases"
-+ depends on CONFIG_UDHCPD
++ default "/var/lib/misc/udhcpd.leases"
++ depends on CONFIG_UDHCPD
+ help
+ The full path to udhcpd's default leases file.
+ (default is: /var/lib/misc/udhcpd.leases)
+
+config CONFIG_UDHCPD_PID_PATH
+ string "Path to default udhcpd PID file"
-+ default "/var/run/udhcpd.pid"
-+ depends on CONFIG_UDHCPD
++ default "/var/run/udhcpd.pid"
++ depends on CONFIG_UDHCPD
+ help
+ The full path to udhcpd's default pid file.
+ (default is: /var/run/udhcpd.pid)
+ The full path to udhcpc's default event script file.
+ (default is: /usr/share/udhcpc/default.script OR
+ /share/udhcpc/default.script if CONFIG_INSTALL_NO_USR is set)
-+
++
+ When udhcpc is started it executes this script to take care
+ of system tasks after it completes DHCP communication. Such
-+ tasks include putting network interfaces up or down, setting
++ tasks include putting network interfaces up or down, setting
+ DNS info, adding routing information, etc.
+
+if CONFIG_INSTALL_NO_USR
+config CONFIG_UDHCPC_SCRIPT_PATH
-+ default "/share/udhcpc/default.script"
++ default "/share/udhcpc/default.script"
+endif
+
+if !CONFIG_INSTALL_NO_USR
+config CONFIG_UDHCPC_SCRIPT_PATH
-+ default "/usr/share/udhcpc/default.script"
++ default "/usr/share/udhcpc/default.script"
+endif
-+
++
+endmenu
+
endmenu
-
+
Index: networking/udhcp/README
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/README,v
@@ -9,27 +9,42 @@
compile time options
-------------------
-
+
-The Makefile contains three of the compile time options:
+The following options can be adjusted when configuring busybox:
-
+
- UDHCP_DEBUG: If UDHCP_DEBUG is defined, udhcpd will output extra
- debugging output, compile with -g, and not fork to the background when
- run.
- UDHCP_SYSLOG: If UDHCP_SYSLOG is defined, udhcpd will log all its
- messages syslog, otherwise, it will attempt to log them to stdout.
--
+-
- COMBINED_BINARY: If COMBINED_BINARY is define, one binary, udhcpd,
- is created. If called as udhcpd, the dhcp server will be started.
- If called as udhcpc, the dhcp client will be started.
--
+-
-dhcpd.h contains the other three compile time options:
--
+-
- LEASE_TIME: The default lease time if not specified in the config
- file.
-+ CONFIG_FEATURE_UDHCP_DEBUG:
-+ If this is defined, udhcpd will output extra debugging output,
++ CONFIG_FEATURE_UDHCP_DEBUG:
++ If this is defined, udhcpd will output extra debugging output,
+ compile with -g, and not fork to the background when run.
-
+
- LEASES_FILE: The default file for storing leases.
--
+-
- DHCPD_CONFIG_FILE: The defualt config file to use.
-+ CONFIG_FEATURE_UDHCP_SYSLOG:
-+ If this is defined, udhcpd will log all its messages syslog,
++ CONFIG_FEATURE_UDHCP_SYSLOG:
++ If this is defined, udhcpd will log all its messages syslog,
+ otherwise, it will attempt to log them to stdout.
+
+ CONFIG_UDHCPD_CONF_PATH:
+
+
+dhcpd.h contains the another compile time option:
-
-+ LEASE_TIME:
-+ The default lease time if not specified in the config file.
-+ This option can also be changed at runtime with the 'lease'
-+ configuration option.
+
++ LEASE_TIME:
++ The default lease time if not specified in the config file.
++ This option can also be changed at runtime with the 'lease'
++ configuration option.
+
options.c contains a set of dhcp options for the client:
-
+
name[10]: The name of the option as it will appear in scripts
Index: networking/udhcp/README.udhcpc
===================================================================
+ /usr/share/udhcpc/default.script or
+ CONFIG_UDHCPC_SCRIPT_PATH at build time)
-v, --version Display version
-
-
+
+
Index: networking/udhcp/README.udhcpd
===================================================================
RCS file: /var/cvs/busybox/networking/udhcp/README.udhcpd,v
--- a/networking/udhcp/README.udhcpd 31 Oct 2002 19:21:27 -0000 1.1
+++ b/networking/udhcp/README.udhcpd 5 Mar 2004 13:20:11 -0000
@@ -50,10 +50,14 @@
-
+
compile time options
-------------------
+
-+During busybox configuration, you can change the default paths for
-+udhcpd.conf, udhcpd.leases, and udhcpd.pid files. See README for
++During busybox configuration, you can change the default paths for
++udhcpd.conf, udhcpd.leases, and udhcpd.pid files. See README for
+more details.
-
+
-dhcpd.h contains the other two compile time options:
+dhcpd.h contains the compile time option:
-
+
LEASE_TIME: The default lease time if not specified in the config
file.
+
-
+
- DHCPD_CONFIG_FILE: The defualt config file to use.
Index: networking/udhcp/dhcpc.h
===================================================================
@@ -2,7 +2,11 @@
#ifndef _DHCPC_H
#define _DHCPC_H
-
+
-#define DEFAULT_SCRIPT "/usr/share/udhcpc/default.script"
+#ifdef CONFIG_UDHCPC_SCRIPT_PATH
+ #define DEFAULT_SCRIPT CONFIG_UDHCPC_SCRIPT_PATH
+#else
+ #define DEFAULT_SCRIPT "/usr/share/udhcpc/default.script"
+#endif
-
+
/* allow libbb_udhcp.h to redefine DEFAULT_SCRIPT */
#include "libbb_udhcp.h"
Index: networking/udhcp/dhcpd.c
int max_sock;
unsigned long num_ips;
+ int daemonize = 1;
-+
++
+ while (strcmp(argv[1],"-f")==0 || strcmp(argv[1],"--foreground")==0) {
+ daemonize = 0;
+ argv++;
+ argc--;
+ }
-
+
memset(&server_config, 0, sizeof(struct server_config_t));
read_config(argc < 2 ? DHCPD_CONF_FILE : argv[1]);
@@ -99,9 +106,8 @@
&server_config.server, server_config.arp) < 0)
return 1;
-
+
-#ifndef UDHCP_DEBUG
- background(server_config.pidfile); /* hold lock during fork. */
-#endif
+ if(daemonize)
+ background(server_config.pidfile); /* hold lock during fork. */
-
+
/* Setup the signal pipe */
udhcp_sp_setup();
Index: networking/udhcp/dhcpd.h
--- a/networking/udhcp/dhcpd.h 30 Jan 2004 23:45:12 -0000 1.5
+++ b/networking/udhcp/dhcpd.h 5 Mar 2004 13:20:12 -0000
@@ -15,11 +15,25 @@
-
+
/* the period of time the client is allowed to use that address */
#define LEASE_TIME (60*60*24*10) /* 10 days of seconds */
-#define LEASES_FILE "/var/lib/misc/udhcpd.leases"
+#else
+ #define LEASES_FILE "/var/lib/misc/udhcpd.leases"
+#endif
-
+
/* where to find the DHCP server configuration file */
-#define DHCPD_CONF_FILE "/etc/udhcpd.conf"
+#ifdef CONFIG_UDHCPD_CONF_PATH
+#else
+ #define DHCPD_CONF_FILE "/etc/udhcpd.conf"
+#endif
-
+
+#ifdef CONFIG_UDHCPD_PID_PATH
+ #define DHCPD_PID_FILE CONFIG_UDHCPD_PID_PATH
+#else
@@ -3,11 +3,6 @@
/* bit of a hack, do this no matter what the order of the includes.
* (for busybox) */
-
+
-#ifdef CONFIG_INSTALL_NO_USR
-#undef DEFUALT_SCRIPT
-#define DEFAULT_SCRIPT "/share/udhcpc/default.script"
-
#ifndef _LIBBB_UDHCP_H
#define _LIBBB_UDHCP_H
-
+
int max_sock;
unsigned long num_ips;
+ int daemonize = 1;
-+
++
+ while (strcmp(argv[1],"-f")==0 || strcmp(argv[1],"--foreground")==0) {
+ daemonize = 0;
+ argv++;
+ argc--;
+ }
-
+
memset(&server_config, 0, sizeof(struct server_config_t));
read_config(argc < 2 ? DHCPD_CONF_FILE : argv[1]);
@@ -99,9 +106,8 @@
&server_config.server, server_config.arp) < 0)
return 1;
-
+
-#ifndef UDHCP_DEBUG
- background(server_config.pidfile); /* hold lock during fork. */
-#endif
+ if(daemonize)
+ background(server_config.pidfile); /* hold lock during fork. */
-
+
/* Setup the signal pipe */
udhcp_sp_setup();
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
/*
* Mini free implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
if (argc > 1 && **(argv + 1) == '-')
bb_show_usage();
- printf("%6s%13s%13s%13s%13s%13s\n", "", "total", "used", "free",
+ printf("%6s%13s%13s%13s%13s%13s\n", "", "total", "used", "free",
"shared", "buffers");
- printf("%6s%13ld%13ld%13ld%13ld%13ld\n", "Mem:", info.totalram,
- info.totalram-info.freeram, info.freeram,
+ printf("%6s%13ld%13ld%13ld%13ld%13ld\n", "Mem:", info.totalram,
+ info.totalram-info.freeram, info.freeram,
info.sharedram, info.bufferram);
#ifndef __uClinux__
* Mini kill/killall implementation for busybox
*
* Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* pidof implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Mini ps implementation(s) for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
extern int renice_main(int argc, char **argv)
{
int prio, status = EXIT_SUCCESS;
-
+
if (argc < 3) bb_show_usage();
-
+
prio = atoi(*++argv);
if (prio > 20) prio = 20;
if (prio < -20) prio = -20;
-
+
while (*++argv) {
int ps = atoi(*argv);
int oldp = getpriority(PRIO_PROCESS, ps);
-
+
if (setpriority(PRIO_PROCESS, ps, prio) == 0) {
printf("%d: old priority %d, new priority %d\n", ps, oldp, prio );
} else {
* - added -p <preload> to preload values from a file
* v1.01.1
* - busybox applet aware by <solar@gentoo.org>
- *
+ *
*/
#include <stdio.h>
}
/*
- * sysctl_main()...
+ * sysctl_main()...
*/
int sysctl_main(int argc, char **argv)
{
/*
- * sysctl_preload_file
+ * sysctl_preload_file
* preload the sysctl's from a conf file
* - we parse the file and then reform it (strip out whitespace)
*/
/*
- * Read a sysctl setting
+ * Read a sysctl setting
*
*/
int sysctl_read_setting(const char *setting, int output)
/*
- * Display all the sysctl settings
+ * Display all the sysctl settings
*
*/
int sysctl_display_all(const char *path, int output, int show_table)
* This reads the PIDs of all processes and their status and shows
* the status of processes (first ones that fit to screen) at given
* intervals.
- *
+ *
* NOTES:
* - At startup this changes to /proc, all the reads are then
* relative to that.
- *
+ *
* (C) Eero Tamminen <oak at welho dot com>
*
* Rewroted by Vladimir Oleynik (C) 2002 <dzo@simtreas.ru>
fscanf(fp, "Mem: %lu %lu %lu %lu %lu %lu",
&total, &used, &mfree, &shared, &buffers, &cached);
} else {
- /*
+ /*
* Revert to manual parsing, which incidentally already has the
* sizes in kilobytes. This should be safe for both 2.4 and
* 2.6.
fscanf(fp, "MemFree: %lu %s\n", &mfree, buf);
- /*
+ /*
* MemShared: is no longer present in 2.6. Report this as 0,
* to maintain consistent behavior with normal procps.
*/
used = total - mfree;
}
fclose(fp);
-
+
/* read load average */
fp = bb_xfopen("loadavg", "r");
if (fscanf(fp, "%f %f %f", &avg1, &avg2, &avg3) != 3) {
cached /= 1024;
total /= 1024;
}
-
+
/* output memory info and load average */
/* clear screen & go to top */
printf("\e[H\e[J" "Mem: "
procps_status_t *s = top;
char rss_str_buf[8];
unsigned long total_memory = display_generic();
-
+
#ifdef FEATURE_CPU_USAGE_PERCENTAGE
/* what info of the processes is shown */
printf("\n\e[7m PID USER STATUS RSS PPID %%CPU %%MEM COMMAND\e[0m\n");
pmem = 1000.0 * s->rss / total_memory;
if (pmem > 999) pmem = 999;
-
+
if(s->rss > 10*1024)
sprintf(rss_str_buf, "%6ldM", s->rss/1024);
else
#endif
#endif /* CONFIG_FEATURE_CLEAN_UP */
}
-
+
static void sig_catcher (int sig)
{
reset_term();
#endif /* CONFIG_FEATURE_USE_TERMIOS */
clearmems();
}
-
+
return EXIT_SUCCESS;
}
/*
* Mini uptime implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
sysinfo(&info);
- printf(" %2d:%02d%s up ",
- current_time->tm_hour%12 ? current_time->tm_hour%12 : 12,
+ printf(" %2d:%02d%s up ",
+ current_time->tm_hour%12 ? current_time->tm_hour%12 : 12,
current_time->tm_min, current_time->tm_hour > 11 ? "pm" : "am");
updays = (int) info.uptime / (60*60*24);
if (updays)
else
printf("%d min, ", upminutes);
- printf("load average: %ld.%02ld, %ld.%02ld, %ld.%02ld\n",
- LOAD_INT(info.loads[0]), LOAD_FRAC(info.loads[0]),
- LOAD_INT(info.loads[1]), LOAD_FRAC(info.loads[1]),
+ printf("load average: %ld.%02ld, %ld.%02ld, %ld.%02ld\n",
+ LOAD_INT(info.loads[0]), LOAD_FRAC(info.loads[0]),
+ LOAD_INT(info.loads[1]), LOAD_FRAC(info.loads[1]),
LOAD_INT(info.loads[2]), LOAD_FRAC(info.loads[2]));
return EXIT_SUCCESS;
<expr> '||' <expr> (6)
<expr> '&&' <expr> (7)
-Expressions are listed in decreasing order of precedence.
+Expressions are listed in decreasing order of precedence.
(1) Convert the symbol into an expression. Boolean and tristate symbols
are simply converted into the respective expression values. All
MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC))
SHARED_OBJS=$(patsubst %.c,%.o, $(SHARED_SRC))
-conf: $(CONF_OBJS) $(SHARED_OBJS)
+conf: $(CONF_OBJS) $(SHARED_OBJS)
$(HOSTCC) $(NATIVE_LDFLAGS) $^ -o $@
mconf: $(MCONF_OBJS) $(SHARED_OBJS)
###
# The following requires flex/bison
-# By default we use the _shipped versions, uncomment the
+# By default we use the _shipped versions, uncomment the
# following line if you are modifying the flex/bison src.
#LKC_GENPARSER := 1
dialog_checklist (const char *title, const char *prompt, int height, int width,
int list_height, int item_no, struct dialog_list_item ** items,
int flag)
-
+
{
int i, x, y, box_x, box_y;
int key = 0, button = 0, choice = 0, scroll = 0, max_choice, *status;
/* Find length of longest item in order to center checklist */
check_x = 0;
- for (i = 0; i < item_no; i++)
+ for (i = 0; i < item_no; i++)
check_x = MAX (check_x, + strlen (items[i]->name) + 4);
check_x = (list_width - check_x) / 2;
break;
- if ( i < max_choice || key == KEY_UP || key == KEY_DOWN ||
+ if ( i < max_choice || key == KEY_UP || key == KEY_DOWN ||
key == '+' || key == '-' ) {
if (key == KEY_UP || key == '-') {
if (!choice) {
}
wnoutrefresh (list);
wrefresh (dialog);
-
+
for (i = 0; i < item_no; i++) {
items[i]->selected = status[i];
}
/* Now, update everything... */
doupdate ();
}
-
+
delwin (dialog);
free (status);
#define ACS_DARROW 'v'
#endif
-/*
+/*
* Attribute names
*/
#define screen_attr attributes[0]
int width, int pause);
int dialog_textbox (const char *title, const char *file, int height, int width);
int dialog_menu (const char *title, const char *prompt, int height, int width,
- int menu_height, const char *choice, int item_no,
+ int menu_height, const char *choice, int item_no,
struct dialog_list_item ** items);
int dialog_checklist (const char *title, const char *prompt, int height,
int width, int list_height, int item_no,
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
+typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
#define EOB_ACT_LAST_MATCH 2
#define YY_LESS_LINENO(n)
-
+
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */
-
+
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
#endif
static void yyunput (int c,char *buf_ptr );
-
+
#ifndef yytext_ptr
static void yy_flex_strncpy (char *,yyconst char *,int );
#endif
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
-
+
int str = 0;
int ts, i;
{
register yy_state_type yy_current_state;
register char *yy_cp;
-
+
yy_current_state = (yy_start);
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
{
register int yy_is_jam;
-
+
yy_current_state = yy_nxt[yy_current_state][1];
yy_is_jam = (yy_current_state <= 0);
static void yyunput (int c, register char * yy_bp )
{
register char *yy_cp;
-
+
yy_cp = (yy_c_buf_p);
/* undo effects of setting up zconftext */
{
int c;
-
+
*(yy_c_buf_p) = (yy_hold_char);
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
/** Immediately switch to a different input stream.
* @param input_file A readable stream.
- *
+ *
* @note This function does not reset the start condition to @c INITIAL .
*/
void zconfrestart (FILE * input_file )
{
-
+
if ( ! YY_CURRENT_BUFFER ){
zconfensure_buffer_stack ();
YY_CURRENT_BUFFER_LVALUE =
/** Switch to a different input buffer.
* @param new_buffer The new input buffer.
- *
+ *
*/
void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer )
{
-
+
/* TODO. We should be able to replace this entire function body
* with
* zconfpop_buffer_state();
/** Allocate and initialize an input buffer state.
* @param file A readable stream.
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- *
+ *
* @return the allocated buffer state.
*/
YY_BUFFER_STATE zconf_create_buffer (FILE * file, int size )
{
YY_BUFFER_STATE b;
-
+
b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
/** Destroy the buffer.
* @param b a buffer created with zconf_create_buffer()
- *
+ *
*/
void zconf_delete_buffer (YY_BUFFER_STATE b )
{
-
+
if ( ! b )
return;
{
int oerrno = errno;
-
+
zconf_flush_buffer(b );
b->yy_input_file = file;
}
b->yy_is_interactive = 0;
-
+
errno = oerrno;
}
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- *
+ *
*/
void zconf_flush_buffer (YY_BUFFER_STATE b )
{
* the current state. This function will allocate the stack
* if necessary.
* @param new_buffer The new state.
- *
+ *
*/
void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer )
{
/** Removes and deletes the top of the stack, if present.
* The next element becomes the new top.
- *
+ *
*/
void zconfpop_buffer_state (void)
{
static void zconfensure_buffer_stack (void)
{
int num_to_alloc;
-
+
if (!(yy_buffer_stack)) {
/* First allocation is just for 2 elements, since we don't know if this
(yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
);
-
+
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
+
(yy_buffer_stack_max) = num_to_alloc;
(yy_buffer_stack_top) = 0;
return;
/** Setup the input buffer state to scan directly from a user-specified character buffer.
* @param base the character buffer
* @param size the size in bytes of the character buffer
- *
- * @return the newly allocated buffer state object.
+ *
+ * @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
{
YY_BUFFER_STATE b;
-
+
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
/** Setup the input buffer state to scan a string. The next call to zconflex() will
* scan from a @e copy of @a str.
* @param str a NUL-terminated string to scan
- *
+ *
* @return the newly allocated buffer state object.
* @note If you want to scan bytes that may contain NUL values, then use
* zconf_scan_bytes() instead.
*/
YY_BUFFER_STATE zconf_scan_string (yyconst char * str )
{
-
+
return zconf_scan_bytes(str,strlen(str) );
}
* scan from a @e copy of @a bytes.
* @param bytes the byte buffer to scan
* @param len the number of bytes in the buffer pointed to by @a bytes.
- *
+ *
* @return the newly allocated buffer state object.
*/
YY_BUFFER_STATE zconf_scan_bytes (yyconst char * bytes, int len )
char *buf;
yy_size_t n;
int i;
-
+
/* Get memory for full buffer, including space for trailing EOB's. */
n = len + 2;
buf = (char *) zconfalloc(n );
/* Accessor methods (get/set functions) to struct members. */
/** Get the current line number.
- *
+ *
*/
int zconfget_lineno (void)
{
-
+
return zconflineno;
}
/** Get the input stream.
- *
+ *
*/
FILE *zconfget_in (void)
{
}
/** Get the output stream.
- *
+ *
*/
FILE *zconfget_out (void)
{
}
/** Get the length of the current token.
- *
+ *
*/
int zconfget_leng (void)
{
}
/** Get the current token.
- *
+ *
*/
char *zconfget_text (void)
/** Set the current line number.
* @param line_number
- *
+ *
*/
void zconfset_lineno (int line_number )
{
-
+
zconflineno = line_number;
}
/** Set the input stream. This does not discard the current
* input buffer.
* @param in_str A readable stream.
- *
+ *
* @see zconf_switch_to_buffer
*/
void zconfset_in (FILE * in_str )
/* zconflex_destroy is for both reentrant and non-reentrant scanners. */
int zconflex_destroy (void)
{
-
+
/* Pop the buffer stack, destroying each element. */
while(YY_CURRENT_BUFFER){
zconf_delete_buffer(YY_CURRENT_BUFFER );
items[item_no]->namelen = 0;
item_no++;
}
-
+
static int cprint_name(const char *fmt, ...)
{
va_list ap;
return res;
}
-
+
static int cprint_tag(const char *fmt, ...)
{
va_list ap;
return res;
}
-
+
static void cdone(void)
{
int i;
if (!strcasecmp(mode, "single_menu"))
single_menu_mode = 1;
}
-
+
tcgetattr(1, &ios_org);
atexit(conf_cleanup);
init_wsize();
init_dialog();
- signal(SIGWINCH, winch_handler);
+ signal(SIGWINCH, winch_handler);
conf(&rootmenu);
end_dialog();
/* Restart dialog to act more like when lxdialog was still separate */
init_dialog();
do {
- stat = dialog_yesno(NULL,
+ stat = dialog_yesno(NULL,
"Do you wish to save your new BusyBox configuration?", 5, 60);
} while (stat < 0);
end_dialog();
if (prop->type == P_PROMPT && prop->menu != menu) {
fprintf(stderr, "%s:%d:warning: choice values currently only support a single prompt\n",
prop->file->name, prop->lineno);
-
+
}
if (prop->type == P_DEFAULT)
fprintf(stderr, "%s:%d:warning: defaults for choice values not supported\n",
*
* *) A bugfix for the Page-Down problem
*
- * *) Formerly when I used Page Down and Page Up, the cursor would be set
+ * *) Formerly when I used Page Down and Page Up, the cursor would be set
* to the first position in the menu box. Now lxdialog is a bit
* smarter and works more like other menu systems (just have a look at
* it).
/*
* Find length of longest item in order to center menu.
- * Set 'choice' to default item.
+ * Set 'choice' to default item.
*/
item_x = 0;
for (i = 0; i < item_no; i++) {
}
}
- if (i < max_choice ||
+ if (i < max_choice ||
key == KEY_UP || key == KEY_DOWN ||
key == '-' || key == '+' ||
key == KEY_PPAGE || key == KEY_NPAGE) {
const char *dialog_result;
-/*
+/*
* Attribute values, default is for mono display
*/
chtype attributes[] =
strcpy (tempstr, prompt);
prompt_len = strlen(tempstr);
-
+
/*
* Remove newlines
*/
if (strchr("<[(", c)) ++in_paren;
if (strchr(">])", c)) --in_paren;
- if ((! in_paren) && isalpha(c) &&
+ if ((! in_paren) && isalpha(c) &&
strchr(exempt, c) == 0)
return i;
}
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
- "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
- "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
- "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_DEFAULT", "T_TRISTATE",
- "T_DEF_TRISTATE", "T_BOOLEAN", "T_DEF_BOOLEAN", "T_STRING", "T_INT",
- "T_HEX", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", "T_EOF", "T_EOL",
- "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_ON", "T_SELECT", "T_RANGE", "T_OR",
- "T_AND", "T_EQUAL", "T_NOT", "$accept", "input", "block",
- "common_block", "config_entry_start", "config_stmt",
- "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
- "config_option", "choice", "choice_entry", "choice_end", "choice_stmt",
- "choice_option_list", "choice_option", "choice_block", "if", "if_end",
- "if_stmt", "if_block", "menu", "menu_entry", "menu_end", "menu_stmt",
- "menu_block", "source", "source_stmt", "comment", "comment_stmt",
- "help_start", "help", "depends_list", "depends", "prompt_stmt_opt",
+ "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU",
+ "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
+ "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
+ "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_DEFAULT", "T_TRISTATE",
+ "T_DEF_TRISTATE", "T_BOOLEAN", "T_DEF_BOOLEAN", "T_STRING", "T_INT",
+ "T_HEX", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", "T_EOF", "T_EOL",
+ "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_ON", "T_SELECT", "T_RANGE", "T_OR",
+ "T_AND", "T_EQUAL", "T_NOT", "$accept", "input", "block",
+ "common_block", "config_entry_start", "config_stmt",
+ "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
+ "config_option", "choice", "choice_entry", "choice_end", "choice_stmt",
+ "choice_option_list", "choice_option", "choice_block", "if", "if_end",
+ "if_stmt", "if_block", "menu", "menu_entry", "menu_end", "menu_stmt",
+ "menu_block", "source", "source_stmt", "comment", "comment_stmt",
+ "help_start", "help", "depends_list", "depends", "prompt_stmt_opt",
"prompt", "end", "nl_or_eof", "if_expr", "expr", "symbol", 0
};
#endif
#endif
#endif
{
-
+
register int yystate;
register int yyn;
int yyresult;
* Smart CONFIG_* processing by Werner Almesberger, Michael Chastain.
*
* Usage: mkdep cflags -- file ...
- *
+ *
* Read source files and output makefile dependency lines for them.
* I make simple dependency lines for #include <*.h> and #include "*.h".
* I also find instances of CONFIG_FOO and generate dependencies
/* Change to output directory. */
if (chdir(str_dir_config) != 0)
ERROR_EXIT(str_dir_config);
-
+
/* Put initial separator into target list. */
ptarget = list_target;
*ptarget++ = '\n';
the most complete and most pedantically correct shell included with
busybox. This shell is actually a derivative of the Debian 'dash'
shell (by Herbert Xu), which was created by porting the 'ash' shell
- (written by Kenneth Almquist) from NetBSD.
+ (written by Kenneth Almquist) from NetBSD.
comment "Ash Shell Options"
depends on CONFIG_ASH
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
int quoted = 0;
static const char *const vstype[16] = {
nullstr, "}", "-", "+", "?", "=",
- "%", "%%", "#", "##", nullstr
+ "%", "%%", "#", "##", nullstr
};
nextc = makestrspace((strlen(s) + 1) * 8, cmdnextc);
* written Dec 2000 and Jan 2001 by Larry Doolittle. The
* execution engine, the builtins, and much of the underlying
* support has been adapted from busybox-0.49pre's lash, which is
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
* written by Erik Andersen <andersen@codepoet.org>. That, in turn,
* is based in part on ladsh.c, by Michael K. Johnson and Erik W.
* Troan, which they placed in the public domain. I don't know
redir_type type; /* type of redirection */
int fd; /* file descriptor being redirected */
int dup; /* -1, or file descriptor being duplicated */
- struct redir_struct *next; /* pointer to the next redirect in the list */
+ struct redir_struct *next; /* pointer to the next redirect in the list */
glob_t word; /* *word.gl_pathv is the filename */
};
unsigned int global_argc;
unsigned int last_return_code;
extern char **environ; /* This is in <unistd.h>, but protected with __USE_GNU */
-
+
/* "globals" within this file */
static char *ifs;
static char map[256];
{"continue", "Continue for, while or until loop", builtin_not_written},
{"env", "Print all environment variables", builtin_env},
{"eval", "Construct and run shell command", builtin_eval},
- {"exec", "Exec command, replacing this shell with the exec'd process",
+ {"exec", "Exec command, replacing this shell with the exec'd process",
builtin_exec},
{"exit", "Exit from shell()", builtin_exit},
{"export", "Set environment variable", builtin_export},
{
char *str = NULL;
int rcode = EXIT_SUCCESS;
-
+
if (child->argv[1]) {
str = make_string(child->argv + 1);
- parse_string_outer(str, FLAG_EXIT_FROM_LOOP |
+ parse_string_outer(str, FLAG_EXIT_FROM_LOOP |
FLAG_PARSE_SEMICOLON);
free(str);
rcode = last_return_code;
PS1 = getenv("PS1");
if(PS1==0)
PS1 = "\\w \\$ ";
-#endif
+#endif
}
static inline void setup_prompt_string(int promptmode, char **prompt_str)
i->p = the_command;
}
-/* This is the magic location that prints prompts
+/* This is the magic location that prints prompts
* and gets data back from the user */
static int file_get(struct in_str *i)
{
}
/* Check if the command matches any busybox internal commands
- * ("applets") here.
+ * ("applets") here.
* FIXME: This feature is not 100% safe, since
* BusyBox is not fully reentrant, so we have no guarantee the things
* from the .bss are still zeroed, or that things from .data are still
* at their defaults. We could exec ourself from /proc/self/exe, but I
* really dislike relying on /proc for things. We could exec ourself
* from global_argv[0], but if we are in a chroot, we may not be able
- * to find ourself... */
+ * to find ourself... */
#ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
{
int argc_l;
}
}
- /* we don't wait for background thejobs to return -- append it
+ /* we don't wait for background thejobs to return -- append it
to the list of backgrounded thejobs and leave it alone */
printf("[%d] %d\n", thejob->jobid, thejob->progs[0].pid);
last_bg_pid = thejob->progs[0].pid;
free(pi);
}
-/* Checks to see if any processes have exited -- if they
+/* Checks to see if any processes have exited -- if they
have, figure out why and see if a job has completed */
static int checkjobs(struct pipe* fg_pipe)
{
int i, rcode = 0;
for (i=0; i < fg_pipe->num_progs; i++) {
if (fg_pipe->progs[i].pid == childpid) {
- if (i==fg_pipe->num_progs-1)
+ if (i==fg_pipe->num_progs-1)
rcode=WEXITSTATUS(status);
(fg_pipe->num_progs)--;
return(rcode);
if (pi->stopped_progs == pi->num_progs) {
printf("\n"JOB_STATUS_FORMAT, pi->jobid, "Stopped", pi->text);
}
-#endif
+#endif
}
}
/* Ok, this case is tricky. We have to decide if this is a
* local variable, or an already exported variable. If it is
* already exported, we have to export the new value. If it is
- * not exported, we need only set this as a local variable.
+ * not exported, we need only set this as a local variable.
* This junk is all to decide whether or not to export this
* variable. */
int export_me=0;
}
if (child->sp) {
char * str = NULL;
-
+
str = make_string((child->argv + i));
parse_string_outer(str, FLAG_EXIT_FROM_LOOP | FLAG_REPARSING);
free(str);
#if !defined(__UCLIBC__) || defined(__UCLIBC_HAS_MMU__)
if (!(child->pid = fork()))
#else
- if (!(child->pid = vfork()))
+ if (!(child->pid = vfork()))
#endif
{
/* Set the handling for job control signals back to the default. */
signal(SIGTTIN, SIG_DFL);
signal(SIGTTOU, SIG_DFL);
signal(SIGCHLD, SIG_DFL);
-
+
close_all();
if (nextin != 0) {
pseudo_exec(child);
}
-
+
/* put our child in the process group whose leader is the
first process in this pipe */
if (nextout != 1)
close(nextout);
- /* If there isn't another process, nextin is garbage
+ /* If there isn't another process, nextin is garbage
but it doesn't matter */
nextin = pipefds[0];
}
(rpipe->next == NULL)) {
syntax();
return 1;
- }
- if ((rpipe->r_mode == RES_IN &&
- (rpipe->next->r_mode == RES_IN &&
+ }
+ if ((rpipe->r_mode == RES_IN &&
+ (rpipe->next->r_mode == RES_IN &&
rpipe->next->progs->argv != NULL))||
(rpipe->r_mode == RES_FOR &&
- rpipe->next->r_mode != RES_IN)) {
+ rpipe->next->r_mode != RES_IN)) {
syntax();
return 1;
}
if (rmode == RES_ELIF && !if_code) continue;
if (rmode == RES_FOR && pi->num_progs) {
if (!list) {
- /* if no variable values after "in" we skip "for" */
+ /* if no variable values after "in" we skip "for" */
if (!pi->next->progs->argv) continue;
/* create list of variable values */
list = make_list_in(pi->next->progs->argv,
save_name = pi->progs->argv[0];
pi->progs->argv[0] = NULL;
flag_rep = 1;
- }
+ }
if (!(*list)) {
free(pi->progs->argv[0]);
free(save_list);
pi->progs->glob_result.gl_pathv[0] =
pi->progs->argv[0];
continue;
- } else {
+ } else {
/* insert new value from list for variable */
- if (pi->progs->argv[0])
+ if (pi->progs->argv[0])
free(pi->progs->argv[0]);
pi->progs->argv[0] = *list++;
pi->progs->glob_result.gl_pathv[0] =
pi->progs->argv[0];
}
- }
+ }
if (rmode == RES_IN) continue;
if (rmode == RES_DO) {
if (!flag_rep) continue;
- }
+ }
if ((rmode == RES_DONE)) {
if (flag_rep) {
flag_restore = 1;
} else {
rpipe = NULL;
}
- }
+ }
if (pi->num_progs == 0) continue;
save_num_progs = pi->num_progs; /* save number of programs */
rcode = run_pipe_real(pi);
pi->num_progs = save_num_progs; /* restore number of programs */
if ( rmode == RES_IF || rmode == RES_ELIF )
next_if_code=rcode; /* can be overwritten a number of times */
- if (rmode == RES_WHILE)
+ if (rmode == RES_WHILE)
flag_rep = !last_return_code;
- if (rmode == RES_UNTIL)
+ if (rmode == RES_UNTIL)
flag_rep = last_return_code;
if ( (rcode==EXIT_SUCCESS && pi->followup==PIPE_OR) ||
(rcode!=EXIT_SUCCESS && pi->followup==PIPE_AND) )
pi->next=NULL;
free(pi);
}
- return rcode;
+ return rcode;
}
/* Select which version we will use */
int rcode=0;
if (fake_mode==0) {
rcode = run_list_real(pi);
- }
+ }
/* free_pipe_list has the side effect of clearing memory
* In the long run that function can be merged with run_list_real,
* but doing that now would hobble the debugging effort. */
/* Assume when we enter this function that we are already in
* NAME=VALUE format. So the first order of business is to
- * split 's' on the '=' into 'name' and 'value' */
+ * split 's' on the '=' into 'name' and 'value' */
value = strchr(name, '=');
if (value==0 && ++value==0) {
free(name);
debug_printf("Redirect type %d%s\n", redir->fd, redir_table[style].descrip);
- /* Check for a '2>&1' type redirect */
+ /* Check for a '2>&1' type redirect */
redir->dup = redirect_dup_num(input);
if (redir->dup == -2) return 1; /* syntax error */
if (redir->dup != -1) {
static char *lookup_param(char *src)
{
char *p=NULL;
- if (src) {
+ if (src) {
p = getenv(src);
- if (!p)
+ if (!p)
p = get_local_var(src);
}
return p;
if (m==2) { /* unquoted IFS */
if (done_word(dest, ctx)) {
return 1;
- }
+ }
/* If we aren't performing a substitution, treat a newline as a
* command separator. */
if (end_trigger != '\0' && ch=='\n')
}
/* complain if quote? No, maybe we just finished a command substitution
* that was quoted. Example:
- * $ echo "`cat foo` plus more"
+ * $ echo "`cat foo` plus more"
* and we just got the EOF generated by the subshell that ran "cat foo"
* The only real complaint is if we got an EOF when end_trigger != '\0',
* that is, we were really supposed to get end_trigger, and never got
if (ctx.old_flag != 0) {
free(ctx.stack);
b_reset(&temp);
- }
+ }
temp.nonnull = 0;
temp.quote = 0;
inp->p = NULL;
/* XXX what should these be while sourcing /etc/profile? */
global_argc = argc;
global_argv = argv;
-
+
/* (re?) initialize globals. Sometimes hush_main() ends up calling
- * hush_main(), therefore we cannot rely on the BSS to zero out this
+ * hush_main(), therefore we cannot rely on the BSS to zero out this
* stuff. Reset these to 0 every time. */
ifs = NULL;
/* map[] is taken care of with call to update_ifs_map() */
#endif
PS2 = "> ";
- /* initialize our shell local variables with the values
+ /* initialize our shell local variables with the values
* currently living in the environment */
if (e) {
for (; *e; e++)
}
}
input=stdin;
-
+
while ((opt = getopt(argc, argv, "c:xif")) > 0) {
switch (opt) {
case 'c':
debug_printf("\ninteractive=%d\n", interactive);
if (interactive) {
/* Looks like they want an interactive shell */
-#ifndef CONFIG_FEATURE_SH_EXTRA_QUIET
+#ifndef CONFIG_FEATURE_SH_EXTRA_QUIET
printf( "\n\n" BB_BANNER " hush - the humble shell v0.01 (testing)\n");
printf( "Enter 'help' for a list of built-in commands.\n\n");
#endif
setup_job_control();
}
-
+
if (argv[optind]==NULL) {
opt=parse_file_outer(stdin);
goto final_return;
int len;
int done = 0;
char *p, *p1, *res_str = NULL;
-
+
while ((p = strchr(inp, SPECIAL_VAR_SYMBOL))) {
if (p != inp) {
len = p - inp;
res_str = xrealloc(res_str, (1 + len));
strcpy((res_str + res_str_len), p1);
res_str_len = len;
- }
+ }
*p = SPECIAL_VAR_SYMBOL;
inp = ++p;
done = 1;
int n = 0;
char **list;
char *p1, *p2, *p3;
-
- /* create list of variable values */
+
+ /* create list of variable values */
list = xmalloc(sizeof(*list));
for (i = 0; inp[i]; i++) {
p3 = insert_var_value(inp[i]);
}
if ((p2 = strchr(p1, ' '))) {
len = p2 - p1;
- } else {
+ } else {
len = strlen(p1);
p2 = p1 + len;
}
- /* we use n + 2 in realloc for list,because we add
+ /* we use n + 2 in realloc for list,because we add
* new element and then we will add NULL element */
- list = xrealloc(list, sizeof(*list) * (n + 2));
+ list = xrealloc(list, sizeof(*list) * (n + 2));
list[n] = xmalloc(2 + name_len + len);
strcpy(list[n], name);
strcat(list[n], "=");
}
list[n] = NULL;
return list;
-}
+}
/* Make new string for parser */
static char * make_string(char ** inp)
/*
* lash -- the BusyBox Lame-Ass SHell
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* Based in part on ladsh.c by Michael K. Johnson and Erik W. Troan, which is
* under the following liberal license: "We have placed this source code in the
}
if (var) {
- /* a single character construction was found, and
+ /* a single character construction was found, and
* already handled in the case statement */
src=dst+2;
} else {
prog->redirects[i].fd = -1;
if (buf != prog->argv[argc_l]) {
- /* the stuff before this character may be the file number
+ /* the stuff before this character may be the file number
being redirected */
prog->redirects[i].fd =
strtol(prog->argv[argc_l], &chptr, 10);
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ *
* Original copyright notice is retained at the end of this file.
*/
if (--argc > 0)
PUSHIO(aword, *++argv, iof = nlchar);
break;
-
+
case 'q':
qflag = SIG_DFL;
break;
setval(prompt, "");
iof = linechar;
break;
-
+
case 'i':
interactive++;
default:
PUSHIO(afile, 0, iof);
if (isatty(0) && isatty(1) && !cflag) {
interactive++;
-#ifndef CONFIG_FEATURE_SH_EXTRA_QUIET
+#ifndef CONFIG_FEATURE_SH_EXTRA_QUIET
printf( "\n\n" BB_BANNER " Built-in shell (msh)\n");
printf( "Enter 'help' for a list of built-in commands.\n\n");
#endif
ap++;
}
}
- }
+ }
setval(lookup("#"), putn((--dolc < 0) ? (dolc = 0) : dolc));
for (;;) {
#if __GNUC__
/* Avoid longjmp clobbering */
(void) ℘
-#endif
+#endif
if (t == NULL)
case TPAREN:
rv = execute(t->left, pin, pout, 0);
break;
-
+
case TCOM:
{
int child;
} else {
i = -1;
while (*wp++ != NULL)
- ;
+ ;
}
vp = lookup(t->str);
while (setjmp(bc.brkpt))
(void) &cp;
(void) &resetsig;
(void) &owp;
-#endif
+#endif
owp = wp;
resetsig = 0;
hintr = intr;
hbrklist = brklist;
hexecflg = execflg;
-
+
i = vfork();
if (i != 0) {
/* who wrote this crappy non vfork safe shit? */
(*pforked)++;
brklist = 0;
execflg = 0;
- }
+ }
if (owp != NULL)
while ((cp = *owp++) != NULL && assign(cp, COPYV))
if (shcom == NULL)
#endif
optind = 1;
if (find_applet_by_name(name)) {
- /* We have to exec here since we vforked. Running
+ /* We have to exec here since we vforked. Running
* run_applet_by_name() won't work and bad things
* will happen. */
execve("/proc/self/exe", v, envp);
for (i=0, applet = applets; i < NUM_APPLETS; applet++, i++) {
if (!applet->name)
continue;
-
- col += printf("%s%s", ((col == 0) ? "\t" : " "),
+
+ col += printf("%s%s", ((col == 0) ? "\t" : " "),
applet->name);
if (col > 60) {
printf("\n");
if (n == SIGINT)
setsig(n, onintr);
else
- setsig(n, n == SIGQUIT ? SIG_IGN
+ setsig(n, n == SIGQUIT ? SIG_IGN
: SIG_DFL);
else
setsig(n, SIG_DFL);
/* Avoid longjmp clobbering */
(void) &cp;
#endif
-
+
for (cp = e.iop->argp->aword; *cp != '`'; cp++)
if (*cp == 0) {
err("no closing `");
err("unclosed ${\n");
return(0);
}
- if (operator) {
+ if (operator) {
src++;
while (*src && (*src != '}')) {
alt_value[alt_index++] = *src++;
}
}
*dest = '\0';
-
+
if (openpipe(pf) < 0)
return(0);
while ((i = vfork()) == -1 && errno == EAGAIN)
for (j=0; j<=_NSIG; j++)
if (ourtrap[j] && signal(j, SIG_IGN) != SIG_IGN)
signal(j, SIG_DFL);
-
+
dup2(pf[1], 1);
closepipe(pf);
wb->w_words[wb->w_nword++] = wd;
return(wb);
}
-static
+static
char **
getwords(wb)
register struct wdblock *wb;
c = mycommand[position];
position++;
return(c);
- } else
+ } else
#endif
{
i = safe_read(ap->afile, &c, sizeof(c));
char c;
char tname[30] = ".msh_XXXXXX";
jmp_buf ev;
-
+
tf = mkstemp(tname);
if (tf < 0)
return (-1);
/*
* Copyright (c) 1987,1997, Prentice Hall
* All rights reserved.
- *
+ *
* Redistribution and use of the MINIX operating system in source and
* binary forms, with or without modification, are permitted provided
* that the following conditions are met:
- *
+ *
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
- *
+ *
* Neither the name of Prentice Hall nor the names of the software
* authors or contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND
* CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
checking /etc/busybox.conf. The format of this file is as follows:
<applet> = [Ssx-][Ssx-][x-] (<username>|<uid>).(<groupname>|<gid>)
-
+
An example might help:
[SUID]
bool "Build BusyBox as a static binary (no shared libs)"
default n
help
- If you want to build a static BusyBox binary, which does not
- use or require any shared libraries, then enable this option.
+ If you want to build a static BusyBox binary, which does not
+ use or require any shared libraries, then enable this option.
This can cause BusyBox to be considerably larger, so you should
leave this option false unless you have a good reason (i.e.
your target platform does not support shared libraries, or
Most people will leave this set to 'N'.
config CONFIG_LFS
- bool "Build with Large File Support (for accessing files > 2 GB)"
+ bool "Build with Large File Support (for accessing files > 2 GB)"
default n
help
If you want to build BusyBox with large file support, then enable
default "/usr/i386-linux-uclibc/bin/i386-uclibc-"
depends on USING_CROSS_COMPILER
help
- If you want to build BusyBox with a cross compiler, then you
+ If you want to build BusyBox with a cross compiler, then you
will need to set this to the cross-compiler prefix. For example,
if my cross-compiler is /usr/i386-linux-uclibc/bin/i386-uclibc-gcc
then I would enter '/usr/i386-linux-uclibc/bin/i386-uclibc-' here,
help
Say Y here if you wish to compile BusyBox with debugging symbols.
This will allow you to use a debugger to examine BusyBox internals
- while applets are running. This increases the size of the binary
+ while applets are running. This increases the size of the binary
considerably and should only be used when doing development.
If you are doing development and want to debug BusyBox, answer Y.
-p check-fence -p check-heap -p check-lists -p check-blank \
-p check-funcs -p realloc-copy -p allow-free-null
- This will make BusyBox be considerable larger and run slower, so
+ This will make BusyBox be considerable larger and run slower, so
you should leave this option disabled for production use.
config CONFIG_EFENCE
help
This enables compiling with Electric-fence support. Electric
fence is another very useful malloc debugging library which uses
- your computer's virtual memory hardware to detect illegal memory
- accesses. This support will make BusyBox be considerable larger
- and run slower, so you should leave this option disabled unless
+ your computer's virtual memory hardware to detect illegal memory
+ accesses. This support will make BusyBox be considerable larger
+ and run slower, so you should leave this option disabled unless
you are hunting a hard to find memory problem.
endmenu
default n
depends on CONFIG_LOGREAD
help
- 'logread' ouput to slow serial terminals can have
+ 'logread' ouput to slow serial terminals can have
side effects on syslog because of the semaphore.
- This option make logread to double buffer copy
- from circular buffer, minimizing semaphore
+ This option make logread to double buffer copy
+ from circular buffer, minimizing semaphore
contention at some minor memory expense.
config CONFIG_KLOGD
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
* Changes: Made this a standalone busybox module which uses standalone
* syslog() client interface.
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* Copyright (C) 2000 by Karl M. Hegbloom <karlheg@debian.org>
*
bb_show_usage();
}
console_log_level++;
-
+
break;
case 'n':
doFork = FALSE;
/*
* Mini logger implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
# endif
#endif
-/* Decode a symbolic name to a numeric value
+/* Decode a symbolic name to a numeric value
* this function is based on code
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
- *
+ *
* Original copyright notice is retained at the end of this file.
*/
static int decode(char *name, CODE * codetab)
return (-1);
}
-/* Decode a symbolic name to a numeric value
+/* Decode a symbolic name to a numeric value
* this function is based on code
* Copyright (c) 1983, 1993
* The Regents of the University of California. All rights reserved.
do {
/* read from stdin */
i = 0;
- while ((c = getc(stdin)) != EOF && c != '\n' &&
+ while ((c = getc(stdin)) != EOF && c != '\n' &&
i < (sizeof(buf)-1)) {
buf[i++] = c;
}
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
- * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
- * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
+ * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change
+ * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change>
*
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
*/
static inline void sem_up(int semid)
{
- if ( semop(semid, SMrup, 1) == -1 )
+ if ( semop(semid, SMrup, 1) == -1 )
error_exit("semop[SMrup]");
}
/*
* sem_down - down()'s a semaphore
- */
+ */
static inline void sem_down(int semid)
{
if ( semop(semid, SMrdn, 2) == -1 )
{
int i;
int follow=0;
-
+
if (argc == 2 && strcmp(argv[1],"-f")==0) {
follow = 1;
} else {
if (argc > 1)
bb_show_usage();
}
-
+
// handle intrrupt signal
if (setjmp(jmp_env)) goto output_end;
-
+
// attempt to redefine ^C signal
signal(SIGINT, interrupted);
-
+
if ( (log_shmid = shmget(KEY_ID, 0, 0)) == -1)
error_exit("Can't find circular buffer");
-
+
// Attach shared memory to our char*
if ( (buf = shmat(log_shmid, NULL, SHM_RDONLY)) == NULL)
error_exit("Can't get access to circular buffer from syslogd");
int log_len,j;
#endif
- sem_down(log_semid);
+ sem_down(log_semid);
//printf("head: %i tail: %i size: %i\n",buf->head,buf->tail,buf->size);
if (buf->head == buf->tail || i==buf->tail) {
printf("<empty syslog>\n");
}
}
-
- // Read Memory
+
+ // Read Memory
#ifdef CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING
log_len = buf->tail - i;
if (log_len < 0)
} while (follow);
output_end:
- if (log_shmid != -1)
+ if (log_shmid != -1)
shmdt(buf);
-
- return EXIT_SUCCESS;
+
+ return EXIT_SUCCESS;
}
static void interrupted(int sig){
static void error_exit(const char *str){
perror(str);
//release all acquired resources
- if (log_shmid != -1)
+ if (log_shmid != -1)
shmdt(buf);
exit(1);
/*
* Mini syslogd implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* Copyright (C) 2000 by Karl M. Hegbloom <karlheg@debian.org>
*
# flush out are those involving preprocessor instructions in
# utility.c.
#
-# TODO: some time it might be nice to list absolute and
+# TODO: some time it might be nice to list absolute and
# differential object sizes for each option...
#
# do extra setup (if any)
-if [ ! -z "$SETUP" ]
+if [ ! -z "$SETUP" ]
then
[ $DEBUG -ge 2 ] && echo "running setup commands in $SETUP"
source $SETUP
if [ $? -eq 1 ]
then
[ $DEBUG -ge 1 ] && echo "FAILED: $line" | tee -a $LOGFILE
- diff -u $CONFIG_OUT $GNU_OUT >> $LOGFILE
+ diff -u $CONFIG_OUT $GNU_OUT >> $LOGFILE
fi
fi
fi
# do extra cleanup (if any)
-if [ ! -z "$CLEANUP" ]
+if [ ! -z "$CLEANUP" ]
then
[ $DEBUG -ge 2 ] && echo "running cleanup commands in $CLEANUP"
source $CLEANUP
help
The fdisk utility is used to divide hard disks into one or more
logical disks, which are generally called partitions. This utility
- can be used to list and edit the set of partitions or BSD style
+ can be used to list and edit the set of partitions or BSD style
'disk slices' that are defined on a hard drive.
if !CONFIG_LFS
endif
config CONFIG_FEATURE_FDISK_WRITABLE
- bool " Write support"
+ bool " Write support"
default y
depends on CONFIG_FDISK
help
config CONFIG_FEATURE_AIX_LABEL
bool " Support AIX disklabels"
default n
- depends on CONFIG_FDISK && CONFIG_FEATURE_FDISK_WRITABLE
+ depends on CONFIG_FDISK && CONFIG_FEATURE_FDISK_WRITABLE
help
Enabling this option allows you to create or change AIX disklabels.
Most people can safely leave this option disabled.
config CONFIG_FEATURE_SUN_LABEL
bool " Support SUN disklabels"
default n
- depends on CONFIG_FDISK && CONFIG_FEATURE_FDISK_WRITABLE
+ depends on CONFIG_FDISK && CONFIG_FEATURE_FDISK_WRITABLE
help
Enabling this option allows you to create or change SUN disklabels.
Most people can safely leave this option disabled.
bool "rdate"
default n
help
- The rdate utility allows you to synchronize the date and time of your
+ The rdate utility allows you to synchronize the date and time of your
system clock with the date and time of a remote networked system using
the RFC868 protocol, which is built into the inetd daemon on most
systems.
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# Makefile for busybox
#
-# Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
* - added Native Language Support
*
- * from util-linux -- adapted for busybox by
- * Erik Andersen <andersen@codepoet.org>. I ripped out Native Language
+ * from util-linux -- adapted for busybox by
+ * Erik Andersen <andersen@codepoet.org>. I ripped out Native Language
* Support, replaced getopt, added some gotos for redundant stuff.
*
* Audited and cleaned up on 7 March 2003 to reduce size of
*
* This is a from-scratch implementation of fbset; but the de facto fbset
* implementation was a good reference. fbset (original) is released under
- * the GPL, and is (c) 1995-1999 by:
+ * the GPL, and is (c) 1995-1999 by:
* Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
*/
struct fb_bitfield {
uint32_t offset; /* beginning of bitfield */
uint32_t length; /* length of bitfield */
- uint32_t msb_right; /* != 0 : Most significant bit is */
- /* right */
+ uint32_t msb_right; /* != 0 : Most significant bit is */
+ /* right */
};
struct fb_var_screeninfo {
uint32_t xres; /* visible resolution */
struct fb_bitfield red; /* bitfield in fb mem if true color, */
struct fb_bitfield green; /* else only length is significant */
struct fb_bitfield blue;
- struct fb_bitfield transp; /* transparency */
+ struct fb_bitfield transp; /* transparency */
uint32_t nonstd; /* != 0 Non standard pixel format */
if ((p = strstr(buf, "geometry "))) {
p += 9;
- sscanf(p, "%d %d %d %d %d",
- &(base->xres), &(base->yres),
- &(base->xres_virtual), &(base->yres_virtual),
+ sscanf(p, "%d %d %d %d %d",
+ &(base->xres), &(base->yres),
+ &(base->xres_virtual), &(base->yres_virtual),
&(base->bits_per_pixel));
} else if ((p = strstr(buf, "timings "))) {
p += 8;
-
+
sscanf(p, "%d %d %d %d %d %d %d",
&(base->pixclock),
&(base->left_margin), &(base->right_margin),
base->sync |= FB_SYNC_EXT;
}
}
-
+
if (strstr(buf, "endmode"))
return 1;
}
#define BLKSSZGET _IO(0x12,104) /* get block device sector size */
/* Avoid conflicts with the 2.6 kernel headers, which define
- * _IOR rather differently */
+ * _IOR rather differently */
#undef _IOR
#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
#define BLKGETSIZE64 _IOR(0x12,114,uint64_t)
while (isdigit(*++line_ptr))
use_default = 0;
-
+
switch (*line_ptr) {
case 'c':
case 'C':
}
fd = bb_xopen(argv[1], O_RDWR);
-
+
result = ioctl(fd, BLKFLSBUF);
#ifdef CONFIG_FEATURE_CLEAN_UP
close(fd);
* 01.07.96 - Fixed the v2 fs stuff to use the right #defines and such
* for modern libcs (janl@math.uio.no, Nicolai Langfeldt)
*
- * 02.07.96 - Added C bit fiddling routines from rmk@ecs.soton.ac.uk
+ * 02.07.96 - Added C bit fiddling routines from rmk@ecs.soton.ac.uk
* (Russell King). He made them for ARM. It would seem
* that the ARM is powerful enough to do this in C whereas
* i386 and m64k must use assembly to get it fast >:-)
* (janl@math.uio.no, Nicolai Langfeldt)
*
* 04.11.96 - Added minor fixes from Andreas Schwab to avoid compiler
- * warnings. Added mc68k bitops from
+ * warnings. Added mc68k bitops from
* Joerg Dorchain <dorchain@mpi-sb.mpg.de>.
*
* 06.11.96 - Added v2 code submitted by Joerg Dorchain, but written by
* -f force filesystem check even if filesystem marked as valid
*
* The device may be a block device or a image of one, but this isn't
- * enforced (but it's not much fun on a character device :-).
+ * enforced (but it's not much fun on a character device :-).
*/
#include <stdio.h>
{
int i;
- if (name_list) {
+ if (name_list) {
for (i = 0; i < MAX_DEPTH; i++) {
free(name_list[i]);
}
/*
* Determine whether or not we should continue with the checking.
* This is based on the status of the filesystem valid and error
- * flags and whether or not the -f switch was specified on the
+ * flags and whether or not the -f switch was specified on the
* command line.
*/
printf("%s, %s\n", bb_applet_name, program_version);
int tm_yday;
int tm_isdst;
};
-
+
#define RTC_SET_TIME _IOW('p', 0x0a, struct linux_rtc_time) /* Set RTC time */
#define RTC_RD_TIME _IOR('p', 0x09, struct linux_rtc_time) /* Read RTC time */
if ( ioctl ( rtc, RTC_RD_TIME, &tm ) < 0 )
bb_perror_msg_and_die ( "Could not read time from RTC" );
tm. tm_isdst = -1; // not known
-
+
close ( rtc );
- if ( utc ) {
+ if ( utc ) {
oldtz = getenv ( "TZ" );
setenv ( "TZ", "UTC 0", 1 );
tzset ( );
}
-
+
t = mktime ( &tm );
-
+
if ( utc ) {
if ( oldtz )
setenv ( "TZ", oldtz, 1 );
if (( rtc = open ( "/dev/misc/rtc", O_WRONLY )) < 0 )
bb_perror_msg_and_die ( "Could not access RTC" );
}
-
+
tm = *( utc ? gmtime ( &t ) : localtime ( &t ));
tm. tm_isdst = 0;
-
+
if ( ioctl ( rtc, RTC_SET_TIME, &tm ) < 0 )
bb_perror_msg_and_die ( "Could not set the RTC time" );
-
+
close ( rtc );
}
time_t t;
char buffer [64];
- t = read_rtc ( utc );
+ t = read_rtc ( utc );
ptm = localtime ( &t ); /* Sets 'tzname[]' */
-
+
safe_strncpy ( buffer, ctime ( &t ), sizeof( buffer ));
if ( buffer [0] )
buffer [bb_strlen ( buffer ) - 1] = 0;
-
+
//printf ( "%s %.6f seconds %s\n", buffer, 0.0, utc ? "" : ( ptm-> tm_isdst ? tzname [1] : tzname [0] ));
printf ( "%s %.6f seconds\n", buffer, 0.0 );
-
+
return 0;
}
{
struct timeval tv = { 0, 0 };
const struct timezone tz = { timezone/60 - 60*daylight, 0 };
-
+
tv. tv_sec = read_rtc ( utc );
if ( settimeofday ( &tv, &tz ))
{
int utc = 0;
FILE *f = fopen ( "/var/lib/hwclock/adjtime", "r" );
-
+
if ( f ) {
char buffer [128];
-
+
while ( fgets ( buffer, sizeof( buffer ), f )) {
int len = bb_strlen ( buffer );
-
+
while ( len && isspace ( buffer [len - 1] ))
len--;
-
+
buffer [len] = 0;
-
+
if ( strncmp ( buffer, "UTC", 3 ) == 0 ) {
utc = 1;
break;
return from_sys_clock ( utc );
} else {
/* default HWCLOCK_OPT_SHOW */
- return show_clock ( utc );
+ return show_clock ( utc );
}
}
*
* 30.10.94 - added support for v2 filesystem
* (Andreas Schwab, schwab@issan.informatik.uni-dortmund.de)
- *
+ *
* 09.11.94 - Added test to prevent overwrite of mounted fs adapted
* from Theodore Ts'o's (tytso@athena.mit.edu) mke2fs
* program. (Daniel Quinlan, quinlan@yggdrasil.com)
* -v for v2 filesystem
*
* The device may be a block device or a image of one, but this isn't
- * enforced (but it's not much fun on a character device :-).
+ * enforced (but it's not much fun on a character device :-).
*
* Modified for BusyBox by Erik Andersen <andersen@debian.org> --
* removed getopt based parser and added a hand rolled one.
if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE)
bb_error_msg_and_die("bad inode size");
#endif
-
+
/* Parse options */
argv++;
while (--argc >= 0 && *argv && **argv) {
magic = MINIX_SUPER_MAGIC;
else if (i == 30)
magic = MINIX_SUPER_MAGIC2;
- else
+ else
bb_show_usage();
namelen = i;
dirsize = i + 2;
* Mini more implementation for busybox
*
* Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* Latest version blended together by Erik Andersen <andersen@codepoet.org>,
- * based on the original more implementation by Bruce, and code from the
+ * based on the original more implementation by Bruce, and code from the
* Debian boot-floppies team.
*
* Termios corrects by Vladimir Oleynik <dzo@simtreas.ru>
file = bb_wfopen(*argv, "r");
if(file==0)
goto loop;
-
+
st.st_size = 0;
fstat(fileno(file), &st);
goto end;
}
- /*
+ /*
* There are two input streams to worry about here:
*
* c : the character we are reading from the file being "mored"
* Mini mount implementation for busybox
*
* Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* 1999-10-07 Erik Andersen <andersen@codepoet.org>.
* Rewrite of a lot of code. Removed mtab usage (I plan on
- * putting it back as a compile-time option some time),
- * major adjustments to option parsing, and some serious
+ * putting it back as a compile-time option some time),
+ * major adjustments to option parsing, and some serious
* dieting all around.
*
* 1999-11-06 mtab suppport is back - andersee
* Rewrote fstab while loop and lower mount section. Can now do
* single mounts from fstab. Can override fstab options for single
* mount. Common mount_one call for single mounts and 'all'. Fixed
- * mtab updating and stale entries. Removed 'remount' default.
- *
+ * mtab updating and stale entries. Removed 'remount' default.
+ *
*/
#include <limits.h>
}
if (read_proc && !status) {
-
+
f = bb_xfopen("/proc/filesystems", "r");
while (fgets(buf, sizeof(buf), f) != NULL) {
*
* 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
* - added Native Language Support
- *
+ *
* Modified by Olaf Kirch and Trond Myklebust for new NFS code,
* plus NFSv3 stuff.
*/
NFSERR_BADTYPE = 10007, /* v3 */
NFSERR_JUKEBOX = 10008 /* v3 */
};
-
+
#define NFS_PROGRAM 100003
for (opt = strtok(old_opts, ","); opt; opt = strtok(NULL, ",")) {
if ((opteq = strchr(opt, '='))) {
- val = atoi(opteq + 1);
+ val = atoi(opteq + 1);
*opteq = '\0';
if (!strcmp(opt, "rsize"))
data.rsize = val;
val = 0;
opt += 2;
}
- if (!strcmp(opt, "bg"))
+ if (!strcmp(opt, "bg"))
bg = val;
- else if (!strcmp(opt, "fg"))
+ else if (!strcmp(opt, "fg"))
bg = !val;
else if (!strcmp(opt, "soft"))
soft = val;
if (fsock != -1)
close(fsock);
return retval;
-}
+}
/*
* We need to translate between nfs status return values and
*
* busyboxed by Evin Robertson
* pivot_root syscall stubbed by Erik Andersen, so it will compile
- * regardless of the kernel being used.
+ * regardless of the kernel being used.
*/
#include <stdlib.h>
#include <stdio.h>
/*
* Mini swapon/swapoff implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/*
* Mini umount implementation for busybox
*
- * Copyright (C) 1999-2003 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include <stdlib.h>
#include "busybox.h"
-/* Teach libc5 about realpath -- it includes it but the
+/* Teach libc5 about realpath -- it includes it but the
* prototype is missing... */
#if (__GLIBC__ <= 2) && (__GLIBC_MINOR__ < 1)
extern char *realpath(const char *path, char *resolved_path);
return mtab_next(iter);
}
-/* Don't bother to clean up, since exit() does that
+/* Don't bother to clean up, since exit() does that
* automagically, so we can save a few bytes */
#ifdef CONFIG_FEATURE_CLEAN_UP
static void mtab_free(void)