aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-08-06 03:41:08 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-08-06 03:41:08 +0000
commit8274e06677ba55532a4e1488b659f0b1e743130e (patch)
treeaf0a5bec322c6f2dc3214ea6a57997455cc35876
parente013475830b2399e31f5e17758dd6674b6b60058 (diff)
downloadbusybox-w32-8274e06677ba55532a4e1488b659f0b1e743130e.tar.gz
busybox-w32-8274e06677ba55532a4e1488b659f0b1e743130e.tar.bz2
busybox-w32-8274e06677ba55532a4e1488b659f0b1e743130e.zip
sed: fix 'q' command handling ("Nguyen Thai Ngoc Duy" <pclouds@gmail.com>)
add testsuite entry for it. Fix applet order checker. Fix cmp yelling. trylink: fix error file and map file generation applets: fix applet order
-rw-r--r--editors/sed.c11
-rw-r--r--include/applets.h2
-rwxr-xr-xscripts/trylink13
-rwxr-xr-xtestsuite/all_sourcecode.tests2
-rwxr-xr-xtestsuite/testing.sh2
5 files changed, 20 insertions, 10 deletions
diff --git a/editors/sed.c b/editors/sed.c
index d0c2ca742..4647079aa 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -836,6 +836,14 @@ static void puts_maybe_newline(char *s, FILE *file, char *last_puts_char, char l
836 836
837#define sed_puts(s, n) (puts_maybe_newline(s, G.nonstdout, &last_puts_char, n)) 837#define sed_puts(s, n) (puts_maybe_newline(s, G.nonstdout, &last_puts_char, n))
838 838
839static int beg_match(sed_cmd_t *sed_cmd, const char *pattern_space)
840{
841 int retval = sed_cmd->beg_match && !regexec(sed_cmd->beg_match, pattern_space, 0, NULL, 0);
842 if (retval)
843 G.previous_regex_ptr = sed_cmd->beg_match;
844 return retval;
845}
846
839/* Process all the lines in all the files */ 847/* Process all the lines in all the files */
840 848
841static void process_files(void) 849static void process_files(void)
@@ -880,8 +888,7 @@ restart:
880 /* Or did we match the start of a numerical range? */ 888 /* Or did we match the start of a numerical range? */
881 || (sed_cmd->beg_line > 0 && (sed_cmd->beg_line == linenum)) 889 || (sed_cmd->beg_line > 0 && (sed_cmd->beg_line == linenum))
882 /* Or does this line match our begin address regex? */ 890 /* Or does this line match our begin address regex? */
883 || (sed_cmd->beg_match && 891 || (beg_match(sed_cmd, pattern_space))
884 !regexec(sed_cmd->beg_match, pattern_space, 0, NULL, 0))
885 /* Or did we match last line of input? */ 892 /* Or did we match last line of input? */
886 || (sed_cmd->beg_line == -1 && next_line == NULL); 893 || (sed_cmd->beg_line == -1 && next_line == NULL);
887 894
diff --git a/include/applets.h b/include/applets.h
index 7eefa0843..b5b9fc884 100644
--- a/include/applets.h
+++ b/include/applets.h
@@ -217,8 +217,8 @@ USE_LS(APPLET_NOEXEC(ls, ls, _BB_DIR_BIN, _BB_SUID_NEVER, ls))
217USE_LSATTR(APPLET(lsattr, _BB_DIR_BIN, _BB_SUID_NEVER)) 217USE_LSATTR(APPLET(lsattr, _BB_DIR_BIN, _BB_SUID_NEVER))
218USE_LSMOD(APPLET(lsmod, _BB_DIR_SBIN, _BB_SUID_NEVER)) 218USE_LSMOD(APPLET(lsmod, _BB_DIR_SBIN, _BB_SUID_NEVER))
219USE_UNLZMA(APPLET_ODDNAME(lzmacat, unlzma, _BB_DIR_USR_BIN, _BB_SUID_NEVER, lzmacat)) 219USE_UNLZMA(APPLET_ODDNAME(lzmacat, unlzma, _BB_DIR_USR_BIN, _BB_SUID_NEVER, lzmacat))
220USE_MATCHPATHCON(APPLET(matchpathcon, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
221USE_MAKEDEVS(APPLET(makedevs, _BB_DIR_SBIN, _BB_SUID_NEVER)) 220USE_MAKEDEVS(APPLET(makedevs, _BB_DIR_SBIN, _BB_SUID_NEVER))
221USE_MATCHPATHCON(APPLET(matchpathcon, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
222USE_MD5SUM(APPLET_ODDNAME(md5sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, md5sum)) 222USE_MD5SUM(APPLET_ODDNAME(md5sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, md5sum))
223USE_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_NEVER)) 223USE_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_NEVER))
224USE_MESG(APPLET(mesg, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) 224USE_MESG(APPLET(mesg, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
diff --git a/scripts/trylink b/scripts/trylink
index bfc67bf5d..b8bf8b1c7 100755
--- a/scripts/trylink
+++ b/scripts/trylink
@@ -25,8 +25,9 @@ try "-Wl,--start-group $l_list -Wl,--end-group" "$@" \
25# Hack: we are not supposed to know executable name, 25# Hack: we are not supposed to know executable name,
26# but this hack cuts down link time 26# but this hack cuts down link time
27mv busybox_unstripped busybox_unstripped.tmp 27mv busybox_unstripped busybox_unstripped.tmp
28mv busybox.map busybox.map.tmp
28 29
29# Now try to remove each lib and build without. 30# Now try to remove each lib and build without it.
30# Stop when no lib can be removed. 31# Stop when no lib can be removed.
31ever_discarded=false 32ever_discarded=false
32while test "$BBOX_LIB_LIST"; do 33while test "$BBOX_LIB_LIST"; do
@@ -47,17 +48,19 @@ while test "$BBOX_LIB_LIST"; do
47 done 48 done
48 # All libs were needed, can't remove any 49 # All libs were needed, can't remove any
49 $all_needed && break 50 $all_needed && break
50 # If there is no space, the list has just one lib. 51 # If there is no space char, the list has just one lib.
51 # I'm not sure that in this case lib really is 100% needed. 52 # I'm not sure that in this case lib really is 100% needed.
52 # Let's try linking without it anyway... thus commented out. 53 # Let's try linking without it anyway... thus commented out.
53 #echo "$BBOX_LIB_LIST" | grep -q ' ' || break 54 #{ echo "$BBOX_LIB_LIST" | grep -q ' '; } || break
54done 55done
55 56
56mv busybox_unstripped.tmp busybox_unstripped 57mv busybox_unstripped.tmp busybox_unstripped
58mv busybox.map.tmp busybox.map
57$ever_discarded && { 59$ever_discarded && {
58 # Ok, make the binary 60 # Make the binary with final, minimal list of libs
59 echo "Final link with: $BBOX_LIB_LIST" 61 echo "Final link with: $BBOX_LIB_LIST"
60 l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/'` 62 l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/'`
61 try "-Wl,--start-group $l_list -Wl,--end-group" "$@" 63 try "-Wl,--start-group $l_list -Wl,--end-group" "$@" && exit 1
62} 64}
65rm busybox_ld.err
63exit 0 # Ensure "success" exit code 66exit 0 # Ensure "success" exit code
diff --git a/testsuite/all_sourcecode.tests b/testsuite/all_sourcecode.tests
index c115878fe..a537dcee9 100755
--- a/testsuite/all_sourcecode.tests
+++ b/testsuite/all_sourcecode.tests
@@ -19,7 +19,7 @@
19# verify the applet order is correct in applets.h, otherwise 19# verify the applet order is correct in applets.h, otherwise
20# applets won't be called properly. 20# applets won't be called properly.
21# 21#
22sed -n -e '/^USE_[A-Z]*(APPLET(/{s:.*(::;s:,.*::;s:"::g;p}' \ 22sed -n -e '/^USE_[A-Z]*(APPLET/{s:,.*::;s:.*(::;s:"::g;p}' \
23 $srcdir/../include/applets.h > applet.order.current 23 $srcdir/../include/applets.h > applet.order.current
24LC_ALL=C sort applet.order.current > applet.order.correct 24LC_ALL=C sort applet.order.current > applet.order.correct
25testing "Applet order" "diff -u applet.order.current applet.order.correct" "" "" "" 25testing "Applet order" "diff -u applet.order.current applet.order.correct" "" "" ""
diff --git a/testsuite/testing.sh b/testsuite/testing.sh
index 01fdfbeca..a886a76eb 100755
--- a/testsuite/testing.sh
+++ b/testsuite/testing.sh
@@ -76,7 +76,7 @@ testing()
76 echo -ne "$5" | eval "$2" > actual 76 echo -ne "$5" | eval "$2" > actual
77 RETVAL=$? 77 RETVAL=$?
78 78
79 cmp expected actual > /dev/null 79 cmp expected actual >/dev/null 2>/dev/null
80 if [ $? -ne 0 ] 80 if [ $? -ne 0 ]
81 then 81 then
82 FAILCOUNT=$[$FAILCOUNT+1] 82 FAILCOUNT=$[$FAILCOUNT+1]