\documentclass[letterpaper]{article}
\nonstopmode
\akai
\usepackage{linuxdoc-sgml}
\usepackage{qwertz}
\usepackage{url}
\usepackage[latin1]{inputenc}
\usepackage{t1enc}
\usepackage[english]{babel}
\usepackage{epsfig}
\usepackage{null}
\def\addbibtoc{
\addcontentsline{toc}{section}{\numberline{\mbox{}}\relax\bibname}
}%end-preamble
\setcounter{page}{1}
\title{ÉÁ¹â¾¯¸æ mini-Howto}
\author{Alessandro Rubini, {\ttfamily rubini@linux.it}}
\date{v2.2, 11Ê®Ò»ÔÂ 1997}
\abstract{ÎÄ¼þ½âÊÍÔÚÒ»¸öÏµÍ³ÉÏÈçºÎÊ¹ÓÃ termcap Éè¶¨Ò»¸öÉÁ¹â¾¯¸æºÍÃèÊöÈçºÎÒÀÐèÇóÊ¹À®°ÈÉùÎÞÐ§.}


\begin{document}
\maketitle
\tableofcontents

\section{½éÉÜ}

Ã¿µ±Ò»¸ö BEL ×ÖÔª(ASCII ´úÂë 7)Êä³öÊ± Linux console ·¢³öÀ®°ÈÉù
.ËäÈ»Ô¤ÉèÐÐÎªÊÇÒ»¸öÕýÈ·µÄÑ¡Ôñ
,Ðí¶àÓÃ»§²»Ï²»¶ËûÃÇµÄµçÄÔ·¢³ö·¢³ößÙßÙÉù.Õâ·Ý
mini-Howto ÒâÒåÓÃÀ´½âÊÍÈçºÎ¸æËßÓ¦ÓÃ³ÌÊ½Ëµ²»Òª²úÉú
BEL ´úÂë.ËüÒ²½âÊÍÈçºÎ½Ìµ¼ºËÐÄºÍ X
ÊÓ´°ÏµÍ³µ±Ò»¸ö BEL ²úÉúÊ±±ÜÃâ·¢³ößÙßÙÉù.×¢ÒâÎÄ¼þ´ó²¿·Ö
Ì¸¼°ÎÄ×Ö console ,µ±Éè¶¨ X ËÅ·þÆ÷
ÊÇÈÝÒ×µÄ catch-all Õë¶ÔÔÚÒ»¸öÍ¼ÐÎµÄ»·¾³¹¤×÷µÄÈÎºÎÊ¹ÓÃÕß.

Ãæ¶ÔÒ»¸ö°®ÌôÌÞµÄµçÄÔÒÔÎÒµÄÒâ¼û×îºÃµÄ·½·¨ÊÇÐÞÕý
Ó²Ìå,ÎÒ×Ô¼ºµÄµçÄÔÉõÖÁÃ»ÓÐÅäÖÃÒ»¸öÀ©ÒôÆ÷.




\section{Spekearectomy}

Speakerectomy Õë¶ÔÀ®°ÈÉùµÄÎÊÌâ
×îÖ±½ÓµÄ½â¾ö·½·¨¾ÍÊÇ°ÑÀ®°ÈÄÃ(°Î)µô, ÕâÑù¾ÍÌý²»µ½À®°ÈµÄÉùÒôÁË.
.Õâ¸öÔË×÷ÊÇÖ±½ÓµÄºÍÄã
ÉõÖÁ²»ÐèÒªÈÎºÎÆäËûµÄ×ö·¨,Èç¹ûÄãÒªµÄ»°ËüÈÔÓÐ¸Ä½øµÄ¿Õ¼ä.

