diff --git a/configure b/configure index cfc1d635..e2e8dba7 100755 --- a/configure +++ b/configure @@ -1412,7 +1412,7 @@ Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-ncurses Force the use of ncurses over curses - --with-pcre[=prefix] compile xmlpcre part (via libpcre check) + --with-pcre[=prefix] --with-readline[=prefix] compile xmlreadline part (via libreadline check) --with-sqlite3=[ARG] use SQLite 3 library [default=yes], optionally specify the prefix for sqlite3 library @@ -2226,7 +2226,7 @@ fi # Define the identity of the package. PACKAGE=lnav - VERSION=0.1.0 + VERSION=0.2.0 cat >>confdefs.h <<_ACEOF @@ -6613,7 +6613,8 @@ fi if test "$ac_cv_lib_pcre_pcre_compile" = "yes" ; then { $as_echo "$as_me:$LINENO: result: .setting PCRE_LIBS -L$with_pcre/lib -lpcre" >&5 $as_echo ".setting PCRE_LIBS -L$with_pcre/lib -lpcre" >&6; } - PCRE_LIBS="-L$with_pcre/lib -lpcre" + PCRE_LDFLAGS="-L$with_pcre/lib" + PCRE_LIBS="-lpcre" test -d "$with_pcre/include" && PCRE_CFLAGS="-I$with_pcre/include" { $as_echo "$as_me:$LINENO: checking lib pcre" >&5 $as_echo_n "checking lib pcre... " >&6; } @@ -7092,13 +7093,6 @@ _ACEOF case "$host_os" in - darwin*) - -cat >>confdefs.h <<\_ACEOF -#define _APPLE_C_SOURCE /**/ -_ACEOF - - ;; *) # AC_DEFINE([_XOPEN_SOURCE], [500], [Need pread]) diff --git a/configure.in b/configure.in index dfad06d4..75e69afa 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ AC_INIT(lnav, 0.1.0, timothyshanestack@gmail.com) AC_CONFIG_SRCDIR([src/lnav.cc]) -AM_INIT_AUTOMAKE(lnav, 0.1.0) +AM_INIT_AUTOMAKE(lnav, 0.2.0) AC_PREFIX_DEFAULT(/usr/) @@ -77,9 +77,6 @@ AX_PATH_LIB_READLINE([], [AC_MSG_ERROR([readline required to build])]) AX_LIB_SQLITE3("3.0.0") case "$host_os" in - darwin*) - AC_DEFINE([_APPLE_C_SOURCE], [], [Needed for the 'timezone' variable]) - ;; *) # AC_DEFINE([_XOPEN_SOURCE], [500], [Need pread]) AC_DEFINE([_BSD_SOURCE], [], [Need pread]) diff --git a/lnav.m4 b/lnav.m4 index d26e51f0..65c006ed 100644 --- a/lnav.m4 +++ b/lnav.m4 @@ -1,7 +1,7 @@ AC_DEFUN([AX_PATH_LIB_PCRE],[dnl AC_MSG_CHECKING([lib pcre]) AC_ARG_WITH(pcre, -[ --with-pcre[[=prefix]] compile xmlpcre part (via libpcre check)],, +[ --with-pcre[[=prefix]]],, with_pcre="yes") if test ".$with_pcre" = ".no" ; then AC_MSG_RESULT([disabled]) @@ -23,7 +23,8 @@ else LDFLAGS="$OLDLDFLAGS" if test "$ac_cv_lib_pcre_pcre_compile" = "yes" ; then AC_MSG_RESULT(.setting PCRE_LIBS -L$with_pcre/lib -lpcre) - PCRE_LIBS="-L$with_pcre/lib -lpcre" + PCRE_LDFLAGS="-L$with_pcre/lib" + PCRE_LIBS="-lpcre" test -d "$with_pcre/include" && PCRE_CFLAGS="-I$with_pcre/include" AC_MSG_CHECKING([lib pcre]) AC_MSG_RESULT([$PCRE_LIBS]) diff --git a/src/Makefile.am b/src/Makefile.am index 93d53c59..ceaea56f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -24,6 +24,7 @@ endif AM_LDFLAGS = \ $(SQLITE3_LDFLAGS) \ + $(PCRE_LDFLAGS) \ -pthread AM_CPPFLAGS = \ @@ -36,6 +37,7 @@ LDADD = \ $(CURSES_LIB) \ $(HELP_O) \ $(SQLITE3_LIBS) \ + $(PCRE_LIBS) \ -lpcrecpp noinst_HEADERS = \ diff --git a/src/Makefile.in b/src/Makefile.in index 0a8e761e..5bce86c4 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -72,7 +72,7 @@ am__DEPENDENCIES_1 = @HAVE_OBJ_FORMAT_TRUE@am__DEPENDENCIES_2 = help.o lnav_DEPENDENCIES = libdiag.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_1) + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -206,6 +206,7 @@ noinst_LIBRARIES = libdiag.a @HAVE_OBJ_FORMAT_TRUE@HELP_SRC = AM_LDFLAGS = \ $(SQLITE3_LDFLAGS) \ + $(PCRE_LDFLAGS) \ -pthread AM_CPPFLAGS = \ @@ -218,6 +219,7 @@ LDADD = \ $(CURSES_LIB) \ $(HELP_O) \ $(SQLITE3_LIBS) \ + $(PCRE_LIBS) \ -lpcrecpp noinst_HEADERS = \ diff --git a/src/config.h.in b/src/config.h.in index a18cdb67..6c57f57d 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -96,8 +96,5 @@ /* Version number of package */ #undef VERSION -/* Needed for the 'timezone' variable */ -#undef _APPLE_C_SOURCE - /* Need pread */ #undef _BSD_SOURCE diff --git a/src/log_format.cc b/src/log_format.cc index 3c6ef604..2f2e9764 100644 --- a/src/log_format.cc +++ b/src/log_format.cc @@ -156,7 +156,6 @@ int log_format::log_scanf(const char *line, while (next_format(fmt, curr_fmt, this->lf_fmt_lock)) { time_dest[0] = '\0'; - memset(tm_out, 0, sizeof(struct tm)); retval = vsscanf(line, fmt[curr_fmt], args); if (retval < expected_matches) { @@ -177,11 +176,13 @@ int log_format::log_scanf(const char *line, while (next_format(time_fmt, curr_time_fmt, this->lf_time_fmt_lock)) { + memset(tm_out, 0, sizeof(struct tm)); if (strptime(time_dest, time_fmt[curr_time_fmt], tm_out) != NULL) { if (tm_out->tm_year < 70) { - tm_out->tm_year = 1970; + // XXX We should pull the time from the file mtime (?) + tm_out->tm_year = 80; } time_out = tm2sec(tm_out); diff --git a/src/log_format_impls.cc b/src/log_format_impls.cc index c09e0738..562e48b9 100644 --- a/src/log_format_impls.cc +++ b/src/log_format_impls.cc @@ -238,7 +238,7 @@ class strace_log_format : public log_format { char timestr[64]; time_t line_time; int usecs; - + if (this->log_scanf(prefix, log_fmt, 2, diff --git a/test/logfile_strace_log.0 b/test/logfile_strace_log.0 new file mode 100644 index 00000000..cc74c002 --- /dev/null +++ b/test/logfile_strace_log.0 @@ -0,0 +1,9 @@ +08:09:33.814936 execve("/bin/ls", ["ls"], [/* 38 vars */]) = 0 <0.000264> +08:09:33.815688 brk(0) = 0x1513000 <0.000016> +08:09:33.815801 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9100b05000 <0.000019> +08:09:33.815943 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory) <0.000019> +08:09:33.816083 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9100b03000 <0.000018> +08:09:33.816206 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) <0.000019> +08:09:33.816326 open("/etc/ld.so.cache", O_RDONLY) = 3 <0.000023> +08:09:33.816428 fstat(3, {st_mode=S_IFREG|0644, st_size=102143, ...}) = 0 <0.000015> +08:09:33.816577 mmap(NULL, 102143, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9100aea000 <0.000019> diff --git a/test/test_logfile.sh b/test/test_logfile.sh index a61191af..620985fb 100644 --- a/test/test_logfile.sh +++ b/test/test_logfile.sh @@ -12,6 +12,10 @@ run_test ./drive_logfile -f access_log ${srcdir}/logfile_access_log.0 on_error_fail_with "Didn't infer access_log log format?" +run_test ./drive_logfile -f strace_log ${srcdir}/logfile_strace_log.0 + +on_error_fail_with "Didn't infer strace_log log format?" + run_test ./drive_logfile ${srcdir}/logfile_empty.0 @@ -53,6 +57,20 @@ Jul 20 22:59:29 2009 -- 000 Jul 20 22:59:29 2009 -- 000 EOF +run_test ./drive_logfile -t -f strace_log ${srcdir}/logfile_strace_log.0 + +check_output "strace_log timestamp interpreted incorrectly?" <