theo@rascal.UUCP (T. Kramer) (02/11/91)
I am having the most frustrating time with curses on SCO Open Desktop developers edition. When compiling a program that uses curses and switches terminals such the freedom 100 and qvt101 into alternate character mode (smacs) all goes well. It is however not possible to switch back into normal mode (rmacs). This only happens when the character sequence for switching back to normal mode is '\E%'. The program listed below illustrates the phenomena. When analysing the output of the program below ie. redirecting the output to a file and using hd to see the characters output, the '\E%' (rmacs) sequence is missing. If I adjust the sequence for rmacs in the terminfo source to something else like 'AA' the rmacs sequence is there. This does not happen on my XENIX V.2.2 development system (fortunatly) therefore forcing me to create production copies of my software on the XENIX box. Does anybody out there know why this is happening, and is there some way I can fix this in a portable way, ie. it must be general for a wide range of terminals? Note: To get the terminal back into non alternate mode after running the included program type in the following: tput rmacs +----------------------- Start of code section ----------------------------+ #include <curses.h> #include <term.h> #define ULCORNER 'f' #define LLCORNER 'e' #define URCORNER 'g' #define LRCORNER 'h' #define HLINE 'k' #define VLINE 'j' void main() { int index; initscr(); cbreak(); noecho(); attron(A_ALTCHARSET); move(0,0); addch(ULCORNER); for (index = 1; index < 20; index++) addch(HLINE); addch(URCORNER); attroff(A_ALTCHARSET); /* puts("\E%"); fflush(stdout); works but is not portable */ refresh(); getch(); endwin(); } /* cc qvt.c -oqvt -lcurses cc qvt.c -oqvt -lcurses # Terminfo source code for my qvt101 terminal qp|qvt101+so|Qume qvt101 + terminal, cr=^M, cud1=^J, ind=^J, bel=^G, is2=\E0P\Ew\E.4\E(\EC\E%\EX\E\047\E+\Ef^M\Eg, clear=\E+, tbc=\E3, hts=\E1, sam, cols#80, lines#24, cr=^M, nel=^J, xmc#0,khome=^^, kcuf1=^L, kcub1=^H, kcud1=^J, kcuu1=^K, cup=\E=%p1%' '%+%c%p2%' '%+%c, cvvis=\E.1, cnorm=\E.4\E*, cbt=\EI, cud1=^J, cuf1=^L, cuu1=^K, home=^^, cub1=^H, ul, smso=\E), rmso=\E(, el=\Et, ed=\Ey, il1=\EE, dl1=\ER, dch1=\EW, ich1=\EQ, smul=\EG8, rmul=\EG0,rmacs=\E%,smacs=\E$, kf1=^A@^M, kf2=^AA^M, kf3=^AB^M, kf4=^AC^M, kf5=^AD^M, kf6=^AE^M, kf7=^AF^M, kf8=^AG^M, kf9=^AH^M, kf0=^AI^M, */ +------------------------------+---------------------------------------------+ | theo@rascal | smacs of something rotten to me | +------------------------------+---------------------------------------------+
staceyc@sco.COM (Stacey Campbell) (02/13/91)
[I'm posting this because this is not the first time I have seen this 'bug' reported against terminfo curses.] In article <1500@rascal.UUCP> theo@rascal.UUCP (T. Kramer) writes: >It is however not possible to switch back into normal mode >(rmacs). This only happens when the character sequence for switching >back to normal mode is '\E%'. Just to double check, you are aware that '%' is special in terminfo and needs to be escaped (I notice that you have shown the special code for ascii 27 '\E' but not for '%' which is '%%'. Do a man terminfo for information. >When analysing the output of the program below ie. redirecting the output >to a file and using hd to see the characters output, the '\E%' (rmacs) >sequence is missing. If I adjust the sequence for rmacs in the terminfo >source to something else like 'AA' the rmacs sequence is there. This would seem to confirm the non escaped '%' theory. Check the terminfo manual page. >This does not happen on my XENIX V.2.2 development system [...] Which uses termcap where '%' is probably not special. >Note: To get the terminal back into non alternate mode after running the >included program type in the following: tput rmacs Note that the tput command does not attempt to parameterize any arguments so it will extract and output the '\E%' without barfing on the '%'. If you write a small program that outputs the tparam() version of "rmacs" you will almost certainly see the '%' disappear. -- Stacey Campbell Internet: staceyc@sco.com UUCP: {uunet,ucscc,att,sq,altos,lotus,sun,microsoft}!sco!staceyc
theo@rascal.UUCP (T. Kramer) (02/14/91)
In article <10156@scolex.sco.COM> staceyc@sco.COM (Stacey Campbell) writes: > >Just to double check, you are aware that '%' is special in terminfo >and needs to be escaped (I notice that you have shown the special code >for ascii 27 '\E' but not for '%' which is '%%'. Do a man terminfo >for information. I have checked the manual and you are quit correct in stating that the '%' (percentage) character is special. However, even if the rmacs sequence is '\E%%' or for that matter '\E%%%%%..%%' the rmacs sequence is not output to the screen. The output for my program is as follows:- ^[(^[(+^[= 5^[%%^M^[$fkkkkkkkkkkkkkkkkkkkg^[=7 ^ ^ ^ | | | rmacs?-+ +-smacs +-- Where is the rmacs??? This is with rmacs set to '\E%%%%' > Which uses termcap where '%' is not probably not special. No! the XENIX V.2.2 linked in curses library is -ltinfo. The XENIX development system generated binary <does> work perfectly for both XENIX V.2.2 and SCO UNIX V.3.2 and SCO Opendesktop all using terminfo. +--------------------------------+--------------------------------------------+ | theo@rascal | Still smacs of something rmacs to me | +--------------------------------+--------------------------------------------+
@usaos.uucp (02/15/91)
Xref: xenitec comp.terminals:1782 sco.opendesktop:551 Keywords: qvt101, freedom100, curses Message-ID: <1502@rascal.UUCP> Date: Thu, 14 Feb 91 10:12:50 GMT References: <1500@rascal.UUCP> <10156@scolex.sco.COM> Reply-To: theo@rascal.UUCP (T. Kramer) Followup-To: comp.terminals In article <10156@scolex.sco.COM> staceyc@sco.COM (Stacey Campbell) writes: > >Just to double check, you are aware that '%' is special in terminfo >and needs to be escaped (I notice that you have shown the special code >for ascii 27 '\E' but not for '%' which is '%%'. Do a man terminfo >for information. I have checked the manual and you are quit correct in stating that the '%' (percentage) character is special. However, even if the rmacs sequence is '\E%%' or for that matter '\E%%%%%..%%' the rmacs sequence is not output to the screen. The output for my program is as follows:- ^[(^[(+^[= 5^[%%^M^[$fkkkkkkkkkkkkkkkkkkkg^[=7 ^ ^ ^ | | | rmacs?-+ +-smacs +-- Where is the rmacs??? This is with rmacs set to '\E%%%%' > Which uses termcap where '%' is not probably not special. No! the XENIX V.2.2 linked in curses library is -ltinfo. The XENIX development system generated binary <does> work perfectly for both XENIX V.2.2 and SCO UNIX V.3.2 and SCO Opendesktop all using terminfo. +--------------------------------+--------------------------------------------+ | theo@rascal | Still smacs of something rmacs to me | +--------------------------------+--------------------------------------------+
staceyc@sco.COM (Stacey Campbell) (02/16/91)
In article <1502@rascal.UUCP> theo@rascal.UUCP (T. Kramer) writes: >I have checked the manual and you are quit correct in stating that >the '%' (percentage) character is special. However, even if the rmacs >sequence is '\E%%' or for that matter '\E%%%%%..%%' the rmacs sequence >is not output to the screen. The output for my program is as follows:- > >^[(^[(+^[= 5^[%%^M^[$fkkkkkkkkkkkkkkkkkkkg^[=7 Which encouraged me to go back and check both the program and the terminfo file again. Message-ID: <1500@rascal.UUCP> #include <curses.h> #include <term.h> <-- term.h is not needed #define ULCORNER 'f' <-- these defines should not be used #define LLCORNER 'e' they are terminal specific #define URCORNER 'g' #define LRCORNER 'h' #define HLINE 'k' #define VLINE 'j' void main() { int index; initscr(); cbreak(); noecho(); attron(A_ALTCHARSET); <-- unnecessary move(0,0); <-- unnecessary addch(ULCORNER); for (index = 1; index < 20; index++) addch(HLINE); <-- use the defined ACS_HLINE, curses understands that it needs to use acsc, sgr or smacs addch(URCORNER); <-- use ACS_URCORNER attroff(A_ALTCHARSET); /* puts("\E%"); fflush(stdout); works but is not portable */ ^ | +-- unnecessary refresh(); getch(); endwin(); } # Terminfo source code for my qvt101 terminal qp|qvt101+so|Qume qvt101 + terminal, cr=^M, cud1=^J, ind=^J, bel=^G, is2=\E0P\Ew\E.4\E(\EC\E%\EX\E\047\E+\Ef^M\Eg, clear=\E+, tbc=\E3, hts=\E1, sam, cols#80, lines#24, cr=^M, nel=^J, xmc#0,khome=^^, kcuf1=^L, kcub1=^H, kcud1=^J, kcuu1=^K, cup=\E=%p1%' '%+%c%p2%' '%+%c, cvvis=\E.1, cnorm=\E.4\E*, cbt=\EI, cud1=^J, cuf1=^L, cuu1=^K, home=^^, cub1=^H, ul, smso=\E), rmso=\E(, el=\Et, ed=\Ey, il1=\EE, dl1=\ER, dch1=\EW, ich1=\EQ, smul=\EG8, rmul=\EG0,rmacs=\E%,smacs=\E$, kf1=^A@^M, kf2=^AA^M, kf3=^AB^M, kf4=^AC^M, kf5=^AD^M, kf6=^AE^M, kf7=^AF^M, kf8=^AG^M, kf9=^AH^M, kf0=^AI^M, You must define an acsc string for your terminal. Curses needs this to correctly deal with alternate characters. If you do not define alternate characters curses will supply its default set ('+', '-', etc). It is not necessary to turn on A_ALTCHARSET attributes when using the ACS_ defines. Note that the Xenix tic command ignores the acsc string (because of some version confusion between curses, terminfo and Xenix), so use the Unix tic command to create your Xenix compiled terminfo file. Most importantly note that the manual strongly recommends creating sgr and sgr0 strings. The exact wording in one 3b2 AT&T terminfo manual entry is; "REMEMBER THAT sgr AND sgr0 MUST ALWAYS BE SPECIFIED". I have terminfo files that work fine without sgr, but curses relies on sgr0 to turn off all attributes that can be turned on with sgr, smso, et. al.. sgr0 is output at endwin() time. It is important not to associate curses calls such as attroff(A_ALTCHARSET) with actual output. In the above code the call to attroff() will probably generate no output, because the endwin() (amongst other things) should, if the terminfo entry is correct, perform the same function. Hope this has been of some help. [hope you don't mind keeping this in sco.opendesktop 'cos I rarely read comp.terminals] -- Stacey Campbell Internet: staceyc@sco.com UUCP: {uunet,ucscc,att,sq,altos,lotus,sun,microsoft}!sco!staceyc
@usaos.uucp (02/16/91)
Xref: xenitec comp.terminals:1784 sco.opendesktop:552 Keywords: qvt101, freedom100, curses Message-ID: <10248@scolex.sco.COM> Date: Fri, 15 Feb 91 18:36:39 GMT References: <1500@rascal.UUCP> <10156@scolex.sco.COM> <1502@rascal.UUCP> Sender: news@sco.COM In article <1502@rascal.UUCP> theo@rascal.UUCP (T. Kramer) writes: >I have checked the manual and you are quit correct in stating that >the '%' (percentage) character is special. However, even if the rmacs >sequence is '\E%%' or for that matter '\E%%%%%..%%' the rmacs sequence >is not output to the screen. The output for my program is as follows:- > >^[(^[(+^[= 5^[%%^M^[$fkkkkkkkkkkkkkkkkkkkg^[=7 Which encouraged me to go back and check both the program and the terminfo file again. Message-ID: <1500@rascal.UUCP> #include <curses.h> #include <term.h> <-- term.h is not needed #define ULCORNER 'f' <-- these defines should not be used #define LLCORNER 'e' they are terminal specific #define URCORNER 'g' #define LRCORNER 'h' #define HLINE 'k' #define VLINE 'j' void main() { int index; initscr(); cbreak(); noecho(); attron(A_ALTCHARSET); <-- unnecessary move(0,0); <-- unnecessary addch(ULCORNER); for (index = 1; index < 20; index++) addch(HLINE); <-- use the defined ACS_HLINE, curses understands that it needs to use acsc, sgr or smacs addch(URCORNER); <-- use ACS_URCORNER attroff(A_ALTCHARSET); /* puts("\E%"); fflush(stdout); works but is not portable */ ^ | +-- unnecessary refresh(); getch(); endwin(); } # Terminfo source code for my qvt101 terminal qp|qvt101+so|Qume qvt101 + terminal, cr=^M, cud1=^J, ind=^J, bel=^G, is2=\E0P\Ew\E.4\E(\EC\E%\EX\E\047\E+\Ef^M\Eg, clear=\E+, tbc=\E3, hts=\E1, sam, cols#80, lines#24, cr=^M, nel=^J, xmc#0,khome=^^, kcuf1=^L, kcub1=^H, kcud1=^J, kcuu1=^K, cup=\E=%p1%' '%+%c%p2%' '%+%c, cvvis=\E.1, cnorm=\E.4\E*, cbt=\EI, cud1=^J, cuf1=^L, cuu1=^K, home=^^, cub1=^H, ul, smso=\E), rmso=\E(, el=\Et, ed=\Ey, il1=\EE, dl1=\ER, dch1=\EW, ich1=\EQ, smul=\EG8, rmul=\EG0,rmacs=\E%,smacs=\E$, kf1=^A@^M, kf2=^AA^M, kf3=^AB^M, kf4=^AC^M, kf5=^AD^M, kf6=^AE^M, kf7=^AF^M, kf8=^AG^M, kf9=^AH^M, kf0=^AI^M, You must define an acsc string for your terminal. Curses needs this to correctly deal with alternate characters. If you do not define alternate characters curses will supply its default set ('+', '-', etc). It is not necessary to turn on A_ALTCHARSET attributes when using the ACS_ defines. Note that the Xenix tic command ignores the acsc string (because of some version confusion between curses, terminfo and Xenix), so use the Unix tic command to create your Xenix compiled terminfo file. Most importantly note that the manual strongly recommends creating sgr and sgr0 strings. The exact wording in one 3b2 AT&T terminfo manual entry is; "REMEMBER THAT sgr AND sgr0 MUST ALWAYS BE SPECIFIED". I have terminfo files that work fine without sgr, but curses relies on sgr0 to turn off all attributes that can be turned on with sgr, smso, et. al.. sgr0 is output at endwin() time. It is important not to associate curses calls such as attroff(A_ALTCHARSET) with actual output. In the above code the call to attroff() will probably generate no output, because the endwin() (amongst other things) should, if the terminfo entry is correct, perform the same function. Hope this has been of some help. [hope you don't mind keeping this in sco.opendesktop 'cos I rarely read comp.terminals] -- Stacey Campbell Internet: staceyc@sco.com UUCP: {uunet,ucscc,att,sq,altos,lotus,sun,microsoft}!sco!staceyc
dboles@ccwf.cc.utexas.edu (David Boles) (02/16/91)
HELP !!! I just got a terminal ( a WYSE 85 ) and am having a great deal of difficulty with it. When I picked it up the guy plugged it in to verify that it worked. Then I thought that he pressed Ctrl-(F3/Set-Up/Reset) to get the setup menu. When I do that, nothing happens. When I turn the terminal I get the line: LINE 1- 1 ---------------------------------------------------------------------- across the top of the screen. I have been unable to get any response from pressing any of the keys. Is this normal? I have a 9600 baud modem hooked to it and can't get the terminal to send any characters to the modem. Could anyone out there tell me what to do (I have no manual for the unit)? Thanks in advance David Boles dboles@ccwf.cc.utexas.edu
theo@rascal.UUCP (T. Kramer) (02/25/91)
In article <10248@scolex.sco.COM> staceyc@sco.COM (Stacey Campbell) writes: > >Which encouraged me to go back and check both the program and the >terminfo file again. Note that the piece of code I included is purely to illustrate the point. > >You must define an acsc string for your terminal. Curses needs this >to correctly deal with alternate characters. If you do not define >alternate characters curses will supply its default set ('+', '-', etc). >It is not necessary to turn on A_ALTCHARSET attributes when using the >ACS_ defines. Unfortunatly ACS is not portable across UNIX V.2, XENIX V.2 etc. This is however, a strict requirement for our code. I use the (w)attron(A_ALTCHARSET) and (w)attroff(A_ALTCHARSET) commands with success on all our platforms. Apart from SCO XENIX and UNIX, these include HPUX on the HP9000 835, UNIX V.4 on the ICL DRS6000, AIX on the IBM RS6000, UNIX V.2 on the Unisys model 5000 range, MS-DOS using ASPEN curses etc. I would agree with you that if I used the ACS_ defines I would not need (w)attron and (w)attrof, but because our code must be portable including, hopefully, our terminfo source files I can not depend on ACS_ defines. > >Most importantly note that the manual strongly recommends creating sgr >and sgr0 strings. The exact wording in one 3b2 AT&T terminfo manual >entry is; > >"REMEMBER THAT sgr AND sgr0 MUST ALWAYS BE SPECIFIED". > >I have terminfo files that work fine without sgr, but curses relies on >sgr0 to turn off all attributes that can be turned on with sgr, smso, et. al.. >sgr0 is output at endwin() time. It is important not to associate curses >calls such as attroff(A_ALTCHARSET) with actual output. In the above >code the call to attroff() will probably generate no output, because the >endwin() (amongst other things) should, if the terminfo entry is correct, >perform the same function. I need the call to (w)attrof as in my actual code I need to output normal character information after for example having painted a box on the screen. I will definitly not call endwin each time I want to go out of alternate character set mode ;-). The point of my request for help, however, is why does SCO Opendesktop Development System curses not output an \E% or \E%% or \E\% but does output AA and BB and \E$ and ... for the (w)attroff call? I seriously believe that this is a serious bug in the curses package which makes it difficult if not impossible for me, and I am sure many others who have selected curses for portability, to generate production binaries using the SCO UNIX and Opendesktop development systems! >[hope you don't mind keeping this in sco.opendesktop 'cos I rarely >read comp.terminals] Not at all, and thanks for all your help up to now :-). +------------------------------+--------------------------------------------+ | theo@rascal | curses @)(!#)(@!()_)(!)_ @??#@?@ | +------------------------------+--------------------------------------------+
@usaos.uucp (02/26/91)
Xref: xenitec comp.terminals:1817 sco.opendesktop:580 Keywords: qvt101, freedom100, curses Message-ID: <1504@rascal.UUCP> Date: Mon, 25 Feb 91 07:33:36 GMT References: <1500@rascal.UUCP> <10156@scolex.sco.COM> <1502@rascal.UUCP> <10248@scolex.sco.COM> Reply-To: theo@rascal.UUCP (T. Kramer) Followup-To: comp.terminals In article <10248@scolex.sco.COM> staceyc@sco.COM (Stacey Campbell) writes: > >Which encouraged me to go back and check both the program and the >terminfo file again. Note that the piece of code I included is purely to illustrate the point. > >You must define an acsc string for your terminal. Curses needs this >to correctly deal with alternate characters. If you do not define >alternate characters curses will supply its default set ('+', '-', etc). >It is not necessary to turn on A_ALTCHARSET attributes when using the >ACS_ defines. Unfortunatly ACS is not portable across UNIX V.2, XENIX V.2 etc. This is however, a strict requirement for our code. I use the (w)attron(A_ALTCHARSET) and (w)attroff(A_ALTCHARSET) commands with success on all our platforms. Apart from SCO XENIX and UNIX, these include HPUX on the HP9000 835, UNIX V.4 on the ICL DRS6000, AIX on the IBM RS6000, UNIX V.2 on the Unisys model 5000 range, MS-DOS using ASPEN curses etc. I would agree with you that if I used the ACS_ defines I would not need (w)attron and (w)attrof, but because our code must be portable including, hopefully, our terminfo source files I can not depend on ACS_ defines. > >Most importantly note that the manual strongly recommends creating sgr >and sgr0 strings. The exact wording in one 3b2 AT&T terminfo manual >entry is; > >"REMEMBER THAT sgr AND sgr0 MUST ALWAYS BE SPECIFIED". > >I have terminfo files that work fine without sgr, but curses relies on >sgr0 to turn off all attributes that can be turned on with sgr, smso, et. al.. >sgr0 is output at endwin() time. It is important not to associate curses >calls such as attroff(A_ALTCHARSET) with actual output. In the above >code the call to attroff() will probably generate no output, because the >endwin() (amongst other things) should, if the terminfo entry is correct, >perform the same function. I need the call to (w)attrof as in my actual code I need to output normal character information after for example having painted a box on the screen. I will definitly not call endwin each time I want to go out of alternate character set mode ;-). The point of my request for help, however, is why does SCO Opendesktop Development System curses not output an \E% or \E%% or \E\% but does output AA and BB and \E$ and ... for the (w)attroff call? I seriously believe that this is a serious bug in the curses package which makes it difficult if not impossible for me, and I am sure many others who have selected curses for portability, to generate production binaries using the SCO UNIX and Opendesktop development systems! >[hope you don't mind keeping this in sco.opendesktop 'cos I rarely >read comp.terminals] Not at all, and thanks for all your help up to now :-). +------------------------------+--------------------------------------------+ | theo@rascal | curses @)(!#)(@!()_)(!)_ @??#@?@ | +------------------------------+--------------------------------------------+