]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/trace/lib_trace.c
ncurses 5.6 - patch 20070714
[ncurses.git] / ncurses / trace / lib_trace.c
index 3e29f326f8f1083b43f5769d1a6acd43fc1a986c..34973daae8294f5394ecf096f938dae18f11c1da 100644 (file)
@@ -46,7 +46,7 @@
 
 #include <ctype.h>
 
 
 #include <ctype.h>
 
-MODULE_ID("$Id: lib_trace.c,v 1.61 2007/04/21 23:06:07 tom Exp $")
+MODULE_ID("$Id: lib_trace.c,v 1.62 2007/07/14 19:32:54 tom Exp $")
 
 NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */
 
 
 NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */
 
@@ -65,11 +65,14 @@ trace(const unsigned int tracelevel)
        const char *mode = _nc_globals.init_trace ? "ab" : "wb";
 
        if (TracePath[0] == '\0') {
        const char *mode = _nc_globals.init_trace ? "ab" : "wb";
 
        if (TracePath[0] == '\0') {
-           if (getcwd(TracePath, sizeof(TracePath) - 10) == 0) {
+           if (getcwd(TracePath, sizeof(TracePath) - 12) == 0) {
                perror("curses: Can't get working directory");
                exit(EXIT_FAILURE);
            }
            strcat(TracePath, "/trace");
                perror("curses: Can't get working directory");
                exit(EXIT_FAILURE);
            }
            strcat(TracePath, "/trace");
+           if (_nc_is_dir_path(TracePath)) {
+               strcat(TracePath, ".log");
+           }
        }
 
        _nc_globals.init_trace = TRUE;
        }
 
        _nc_globals.init_trace = TRUE;