PC ÊÇÍ¨³£×°±¸Ò»¸ö±¿×¾µÄÇÐ»»½ÏµÍµÄ CPU Ê±ÂöµÄ¿ª¹Ø.
µ±ÄãÔÚÒ»¸ö¶à¹¤»·¾³ÖÐ¹¤×÷Ê±Õâ¿ª¹ØÊÇ´ÓÎ´Ê¹ÓÃ,µ±
ÄãÉõÖÁ²»ÐèÒª°ÑµçÄÔÂýÏÂÀ´Ö´ÐÐÓÎÏ·»ù´¡ÔÚ
ÈíÌå loops ÉÏ.²»ÐÒµÄÊÇÎÒÃÇ²»ÄÜÊ¹ÓÃÇÐ»»Ôö¼Ó
´¦ÀíÆ÷ËÙ¶È,µ«ÊÇÎÒÃÇ¿ÉÒÔÊ¹ÓÃËüÊ¹À©ÒôÆ÷ Æô¶¯/ÎÞÐ§
.ÓÐÊ±À©ÒôÆ÷ÊÇÓÐÓÃµÄ¼ÙÊ¹ÄãÏíÊÜÒ»¸ö
silent number cruncher cruncher,ÀýÈçÐÅºÅ½áÊøµÄÒ»¸ö lenghty
±à¼­.ÐÞ¸Ä¿ª¹Ø¹¦ÄÜÐÔ,Ö»Òª´ÓÖ÷ÒªµÄµçÂ·°æºÍËüÒÀÐòÁ¬½ÓÀ©ÒôÆ÷µÄÏß·Ö¿ªÀ´
.

Ï¥ÉÏÐÍµçÄÔµÄÓµÓÐÈË,²»ÐÒµÄ²»ÈÝÒ×µÄÊ¹ÓÃ
À©ÒôÆ÷,ËûÃÇÆäÖÐÃ»ÓÐÒ»¸öÊ£âÅµÄÇÐ»»¿ª¹ØÈ¥×ª±ä³ÉÁíÒ»¸ö
²»Í¬µÄ¹¤×÷.Õë¶ÔÕâÑùµÄÓÃ»§½ÏºÃµÄ½â¾ö·½°¸ÊÇÉè¶¨
ËûÃÇµÄÈíÌå±ÜÃâ·¢³ößÙßÙÉù,ÈçÒÔÏÂµÄÃèÊö.




\section{Ã¿Ò»¸ö console ·¢³ößÙßÙÉùÉè¶¨}

ÔÚ Linux 1.3.43 Ê±ºò, Martin Mares ¼ÓÈëÉè¶¨·¢³ößÙßÙÉù
³Ì¶ÈºÍ³ÖÐøµÄÄÜÁ¦,¿¿ÐÞ¸Ä {\ttfamily  console.c}.Ã¿Ò»¸ö
console ¿ÉÒÔÊÇ±»Éè¶¨ÌØÉ«Ò»¸ö²»Í¬µÄ³ÖÐø ºÍ/»òÕß À®°ÈÉùÒôµÄ³Ì¶È
;ÈÎÎñ±»Íê³É¿¿Ê¹ÓÃ escape Ë³ÐòÊä³ö
µ½ console Éè±¸.Äã¿ÉÒÔÉè¶¨Äã×Ô¼ºµÄ {\ttfamily \~{}/.profile}
»òÕß {\ttfamily \~{}/.login}µµ°¸Ñ¡ÔñÒ»¸ö²»Í¬µÄßÙÉùÉè¶¨Áª½Óµ½
¸÷ console  (»òÕßÍêÈ«Ò»µãÒ²²»·¢³ößÙßÙÉù,Èç¹ûÐèÒªµÄ»°).

escape Ë³ÐòÈçÒÔÏÂÔË×÷:
\begin{itemize}
\item ESC-{\ttfamily [10;}xx{\ttfamily ]} Ñ¡ÔñÀ®°ÈÉùÆµÂÊÓÃºÕÖ¥.Õâ¸öÖµ
Ó¦ÔÚ¡õÎ§ 21-32766,·ñÔòÕâ¸öÖµÊÇÃ»ÓÐ±»¶¨Òå.
Èç¹û `xx' ²ÎÊýÖµÒÅÊ§ÁË,Ô¤ÉèÖµÊÇ (750ºÕ×È) ½«»áÔË×÷,
µ±ÔÚ `ESC-{\ttfamily [10]}.
\item ESC-{\ttfamily [11;}xx{\ttfamily ]} Ñ¡ÔñÀ®°ÈÉù³ÖÐø,ÔÚ milli-seconds (ºÁÃë).
Èç¹ûÄãÖ¸¶¨³¬¹ý 2Ãë,Ô¤ÉèÊ¹ÓÃ (125ms).È»ááÔÙÒ»´Î
,Èç¹û `xx' ²ÎÊýÖµÒÅÊ§ÁË (ESC-{\ttfamily [11]}) Ô¤ÉèÖµ
½«»á±»Ê¹ÓÃ.
\end{itemize}


Ñ¡Ôñ,ÀýÈç,Ò»¸ö 50Hz ³Ì¶È¿ÉÒÔ³ÖÐøÒ»ÃëÖÓ,Äã¿ÉÒÔÊ¹ÓÃ
"{\ttfamily echo -e "$\backslash$$\backslash$33[10;50]$\backslash$$\backslash$33[11;1000]"}" with {\ttfamily bash} (where "-e"
ÒâË¼ÊÇ `ÁË½â Escape Ë³Ðò'.Èç¹ûÄãÊ¹ÓÃ {\ttfamily tcsh} ÏàÍ¬µÄ
ÃüÁîÆ´Ð´Èç "{\ttfamily echo "$\backslash$$\backslash$033[10;50]$\backslash$$\backslash$033[11;1000]"}".

