<HTML ><HEAD ><TITLE >What You Should Do When Writing Applications</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ "><LINK REL="HOME" TITLE="Linux Backspace/Delete mini-HOWTO" HREF="index.html"><LINK REL="PREVIOUS" TITLE="X" HREF="x.html"><LINK REL="NEXT" TITLE="What You Should Do On Your System" HREF="system.html"></HEAD ><BODY CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Linux <B CLASS="KEYCAP" >Backspace</B >/<B CLASS="KEYCAP" >Delete</B > mini-HOWTO</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="x.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="system.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="WRITING">5. What You Should Do When Writing Applications</H1 ><P >When you write a console application, be kind to the user and try to understand what comes from the standard input using the following fallback chain:</P ><P ></P ><OL TYPE="1" ><LI ><P >open the right <SPAN CLASS="APPLICATION" >terminfo</SPAN > entry, and try to process the sequence so as to discover whether it has a particular meaning on the current terminal; if so, use the <SPAN CLASS="APPLICATION" >terminfo</SPAN > semantics;</P ></LI ><LI ><P >use the <SPAN CLASS="ACRONYM" >ASCII</SPAN > intended meaning on line feeds, newlines, tab characters and, of course, <SPAN CLASS="SYMBOL" >BS</SPAN > and <SPAN CLASS="SYMBOL" >DEL</SPAN >. Crossing your finger could also be useful.</P ></LI ></OL ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="x.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="system.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >X</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >What You Should Do On Your System</TD ></TR ></TABLE ></DIV ></BODY ></HTML >