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"; } BEGIN { FS = "\t"; }
{ pop[$4] += $3; } { pop[$4] += $3; }
END { 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) 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 # the following two statements make the program behave
# consistently across different platforms. # consistently across different platforms.
# on some platforms, the sort command output has # on some platforms, the sort command output has
# been delayed until the program exits. # been delayed until the program exits.
close ("sort -t'\t' +1rn"); close ("sort -t'\t' -k2 -rn");
sleep (1); sleep (1);
} }

View File

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

View File

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