¾¡¹ÜÎÒ²»ÖªµÀ {\ttfamily setterm} ÃüÁîµÄÈÎºÎ°æ±¾µ«Ëü
Ö§³ÖÕâÑùµÄÉè¶¨,ÕâÃüÁîµÄ½«À´µÄ°æ±¾Ò²ÐíºÃºÃ
Ö§³ÖÃüÁîÐÐÑ¡ÏîÀ´Éè¶¨À®°ÈÉùÉùÒô.

Èç¹ûÄãÖ´ÐÐ Linux-1.3.43 »òÕß½ÏÐÂµÄ,ÄãÒ²ÐíÂúÒâ escape
Ë³ÐòºÍ±ÜÃâÔÄ¶Á¸ü¶àµÄ.Èç¹ûÄãÖ´ÐÐ½Ï¾ÉµÄºËÐÄ,»òÕßÈç¹û
ÄãÒªÉÁ¹â¾¯¸æ,ÄãÒªÔÄ¶ÁÎÄ¼þÆäâÅµÄ²¿·Ö.




\section{»ù±¾¸ÅÄî¹Øì¶ Termcap ºÍ Terminfo}

µµ°¸ {\ttfamily /etc/termcap}ÊÇÒ»¸öÎÄ×Öµµ°¸ËüÁÐ³ö
{\ttfamily term}inal {\ttfamily cap}abilities. Êý¸öÓ¦ÓÃ³ÌÊ½Ê¹ÓÃ
{\ttfamily termcap} ×ÊÁÏÔÚÓ©Ä»ÖÜÎ§ÒÆ¶¯Ö¸±êºÍ×ö
±ðµÄÓ©Ä»µ¼ÏòµÄ¹¤×÷.  {\ttfamily tcsh}, {\ttfamily bash}, {\ttfamily vi} ÒÔ¼°ÆäËû
{\ttfamily curses}-»ù´¡Ó¦ÓÃ³ÌÊ½Ê¹ÓÃ {\ttfamily termcap} ×ÊÁÏ¿â.

×ÊÁÏ¿âÃèÊöÊý¸öÖÕ¶Ë»úµÄÀàÐÍ. 
{\ttfamily TERM} »·¾³±äÊýÔÚÔËÐÐÊ±Ñ¡ÔñÕýÈ·µÄÐÐÎª
,¿¿ÃüÃûÒ»¸ö {\ttfamily termcap} À¸Î»ÊÇ±»
Ó¦ÓÃ³ÌÊ½ËùÊ¹ÓÃ.

ÔÚ×ÊÁÏ¿âÄÚ²¿,Ã¿Ò»¸öÖÕ¶Ë»úµÄÄÜÁ¦ÏÔÊ¾µ±Ò»¸ö
two-letter ´úÂëºÍÒ»¸öÊµ¼ÊµÄ escape Ë³ÐòµÄ±íÊ¾
±»Ê¹ÓÃÀ´È¡µÃÏëÒªµÄÐ§¹û.ÔÚ²»Í¬µÄÄÜÁ¦Ö®¼äµÄ·Ö¸ô·û×ÖÔª
ÊÇÊ¹ÓÃÃ°ºÅ (":").¾ÙÒ»ÊµÀý,ÌýµÃ¼ûµÄ
À®°ÈÉù,ËüµÄ´úÂë "bl",Í¨³£³öÏÖµ± "{\ttfamily bl=\^{}G}".Ë³Ðò
¸æËßËüÀ®°ÈÉùÉùÒôÊÇ»ñµÃ¿¿ÁÐÓ¡ control-G
×ÖÔª, ASCII BEL .

