Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > 965e33040dd61030a94f0eb89877aee8 > files > 7248

howto-html-en-20080722-2mdv2010.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
 <TITLE>How to change the title of an xterm: Appendix: examples in other languages</TITLE>
 <LINK HREF="Xterm-Title-8.html" REL=next>
 <LINK HREF="Xterm-Title-6.html" REL=previous>
 <LINK HREF="Xterm-Title.html#toc7" REL=contents>
</HEAD>
<BODY>
<A HREF="Xterm-Title-8.html">Next</A>
<A HREF="Xterm-Title-6.html">Previous</A>
<A HREF="Xterm-Title.html#toc7">Contents</A>
<HR>
<H2><A NAME="s7">7. Appendix: examples in other languages</A></H2>

<P>It may be useful to write a small program to print an argument to
the title using the <CODE>xterm</CODE> escapes. Some examples are provided
below.
<P>
<P>
<H2><A NAME="ss7.1">7.1 C</A>
</H2>

<P>
<BLOCKQUOTE><CODE>
<PRE>
#include &lt;stdio.h>

int main (int argc, char *argv[]) {
  printf("%c]0;%s%c", '\033', argv[1], '\007');
  return(0);
}
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>
<H2><A NAME="ss7.2">7.2 Perl</A>
</H2>

<P>
<BLOCKQUOTE><CODE>
<PRE>
#!/usr/bin/perl
print "\033]0;@ARGV\007";
</PRE>
</CODE></BLOCKQUOTE>
<P>
<P>
<P>
<HR>
<A HREF="Xterm-Title-8.html">Next</A>
<A HREF="Xterm-Title-6.html">Previous</A>
<A HREF="Xterm-Title.html#toc7">Contents</A>
</BODY>
</HTML>