CTRL(x) macro (was: Re: What is a constant expression)

Maarten Litmaath maart at cs.vu.nl
Wed Oct 25 06:55:25 AEST 1989


davidsen at crdos1.crd.ge.COM (Wm E Davidsen Jr) writes:
\In article <3786 at solo6.cs.vu.nl>, maart at cs.vu.nl (Maarten Litmaath) writes:
\|  
\|  	#define CTRL(x) ((x) ^ 0100)
\|  
\|  ...so you can say
\|  
\|  	CTRL('?')
\|  
\|  to get DEL.
\
\  You should use another name, perhaps, since many people assume that
\CTRL returns control characters. They are defined as the values from
\00-37 octal, from the action of the Control key on the original Teletype
\terminals. 

In BSD the new tty driver as well as vi, cat -v, ... use ^? to denote DEL.
Seems pretty normal to me.  According to iscntrl(3) DEL is a control character
too.  Too bad it isn't a normal control character; it would have simplified
things.
-- 
A symbolic link is a POINTER to a file, | Maarten Litmaath @ VU Amsterdam:
 a hard link is the file system's GOTO. | maart at cs.vu.nl, mcsun!botter!maart



More information about the Comp.lang.c mailing list