X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=progs%2Ftic.c;h=3d894acd2d406b850c465268400a2b6c2933c31b;hp=31045a63a2a2d6a104d979798b74ca681a44aabe;hb=3996fe0bf797f113d6abc4329cc869951735a4d8;hpb=8f527f87c0b979d9c2598ef5c3394463af288468 diff --git a/progs/tic.c b/progs/tic.c index 31045a63..3d894acd 100644 --- a/progs/tic.c +++ b/progs/tic.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. * + * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -44,7 +44,7 @@ #include #include -MODULE_ID("$Id: tic.c,v 1.135 2008/08/04 12:43:40 tom Exp $") +MODULE_ID("$Id: tic.c,v 1.139 2009/12/12 17:30:12 Nicholas.Marriott Exp $") const char *_nc_progname = "tic"; @@ -99,7 +99,7 @@ free_namelist(char **src) #endif static void -cleanup(char **namelst) +cleanup(char **namelst GCC_UNUSED) { #if NO_LEAKS free_namelist(namelst); @@ -342,8 +342,12 @@ stripped(char *src) while (isspace(UChar(*src))) src++; if (*src != '\0') { - char *dst = strcpy((char *) malloc(strlen(src) + 1), src); - size_t len = strlen(dst); + char *dst; + size_t len; + + if ((dst = strdup(src)) == NULL) + failed("strdup"); + len = strlen(dst); while (--len != 0 && isspace(UChar(dst[len]))) dst[len] = '\0'; return dst; @@ -495,11 +499,11 @@ main(int argc, char *argv[]) _nc_progname = _nc_rootname(argv[0]); - if ((infodump = (strcmp(_nc_progname, PROG_CAPTOINFO) == 0)) != FALSE) { + if ((infodump = same_program(_nc_progname, PROG_CAPTOINFO)) != FALSE) { outform = F_TERMINFO; sortmode = S_TERMINFO; } - if ((capdump = (strcmp(_nc_progname, PROG_INFOTOCAP) == 0)) != FALSE) { + if ((capdump = same_program(_nc_progname, PROG_INFOTOCAP)) != FALSE) { outform = F_TERMCAP; sortmode = S_TERMCAP; } @@ -759,7 +763,7 @@ main(int argc, char *argv[]) dump_entry(&qp->tterm, suppress_untranslatable, limited, numbers, NULL); - for (j = 0; j < qp->nuses; j++) + for (j = 0; j < (int) qp->nuses; j++) dump_uses(qp->uses[j].name, !capdump); len = show_entry(); if (debug_level != 0 && !limited)