Attachment "tcl_85_changes.diff" to
ticket [2140847fff]
added by
mistachkin
2008-10-03 01:29:11.
Index: tools/man2help2.tcl
===================================================================
RCS file: /cvsroot/tcl/tcl/tools/man2help2.tcl,v
retrieving revision 1.17
diff -b -u -r1.17 man2help2.tcl
--- tools/man2help2.tcl 13 Dec 2007 15:28:40 -0000 1.17
+++ tools/man2help2.tcl 1 Oct 2008 18:08:06 -0000
@@ -600,7 +600,7 @@
set relativeTo [expr {$state(leftMargin) \
+ ($state(offset) * $state(nestingLevel))}]
}
- if {[regexp {^\w'(.*)'u$} $arg -> submatch]} {
+ if {[regexp {^\\w'([^']*)'u$} $arg -> submatch]} {
# Magic factor!
set distance [expr {[string length $submatch] * 86.4}]
} else {
@@ -976,6 +976,10 @@
puts stderr "bad distance \"$arg\""
return 0
}
+ if {[string length $units] > 1} {
+ puts stderr "additional characters after unit \"$arg\""
+ set units [string index $units 0]
+ }
switch -- $units {
c {
set distance [expr {$distance * 567}]
@@ -985,7 +989,7 @@
}
default {
puts stderr "bad units in distance \"$arg\""
- continue
+ return 0
}
}
return $distance
Index: tools/man2tcl.c
===================================================================
RCS file: /cvsroot/tcl/tcl/tools/man2tcl.c,v
retrieving revision 1.13
diff -b -u -r1.13 man2tcl.c
--- tools/man2tcl.c 13 Dec 2007 15:28:40 -0000 1.13
+++ tools/man2tcl.c 1 Oct 2008 18:08:06 -0000
@@ -96,7 +96,7 @@
char **argv) /* Values of command-line arguments. */
{
FILE *f;
-#define MAX_LINE_SIZE 1000
+#define MAX_LINE_SIZE 4000
char line[MAX_LINE_SIZE];
char *p;
@@ -197,6 +197,7 @@
* invocation. */
{
char *p, *end;
+ int quote;
/*
* If there is no macro name, then just skip the whole line.
@@ -234,8 +235,11 @@
}
QuoteText(p+1, (end-(p+1)));
} else {
- for (end = p+1; (*end != 0) && !isspace(*end); end++) {
- /* Empty loop body. */
+ quote = 0;
+ for (end = p+1; (*end != 0) && (quote || !isspace(*end)); end++) {
+ if (*end == '\'') {
+ quote = !quote;
+ }
}
QuoteText(p, end-p);
}
@@ -346,7 +350,7 @@
p += 2;
sscanf(p,"%d",&ch);
- PRINT(("text \\u%04x", ch));
+ PRINT(("text \\u%04x\n", ch));
while(*p&&*p!='\'') p++;
} else if (*p != 0) {
PRINT(("char {\\%c}\n", *p));