From ba21ec2208f31eca1cd9fe08dd5cd4c74846ee36 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 21 Mar 2008 22:17:04 +0000 Subject: [PATCH] --- ase/cmd/awk/cou-027.awk | 8 ++++-- ase/cmd/awk/cou-027.out | 4 +-- ase/cmd/awk/regress.sh | 58 ++++++++++++++++------------------------- ase/makefile.in | 6 ++--- 4 files changed, 34 insertions(+), 42 deletions(-) diff --git a/ase/cmd/awk/cou-027.awk b/ase/cmd/awk/cou-027.awk index a3ec5f31..0ea93ce5 100644 --- a/ase/cmd/awk/cou-027.awk +++ b/ase/cmd/awk/cou-027.awk @@ -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); } diff --git a/ase/cmd/awk/cou-027.out b/ase/cmd/awk/cou-027.out index d0d57165..a2242899 100644 --- a/ase/cmd/awk/cou-027.out +++ b/ase/cmd/awk/cou-027.out @@ -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 diff --git a/ase/cmd/awk/regress.sh b/ase/cmd/awk/regress.sh index 89e88869..accfc423 100755 --- a/ase/cmd/awk/regress.sh +++ b/ase/cmd/awk/regress.sh @@ -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 diff --git a/ase/makefile.in b/ase/makefile.in index 2b38ffa3..12d42f86 100644 --- a/ase/makefile.in +++ b/ase/makefile.in @@ -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 \