aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-06-06 01:53:38 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-06-06 01:53:38 +0200
commitf0f94700610eba964441ce4a112134e03c76eb89 (patch)
tree2823e4cd344df7f85f0cd94dc87f1133d05fcc19
parent6c5bf0d347faded028e15d523c26a0d64c6d3920 (diff)
downloadbusybox-w32-f0f94700610eba964441ce4a112134e03c76eb89.tar.gz
busybox-w32-f0f94700610eba964441ce4a112134e03c76eb89.tar.bz2
busybox-w32-f0f94700610eba964441ce4a112134e03c76eb89.zip
make it possible to keep usage texts in .c files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--Makefile.custom2
-rw-r--r--archival/bbunzip.c11
-rw-r--r--include/usage.src.h (renamed from include/usage.h)15
-rw-r--r--scripts/Makefile.IMA2
-rwxr-xr-xscripts/gen_build_files.sh26
5 files changed, 40 insertions, 16 deletions
diff --git a/Makefile.custom b/Makefile.custom
index fa69dcebb..01d69ddf8 100644
--- a/Makefile.custom
+++ b/Makefile.custom
@@ -118,7 +118,7 @@ disp_doc = $($(quiet)cmd_doc)
118# sed adds newlines after "Options:" etc, 118# sed adds newlines after "Options:" etc,
119# this is needed in order to get good BusyBox.{1,txt,html} 119# this is needed in order to get good BusyBox.{1,txt,html}
120docs/busybox.pod: $(srctree)/docs/busybox_header.pod \ 120docs/busybox.pod: $(srctree)/docs/busybox_header.pod \
121 $(srctree)/include/usage.h \ 121 include/usage.h \
122 $(srctree)/docs/busybox_footer.pod \ 122 $(srctree)/docs/busybox_footer.pod \
123 applets/usage_pod 123 applets/usage_pod
124 $(disp_doc) 124 $(disp_doc)
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index ce6223514..b243afb2e 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -304,6 +304,17 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv)
304 * 304 *
305 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 305 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
306 */ 306 */
307//usage:#define bunzip2_trivial_usage
308//usage: "[OPTIONS] [FILE]..."
309//usage:#define bunzip2_full_usage "\n\n"
310//usage: "Decompress FILEs (or stdin)\n"
311//usage: "\nOptions:"
312//usage: "\n -c Write to stdout"
313//usage: "\n -f Force"
314//usage:#define bzcat_trivial_usage
315//usage: "FILE"
316//usage:#define bzcat_full_usage "\n\n"
317//usage: "Decompress to stdout"
307//applet:IF_BUNZIP2(APPLET(bunzip2, _BB_DIR_USR_BIN, _BB_SUID_DROP)) 318//applet:IF_BUNZIP2(APPLET(bunzip2, _BB_DIR_USR_BIN, _BB_SUID_DROP))
308//applet:IF_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, _BB_DIR_USR_BIN, _BB_SUID_DROP, bzcat)) 319//applet:IF_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, _BB_DIR_USR_BIN, _BB_SUID_DROP, bzcat))
309#if ENABLE_BUNZIP2 320#if ENABLE_BUNZIP2
diff --git a/include/usage.h b/include/usage.src.h
index a9c4c4294..78c0a0f1c 100644
--- a/include/usage.h
+++ b/include/usage.src.h
@@ -15,6 +15,8 @@
15 15
16#define NOUSAGE_STR "\b" 16#define NOUSAGE_STR "\b"
17 17
18INSERT
19
18#define acpid_trivial_usage \ 20#define acpid_trivial_usage \
19 "[-d] [-c CONFDIR] [-l LOGFILE] [-e PROC_EVENT_FILE] [EVDEV_EVENT_FILE]..." 21 "[-d] [-c CONFDIR] [-l LOGFILE] [-e PROC_EVENT_FILE] [EVDEV_EVENT_FILE]..."
20#define acpid_full_usage "\n\n" \ 22#define acpid_full_usage "\n\n" \
@@ -234,19 +236,6 @@
234 "\n -v Verbose" \ 236 "\n -v Verbose" \
235 "\n -F Don't store or verify checksum" \ 237 "\n -F Don't store or verify checksum" \
236 238
237#define bunzip2_trivial_usage \
238 "[OPTIONS] [FILE]..."
239#define bunzip2_full_usage "\n\n" \
240 "Decompress FILEs (or stdin)\n" \
241 "\nOptions:" \
242 "\n -c Write to stdout" \
243 "\n -f Force" \
244
245#define bzcat_trivial_usage \
246 "FILE"
247#define bzcat_full_usage "\n\n" \
248 "Decompress to stdout"
249
250#define unlzma_trivial_usage \ 239#define unlzma_trivial_usage \
251 "[OPTIONS] [FILE]..." 240 "[OPTIONS] [FILE]..."
252#define unlzma_full_usage "\n\n" \ 241#define unlzma_full_usage "\n\n" \
diff --git a/scripts/Makefile.IMA b/scripts/Makefile.IMA
index bddd70229..11ae39eae 100644
--- a/scripts/Makefile.IMA
+++ b/scripts/Makefile.IMA
@@ -200,7 +200,7 @@ applets/usage: include/autoconf.h
200applets/applet_tables: include/autoconf.h 200applets/applet_tables: include/autoconf.h
201 $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/applet_tables applets/applet_tables.c 201 $(HOSTCC) -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -I$(srctree)/include -o applets/applet_tables applets/applet_tables.c
202 202
203include/usage_compressed.h: $(srctree)/include/usage.h applets/usage 203include/usage_compressed.h: include/usage.h applets/usage
204 $(srctree)/applets/usage_compressed include/usage_compressed.h applets 204 $(srctree)/applets/usage_compressed include/usage_compressed.h applets
205 205
206include/applet_tables.h: include/applets.h 206include/applet_tables.h: include/applets.h
diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh
index 44e8c1744..647c7daf7 100755
--- a/scripts/gen_build_files.sh
+++ b/scripts/gen_build_files.sh
@@ -10,7 +10,7 @@ srctree="$1"
10# (Re)generate include/applets.h 10# (Re)generate include/applets.h
11src="$srctree/include/applets.src.h" 11src="$srctree/include/applets.src.h"
12dst="include/applets.h" 12dst="include/applets.h"
13s=`sed -n 's@^//applet:@@p' -- */*.c */*/*.c` 13s=`sed -n 's@^//applet:@@p' -- "$srctree"/*/*.c "$srctree"/*/*/*.c`
14echo "/* DO NOT EDIT. This file is generated from applets.src.h */" >"$dst.$$.tmp" 14echo "/* DO NOT EDIT. This file is generated from applets.src.h */" >"$dst.$$.tmp"
15# Why "IFS='' read -r REPLY"?? 15# Why "IFS='' read -r REPLY"??
16# This atrocity is needed to read lines without mangling. 16# This atrocity is needed to read lines without mangling.
@@ -27,6 +27,30 @@ else
27 mv -- "$dst.$$.tmp" "$dst" 27 mv -- "$dst.$$.tmp" "$dst"
28fi 28fi
29 29
30# (Re)generate include/usage.h
31src="$srctree/include/usage.src.h"
32dst="include/usage.h"
33# We add line continuation backslash after each line,
34# and insert empty line before each line which doesn't start
35# with space or tab
36# (note: we need to use \\\\ because of ``)
37s=`sed -n -e 's@^//usage:\([ \t].*\)$@\1 \\\\@p' -e 's@^//usage:\([^ \t].*\)$@\n\1 \\\\@p' -- "$srctree"/*/*.c "$srctree"/*/*/*.c`
38echo "/* DO NOT EDIT. This file is generated from usage.src.h */" >"$dst.$$.tmp"
39# Why "IFS='' read -r REPLY"??
40# This atrocity is needed to read lines without mangling.
41# IFS='' prevents whitespace trimming,
42# -r suppresses backslash handling.
43while IFS='' read -r REPLY; do
44 test x"$REPLY" = x"INSERT" && REPLY="$s"
45 printf "%s\n" "$REPLY"
46done <"$src" >>"$dst.$$.tmp"
47if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
48 rm -- "$dst.$$.tmp"
49else
50 echo " GEN $dst"
51 mv -- "$dst.$$.tmp" "$dst"
52fi
53
30# (Re)generate */Kbuild and */Config.in 54# (Re)generate */Kbuild and */Config.in
31find -type d | while read -r d; do 55find -type d | while read -r d; do
32 d="${d#./}" 56 d="${d#./}"