File: MergePCBPS

package info (click to toggle)
pcb 20091103-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 21,568 kB
  • ctags: 13,286
  • sloc: ansic: 112,778; sh: 6,245; yacc: 5,035; pascal: 4,086; makefile: 1,425; perl: 560; lex: 432; awk: 158; tcl: 63; xml: 20
file content (49 lines) | stat: -rwxr-xr-x 739 bytes parent folder | download | duplicates (2)
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
#
# $Id$
#
# 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++; }
	/^%!PS/,/^% PCBENDDATA/				{
		if (filecount == 1)
		{
			if (index($0, "%%Title:") == 1)
				sub(",.*$", ", merged layouts");
			print $0;
			next;
		}
	}
	/^% PCBSTARTDATA/,/^% PCBENDDATA/	{
		if (filecount > 1)
		{
			print $0;
			next;
		}
	}
										{ next; }
	END									{
		print "showpage";
		print "%%EOF";
	}
' $@