File: grab-ppd.awk

package info (click to toggle)
printfilters-ppd 2.13-11.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, wheezy
  • size: 872 kB
  • ctags: 8
  • sloc: sh: 4,191; makefile: 94; perl: 54; awk: 14; ansic: 6
file content (25 lines) | stat: -rwxr-xr-x 491 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/awk -f

# set up field and record separators to bring up printcap entries split
# appropriately
BEGIN {
	FS = ":\\\\[^:graph:]+:";
	RS = "[^\\\\]\n";
	gar="sd=" spool "[:\\n]";
};

# There's a better way to do this, but it works.

# blank?  all comment?  Ditch it
/^[^:graph:]*[#$]/ { next }


# find the printer whose spooldir was specified and print the ppdfile to stdout
$0 ~ gar {
	for(i=1; i<=NF; i++) {
		if($i ~ /^ppdfile=/) {
			split($i, a, "=");
			print a[2];
		}
	}
}