summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2015-04-16 08:23:24 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2015-04-16 08:23:24 +0200
commitdd664527743fa4e5570e0a3e38e186370e7b23e2 (patch)
tree7aab2f161ac15fc6be0f06b80b6cf500077bb256 /src
parenta58ebc0ee09c28f095ca40080858dbf5becd730a (diff)
Report pdcurses/ncurses library version
Diffstat (limited to 'src')
-rw-r--r--src/intrfn.c19
-rw-r--r--src/intrfn.h1
-rw-r--r--src/phmain.c8
-rw-r--r--src/testdisk.c8
4 files changed, 28 insertions, 8 deletions
diff --git a/src/intrfn.c b/src/intrfn.c
index fb0e5ae..ac5b2ff 100644
--- a/src/intrfn.c
+++ b/src/intrfn.c
@@ -1071,7 +1071,9 @@ static void get_newterm(const char *prog_name)
return ;
#ifdef HAVE_SETENV
/* NCurses 5.9 caches the env variables during 1s, so sleep to avoid this cache */
+#if defined(NCURSES_VERSION_MAJOR) && defined(NCURSES_VERSION_MINOR) && (NCURSES_VERSION_MAJOR > 5 || (NCURSES_VERSION_MAJOR == 5 && NCURSES_VERSION_MINOR>7))
sleep(2);
+#endif
tmp=strdup(prog_name);
dirname_prog= dirname(tmp);
dirs=(char *)MALLOC(strlen(dirname_prog)+2+1);
@@ -1370,10 +1372,27 @@ const char *ask_string_ncurses(const char *string)
return &response[0];
}
+const char *td_curses_version(void)
+{
+ static char curses_version_string[512];
+#ifdef NCURSES_VERSION
+ snprintf(curses_version_string, sizeof(curses_version_string), "ncurses %s", NCURSES_VERSION);
+ return curses_version_string;
+#elif defined(PDC_BUILD)
+ snprintf(curses_version_string, sizeof(curses_version_string), "pdcurses build %u", PDC_BUILD);
+ return curses_version_string;
+#else
+ return "unknown version";
+#endif
+}
#else
#include "log.h"
#include "intrfn.h"
+const char *td_curses_version(void)
+{
+ return "None";
+}
void display_message(const char*msg)
{
diff --git a/src/intrfn.h b/src/intrfn.h
index bd15d5a..03c43f4 100644
--- a/src/intrfn.h
+++ b/src/intrfn.h
@@ -65,6 +65,7 @@ char *ask_log_location(const char*filename, const int errsv);
int get_string(WINDOW *window, char *str, const int len, const char *def);
uint64_t ask_int_ncurses(const char *string);
const char *ask_string_ncurses(const char *string);
+const char *td_curses_version(void);
#endif
void display_message(const char*msg);
diff --git a/src/phmain.c b/src/phmain.c
index 5ba4174..869f01e 100644
--- a/src/phmain.c
+++ b/src/phmain.c
@@ -115,8 +115,8 @@ static void display_version(void)
printf("Version: %s\n", VERSION);
printf("Compiler: %s\n", get_compiler());
printf("Compilation date: %s\n", get_compilation_date());
- printf("ext2fs lib: %s, ntfs lib: %s, ewf lib: %s, libjpeg: %s\n",
- td_ext2fs_version(), td_ntfs_version(), td_ewf_version(), td_jpeg_version());
+ printf("ext2fs lib: %s, ntfs lib: %s, ewf lib: %s, libjpeg: %s, curses lib: %s\n",
+ td_ext2fs_version(), td_ntfs_version(), td_ewf_version(), td_jpeg_version(), td_curses_version());
printf("OS: %s\n" , get_os());
}
@@ -319,8 +319,8 @@ int main( int argc, char **argv )
log_info("OS: %s\n" , get_os());
log_info("Compiler: %s\n", get_compiler());
log_info("Compilation date: %s\n", get_compilation_date());
- log_info("ext2fs lib: %s, ntfs lib: %s, ewf lib: %s, libjpeg: %s\n",
- td_ext2fs_version(), td_ntfs_version(), td_ewf_version(), td_jpeg_version());
+ log_info("ext2fs lib: %s, ntfs lib: %s, ewf lib: %s, libjpeg: %s, curses lib: %s\n",
+ td_ext2fs_version(), td_ntfs_version(), td_ewf_version(), td_jpeg_version(), td_curses_version());
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(DJGPP)
#else
#ifdef HAVE_GETEUID
diff --git a/src/testdisk.c b/src/testdisk.c
index 5d4170c..1e594e9 100644
--- a/src/testdisk.c
+++ b/src/testdisk.c
@@ -118,8 +118,8 @@ static void display_version(void)
printf("Version: %s\n", VERSION);
printf("Compiler: %s\n", get_compiler());
printf("Compilation date: %s\n", get_compilation_date());
- printf("ext2fs lib: %s, ntfs lib: %s, reiserfs lib: %s, ewf lib: %s\n",
- td_ext2fs_version(), td_ntfs_version(), td_reiserfs_version(), td_ewf_version());
+ printf("ext2fs lib: %s, ntfs lib: %s, reiserfs lib: %s, ewf lib: %s, curses lib: %s\n",
+ td_ext2fs_version(), td_ntfs_version(), td_reiserfs_version(), td_ewf_version(), td_curses_version());
printf("OS: %s\n" , get_os());
}
@@ -405,8 +405,8 @@ int main( int argc, char **argv )
log_info("OS: %s\n" , get_os());
log_info("Compiler: %s\n", get_compiler());
log_info("Compilation date: %s\n", get_compilation_date());
- log_info("ext2fs lib: %s, ntfs lib: %s, reiserfs lib: %s, ewf lib: %s\n",
- td_ext2fs_version(), td_ntfs_version(), td_reiserfs_version(), td_ewf_version());
+ log_info("ext2fs lib: %s, ntfs lib: %s, reiserfs lib: %s, ewf lib: %s, curses lib: %s\n",
+ td_ext2fs_version(), td_ntfs_version(), td_reiserfs_version(), td_ewf_version(), td_curses_version());
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(DJGPP)
#else
#ifdef HAVE_GETEUID