diff options
author | Tim Dickson <dickson.tim@googlemail.com> | 2020-10-01 19:47:40 +0100 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2020-10-03 09:01:42 +0700 |
commit | 8adbacc0058d79d26ddf417d277a5756f5cb74a7 (patch) | |
tree | ebb84c72edb9d99b5ff0c03530dc20524fb393b4 /system/epson-printer-utility/fixrm | |
parent | 880f42641e0a11b722405037900da73fa1baa8db (diff) | |
download | slackbuilds-8adbacc0058d79d26ddf417d277a5756f5cb74a7.tar.gz |
system/epson-printer-utility: Added (epson printer monitor+tools)
Signed-off-by: Dave Woodfall <dave@slackbuilds.org>
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/epson-printer-utility/fixrm')
-rw-r--r-- | system/epson-printer-utility/fixrm | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/system/epson-printer-utility/fixrm b/system/epson-printer-utility/fixrm new file mode 100644 index 0000000000..ffc0942dd7 --- /dev/null +++ b/system/epson-printer-utility/fixrm @@ -0,0 +1,29 @@ +#!/bin/sh +#fixrm is a little script to limit the items on each line so the line +#is less than 72 characters. it is used by the maintainer when creating +#the README.models file for this package, and for the epson-inkjet-printer-escpr2 +#slackbuild. It takes the list posted on a single long first line, and spreads +#them over as many lines as needed. +# +#paste the list from the epson website into an empty README.models and run this +#script in the same directory + +FNAME="README.models" +MAXLEN=${MAXLEN:-72} +#make sure MAXLEN is a integer bigger than 39 +MAXLEN=`echo $MAXLEN|awk '($1<40) {print "40"} (int($1)>39) {print int($1) }'` +if [ -e $FNAME ]&&[ `cat $FNAME|head -n1|awk '{print length($0)}'` -gt $MAXLEN ]; then + #only do something if the file exists, and thefirst line is longer than it + #should be. + TMPFILE=rmtmp + mv README.models $TMPFILE + cat $TMPFILE|awk -v mlen="$MAXLEN" -F', ' 'BEGIN{curline="";mlen=mlen-2} +{ for (i=1;i<=NF; i++) + { { n=0; l=length(curline)+length($i) } + if (l<mlen) { curline=curline ", " $i; n=1} + if (n==0) {print curline; curline=$i } + } + if (length(curline)>0) {print curline} +}'>README.models + rm $TMPFILE +fi |