diff --git a/icu4c/source/tools/gennames/gennames.c b/icu4c/source/tools/gennames/gennames.c index 774d455e8f..a613c05985 100644 --- a/icu4c/source/tools/gennames/gennames.c +++ b/icu4c/source/tools/gennames/gennames.c @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 1999-2001, International Business Machines +* Copyright (C) 1999-2003, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -369,6 +369,22 @@ init() { /* parsing ------------------------------------------------------------------ */ +/* get a name, strip leading and trailing whitespace */ +static int16_t +getName(char **pStart, char *limit) { + /* strip leading whitespace */ + char *start=(char *)u_skipWhitespace(*pStart); + + /* strip trailing whitespace */ + while(start brackets */ lengths[0]=0; } @@ -397,15 +412,16 @@ lineFn(void *context, /* get the second character name, the one from Unicode 1.0 */ /* do not store pseudo-names in <> brackets */ names[1]=fields[10][0]; - if(*(UBool *)context && fields[10][0][0]!='<') { - lengths[1]=(int16_t)(fields[10][1]-names[1]); + lengths[1]=getName(names+1, fields[10][1]); + if(*(UBool *)context && names[1][0]!='<') { + /* keep the name */ } else { lengths[1]=0; } /* get the ISO 10646 comment */ names[2]=fields[11][0]; - lengths[2]=(int16_t)(fields[11][1]-names[2]); + lengths[2]=getName(names+2, fields[11][1]); if(lengths[0]+lengths[1]+lengths[2]==0) { return;