changeset 91:82c94684f799

working with one input
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Wed, 14 Apr 2021 10:08:41 +0000
parents 5384208a0834
children d56465d5c51f
files bin/ix.sh
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/bin/ix.sh	Wed Apr 14 08:57:43 2021 +0000
+++ b/bin/ix.sh	Wed Apr 14 10:08:41 2021 +0000
@@ -38,6 +38,7 @@
 { s="w"
 if [ -n "$p" ]
 then
+   shopt -qs extglob # for %%*(...)
    while read -r L
    do
      if [ "$s" = "w" ]
@@ -46,6 +47,10 @@
 	 if [ "$L" = "
" ]
 	 then
 	     s="h"
+	     if [[ -n "$w" && ( -n "$h" || -n "$b" ) ]]
+	     then
+		 echo
+	     fi	 
 	     continue
 	 fi
 	 if [ -n "$w" ]
@@ -58,7 +63,12 @@
      then
 	 # HTTP header
 	 case "$L" in
-	     
) s="b" ; n=0 ; continue ;;
+	     
) s="b" ; n=0
+		 if [ -n "$h" -a -n "$b" ]
+		 then
+		     echo
+		 fi	 
+                 continue ;;
 	     Content-Length:\ *) bl=${L##*: }
 		                 bl=${bl%%*([
[:space:]])}
 				 ;;
@@ -72,7 +82,7 @@
 	 # HTTP body
 	 if [ -n "$b" ]
 	 then
-	     printf "%s\n" "$bl" 1>&2
+	     #printf "%s\n" "$bl" 1>&2
 	     head -c "$bl"
 	 else
 	     break