OpenSolaris_b135/cmd/terminfo/cvt.ex

" #ident	"@(#)terminfo:cvt.ex	1.2"
"
" CDDL HEADER START
"
" The contents of this file are subject to the terms of the
" Common Development and Distribution License, Version 1.0 only
" (the "License").  You may not use this file except in compliance
" with the License.
"
" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
" or http://www.opensolaris.org/os/licensing.
" See the License for the specific language governing permissions
" and limitations under the License.
"
" When distributing Covered Code, include this CDDL HEADER in each
" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
" If applicable, add the following below this CDDL HEADER, with the
" fields enclosed by brackets "[]" replaced with your own identifying
" information: Portions Copyright [yyyy] [name of copyright owner]
"
" CDDL HEADER END
"
" Defend against files with spaces instead of tabs
g/^  *:/s/^ */	/
" Clean out all junk lines, making them into comments.
v/^[#	A-Za-z]/s/^/# /
g/^[	A-Za-z].*[^\\:]$/s/^/# /
" Get rid of capabilities on the first line.
g/^[a-zA-Z].|.*:.*:/s/:/:\\\
	/
" Change colons to commas, with appropriate white space
v/^#/s/,/\\054/g
v/^#/s/:/, /g
v/^#/s/^	, /	/
v/^#/s/, \\$/,/
" Get rid of two letter codes
g/^[a-zA-Z].|/s///|s/$/HEADER/
" Change names of capabilities - this list to be updated from caps
v/^#/s/\<mi\>/mir/g
v/^#/s/\<ms\>/msgr/g
v/^#/s/\<pt\>/ht=^I/g
v/^#/s/\<xb\>/xsb/g
v/^#/s/\<xn\>/xenl/g
v/^#/s/\<xo\>/xon/g
v/^#/s/\<xs\>/xhp/g
v/^#/s/\<co\>/cols/g
v/^#/s/\<li\>/lines/g
v/^#/s/\<sg\>/xmc/g
v/^#/s/\<AL\>/il/g
v/^#/s/\<CC\>/CC/g
v/^#/s/\<DL\>/dl/g
v/^#/s/\<DO\>/cud/g
v/^#/s/\<LE\>/cub/g
v/^#/s/\<RI\>/cuf/g
v/^#/s/\<UP\>/cuu/g
v/^#/s/\<ae\>/smacs/g
v/^#/s/\<al\>/il1/g
v/^#/s/\<as\>/rmacs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^	]/-!fmt
g/HEADER/s///
g/\<nc\>,/s///|?cr=^M, ?s///
g/\<ns\>,/s///|?ind=^J, ?s///
" Still should do something about the cr=, nl=, tab= capabilities.
" Change parameterized strings
v/^#/s/%\./%p1%c/
v/^#/s/%\./%p2%c/
v/^#/s/%\./%p1%c/
v/^#/s/%\./%p2%c/
v/^#/s/%d/%p1%DECIMAL/
v/^#/s/%d/%p2%DECIMAL/
v/^#/s/%d/%p1%DECIMAL/
v/^#/s/%d/%p2%DECIMAL/
v/^#/s/DECIMAL/d/g
v/^#/s/%+\([^%]\)/%p1%'\1'%+%c/
v/^#/s/%+\([^%]\)/%p2%'\1'%+%c/
v/^#/s/%+\([^%]\)/%p1%'\1'%+%c/
v/^#/s/%+\([^%]\)/%p2%'\1'%+%c/
$g/^# junk$/d
w
q