diff --git a/extensions/xmlterm/base/ltermEscape.c b/extensions/xmlterm/base/ltermEscape.c index 35c831635cf0..02c7565afde5 100644 --- a/extensions/xmlterm/base/ltermEscape.c +++ b/extensions/xmlterm/base/ltermEscape.c @@ -1017,11 +1017,13 @@ static int ltermProcessXTERMSequence(struct lterms *lts, const UNICHAR *buf, /** Processes XMLTerm sequence (a special case of Escape sequence processing) * XMLterm escape sequences are of the form - * ESC { Pm C Pt BEL + * ESC { Pm C Pt LF * where Pm denotes multiple numeric arguments separated by semicolons, - * character C is a not a digit and not a semicolon, and - * text parameter Pt may be a null string. + * character C is a not a digit and not a semicolon, + * text parameter Pt may be a null string, and + * LF is the linefeed character. * Omitted numeric parameters are assumed to be zero. + * Any carriage return character preceding the terminating LF is discarded. * @return 0 on success and -1 on error. */ static int ltermProcessXMLTermSequence(struct lterms *lts, const UNICHAR *buf, @@ -1104,7 +1106,7 @@ static int ltermProcessXMLTermSequence(struct lterms *lts, const UNICHAR *buf, /* Process string parameter */ strLength = 0; - while ((offset < count) && (buf[offset] != U_BEL)) { + while ((offset < count) && (buf[offset] != U_LINEFEED)) { if (strLength < MAXSTRINGPARAM) { paramCString[strLength] = buf[offset]; paramString[strLength++] = buf[offset]; @@ -1122,6 +1124,10 @@ static int ltermProcessXMLTermSequence(struct lterms *lts, const UNICHAR *buf, return 1; } + /* Discard any CR character preceding the terminating LF character */ + if ((strLength > 0) && (paramString[strLength-1] == U_CRETURN)) + strLength--; + /* Insert terminating NULL character in string */ paramCString[strLength] = U_NUL; paramString[strLength] = U_NUL; @@ -1139,6 +1145,20 @@ static int ltermProcessXMLTermSequence(struct lterms *lts, const UNICHAR *buf, switch (termChar) { int streamOpcodes; + case U_A_CHAR: /* Send XMLterm device attributes */ + LTERM_LOG(ltermProcessXMLTermSequence,52,("Sending device attributes\n")); + if (ltermSendChar(lts, "\033{?", 3) != 0) + return -1; + + if (strlen(lts->cookie) > 0) { + if (ltermSendChar(lts, lts->cookie, strlen(lts->cookie)) != 0) + return -1; + } + + if (ltermSendChar(lts, "\n", 1) != 0) + return -1; + return 0; + case U_D_CHAR: /* Set debugging messageLevel/search-string */ LTERM_LOG(ltermProcessXMLTermSequence,52,("Setting message level etc.\n")); if (strLength == 0) { diff --git a/extensions/xmlterm/scripts/xcat b/extensions/xmlterm/scripts/xcat index caa34432be89..b673e3658e4e 100755 --- a/extensions/xmlterm/scripts/xcat +++ b/extensions/xmlterm/scripts/xcat @@ -88,7 +88,7 @@ foreach my $url (@ARGV) { # for each argument ($extension eq ".jpg")) { ## print STDERR "Image file\n"; - print "\e{S$cookie\a"; # HTML stream escape sequence + print "\e{S$cookie\n"; # HTML stream escape sequence print ""; print "\000"; # Terminate HTML stream @@ -130,7 +130,7 @@ foreach my $url (@ARGV) { # for each argument my $clickcmd = qq%onClick="return HandleEvent(event,'click','textlink',-\#,'$urlstr')"%; - print "\e{S$cookie\a"; # HTML stream escape sequence + print "\e{S$cookie\n"; # HTML stream escape sequence if ($nurl >= 2) { print "
"; } @@ -142,7 +142,7 @@ foreach my $url (@ARGV) { # for each argument (($scheme eq "file") && (($extension eq ".htm") || ($extension eq ".html")) ) ) { ## print STDERR "IFRAME\n"; - print "\e{S$cookie\a"; # HTML stream escape sequence + print "\e{S$cookie\n"; # HTML stream escape sequence print ""; print "
"; print "Use shift-key + Home/End/PageUp/PageDown to scroll nested IFrame."; @@ -153,7 +153,7 @@ foreach my $url (@ARGV) { # for each argument ## print STDERR "Text file\n"; open INFILE, $pathname or next; - print "\e{S$cookie\a"; # HTML stream escape sequence + print "\e{S$cookie\n"; # HTML stream escape sequence print "
";
 
         while () {
diff --git a/extensions/xmlterm/scripts/xls b/extensions/xmlterm/scripts/xls
index 2a6b3aeb53c8..36a1ad559b1b 100755
--- a/extensions/xmlterm/scripts/xls
+++ b/extensions/xmlterm/scripts/xls
@@ -43,7 +43,7 @@ if (@ARGV) {
 }
 
 my $cookie = $ENV{LTERM_COOKIE};           # XMLTerm cookie
-print "\e{S$cookie\a";                     # HTML stream escape sequence
+print "\e{S$cookie\012";                     # HTML stream escape sequence
 print "";
 print "";
 
diff --git a/extensions/xmlterm/tests/DocStream.c b/extensions/xmlterm/tests/DocStream.c
index 733623199e5d..98c18ffa0f45 100644
--- a/extensions/xmlterm/tests/DocStream.c
+++ b/extensions/xmlterm/tests/DocStream.c
@@ -13,7 +13,7 @@ int main(void)
     cookie = "";
 
   /* XMLTerm escape sequence signalling start of a HTML document */
-  printf("\033{1S%s\007", cookie);
+  printf("\033{1S%s\n", cookie);
 
   printf("  \
  \
@@ -34,10 +34,10 @@ int main(void)
   while((ch = getchar())){ /* Poll for data generated by button click events */
     switch (ch) {
     case 'b':
-      printf("\033{S%s\007Hello World!
%c", cookie, '\0'); + printf("\033{S%s\nHello World!
%c", cookie, '\0'); break; case 'e': - printf("\033{S%s\007Hello World!
%c", cookie, '\0'); + printf("\033{S%s\nHello World!
%c", cookie, '\0'); break; case 'q': return 0; diff --git a/extensions/xmlterm/tests/HelloWorld.c b/extensions/xmlterm/tests/HelloWorld.c index 18ec6e3a729c..9cbb8502dda7 100644 --- a/extensions/xmlterm/tests/HelloWorld.c +++ b/extensions/xmlterm/tests/HelloWorld.c @@ -12,7 +12,7 @@ int main(void) if (cookie == NULL) cookie = ""; - printf("\033{S%s\007", cookie); /* Escape sequence for start of HTML frag */ + printf("\033{S%s\n", cookie); /* Escape sequence for start of HTML frag */ printf(" \ \ @@ -30,10 +30,10 @@ int main(void) while((ch = getchar())){ /* Poll for data generated by button click events */ switch (ch) { case 'b': - printf("\033{S%s\007Hello World!
%c", cookie, '\0'); + printf("\033{S%s\nHello World!
%c", cookie, '\0'); break; case 'e': - printf("\033{S%s\007Hello World!
%c", cookie, '\0'); + printf("\033{S%s\nHello World!
%c", cookie, '\0'); break; case 'q': return 0; @@ -43,7 +43,7 @@ int main(void) } } - printf("\033{1E\007"); /* Enable input echo */ + printf("\033{1E\n"); /* Enable input echo */ return 0; } diff --git a/extensions/xmlterm/tests/escape.c b/extensions/xmlterm/tests/escape.c index c7823985f9d6..e2a53e7a7a88 100644 --- a/extensions/xmlterm/tests/escape.c +++ b/extensions/xmlterm/tests/escape.c @@ -39,17 +39,17 @@ int main(int argc, char *argv[]) } if (nparam == 0) { - fprintf(stderr, "ESC{%s%sBEL\n", code, sparam); - fprintf(stdout, "\033{%s%s\007", code, sparam); + fprintf(stderr, "ESC{%s%s\\n\n", code, sparam); + fprintf(stdout, "\033{%s%s\n", code, sparam); } else if (nparam == 1) { - fprintf(stderr, "ESC{%s%s%sBEL\n", param1, code, sparam); - fprintf(stdout, "\033{%s%s%s\007", param1, code, sparam); + fprintf(stderr, "ESC{%s%s%s\\n\n", param1, code, sparam); + fprintf(stdout, "\033{%s%s%s\n", param1, code, sparam); } else if (nparam == 2) { - fprintf(stderr, "ESC{%s;%s%s%sBEL\n", param1, param2, code, sparam); - fprintf(stdout, "\033{%s;%s%s%s\007", param1, param2, code, sparam); + fprintf(stderr, "ESC{%s;%s%s%s\\n\n", param1, param2, code, sparam); + fprintf(stdout, "\033{%s;%s%s%s\n", param1, param2, code, sparam); } else { - fprintf(stderr, "ESC{%s;%s;%s%s%sBEL\n", param1, param2, param3, code, sparam); - fprintf(stdout, "\033{%s;%s;%s%s%s\007", param1, param2, param3, code, sparam); + fprintf(stderr, "ESC{%s;%s;%s%s%s\\n\n", param1, param2, param3, code, sparam); + fprintf(stdout, "\033{%s;%s;%s%s%s\n", param1, param2, param3, code, sparam); } return 0; diff --git a/extensions/xmlterm/tests/teststream.c b/extensions/xmlterm/tests/teststream.c index 69b65c599d8d..a37296d8296c 100644 --- a/extensions/xmlterm/tests/teststream.c +++ b/extensions/xmlterm/tests/teststream.c @@ -1,19 +1,26 @@ /* teststream.c: Test driver to generate escaped stream data */ #include +#include int main(int argc, char *argv[]) { + char* cookie; + + cookie = getenv("LTERM_COOKIE"); /* Get security cookie */ + if (cookie == NULL) + cookie = ""; + if (argc < 2) { fprintf(stderr, "Usage: %s []\n",argv[0]); return 1; } if (argc > 2) { - /* fprintf(stderr, "{ESCS%sBEL%s%s", argv[2], argv[1], argv[2]); */ - fprintf(stdout, "\033{S%s\007%s%s", argv[2], argv[1], argv[2]); + /* NOT IMPLEMENTED YET */ + fprintf(stdout, "\033{T%s\n%s%s", argv[2], argv[1], argv[2]); } else { - fprintf(stdout, "\033{S\007%s%c", argv[1], '\0'); + fprintf(stdout, "\033{S%s\n%s%c", cookie, argv[1], '\0'); } return 0;