From 6198803c454b61a0d975e12c33ddc70636ea48aa Mon Sep 17 00:00:00 2001 From: Tom Scavo Date: Sun, 30 Oct 2016 18:55:24 -0400 Subject: [PATCH] Edit inline comments --- bin/http_xsltproc.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bin/http_xsltproc.sh b/bin/http_xsltproc.sh index 091b6f9..cdef938 100755 --- a/bin/http_xsltproc.sh +++ b/bin/http_xsltproc.sh @@ -24,7 +24,7 @@ display_help () { /bin/cat <<- HELP_MSG This script is a wrapper around the xsltproc command-line tool. Like xsltproc, this script applies an XSL stylesheet to an XML - document and outputs the resulting transformation on stdout. + document and outputs the resulting transformed document on stdout. Unlike xsltproc, this script fetches the target XML document from an HTTP server. @@ -57,11 +57,13 @@ display_help () { option -F or -C, which are mutually exclusive. Force Output Mode (option -F) forces the return of a fresh resource. The resource is output on stdout if and only if the server - responds with 200. If the response is 304, an error is thrown. + responds with 200. If the response is 304, the script silently + fails with exit code 1. Cache Only Mode (option -C) bypasses the GET request altogether and goes directly to cache. If the resource resides in cache, - it is output on stdout, otherwise an error is thrown. + it is output on stdout, otherwise the script silently fails + with exit code 1. Option -o specifies an output file in the local file system. If option -o is omitted, the transformed document is written @@ -178,7 +180,6 @@ if [ -z "$CACHE_DIR" ]; then exit 2 fi if [ ! -d "$CACHE_DIR" ]; then - # think carefully about this... /bin/mkdir "$CACHE_DIR" exit_code=$? if [ $exit_code -ne 0 ]; then @@ -231,6 +232,7 @@ else TMP_DIR="${tmp_dir%%/}/${script_name%%.*}" $verbose_mode && printf "$script_name creating temp dir: %s\n" "$TMP_DIR" fi +# create a subdirectory if [ ! -d "$TMP_DIR" ]; then /bin/mkdir "$TMP_DIR" exit_code=$? @@ -271,6 +273,7 @@ if [ $exit_code -ne 0 ]; then fi $verbose_mode && printf "$script_name successfully executed xsltproc\n" +# output the transformed document if [ -z "$out_file" ]; then /bin/cat "$xsltproc_out_file" exit_code=$?