Align shell style all over the repo

This commit is contained in:
Lucas 2020-05-03 14:47:27 +00:00
parent afb13d9c9c
commit d5e71c46f7
16 changed files with 113 additions and 86 deletions

View file

@ -1,6 +1,6 @@
#!/bin/sh
# imgresize
# Written in 2019 by Lucas
# Written in 2019-2020 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
@ -29,13 +29,12 @@ err()
check_dimension_format()
{
printf "%s\n" "$1" | grep -q "^[0-9]*x[0-9]*\$" \
&& [ "$1" != "x" ]
printf "%s\n" "$1" | grep -q "^[0-9]*x[0-9]*\$" && [ "$1" != "x" ]
}
[ $# -eq 3 ] && check_dimension_format "$1" || usage
[ -n "$2" ] || err "Input file name can't be empty."
[ -n "$3" ] || err "Output file name can't be empty."
[ -n "$2" ] || err "input file name can't be empty"
[ -n "$3" ] || err "output file name can't be empty"
size=$1
w=${size%x*}
@ -50,7 +49,7 @@ case $infile in
;;
*.png) inprog=pngtopam
;;
*) err "Unknown input format."
*) err "unknown input format"
;;
esac
@ -61,10 +60,10 @@ case $outfile in
;;
*.png) outprog=pamtopng
;;
*) err "Unknown output format."
*) err "unknown output format"
;;
esac
"$inprog" <"$infile" \
| pamscale ${w:+-width "$w"} ${h:+-height "$h"} \
| "$outprog" >"$outfile"
$inprog <"$infile" |
pamscale ${w:+-width "$w"} ${h:+-height "$h"} |
$outprog >"$outfile"