xref: /dflybsd-src/usr.bin/window/char.c (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino /*	@(#)char.c	8.1 (Berkeley) 6/6/93	*/
286d7f5d3SJohn Marino /*	$NetBSD: char.c,v 1.6 2009/04/14 08:50:06 lukem Exp $	*/
386d7f5d3SJohn Marino 
486d7f5d3SJohn Marino /*
586d7f5d3SJohn Marino  * Copyright (c) 1983, 1993
686d7f5d3SJohn Marino  *	The Regents of the University of California.  All rights reserved.
786d7f5d3SJohn Marino  *
886d7f5d3SJohn Marino  * This code is derived from software contributed to Berkeley by
986d7f5d3SJohn Marino  * Edward Wang at The University of California, Berkeley.
1086d7f5d3SJohn Marino  *
1186d7f5d3SJohn Marino  * Redistribution and use in source and binary forms, with or without
1286d7f5d3SJohn Marino  * modification, are permitted provided that the following conditions
1386d7f5d3SJohn Marino  * are met:
1486d7f5d3SJohn Marino  * 1. Redistributions of source code must retain the above copyright
1586d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer.
1686d7f5d3SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
1786d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer in the
1886d7f5d3SJohn Marino  *    documentation and/or other materials provided with the distribution.
1986d7f5d3SJohn Marino  * 3. Neither the name of the University nor the names of its contributors
2086d7f5d3SJohn Marino  *    may be used to endorse or promote products derived from this software
2186d7f5d3SJohn Marino  *    without specific prior written permission.
2286d7f5d3SJohn Marino  *
2386d7f5d3SJohn Marino  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2486d7f5d3SJohn Marino  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2586d7f5d3SJohn Marino  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2686d7f5d3SJohn Marino  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2786d7f5d3SJohn Marino  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2886d7f5d3SJohn Marino  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2986d7f5d3SJohn Marino  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3086d7f5d3SJohn Marino  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3186d7f5d3SJohn Marino  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3286d7f5d3SJohn Marino  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3386d7f5d3SJohn Marino  * SUCH DAMAGE.
3486d7f5d3SJohn Marino  */
3586d7f5d3SJohn Marino 
3686d7f5d3SJohn Marino #include "char.h"
3786d7f5d3SJohn Marino 
3886d7f5d3SJohn Marino char _cmap[] = {
3986d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,	/* ^@ - ^C */
4086d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,	/* ^D - ^G */
4186d7f5d3SJohn Marino 	_C,		_C|_P,		_C,		_C|_U,	/* ^H - ^K */
4286d7f5d3SJohn Marino 	_C|_U,		_C,		_C|_U,		_C|_U,	/* ^L - ^O */
4386d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,	/* ^P - ^S */
4486d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,	/* ^T - ^W */
4586d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,	/* ^U - ^[ */
4686d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,	/* ^\ - ^_ */
4786d7f5d3SJohn Marino 
4886d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
4986d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
5086d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
5186d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
5286d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
5386d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
5486d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
5586d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
5686d7f5d3SJohn Marino 
5786d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
5886d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
5986d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
6086d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
6186d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
6286d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
6386d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
6486d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
6586d7f5d3SJohn Marino 
6686d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
6786d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
6886d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
6986d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
7086d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
7186d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
7286d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_P|_U,
7386d7f5d3SJohn Marino 	_P|_U,		_P|_U,		_P|_U,		_C|_U,
7486d7f5d3SJohn Marino 
7586d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
7686d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
7786d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
7886d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
7986d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
8086d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
8186d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
8286d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
8386d7f5d3SJohn Marino 
8486d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
8586d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
8686d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
8786d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
8886d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
8986d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
9086d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
9186d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
9286d7f5d3SJohn Marino 
9386d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
9486d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
9586d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
9686d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
9786d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
9886d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
9986d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
10086d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
10186d7f5d3SJohn Marino 
10286d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
10386d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
10486d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
10586d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
10686d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
10786d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
10886d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U,
10986d7f5d3SJohn Marino 	_C|_U,		_C|_U,		_C|_U,		_C|_U
11086d7f5d3SJohn Marino };
11186d7f5d3SJohn Marino 
11286d7f5d3SJohn Marino const char *_unctrl[] = {
11386d7f5d3SJohn Marino 	"^@",	"^A",	"^B",	"^C",	"^D",	"^E",	"^F",	"^G",
11486d7f5d3SJohn Marino 	"^H",	"^I",	"^J",	"^K",	"^L",	"^M",	"^N",	"^O",
11586d7f5d3SJohn Marino 	"^P",	"^Q",	"^R",	"^S",	"^T",	"^U",	"^V",	"^W",
11686d7f5d3SJohn Marino 	"^X",	"^Y",	"^Z",	"^[",	"^\\",	"^]",	"^^",	"^_",
11786d7f5d3SJohn Marino 	" ",	"!",	"\"",	"#",	"$",	"%",	"&",	"'",
11886d7f5d3SJohn Marino 	"(",	")",	"*",	"+",	",",	"-",	".",	"/",
11986d7f5d3SJohn Marino 	"0",	"1",	"2",	"3",	"4",	"5",	"6",	"7",
12086d7f5d3SJohn Marino 	"8",	"9",	":",	";",	"<",	"=",	">",	"?",
12186d7f5d3SJohn Marino 	"@",	"A",	"B",	"C",	"D",	"E",	"F",	"G",
12286d7f5d3SJohn Marino 	"H",	"I",	"J",	"K",	"L",	"M",	"N",	"O",
12386d7f5d3SJohn Marino 	"P",	"Q",	"R",	"S",	"T",	"U",	"V",	"W",
12486d7f5d3SJohn Marino 	"X",	"Y",	"Z",	"[",	"\\",	"]",	"^",	"_",
12586d7f5d3SJohn Marino 	"`",	"a",	"b",	"c",	"d",	"e",	"f",	"g",
12686d7f5d3SJohn Marino 	"h",	"i",	"j",	"k",	"l",	"m",	"n",	"o",
12786d7f5d3SJohn Marino 	"p",	"q",	"r",	"s",	"t",	"u",	"v",	"w",
12886d7f5d3SJohn Marino 	"x",	"y",	"z",	"{",	"|",	"}",	"~",	"^?",
12986d7f5d3SJohn Marino 	"\\200","\\201","\\202","\\203","\\204","\\205","\\206","\\207",
13086d7f5d3SJohn Marino 	"\\210","\\211","\\212","\\213","\\214","\\215","\\216","\\217",
13186d7f5d3SJohn Marino 	"\\220","\\221","\\222","\\223","\\224","\\225","\\226","\\227",
13286d7f5d3SJohn Marino 	"\\230","\\231","\\232","\\233","\\234","\\235","\\236","\\237",
13386d7f5d3SJohn Marino 	"\\240","\\241","\\242","\\243","\\244","\\245","\\246","\\247",
13486d7f5d3SJohn Marino 	"\\250","\\251","\\252","\\253","\\254","\\255","\\256","\\257",
13586d7f5d3SJohn Marino 	"\\260","\\261","\\262","\\263","\\264","\\265","\\266","\\267",
13686d7f5d3SJohn Marino 	"\\270","\\271","\\272","\\273","\\274","\\275","\\276","\\277",
13786d7f5d3SJohn Marino 	"\\300","\\301","\\302","\\303","\\304","\\305","\\306","\\307",
13886d7f5d3SJohn Marino 	"\\310","\\311","\\312","\\313","\\314","\\315","\\316","\\317",
13986d7f5d3SJohn Marino 	"\\320","\\321","\\322","\\323","\\324","\\325","\\326","\\327",
14086d7f5d3SJohn Marino 	"\\330","\\331","\\332","\\333","\\334","\\335","\\336","\\337",
14186d7f5d3SJohn Marino 	"\\340","\\341","\\342","\\343","\\344","\\345","\\346","\\347",
14286d7f5d3SJohn Marino 	"\\350","\\351","\\352","\\353","\\354","\\355","\\356","\\357",
14386d7f5d3SJohn Marino 	"\\360","\\361","\\362","\\363","\\364","\\365","\\366","\\367",
14486d7f5d3SJohn Marino 	"\\370","\\371","\\372","\\373","\\374","\\375","\\376","\\377"
14586d7f5d3SJohn Marino };
146