X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=progs%2Ftic.c;h=739e7ed71ac4aa7fab979c6fdca22d176391e4a8;hb=e4f74c675a54486fed6c2e127391203849c3515a;hp=62f1f0a3be3507f57323dd36ee78bb7fe39e865b;hpb=a1efee451ca15ad519932af3bcb2f7e9f8962811;p=platform%2Fupstream%2Fncurses.git diff --git a/progs/tic.c b/progs/tic.c index 62f1f0a..739e7ed 100644 --- a/progs/tic.c +++ b/progs/tic.c @@ -44,7 +44,7 @@ #include #include -MODULE_ID("$Id: tic.c,v 1.149 2011/05/14 23:24:57 tom Exp $") +MODULE_ID("$Id: tic.c,v 1.150 2011/05/21 18:15:45 tom Exp $") const char *_nc_progname = "tic"; @@ -339,23 +339,23 @@ put_translate(int c) static char * stripped(char *src) { + char *dst = 0; + while (isspace(UChar(*src))) src++; + if (*src != '\0') { - char *dst; size_t len; - if ((dst = strdup(src)) == NULL) + if ((dst = strdup(src)) == NULL) { failed("strdup"); - - assert(dst != 0); - - len = strlen(dst); - while (--len != 0 && isspace(UChar(dst[len]))) - dst[len] = '\0'; - return dst; + } else { + len = strlen(dst); + while (--len != 0 && isspace(UChar(dst[len]))) + dst[len] = '\0'; + } } - return 0; + return dst; } static FILE *