<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE> {The S-lang C Library Reference}: SLang_process_keystring</TITLE>
<LINK HREF="cref-127.html" REL=next>
<LINK HREF="cref-125.html" REL=previous>
<LINK HREF="cref.html#toc126" REL=contents>
</HEAD>
<BODY>
<A HREF="cref-127.html">Next</A>
<A HREF="cref-125.html">Previous</A>
<A HREF="cref.html#toc126">Contents</A>
<HR>
<H2><A NAME="SLang_process_keystring"></A> <A NAME="s126">126. <B>SLang_process_keystring</B></A></H2>

<P>
<DL>
<DT><B> Synopsis </B><DD><P>Un-escape a key-sequence
<DT><B> Usage </B><DD><P><CODE>char *SLang_process_keystring (char *kseq);</CODE>
<DT><B> Description </B><DD><P>The <CODE>SLang_process_keystring</CODE> function converts an escaped key
sequence to its raw form by converting two-character combinations
such as <CODE>^A</CODE> to the <EM>single</EM> character <CODE>Ctrl-A</CODE> (ASCII
1).  In addition, if the key sequence contains constructs such as
<CODE>^(XX)</CODE>, where <CODE>XX</CODE> represents a two-character termcap
specifier, the termcap escape sequence will be looked up and
substituted.   
<P>Upon success, <CODE>SLang_process_keystring</CODE> returns a raw
key-sequence whose first character represents the total length of
the key-sequence, including the length specifier itself.  It returns
<CODE>NULL</CODE> upon failure.
<DT><B> Example </B><DD><P>Consider the following examples:
<BLOCKQUOTE><CODE>
<PRE>
     SLang_process_keystring ("^X^C");
     SLang_process_keystring ("^[[A");
</PRE>
</CODE></BLOCKQUOTE>

The first example will return a pointer to a buffer of three characters
whose ASCII values are given by <CODE>{3,24,3}</CODE>.  Similarly, the
second example will return a pointer to the four characters
<CODE>{4,27,91,65}</CODE>.  Finally, the result of
<BLOCKQUOTE><CODE>
<PRE>
     SLang_process_keystring ("^[^(ku)");
</PRE>
</CODE></BLOCKQUOTE>

will depend upon the termcap/terminfo capability <CODE>"ku"</CODE>, which
represents the escape sequence associated with the terminal's UP
arrow key.  For an ANSI terminal whose UP arrow produces
<CODE>"ESC [ A"</CODE>, the result will be <CODE>5,27,27,91,65</CODE>.
<DT><B> Notes </B><DD><P><CODE>SLang_process_keystring</CODE> returns a pointer to a static area
that will be overwritten on subsequent calls.
<DT><B> See Also </B><DD><P><CODE>SLang_define_key, SLang_make_keystring</CODE>
</DL>
<P>
<P>
<HR>
<A HREF="cref-127.html">Next</A>
<A HREF="cref-125.html">Previous</A>
<A HREF="cref.html#toc126">Contents</A>
</BODY>
</HTML>
