aboutsummaryrefslogtreecommitdiff
path: root/system/epson-inkjet-printer-escpr2/fixrm
diff options
context:
space:
mode:
authorTim Dickson <dickson.tim@googlemail.com>2020-10-01 18:36:27 +0100
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2020-10-03 09:01:42 +0700
commit98ca1b63d480d8da6c98a22d046546f8118b8067 (patch)
treed4d58d0441c3d65c3178449fcd60f246171ee51f /system/epson-inkjet-printer-escpr2/fixrm
parentbde4c2f2336c475ab7f5e4364814e7218214961b (diff)
downloadslackbuilds-98ca1b63d480d8da6c98a22d046546f8118b8067.tar.xz
system/epson-inkjet-printer-escpr2: Updated for version 1.1.20.
Signed-off-by: Dave Woodfall <dave@slackbuilds.org> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/epson-inkjet-printer-escpr2/fixrm')
-rw-r--r--system/epson-inkjet-printer-escpr2/fixrm29
1 files changed, 29 insertions, 0 deletions
diff --git a/system/epson-inkjet-printer-escpr2/fixrm b/system/epson-inkjet-printer-escpr2/fixrm
new file mode 100644
index 000000000000..ffc0942dd775
--- /dev/null
+++ b/system/epson-inkjet-printer-escpr2/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