³ý {\ttfamily bl} ÄÜÁ¦Íâ, {\ttfamily vb} ÄÜÁ¦ÊÇ±»
ÖØÐÂ×éÖ¯.ËüÊÇ±»Ê¹ÓÃÀ´±íÏÖ "ÉÁ¹â¾¯¸æ". {\ttfamily vb} 
Í¨³£ÔÚ {\ttfamily termcap} µµ°¸ {\ttfamily linux} µÄÀ¸Î»ÓÐÒÅÊ§.



´ó²¿·ÖµÄÏÖ´úÓ¦ÓÃ³ÌÊ½ºÍ³ÌÊ½¿âÊ¹ÓÃ {\ttfamily terminfo} ×ÊÁÏ¿â
´úÌæ {\ttfamily termcap}. ×ÊÁÏ¿âÖÐÃ¿Ò»¸öÖÕ¶Ë»úÐÍÌ¬Ê¹ÓÃÒ»¸öµµ°¸
ºÍÎ»ì¶ {\ttfamily /usr/lib/terminfo};±ÜÃâÊ¹ÓÃ¼«´óµÄ
Ä¿Â¼,Ã¿Ò»¸öÖÕ¶Ë»úµÄÀàÐÍµÄÃèÊöÊÇ´¢´æÔÚÓÉËüµÄÊ××ÖÄ¸¾ö¶¨µÄÒ»¸ö
Ä¿Â¼ÖÐ; ÄÇ¸ö {\ttfamily linux} À¸Î»,
Òò´Ë,ÊÇ {\ttfamily /usr/lib/terminfo/l/linux}.½¨Á¢Ò»¸ö
{\ttfamily terminfo} À¸Î»Äã½« ``±àÒë'' {\ttfamily termcap} ÃèÊö;
Ì¸¼° {\ttfamily tic} ³ÌÊ½ºÍËüµÄËµÃ÷Ò³.




\section{¶¨ÒåÒ»¸öÉÁ¹â¾¯¸æ}

