=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/less/tags.c,v retrieving revision 1.1.1.3 retrieving revision 1.1.1.4 diff -u -r1.1.1.3 -r1.1.1.4 --- src/usr.bin/less/tags.c 2011/09/16 17:47:08 1.1.1.3 +++ src/usr.bin/less/tags.c 2014/04/25 13:33:52 1.1.1.4 @@ -1,11 +1,10 @@ /* - * Copyright (C) 1984-2011 Mark Nudelman + * Copyright (C) 1984-2012 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. * - * For more information about less, or for information on how to - * contact the author, see the README file. + * For more information, see the README file. */ @@ -21,7 +20,7 @@ static int curseq; extern int linenums; -extern int sigs; +extern volatile sig_atomic_t sigs; enum tag_result { TAG_FOUND, @@ -120,17 +119,13 @@ register struct tag *tp; tp = (struct tag *) ecalloc(sizeof(struct tag), 1); - tp->tag_file = (char *) ecalloc(strlen(file) + 1, sizeof(char)); - strcpy(tp->tag_file, file); + tp->tag_file = save(file); tp->tag_linenum = linenum; tp->tag_endline = endline; if (pattern == NULL) tp->tag_pattern = NULL; else - { - tp->tag_pattern = (char *) ecalloc(strlen(pattern) + 1, sizeof(char)); - strcpy(tp->tag_pattern, pattern); - } + tp->tag_pattern = save(pattern); return (tp); } @@ -477,6 +472,7 @@ char buf[256]; FILE *fp; struct tag *tp; + size_t len; if (type != T_CTAGS_X && tag == NULL) return TAG_NOFILE; @@ -528,9 +524,9 @@ qtag = shell_quote(tag); if (qtag == NULL) qtag = tag; - command = (char *) ecalloc(strlen(cmd) + strlen(flag) + - strlen(qtag) + 5, sizeof(char)); - sprintf(command, "%s -x%s %s", cmd, flag, qtag); + len = strlen(cmd) + strlen(flag) + strlen(qtag) + 5; + command = (char *) ecalloc(len, sizeof(char)); + snprintf(command, len, "%s -x%s %s", cmd, flag, qtag); if (qtag != tag) free(qtag); fp = popen(command, "r"); @@ -542,7 +538,6 @@ while (fgets(buf, sizeof(buf), fp)) { char *name, *file, *line; - int len; if (sigs) {