fix-amd-map.in revision 174295
1219820Sjeff#!@PERL@ 2219820Sjeff# 3219820Sjeff# fix an old-syntax amd map to new one 4219820Sjeff# 5219820Sjeff# takes any number of files on the command line, and produces 6219820Sjeff# a fixed map on stdout. 7219820Sjeff# 8219820Sjeff# Package: am-utils-6.x 9219820Sjeff# Author: Erez Zadok <ezk@cs.columbia.edu> 10219820Sjeff# 11219820Sjeff 12219820Sjeff############################################################################## 13219820Sjeff### MAINTAINER EDITABLE SECTION 14219820Sjeff 15219820Sjeff# Mappings of old names to new ones: 16219820Sjeff# Update when needed, do not forget commas but not on the last entry! 17219820Sjeff# For your convenience, this is the complete list of all OSs that were 18219820Sjeff# supported by amd-upl102, in their old names: 19219820Sjeff# 20219820Sjeff# 386bsd acis43 aix3 aoi aux bsd43 bsd44 bsdi11 21219820Sjeff# concentrix dgux fpx4 freebsd hcx hlh42 hpux irix3 irix4 irix5 isc3 22219820Sjeff# linux mach2 mach3 netbsd news4 next osf1 pyrOSx riscix riscos 23219820Sjeff# rtu6 sos3 sos4 sos5 stellix svr4 u2_2 u3_0 u4_0 u4_2 u4_3 u4_4 24219820Sjeff# umax43 utek utx32 xinu43 25219820Sjeff# 26219820Sjeff%mappings = ( 27219820Sjeff "sos4", "sunos4", 28219820Sjeff "sos5", "sunos5", 29219820Sjeff "freebsd", "freebsd2" 30219820Sjeff); 31219820Sjeff 32219820Sjeff############################################################################## 33219820Sjeff### DO NOT EDIT ANYTHING BELOW 34219820Sjeff 35219820Sjeff# This is a trivial parser and works as follows: 36219820Sjeff# (1) read each line 37219820Sjeff# (2) search of regexps that start with '=', continue with a word to replace 38219820Sjeff# and end with a non-value name (whitespace, ';', or newline 39219820Sjeffwhile (<>) { 40219820Sjeff # skip trivial lines 41219820Sjeff if ($_ =~ /^$/ || $_ =~ /^#/) { 42219820Sjeff print; 43219820Sjeff next; 44219820Sjeff } 45219820Sjeff # modify the line if needed 46219820Sjeff foreach $m (keys %mappings) { 47219820Sjeff $val = $mappings{$m}; 48219820Sjeff $_ =~ s/=$m([^a-zA-Z0-9_])/=$val$1/g; 49219820Sjeff } 50219820Sjeff # print the (possibly) modified line 51219820Sjeff print; 52219820Sjeff} 53219820Sjeff