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 "
"; 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(" \