This commit is contained in:
hyung-hwan 2008-03-21 22:17:04 +00:00
parent b52f039c69
commit ba21ec2208
4 changed files with 34 additions and 42 deletions

View File

@ -1,13 +1,17 @@
BEGIN { FS = "\t"; }
{ pop[$4] += $3; }
END {
# specifying a postion with + notation seems obsolete for sort
# on most platforms.
# sort -t'\t' +1rn => sort -t'\t' -k2 -rn
for (c in pop)
printf ("%15s\t%6d\n", c, pop[c]) | "sort -t'\t' +1rn";
printf ("%15s\t%6d\n", c, pop[c]) | "sort -t'\t' -k2 -rn";
# the following two statements make the program behave
# consistently across different platforms.
# on some platforms, the sort command output has
# been delayed until the program exits.
close ("sort -t'\t' +1rn");
close ("sort -t'\t' -k2 -rn");
sleep (1);
}

View File

@ -8,8 +8,8 @@ BEGIN {
END {
for (c in pop)
printf ("%15s %6d\n",c,pop[c]) | "sort -t' ' +1rn";
close ("sort -t' ' +1rn");
printf ("%15s %6d\n",c,pop[c]) | "sort -t' ' -k2 -rn";
close ("sort -t' ' -k2 -rn");
sleep (1);
}
Asia 2173

View File

@ -128,73 +128,57 @@ run_test()
for script in simple-???.awk
do
run_script_for_test_nodata "$script"
if [ $? -ne 0 ]
then
[ $? -ne 0 ] && {
echo "###################################"
echo "PROBLEM(S) DETECTED IN $script.".
echo "###################################"
echo "Do you want to abort? [y/n]"
read ans
if [ "$ans" = "y" -o "$ans" = "Y" ]
then
return 1
fi
fi
[ "$ans" = "y" -o "$ans" = "Y" ] && return 1
}
done
for script in main-???.awk
do
run_script_for_test_main "$script"
if [ $? -ne 0 ]
then
[ $? -ne 0 ] && {
echo "###################################"
echo "PROBLEM(S) DETECTED IN $script.".
echo "###################################"
echo "Do you want to abort? [y/n]"
read ans
if [ "$ans" = "y" -o "$ans" = "Y" ]
then
return 1
fi
fi
[ "$ans" = "y" -o "$ans" = "Y" ] && return 1
}
done
for script in emp-???.awk
do
run_script_for_test "$script" "emp-en.data"
if [ $? -ne 0 ]
then
[ $? -ne 0 ] && {
echo "###################################"
echo "PROBLEM(S) DETECTED IN $script.".
echo "###################################"
echo "Do you want to abort? [y/n]"
read ans
if [ "$ans" = "y" -o "$ans" = "Y" ]
then
return 1
fi
fi
[ "$ans" = "y" -o "$ans" = "Y" ] && return 1
}
done
for script in cou-???.awk
do
run_script_for_test "$script" "cou-en.data"
if [ $? -ne 0 ]
then
[ $? -ne 0 ] && {
echo "###################################"
echo "PROBLEM(S) DETECTED IN $script.".
echo "###################################"
echo "Do you want to abort? [y/n]"
read ans
if [ "$ans" = "y" -o "$ans" = "Y" ]
then
return 1
fi
fi
[ "$ans" = "y" -o "$ans" = "Y" ] && return 1
}
done
for script in adr-???.awk
@ -236,6 +220,12 @@ run_test()
return 0
}
print_usage()
{
echo "Usage: $0 init"
echo " $0 test"
}
#--------#
# main #
#--------#
@ -254,12 +244,10 @@ else
exit 1;
fi
if [ $# -ne 1 ]
then
echo "Usage: $0 init"
echo " $0 test"
[ $# -ne 1 ] && {
print_usage "$0"
exit 1
fi
}
if [ "$1" = "init" ]
then
@ -268,8 +256,8 @@ elif [ "$1" = "test" ]
then
run_test
else
echo "Usage: $0 init"
echo " $0 test"
print_usage "$0"
exit 1
fi
exit 0

View File

@ -3,14 +3,14 @@
#
LIBDIRS = cmn utl awk lsp cmd/awk cmd/lsp
BLDDIRS = cmn utl awk lsp cmd/awk cmd/lsp
MODE = @BUILDMODE@
LIBTOOL_DEPS = @LIBTOOL_DEPS@
all: build
build:
@for i in $(LIBDIRS); \
@for i in $(BLDDIRS); \
do \
if [ ! -d $$i ]; \
then \
@ -28,7 +28,7 @@ build:
done
clean:
@for i in $(LIBDIRS); \
@for i in $(BLDDIRS); \
do \
if [ ! -d $$i ]; \
then \