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
This commit is contained in:
Denis Vlasenko 2007-08-06 03:41:08 +00:00
parent e013475830
commit 8274e06677
5 changed files with 20 additions and 10 deletions

View File

@ -836,6 +836,14 @@ static void puts_maybe_newline(char *s, FILE *file, char *last_puts_char, char l
#define sed_puts(s, n) (puts_maybe_newline(s, G.nonstdout, &last_puts_char, n)) #define sed_puts(s, n) (puts_maybe_newline(s, G.nonstdout, &last_puts_char, n))
static int beg_match(sed_cmd_t *sed_cmd, const char *pattern_space)
{
int retval = sed_cmd->beg_match && !regexec(sed_cmd->beg_match, pattern_space, 0, NULL, 0);
if (retval)
G.previous_regex_ptr = sed_cmd->beg_match;
return retval;
}
/* Process all the lines in all the files */ /* Process all the lines in all the files */
static void process_files(void) static void process_files(void)
@ -880,8 +888,7 @@ restart:
/* Or did we match the start of a numerical range? */ /* Or did we match the start of a numerical range? */
|| (sed_cmd->beg_line > 0 && (sed_cmd->beg_line == linenum)) || (sed_cmd->beg_line > 0 && (sed_cmd->beg_line == linenum))
/* Or does this line match our begin address regex? */ /* Or does this line match our begin address regex? */
|| (sed_cmd->beg_match && || (beg_match(sed_cmd, pattern_space))
!regexec(sed_cmd->beg_match, pattern_space, 0, NULL, 0))
/* Or did we match last line of input? */ /* Or did we match last line of input? */
|| (sed_cmd->beg_line == -1 && next_line == NULL); || (sed_cmd->beg_line == -1 && next_line == NULL);

View File

@ -217,8 +217,8 @@ USE_LS(APPLET_NOEXEC(ls, ls, _BB_DIR_BIN, _BB_SUID_NEVER, ls))
USE_LSATTR(APPLET(lsattr, _BB_DIR_BIN, _BB_SUID_NEVER)) USE_LSATTR(APPLET(lsattr, _BB_DIR_BIN, _BB_SUID_NEVER))
USE_LSMOD(APPLET(lsmod, _BB_DIR_SBIN, _BB_SUID_NEVER)) USE_LSMOD(APPLET(lsmod, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_UNLZMA(APPLET_ODDNAME(lzmacat, unlzma, _BB_DIR_USR_BIN, _BB_SUID_NEVER, lzmacat)) USE_UNLZMA(APPLET_ODDNAME(lzmacat, unlzma, _BB_DIR_USR_BIN, _BB_SUID_NEVER, lzmacat))
USE_MATCHPATHCON(APPLET(matchpathcon, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_MAKEDEVS(APPLET(makedevs, _BB_DIR_SBIN, _BB_SUID_NEVER)) USE_MAKEDEVS(APPLET(makedevs, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MATCHPATHCON(APPLET(matchpathcon, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
USE_MD5SUM(APPLET_ODDNAME(md5sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, md5sum)) USE_MD5SUM(APPLET_ODDNAME(md5sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, md5sum))
USE_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_NEVER)) USE_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_NEVER))
USE_MESG(APPLET(mesg, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) USE_MESG(APPLET(mesg, _BB_DIR_USR_BIN, _BB_SUID_NEVER))

View File

@ -25,8 +25,9 @@ try "-Wl,--start-group $l_list -Wl,--end-group" "$@" \
# Hack: we are not supposed to know executable name, # Hack: we are not supposed to know executable name,
# but this hack cuts down link time # but this hack cuts down link time
mv busybox_unstripped busybox_unstripped.tmp mv busybox_unstripped busybox_unstripped.tmp
mv busybox.map busybox.map.tmp
# Now try to remove each lib and build without. # Now try to remove each lib and build without it.
# Stop when no lib can be removed. # Stop when no lib can be removed.
ever_discarded=false ever_discarded=false
while test "$BBOX_LIB_LIST"; do while test "$BBOX_LIB_LIST"; do
@ -47,17 +48,19 @@ while test "$BBOX_LIB_LIST"; do
done done
# All libs were needed, can't remove any # All libs were needed, can't remove any
$all_needed && break $all_needed && break
# If there is no space, the list has just one lib. # If there is no space char, the list has just one lib.
# I'm not sure that in this case lib really is 100% needed. # I'm not sure that in this case lib really is 100% needed.
# Let's try linking without it anyway... thus commented out. # Let's try linking without it anyway... thus commented out.
#echo "$BBOX_LIB_LIST" | grep -q ' ' || break #{ echo "$BBOX_LIB_LIST" | grep -q ' '; } || break
done done
mv busybox_unstripped.tmp busybox_unstripped mv busybox_unstripped.tmp busybox_unstripped
mv busybox.map.tmp busybox.map
$ever_discarded && { $ever_discarded && {
# Ok, make the binary # Make the binary with final, minimal list of libs
echo "Final link with: $BBOX_LIB_LIST" echo "Final link with: $BBOX_LIB_LIST"
l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/'` l_list=`echo "$BBOX_LIB_LIST" | sed -e 's/ / -l/g' -e 's/^/-l/'`
try "-Wl,--start-group $l_list -Wl,--end-group" "$@" try "-Wl,--start-group $l_list -Wl,--end-group" "$@" && exit 1
} }
rm busybox_ld.err
exit 0 # Ensure "success" exit code exit 0 # Ensure "success" exit code

View File

@ -19,7 +19,7 @@
# verify the applet order is correct in applets.h, otherwise # verify the applet order is correct in applets.h, otherwise
# applets won't be called properly. # applets won't be called properly.
# #
sed -n -e '/^USE_[A-Z]*(APPLET(/{s:.*(::;s:,.*::;s:"::g;p}' \ sed -n -e '/^USE_[A-Z]*(APPLET/{s:,.*::;s:.*(::;s:"::g;p}' \
$srcdir/../include/applets.h > applet.order.current $srcdir/../include/applets.h > applet.order.current
LC_ALL=C sort applet.order.current > applet.order.correct LC_ALL=C sort applet.order.current > applet.order.correct
testing "Applet order" "diff -u applet.order.current applet.order.correct" "" "" "" testing "Applet order" "diff -u applet.order.current applet.order.correct" "" "" ""

View File

@ -76,7 +76,7 @@ testing()
echo -ne "$5" | eval "$2" > actual echo -ne "$5" | eval "$2" > actual
RETVAL=$? RETVAL=$?
cmp expected actual > /dev/null cmp expected actual >/dev/null 2>/dev/null
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
FAILCOUNT=$[$FAILCOUNT+1] FAILCOUNT=$[$FAILCOUNT+1]