diff options
Diffstat (limited to 'src/image_data/png_to_c_header.sh')
-rwxr-xr-x | src/image_data/png_to_c_header.sh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/image_data/png_to_c_header.sh b/src/image_data/png_to_c_header.sh index 65f7c26..75837c8 100755 --- a/src/image_data/png_to_c_header.sh +++ b/src/image_data/png_to_c_header.sh @@ -20,6 +20,8 @@ ## errors/warnings are tied to the right line ## number. +set -e + ## ## Make sure we were given a png file. @@ -79,7 +81,8 @@ TMP_CODE="$0.code.c" echo "Generating conversion code '$TMP_CODE' ..." -let L="`wc -l < $0` - 3" # Skip the first three lines! +L=`wc -l < $0` +L=`expr $L - 3` # Skip the first three lines! echo "#include \"$INC_HEADER\"" > $TMP_CODE echo "" >> $TMP_CODE echo "/""**" >> $TMP_CODE @@ -135,7 +138,8 @@ REGEXP="s/^ \(.*\/\* pixel_data.*\)/ ${NAME}_pixel_data \/\* pixel_data \*\//" # gdk-pixbuf-csource adds 2 extra empty lines so get rid of one of them. L=`wc -l < $TMP_HEADER` -let L="$L - `tail -n 2 $TMP_HEADER | grep '^[ \t]*$' | wc -l`" +M=`tail -n 2 $TMP_HEADER | grep '^[ \t]*$' | wc -l` +L=`expr $L - $M` head -n $L $TMP_HEADER | \ sed -n '/^ \"/ !p' | \ |