=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ctags/ctags.c,v retrieving revision 1.4 retrieving revision 1.5 diff -c -r1.4 -r1.5 *** src/usr.bin/ctags/ctags.c 1999/07/02 18:37:11 1.4 --- src/usr.bin/ctags/ctags.c 2000/07/25 19:28:30 1.5 *************** *** 1,4 **** ! /* $OpenBSD: ctags.c,v 1.4 1999/07/02 18:37:11 deraadt Exp $ */ /* $NetBSD: ctags.c,v 1.4 1995/09/02 05:57:23 jtc Exp $ */ /* --- 1,4 ---- ! /* $OpenBSD: ctags.c,v 1.5 2000/07/25 19:28:30 deraadt Exp $ */ /* $NetBSD: ctags.c,v 1.4 1995/09/02 05:57:23 jtc Exp $ */ /* *************** *** 44,50 **** #if 0 static char sccsid[] = "@(#)ctags.c 8.4 (Berkeley) 2/7/95"; #endif ! static char rcsid[] = "$OpenBSD: ctags.c,v 1.4 1999/07/02 18:37:11 deraadt Exp $"; #endif /* not lint */ #include --- 44,50 ---- #if 0 static char sccsid[] = "@(#)ctags.c 8.4 (Berkeley) 2/7/95"; #endif ! static char rcsid[] = "$OpenBSD: ctags.c,v 1.5 2000/07/25 19:28:30 deraadt Exp $"; #endif /* not lint */ #include *************** *** 95,101 **** int exit_val; /* exit value */ int step; /* step through args */ int ch; /* getopts char */ ! char cmd[100]; /* too ugly to explain */ aflag = uflag = NO; while ((ch = getopt(argc, argv, "BFadf:tuwvx")) != -1) --- 95,101 ---- int exit_val; /* exit value */ int step; /* step through args */ int ch; /* getopts char */ ! char *cmd; aflag = uflag = NO; while ((ch = getopt(argc, argv, "BFadf:tuwvx")) != -1) *************** *** 160,170 **** else { if (uflag) { for (step = 0; step < argc; step++) { ! (void)sprintf(cmd, ! "mv %s OTAGS; fgrep -v '\t%s\t' OTAGS >%s; rm OTAGS", ! outfile, argv[step], ! outfile); system(cmd); } ++aflag; } --- 160,173 ---- else { if (uflag) { for (step = 0; step < argc; step++) { ! (void)asprintf(&cmd, ! "mv %s OTAGS; fgrep -v '\t%s\t' OTAGS >%s; rm OTAGS", ! outfile, argv[step], outfile); ! if (cmd == NULL) ! err(1, "out of space"); system(cmd); + free(cmd); + cmd = NULL; } ++aflag; } *************** *** 173,181 **** put_entries(head); (void)fclose(outf); if (uflag) { ! (void)sprintf(cmd, "sort -o %s %s", ! outfile, outfile); system(cmd); } } } --- 176,188 ---- put_entries(head); (void)fclose(outf); if (uflag) { ! (void)asprintf(&cmd, "sort -o %s %s", ! outfile, outfile); ! if (cmd == NULL) ! err(1, "out of space"); system(cmd); + free(cmd); + cmd = NULL; } } } *************** *** 231,237 **** char *cp; lineno = 0; /* should be 1 ?? KB */ ! if (cp = strrchr(file, '.')) { if (cp[1] == 'l' && !cp[2]) { int c; --- 238,244 ---- char *cp; lineno = 0; /* should be 1 ?? KB */ ! if ((cp = strrchr(file, '.'))) { if (cp[1] == 'l' && !cp[2]) { int c;