From 0294edc8f4fea7d05c07579a15b04e0c5a2ba4bf Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Tue, 7 Feb 2017 16:04:38 +0000 Subject: [PATCH] Examples: bufr_copy_data --- examples/C/bufr_copy_data.c | 2 +- examples/C/bufr_copy_data.sh | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/examples/C/bufr_copy_data.c b/examples/C/bufr_copy_data.c index dd2139397..d81cc56b2 100644 --- a/examples/C/bufr_copy_data.c +++ b/examples/C/bufr_copy_data.c @@ -98,7 +98,7 @@ int main(int argc, char *argv[]) printf("Copied %s\n",keys[i]); free(keys[i]); } - printf("Copied a total of %ld keys\n", nkeys); + printf("Total number of copied keys = %ld\n", nkeys); free(keys); codes_handle_delete(h); diff --git a/examples/C/bufr_copy_data.sh b/examples/C/bufr_copy_data.sh index c9dc2f7ab..d1100c0e6 100755 --- a/examples/C/bufr_copy_data.sh +++ b/examples/C/bufr_copy_data.sh @@ -12,11 +12,12 @@ #Define a common label for all the tmp files label="bufr_copy_data_c" -TEMP=$label.out.bufr +TEMP_BUFR=$label.out.bufr +TEMP_TEXT=$label.out.txt REF=$label.compare.log.ref MYLOG=$label.compare.log -rm -f ${TEMP} ${REF} ${MYLOG} +rm -f ${TEMP_BUFR} ${TEMP_TEXT} ${REF} ${MYLOG} cat > ${REF} < ${REF} < ${TEMP_TEXT} + +num_copied_keys=`grep -c '^Copied' ${TEMP_TEXT}` +[ $num_copied_keys -eq 58 ] # The input and output BUFR messages should be different set +e -${tools_dir}/bufr_compare ${TEMP} ${INPUT} > ${MYLOG} +${tools_dir}/bufr_compare ${TEMP_BUFR} ${INPUT} > ${MYLOG} status=$? set -e [ $status -eq 1 ] diff ${MYLOG} ${REF} -rm -f ${TEMP} ${REF} ${MYLOG} +rm -f ${TEMP_BUFR} ${REF} ${MYLOG} ${TEMP_TEXT}