File: Merge_dimPCBPS

package info (click to toggle)
pcb 20140316-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 22,212 kB
  • ctags: 16,012
  • sloc: ansic: 123,955; sh: 7,306; yacc: 5,087; pascal: 4,118; makefile: 1,559; perl: 552; lex: 438; awk: 157; lisp: 86; tcl: 63; xml: 20
file content (49 lines) | stat: -rwxr-xr-x 881 bytes parent folder | download | duplicates (4)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
#
# merges PostScript files created by pcb (version >= 1.4.2) into
# a single file for backward compatibility
#
# Usage: name files...
#
# by Thomas Nau 9/96
#

if [ $# -eq 0 ]; then
	echo "Usage: `basename $0` files..." >&2
	exit 1
fi

# some system need nawk
#
case `uname` in
	SunOS)	AWK=nawk;;
	*)		AWK=awk;;
esac

$AWK '
	BEGIN								{ filecount = 0; }
	/^%!PS/								{ filecount++;  if (filecount > 1) { print "Black"; } }
	/^%!PS/,/^% PCBENDDATA/				{
		if (filecount == 1)
		{
			if (index($0, "%%Title:") == 1)
				sub(",.*$", ", merged layouts");
                        if (index($0, "Black") == 1)
                           sub ("Black", "0.9 mysetgray");
			print $0;
			next;
		}
	}
	/^% PCBSTARTDATA/,/^% PCBENDDATA/	{
		if (filecount > 1)
		{
			print $0;
			next;
		}
	}
										{ next; }
	END									{
		print "showpage";
		print "%%EOF";
	}
' $@