void-packages/srcpkgs/foomatic-db-engine/patches/patch-foomatic-getpjloptions.in.diff
Đoàn Trần Công Danh be5369a0cb srcpkgs/f*: convert patches to -Np1
* fpc is kept at -Np0

```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

33 lines
1 KiB
Diff

--- a/foomatic-getpjloptions.in 2015-02-14 07:21:56.000000000 -0500
+++ b/foomatic-getpjloptions.in 2015-02-15 07:36:23.000000000 -0500
@@ -1,3 +1,3 @@
-#!@SH@
+#!/bin/sh
#
# Polls PJL options from local or network printers
@@ -23,6 +23,5 @@
NC=@NC@
CAT=@CAT@
-PRINTF=@PRINTF@
-PERL=@PERL@
+PRINTF=printf # sh builtin
usage(){
@@ -63,12 +62,13 @@
- # We have two arguments, do ethernet printer request
+ # We have two arguments, do network printer request
# Poll the printer's answer and filter out the newpage characters
+ # as well as the carriage-returns (\r or, in octal, 015)
- ${NC} -w 3 ${1} ${2} 2>/dev/null | ${PERL} -p -e "s/\014//"
+ $NC -w 3 $1 $2 2>/dev/null | tr -d "\015\014"
else
# We have one argument, do local printer request
# Send commands to printer port
- ${CAT} > ${1}
+ $CAT > $1
# Wait ten seconds for the printer to process the request
sleep 10
# Poll the printer's answer and filter out the newpage and CR characters
- ${CAT} < ${1} | ${PERL} -p -e "s/[\015\014]//"
+ exec tr -d "\015\014" < $1
fi