summaryrefslogtreecommitdiffstats
path: root/contrib/amd/scripts/fix-amd-map.in
blob: 9bbc9b6a21bc8a09a0d21e5e2fc3b7f149209f3e (plain)
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
52
#!@PERL@
#
# fix an old-syntax amd map to new one
#
# takes any number of files on the command line, and produces
# a fixed map on stdout.
#
# Package:	am-utils-6.x
# Author:	Erez Zadok <ezk@cs.columbia.edu>
#

##############################################################################
### MAINTAINER EDITABLE SECTION

# Mappings of old names to new ones:
# Update when needed, do not forget commas but not on the last entry!
# For your convenience, this is the complete list of all OSs that were
# supported by amd-upl102, in their old names:
#
#	386bsd acis43 aix3 aoi aux bsd43 bsd44 bsdi11
#	concentrix dgux fpx4 freebsd hcx hlh42 hpux irix3 irix4 irix5 isc3
#	linux mach2 mach3 netbsd news4 next osf1 pyrOSx riscix riscos
#	rtu6 sos3 sos4 sos5 stellix svr4 u2_2 u3_0 u4_0 u4_2 u4_3 u4_4
#	umax43 utek utx32 xinu43
#
%mappings = (
	"sos4",		"sunos4",
	"sos5",		"sunos5",
	"freebsd",	"freebsd2"
);

##############################################################################
### DO NOT EDIT ANYTHING BELOW

# This is a trivial parser and works as follows:
# (1) read each line
# (2) search of regexps that start with '=', continue with a word to replace
#     and end with a non-value name (whitespace, ';', or newline
while (<>) {
    # skip trivial lines
    if ($_ =~ /^$/  ||  $_ =~ /^#/) {
	print;
	next;
    }
    # modify the line if needed
    foreach $m (keys %mappings) {
	$val = $mappings{$m};
	$_ =~ s/=$m([^a-zA-Z0-9_])/=$val$1/g;
    }
    # print the (possibly) modified line
    print;
}
OpenPOWER on IntegriCloud