Äã¿ÉÒÔ¼ÓÀ¸Î»Õë¶Ô {\ttfamily vb} ÄÜÁ¦ÔÚÄãµÄ×Ô¼ºµÄ termcap
µµ°¸ÖÐ,Èç¹ûÃ»ÓÐÒÑ¾­¶¨ÒåÒ»¸ö.  Dennis Henriksen
(duke@diku.dk) ½¨Òé²åÈëÏÂÁÐ¸÷ÐÐÔÚ
{\ttfamily termcap} À¸Î»ÖÐÕë¶Ô {\ttfamily linux} (×¢ÒâÔÚ¾ÉµÄ distributions ÖÐÀ¸Î»ÊÇ½Ð×ö
{\ttfamily console}  ):
\begin{tscreen}
\begin{verbatim}
:vb=\E7\E[?5h\E[?5l\E[?5h\E[?5l\E[?5h\E[?5l\E[?5h\E[?5l\E8:\
\end{verbatim}
\end{tscreen}

Ñ°¼£ backslash ÔÚ×ÊÁÏ¿âÊÇ±»Ê¹ÓÃ×ö escape newline.
Dennis' µÄÂë×öÏÂÁÐ¸÷Ïî (Ëû×Ô¼ºËµµÄ):
\begin{itemize}
\item ´¢´æÖ¸±êÎ»ÖÃ (uustÒ»¸ö°²È«½÷É÷).
\item ¸Ä±ä±³¾°ÑÕÉ«Êý´ÎÔÚ±ê×¼ºÍ·Ç±ê×¼Ö®¼ä.
\item »Ö¸´Ö¸±êÎ»ÖÃ.
\end{itemize}





\section{Ê¹À®°ÈÉùÔÚÉÏÎÄ×Ö console Ê§Ð§}

Èç¹ûÄãÇ¿ÖÆÊ¹ÉÁ¹â¾¯¸æÔÚÄãµÄ console ÉÏÄã¿ÉÒÔÊ¹ÓÃ
"{\ttfamily bl}" ÔÚ {\ttfamily termcap} À¸Î»ºÍ¶¨ÒåËüÊ¹ÓÃÏàÍ¬µÄ×Ö´®
½¨ÒéÕë¶ÔÔÚ "{\ttfamily vb}" Ö®ÉÏ.¿¿½üÊÇ±ãÀûµÄÈç¹ûÄã²»
Òª×ÔÒÑÉè¶¨Ã¿Ò»¸öÓ¦ÓÃ³ÌÊ½ (ËüÈçÒÔÏÂµÄÃèÊö,ÎÞÂÛÈçºÎ).
ÎÒÔÚËùÓÐ»úÆ÷ÉÏÊ¹ÓÃÕâÑ¡ÏîÔÚÄÄÀïÎÒ¿ÉÒÔÖ´ÐÐ Linux ºÍÎÒ
²»ÄÜ²ð¿ªÀ®°È.




\section{¸æËßÓ¦ÓÃ³ÌÊ½±ÜÃâ·¢³ößÙßÙÉù}

ÕâÊÇÒ»²»ÍêÈ«µÄÓ¦ÓÃ³ÌÊ½µÄÇåµ¥Ëü¿ÉÒÔÊÇ±»Ö¸Ê¾È¥
Ê¹ÓÃ {\ttfamily vb} À¸Î»Õë¶Ôµ±Ç°µÄÖÕ¶Ë»úµÄÐÎÌ¬ (Ê¹ÓÃÈÎÒ»
{\ttfamily termcap} ×ÊÁÏ»òÕß {\ttfamily terminfo} Õâ¸ö):

\begin{itemize}
\item  X ËÅ·þÆ÷:Ê¹ÓÃ "{\ttfamily xset b}"ÃüÁîÀ´Ñ¡Ôñ
bell µÄÐÐÎª.Õâ¸öÖ¸ÁîÈ¡Èý¸öÊýÖµµÄ
²ÎÊý:´óÐ¡,³Ì¶ÈºÍ³ÖÐø. "{\ttfamily xset -b}" Ê¹
À®°ÈÉùÍêÈ«ÎÞÐ§.Éè¶¨ X ËÅ·þÆ÷Ó°ÏìÔÚÏÔÊ¾Æ÷ÉÏËùÓÐÖ´ÐÐµÄ
Ó¦ÓÃ³ÌÊ½.
\item {\ttfamily xterm}: xterm ¿ÉÒÔ×ª»»¸÷À®°ÈÉùµ½Ò»¸ö¿´µÃ¼ûµÄ»òÕß
ÌýµÃ¼ûµÄÐÅºÅ.Èç¹ûÄãÊ¹ÓÃÀ®°ÈÉù,"{\ttfamily xset}" µÄÉè¶¨
½«»áÔË×÷.À®°ÈÉùÔÚ {\ttfamily xterm} Ô¤ÉèÊÇ
ÌýµÃ¼ûµÄ,µ«ÊÇÄã¿ÉÒÔÊ¹ÓÃ "{\ttfamily -vb}" ÃüÁîÐÐÑ¡Ïî
ºÍ "{\ttfamily xterm*visualBell: true}" µÄ°ì·¨×ª±äËü³ÉÒ»¸ö
¿´µÃ¼ûµÄÉÁ¹â.Äã¿ÉÒÔË©ÀÎ¿´µÃ¼ûµÄ/ÌýµÃ¼ûµÄÐÅºÅÔÚ
ÔËÐÐÊ±¿¿ control--left-mouse-button ½Ð³öÑ¡µ¥
.Èç¹ûÄãÖ´ÐÐ X Äã×îÓÐ¿ÉÄÜµÄ
²»ÐèÒªÏÂÁÐ×ÊÁÏ.

\item {\ttfamily tcsh} (6.04 ºÍÒÔááµÄ): "{\ttfamily set visiblebell}".
ÕâÖ¸Ê¾¿ÉÒÔÊÇ°²·ÅµÄÔÚ {\ttfamily .cshrc} »òÕß¿ÉÒÔÊÇ»¥¶¯Ê½µÄÖ´ÐÐ
.ÖØÉèÀ®°ÈÉùÖ»Òª "{\ttfamily unset
visiblebell}".Ê¹ÈÎºÎÍ¨ÖªÃüÁîÎÞÐ§,Ê¹ÓÃ "{\ttfamily set
nobeep}" È¡´ú.
\item {\ttfamily bash} (ÈÎºÎ bash,ÈçÎÒËùÖªµÀ):·Å "{\ttfamily set bell-style
visible}" ÔÚÄãµÄ {\ttfamily \~{}/.bashrc}ÖÐ.¿ÉÄÜµÄÀ®°ÈÉùÐÎÌ¬
¿ÉÒÔÊÇ "Ã»ÓÐ"»òÕß "¿ÉÌýµÃ¼ûµÄ".
\item {\ttfamily bash} (with {\ttfamily readline},ÈçÍ¬ÆäËûµÄ {\ttfamily readline}
»ùì¶Ó¦ÓÃ³ÌÊ½):·Å "{\ttfamily set prefer-visible-bell}" ÔÚ
{\ttfamily \~{}/.inputrc}.
\item {\ttfamily nvi} ºÍ {\ttfamily elvis}: ·Å "{\ttfamily set flash}" ÔÚ
{\ttfamily \~{}/.exrc}»òÕßËµ "{\ttfamily :set flash}" »¥¶¯Ê½µÄ (×¢Òâ
ÄÇ¸öÃ°ºÅ).Ê¹ÉÁ¹â¾¯¸æÎÞÐ§Ê¹ÓÃ {\ttfamily noflash} ÔÚ
{\ttfamily flash} µÄµØ·½.
\item {\ttfamily emacs}: ·Å "{\ttfamily (setq visible-bell t)}"ÔÚÄãµÄ
{\ttfamily \~{}/.emacs}.ËüÊÇ¿¿ "{\ttfamily (setq visible-bell
nil)}" Ê¹ÆäÃ»ÓÐÐ§ÓÃ.
\item {\ttfamily less}:Ê¹ÓÃ "{\ttfamily -q}"ÔÚÃüÁîÐÐÉÏÊ¹ÓÃÉÁ¹â¾¯¸æ,
Ê¹ÓÃ "{\ttfamily -Q}" Ê¹ÈÎºÎ±¨¸æÎÞÐ§.Ô¤ÉèÑ¡Ïî¿ÉÒÔ
·Å½øÄãµÄ»·¾³±äÊý "{\ttfamily LESS}".
\item {\ttfamily screen}: Ö´ÐÐ CtrlA-CtrlG ÃüÁî.¸Ä±ä
ËùÓÐÐéÄâÓ©Ä»µÄÐÐÎª.¿´ man page
ÔÚ "CUSTOMIZATION" Ö®ÏÂÕë¶Ô°²×°Ô¤ÉèÖµ.
\end{itemize}





\section{ÎÊÌâµÄºÚ°µ±ß}

»µÏûÏ¢ÊÇËü²»ÊÇÃ¿Ò»¸öÓ¦ÓÃ³ÌÊ½¶¼Ê¹ÓÃ {\ttfamily termcap} »òÕß
{\ttfamily terminfo}.´ó²¿·ÖÐ¡µÄ³ÌÐòÌØÉ«ÔÚ C Ô­Ê¼ÂëÂëÖÐÊ¹ÓÃ 'backslash-a' (¾¯±¨)
×ÖÔª. "alarm" ÂëÔÚ×Ö´®ÖÐ±ä³ÉÒ»¸ö×ÖÃæÉÏµÄ
ASCII BEL µ±´¢´æ³É¶þ½øÎ»µÄ.ÕæµÄ
Ó¦ÓÃ³ÌÊ½Í¨³£²»»áµôÈëÕâÖÖÀà,µ«ÊÇ×¢ÒâÐÂÑ§ C µÄÈË
ËûÃÇ¸øÄãËûÃÇ×Ô¼ºµÄ³ÌÊ½.ÊÇËùÓÐ×î»µµÄµÄÊÇµçÄÔ¿ÆÑ§µÄÑ§Éú
,ÕæµÄ.

Î¨Ò»µÄ·½·¨Ê¹ÕâÐ©³ÌÊ½³ÁÄ¬µÄÓ¦ÓÃ³ÌÊ½ÊÇ
spekearectomy,»òÕßÒÀ Martin Mares µÄ·½·¨Ê¹ÓÃ escape Ë³Ðò.



\end{document}
