Merge branch 'vendor/GREP'
[dragonfly.git] / contrib / amd / scripts / fix-amd-map.in
1 #!@PERL@
2 #
3 # fix an old-syntax amd map to new one
4 #
5 # takes any number of files on the command line, and produces
6 # a fixed map on stdout.
7 #
8 # Package:      am-utils-6.0
9 # Author:       Erez Zadok <ezk@cs.columbia.edu>
10 #
11
12 ##############################################################################
13 ### MAINTAINER EDITABLE SECTION
14
15 # Mappings of old names to new ones:
16 # Update when needed, do not forget commas but not on the last entry!
17 # For your convenience, this is the complete list of all OSs that were
18 # supported by amd-upl102, in their old names:
19 #
20 #       386bsd acis43 aix3 aoi aux bsd43 bsd44 bsdi11
21 #       concentrix dgux fpx4 freebsd hcx hlh42 hpux irix3 irix4 irix5 isc3
22 #       linux mach2 mach3 netbsd news4 next osf1 pyrOSx riscix riscos
23 #       rtu6 sos3 sos4 sos5 stellix svr4 u2_2 u3_0 u4_0 u4_2 u4_3 u4_4
24 #       umax43 utek utx32 xinu43
25 #
26 %mappings = (
27         "sos4",         "sunos4",
28         "sos5",         "sunos5",
29         "freebsd",      "freebsd2"
30 );
31
32 ##############################################################################
33 ### DO NOT EDIT ANYTHING BELOW
34
35 # This is a trivial parser and works as follows:
36 # (1) read each line
37 # (2) search of regexps that start with '=', continue with a word to replace
38 #     and end with a non-value name (whitespace, ';', or newline
39 while (<>) {
40     # skip trivial lines
41     if ($_ =~ /^$/  ||  $_ =~ /^#/) {
42         print;
43         next;
44     }
45     # modify the line if needed
46     foreach $m (keys %mappings) {
47         $val = $mappings{$m};
48         $_ =~ s/=$m([^a-zA-Z0-9_])/=$val$1/g;
49     }
50     # print the (possibly) modified line
51     print;
52 }