diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2007-10-26 14:32:15 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2007-10-26 14:32:15 (GMT) |
commit | d2b63746183fe9a91992b7327fcc262fef67f088 (patch) | |
tree | 7d4e9a884720c15da35cf61e39bdd49d32bf2794 /tools/man2tcl.c | |
parent | d3af9b6c8c71010caf7b39bc82653ab9db34d055 (diff) | |
download | tcl-d2b63746183fe9a91992b7327fcc262fef67f088.zip tcl-d2b63746183fe9a91992b7327fcc262fef67f088.tar.gz tcl-d2b63746183fe9a91992b7327fcc262fef67f088.tar.bz2 |
Working towards better nroff scraping...
Diffstat (limited to 'tools/man2tcl.c')
-rw-r--r-- | tools/man2tcl.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/tools/man2tcl.c b/tools/man2tcl.c index a90b729..8ddeb20 100644 --- a/tools/man2tcl.c +++ b/tools/man2tcl.c @@ -15,7 +15,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: man2tcl.c,v 1.11 2007/01/19 08:17:35 mistachkin Exp $ + * RCS: @(#) $Id: man2tcl.c,v 1.12 2007/10/26 14:32:16 dkf Exp $ */ static char sccsid[] = "@(#) man2tcl.c 1.3 95/08/12 17:34:08"; @@ -329,6 +329,9 @@ DoText( p++; } else if (*p == '&') { p++; + } else if (*p == '0') { + PRINT(("text { }\n")); + p++; } else if (*p == '(') { if ((p[1] == 0) || (p[2] == 0)) { fprintf(stderr, "Bad \\( sequence on line %d.\n", @@ -338,6 +341,13 @@ DoText( PRINT(("char {\\(%c%c}\n", p[1], p[2])); p += 3; } + } else if (*p == 'N' && *(p+1) == '\'') { + int ch; + + p += 2; + sscanf(p,"%d",&ch); + PRINT(("text \\u%04x", ch)); + while(*p&&*p!='\'') p++; } else if (*p != 0) { PRINT(("char {\\%c}\n", *p)); p++; @@ -377,7 +387,23 @@ QuoteText( } for ( ; count > 0; string++, count--) { switch (*string) { - case '$': case '[': case '{': case ' ': case ';': case '\\': + case '\\': + if (*(string+1) == 'N' && *(string+2) == '\'') { + int ch; + + string += 3; + count -= 3; + sscanf(string,"%d",&ch); + PRINT(("\\u%04x", ch)); + while(count>0&&*string!='\'') {string++;count--;} + continue; + } else if (*(string+1) == '0') { + PRINT(("\\ ")); + string++; + count--; + continue; + } + case '$': case '[': case '{': case ' ': case ';': case '"': case '\t': PRINTC('\\'); default: |