From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII X-Google-Thread: fee84,9a2a420ec841e44c X-Google-Attributes: gidfee84,public From: Tobias Ernst Subject: Re: Dec C pecularity Date: 1999/06/26 Message-ID: <87vhcb42lh.fsf@romulus.bland.fido.de>#1/1 X-Deja-AN: 494172108 Sender: tobi@romulus.bland.fido.de References: <37614C91.3FBFAB0A@zk3.dec.com> <87hfocxypx.fsf@romulus.bland.fido.de> <7k37t4$bq@web.nmti.com> Organization: Comp.Center (RUS), U of Stuttgart, FRG Newsgroups: comp.unix.osf.osf1 peter@baileynm.com (Peter da Silva) writes: > 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? People tend to use \x1b instead of \033 because a little more advanced programmers usually know hexadecimal codes by heart, while they have to calculate the octal ones manually. I personally tend to like compilers that understand \x.. because they give me less trouble when I take over code from someone else that has been using \x... In my current code I changed all occurences of hexadecimal codes to octal ones, but it was not the most pleasant kind of work. BTW, Jeff Sullivan has pointed out to me that DEC cc can handle \x... when using the -std or -std1 option. > cl = tgetstr(tbuf, "cl"); I know that this method is more clean in theory. It also works very well if you restrict yourself on using simple things like clear screen and move the cursor. However, I made the experiences that especially on countless Linux installations, but also on some commercial boxes like AIX, tgetstr tells you lot of very advanced commands that it thinks the terminal understands, which actually the terminal doesn�t understand. The result is that text-based applications that are written "more cleanly" in theory actually do not work like the users expects. Therefore, I decided for some procjects to ignore termcap and use the plain ANSI X3.64 (ISO 6429) command set, or to be more exactly that subpart of it that even runs on a VT52. This is not so clean in theory as it will not run on some terminals that use totally different command strings, but in praxis it will run better for most users. Another reason I sometimes use these codes is that such programs can be ported over to systems that do not have a termcap by default, like DOS, Windows and OS/2, and will work instantly. However this is not always an option; the subset that can sefely be used is very small and not very powerful, so sometimes the program gets too slow because it has to emulate advnanced functions with very basic commands. If this becomes a problem I also resort to using termcap. But I guess this is getting off-topic here ;-). Kind Regards, Tobias.