Plan 9 from Bell Labs’s /usr/web/sources/plan9/sys/src/cmd/abaco/charsets.awk

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/awk -f
# makes a table of character sets from http://www.iana.org/assignments/character-sets
# and tcs.txt

BEGIN{
	if(ARGC != 3){
		print "Usage:  " ARGV[0] " charsets.txt  tcs.txt"
		exit 1
	}
	while(getline<ARGV[1]){
		if(/^Name:/){
			i = 0
			name=tolower($2)
			names[name] = name
			alias[name i] = name
			nalias[name] = ++i
			
		}
		if(/^Alias:/){
			a = tolower($2)
			if(a != "none"){
				names[a] = name
				alias[name i ] = a
				nalias[name] = ++i
			}
		}
	}
}
{
	tcs = $1
	if(tcs in names){
		name = names[tcs]
		for(i=0; i<nalias[name]; i++)
			print "\"" alias[name i] "\", \"" $2 "\","
	}
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].