diff options
author | epoch <epoch@hacking.allowed.org> | 2019-04-22 23:33:47 -0500 |
---|---|---|
committer | epoch <epoch@hacking.allowed.org> | 2019-04-22 23:33:47 -0500 |
commit | 97c0e839fea71df6caefca601fdc34469fd7b2b5 (patch) | |
tree | 0b1cb807fbcb28d723d725182812c8d75508fc03 /uriprintf | |
parent | 25c40a3f4c5447fc2224b1707b44a99b46515151 (diff) | |
download | uritools-97c0e839fea71df6caefca601fdc34469fd7b2b5.tar.gz uritools-97c0e839fea71df6caefca601fdc34469fd7b2b5.zip |
urlprintf got an extra sanity check
Diffstat (limited to 'uriprintf')
-rwxr-xr-x | uriprintf | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1,5 +1,9 @@ #!/bin/sh cutargs="$(printf "%s\n" "$1" | sed 's/%[^sukdPpqfU]//g' | tr '%' '\n' | tail -n+2 | sed 's/^\(.\).*/-\1/g' | tr '\n' ' ')" count="$(echo $cutargs | tr '-' '\n' | grep -c .)" -printfargs="$(printf "%s\n" "$1" | sed 's/%[sukdPpqfU]/%s/g')" -uricut "$cutargs" | tr '\n' '\0' | xargs -n $count -0 printf "$printfargs" +if [ "$count" = 0 ];then + printf "%s\n" "$1" +else + printfargs="$(printf "%s\n" "$1" | sed 's/%[sukdPpqfU]/%s/g')" + urlcut "$cutargs" | tr '\n' '\0' | xargs -n $count -0 printf "$printfargs" +fi |