From: peter@baileynm.com (Peter da Silva)
Subject: Re: Dec C pecularity
Date: 1999/06/14 [thread overview]
Message-ID: <7k37t4$bq@web.nmti.com> (raw)
In-Reply-To: 87hfocxypx.fsf@romulus.bland.fido.de
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1161 bytes --]
In article <87hfocxypx.fsf@romulus.bland.fido.de>,
Tobias Ernst <tobi@bland.fido.de> wrote:
>Gnu C can recognise "\x1B" as a way of encoding the character with
>charactercode 0x1B
Since \033 (which you do know about) takes the same number of characters
as \x1b, and has the advantage of actually being C rather than some
extension, why not use that?
Though IMO a more correct way to code that is:
#include <stdio.h>
#include <curses.h>
char tbuf[1024];
int main(int ac, char **av)
{
char *term = getenv("TERM");
if(!term) {
fprintf(stderr, "%s: TERM type not known.\n", av[0]);
return 2;
}
switch(tgetent(tbuf, term)) {
case 0:
fprintf(stderr, "%s: %s not found.\n", av[0], term);
return 2;
case -1:
fprintf(stderr, "%s: Can't open TERM database.\n", av[0]);
return 2;
}
cl = tgetstr(tbuf, "cl");
if(!cl) {
fprintf(stderr, "%s: %s does not have clear screen.\n", av[0]);
return 2;
}
printf("%sThe screen is cleared.\n", cs);
return 0;
}
--
In hoc signo hack, Peter da Silva <peter@baileynm.com>
`-_-' Ar rug t� barr�g ar do mhact�re inniu?
'U` "Be vewy vewy quiet...I'm hunting Jedi." -- Darth Fudd
next prev parent reply other threads:[~1999-06-14 4:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-06-09 4:00 Dec C pecularity Bernhard Reiter
1999-06-11 4:00 ` Jeff Sullivan
1999-06-13 4:00 ` Tobias Ernst
1999-06-14 4:00 ` Peter da Silva [this message]
1999-06-26 4:00 ` Tobias Ernst
1999-06-29 4:00 ` Charles M Richmond
1999-07-13 4:00 ` Tobias Ernst
1999-07-13 4:00 ` Kevin Oberman
1999-07-13 4:00 ` Charles M Richmond
1999-07-14 4:00 ` T.E.Dickey
1999-07-15 4:00 ` libcurses and patches for 4.0 jhitchcock
1999-07-16 4:00 ` T.E.Dickey
1999-08-10 4:00 ` b_andreasen
1999-07-16 4:00 ` Dec C pecularity Tobias Ernst
1999-07-18 4:00 ` T.E.Dickey
1999-07-14 4:00 ` T.E.Dickey
1999-06-22 4:00 ` Jeff Sullivan
1999-06-22 4:00 ` Jeff Sullivan
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox