File: Merge_dimPCBPS

package info (click to toggle)
pcb 20060822-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 11,260 kB
  • ctags: 6,230
  • sloc: ansic: 62,222; sh: 4,062; pascal: 3,569; yacc: 1,097; makefile: 792; lex: 348; perl: 299; awk: 158; tcl: 63
file content (51 lines) | stat: -rwxr-xr-x 943 bytes parent folder | download | duplicates (3)
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
50
51
#!/bin/sh
#
# $Id: Merge_dimPCBPS,v 1.2 2004/02/09 04:06:30 danmc Exp $
#
# 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";
	}
' $@