]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - progs/tic.c
ncurses 6.2 - patch 20210703
[ncurses.git] / progs / tic.c
index 49e0a1d8b77abff9bbf24f9764c7566e630a3c88..283201afb913b8687ee15bd769a3fc2156e367c3 100644 (file)
@@ -49,7 +49,7 @@
 #include <parametrized.h>
 #include <transform.h>
 
-MODULE_ID("$Id: tic.c,v 1.294 2021/04/03 22:51:09 tom Exp $")
+MODULE_ID("$Id: tic.c,v 1.296 2021/06/26 19:44:08 tom Exp $")
 
 #define STDIN_NAME "<stdin>"
 
@@ -116,8 +116,6 @@ free_namelist(char **src)
 static void
 cleanup(void)
 {
-    int rc;
-
 #if NO_LEAKS
     free_namelist(namelst);
     _nc_leaks_dump_entry();
@@ -125,6 +123,8 @@ cleanup(void)
     if (tmp_fp != 0)
        fclose(tmp_fp);
     if (to_remove != 0) {
+       int rc;
+
 #if HAVE_REMOVE
        rc = remove(to_remove);
 #else
@@ -400,7 +400,7 @@ open_tempfile(char *filename)
     }
 #else
     if (tmpnam(filename) != 0)
-       result = fopen(filename, "w");
+       result = safe_fopen(filename, "w");
 #endif
     return result;
 }
@@ -442,7 +442,7 @@ copy_input(FILE *source, const char *filename, char *alt_file)
         * the one that we were writing on before starting to read from the
         * second stream.
         */
-       result = fopen(alt_file, "r+");
+       result = safe_fopen(alt_file, "r+");
        fclose(target);
        to_remove = strdup(alt_file);
     }
@@ -466,7 +466,7 @@ open_input(const char *filename, char *alt_file)
        fprintf(stderr, "%s: %s is not a file\n", _nc_progname, filename);
        ExitProgram(EXIT_FAILURE);
     } else {
-       fp = fopen(filename, "r");
+       fp = safe_fopen(filename, "r");
 
        if (fp == 0) {
            fprintf(stderr, "%s: Can't open %s\n", _nc_progname, filename);
@@ -2683,11 +2683,11 @@ static void
 check_conflict(TERMTYPE2 *tp)
 {
     bool conflict = FALSE;
-    unsigned j, k;
 
     if (!(_nc_syntax == SYN_TERMCAP && capdump)) {
        char *check = calloc((size_t) (NUM_STRINGS(tp) + 1), sizeof(char));
        NAME_VALUE *given = get_fkey_list(tp);
+       unsigned j, k;
 
        if (check == 0)
            failed("check_conflict");