Add get_compilation_date() and td_jpeg_version() functions
This commit is contained in:
parent
791794a74f
commit
f7a3262623
6 changed files with 69 additions and 60 deletions
|
@ -51,6 +51,7 @@ typedef int boolean;
|
|||
#include "filegen.h"
|
||||
#include "common.h"
|
||||
#include "log.h"
|
||||
#include "file_jpg.h"
|
||||
#include "file_tiff.h"
|
||||
|
||||
extern const file_hint_t file_hint_indd;
|
||||
|
@ -1445,3 +1446,18 @@ int data_check_jpg(const unsigned char *buffer, const unsigned int buffer_size,
|
|||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char*td_jpeg_version(void)
|
||||
{
|
||||
#if defined(HAVE_LIBJPEG)
|
||||
#if defined(JPEG_LIB_VERSION)
|
||||
static char buffer[32];
|
||||
sprintf(buffer,"%d", JPEG_LIB_VERSION);
|
||||
return buffer;
|
||||
#else
|
||||
return "yes";
|
||||
#endif
|
||||
#else
|
||||
return "none";
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
int64_t test_jpeg(FILE *infile);
|
||||
const char*td_jpeg_version(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* closing brace for extern "C" */
|
||||
|
|
72
src/misc.c
72
src/misc.c
|
@ -44,9 +44,9 @@
|
|||
|
||||
const char *get_os(void)
|
||||
{
|
||||
static char buffer[100] = {0x00};
|
||||
#ifdef WIN32
|
||||
{
|
||||
static char buffer[100] = {0x00};
|
||||
/* For more information, read
|
||||
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getting_the_system_version.asp
|
||||
*/
|
||||
|
@ -148,55 +148,60 @@ http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/ge
|
|||
if (Extended && Ver.wServicePackMajor != 0) {
|
||||
snprintf(buffer+strlen(buffer), sizeof(buffer) - 1 - strlen(buffer)," SP%i",Ver.wServicePackMajor);
|
||||
}
|
||||
return buffer;
|
||||
}
|
||||
#elif defined(DJGPP)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "DOS");
|
||||
return "DOS";
|
||||
#elif defined(HAVE_SYS_UTSNAME_H)
|
||||
{
|
||||
struct utsname Ver;
|
||||
uname(&Ver);
|
||||
if(uname(&Ver)==0)
|
||||
{
|
||||
static char buffer[100] = {0x00};
|
||||
snprintf(buffer, sizeof(buffer) - 1, "%s, kernel %s (%s) %s", Ver.sysname, Ver.release, Ver.version, Ver.machine);
|
||||
return buffer;
|
||||
}
|
||||
#elif defined(__FreeBSD__)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "FreeBSD");
|
||||
}
|
||||
#endif
|
||||
#if defined(__FreeBSD__)
|
||||
return "FreeBSD";
|
||||
#elif defined(__NetBSD__)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "NetBSD");
|
||||
return "NetBSD";
|
||||
#elif defined(__OpenBSD__)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "OpenBSD");
|
||||
return "BSD";
|
||||
#elif defined(__GNU__)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "GNU/Hurd");
|
||||
return "GNU/Hurd";
|
||||
#elif defined(sun) || defined(__sun) || defined(__sun__)
|
||||
# ifdef __SVR4
|
||||
snprintf(buffer, sizeof(buffer) - 1, "Sun Solaris");
|
||||
return "Sun Solaris";
|
||||
# else
|
||||
snprintf(buffer, sizeof(buffer) - 1, "SunOS");
|
||||
return "SunOS";
|
||||
# endif
|
||||
#elif defined(hpux) || defined(__hpux) || defined(__hpux__)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "HP-UX");
|
||||
return "HP-UX";
|
||||
#elif defined(ultrix) || defined(__ultrix) || defined(__ultrix__)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "DEC Ultrix");
|
||||
return "DEC Ultrix";
|
||||
#elif defined(sgi) || defined(__sgi)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "SGI Irix");
|
||||
return "SGI Irix";
|
||||
#elif defined(__osf__)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "OSF Unix");
|
||||
return "OSF Unix";
|
||||
#elif defined(bsdi) || defined(__bsdi__)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "BSDI Unix");
|
||||
return "BSDI Unix";
|
||||
#elif defined(_AIX)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "AIX Unix");
|
||||
return "AIX Unix";
|
||||
#elif defined(_UNIXWARE)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "SCO Unixware");
|
||||
return "SCO Unixware";
|
||||
#elif defined(DGUX)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "DG Unix");
|
||||
return "DG Unix";
|
||||
#elif defined(__QNX__)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "QNX");
|
||||
return "QNX";
|
||||
#elif defined(__APPLE__)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "Apple");
|
||||
return "Apple";
|
||||
#elif defined(__OS2__)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "OS2");
|
||||
return "OS2";
|
||||
#else
|
||||
snprintf(buffer, sizeof(buffer) - 1, "unknown");
|
||||
return "unknown";
|
||||
#endif
|
||||
return buffer;
|
||||
}
|
||||
|
||||
const char *get_compiler(void)
|
||||
|
@ -205,13 +210,13 @@ const char *get_compiler(void)
|
|||
#ifdef WIN32
|
||||
# ifdef _MSC_VER
|
||||
if (_MSC_VER == 1200) { /* ? */
|
||||
snprintf(buffer, sizeof(buffer) - 1, "MS VC 6.0");
|
||||
return "MS VC 6.0";
|
||||
} else if (_MSC_VER == 1300) {
|
||||
snprintf(buffer, sizeof(buffer) - 1, "MS VC .NET 2002");
|
||||
return "MS VC .NET 2002";
|
||||
} else if (_MSC_VER == 1310) {
|
||||
snprintf(buffer, sizeof(buffer) - 1, "MS VC .NET 2003");
|
||||
return "MS VC .NET 2003";
|
||||
} else if (_MSC_VER == 1400) {
|
||||
snprintf(buffer, sizeof(buffer) - 1, "MS VC .NET 2005");
|
||||
return "MS VC .NET 2005";
|
||||
} else {
|
||||
snprintf(buffer, sizeof(buffer) - 1, "MS VC %i",_MSC_VER);
|
||||
}
|
||||
|
@ -228,7 +233,7 @@ const char *get_compiler(void)
|
|||
# elif defined(__GNUC__)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "GCC %i.%i", __GNUC__, __GNUC_MINOR__);
|
||||
# else
|
||||
snprintf(buffer, sizeof(buffer) - 1, "unknown compiler");
|
||||
return "unknown compiler";
|
||||
# endif
|
||||
#elif defined(DJGPP)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "djgpp %d.%d", __DJGPP, __DJGPP_MINOR);
|
||||
|
@ -239,11 +244,16 @@ const char *get_compiler(void)
|
|||
#elif defined(__INTEL_COMPILER)
|
||||
snprintf(buffer, sizeof(buffer) - 1, "Intel Compiler %ld", __INTEL_COMPILER);
|
||||
#else
|
||||
snprintf(buffer, sizeof(buffer) - 1, "unknown compiler");
|
||||
return "unknown compiler";
|
||||
#endif
|
||||
return buffer;
|
||||
}
|
||||
|
||||
const char *get_compilation_date(void)
|
||||
{
|
||||
static char buffer[100] = {0x00};
|
||||
#ifdef __DATE__
|
||||
strcat(buffer, " - ");
|
||||
strcat(buffer, __DATE__);
|
||||
strcpy(buffer, __DATE__);
|
||||
#ifdef __TIME__
|
||||
strcat(buffer, " ");
|
||||
strcat(buffer, __TIME__);
|
||||
|
|
|
@ -25,6 +25,7 @@ extern "C" {
|
|||
|
||||
const char *get_os(void);
|
||||
const char *get_compiler(void);
|
||||
const char *get_compilation_date(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* closing brace for extern "C" */
|
||||
|
|
34
src/phmain.c
34
src/phmain.c
|
@ -62,9 +62,6 @@
|
|||
#ifdef HAVE_NCURSES
|
||||
#include "intrfn.h"
|
||||
#endif
|
||||
#ifdef HAVE_JPEGLIB_H
|
||||
#include <jpeglib.h>
|
||||
#endif
|
||||
#include "dir.h"
|
||||
#include "filegen.h"
|
||||
#include "photorec.h"
|
||||
|
@ -76,6 +73,7 @@
|
|||
#include "phcfg.h"
|
||||
#include "misc.h"
|
||||
#include "ext2_dir.h"
|
||||
#include "file_jpg.h"
|
||||
#include "ntfs_dir.h"
|
||||
#include "pdisksel.h"
|
||||
extern const arch_fnct_t arch_none;
|
||||
|
@ -219,18 +217,9 @@ int main( int argc, char **argv )
|
|||
printf("\n");
|
||||
printf("Version: %s\n", VERSION);
|
||||
printf("Compiler: %s\n", get_compiler());
|
||||
printf("ext2fs lib: %s, ntfs lib: %s, ewf lib: %s, libjpeg: ",
|
||||
td_ext2fs_version(), td_ntfs_version(), td_ewf_version());
|
||||
#if defined(HAVE_LIBJPEG)
|
||||
#if defined(JPEG_LIB_VERSION)
|
||||
printf("%d", JPEG_LIB_VERSION);
|
||||
#else
|
||||
printf("yes");
|
||||
#endif
|
||||
#else
|
||||
printf("none");
|
||||
#endif
|
||||
printf("\n");
|
||||
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("OS: %s\n" , get_os());
|
||||
return 0;
|
||||
}
|
||||
|
@ -302,18 +291,9 @@ int main( int argc, char **argv )
|
|||
log_info("PhotoRec %s, Data Recovery Utility, %s\nChristophe GRENIER <grenier@cgsecurity.org>\nhttp://www.cgsecurity.org\n", VERSION, TESTDISKDATE);
|
||||
log_info("OS: %s\n" , get_os());
|
||||
log_info("Compiler: %s\n", get_compiler());
|
||||
log_info("ext2fs lib: %s, ntfs lib: %s, ewf lib: %s, libjpeg: ",
|
||||
td_ext2fs_version(), td_ntfs_version(), td_ewf_version());
|
||||
#if defined(HAVE_LIBJPEG)
|
||||
#if defined(JPEG_LIB_VERSION)
|
||||
log_info("%d", JPEG_LIB_VERSION);
|
||||
#else
|
||||
log_info("yes");
|
||||
#endif
|
||||
#else
|
||||
log_info("none");
|
||||
#endif
|
||||
log_info("\n");
|
||||
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());
|
||||
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(DJGPP)
|
||||
#else
|
||||
#ifdef HAVE_GETEUID
|
||||
|
|
|
@ -222,6 +222,7 @@ int main( int argc, char **argv )
|
|||
printf("\n");
|
||||
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("OS: %s\n" , get_os());
|
||||
|
@ -345,6 +346,7 @@ int main( int argc, char **argv )
|
|||
log_info("TestDisk %s, Data Recovery Utility, %s\nChristophe GRENIER <grenier@cgsecurity.org>\nhttp://www.cgsecurity.org\n", VERSION, TESTDISKDATE);
|
||||
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());
|
||||
#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(DJGPP)
|
||||
|
|
Loading…
Reference in a new issue