[test] some cleanup for tests and other things

Just a cleanup pass
pull/48/head
Timothy Stack 12 years ago
parent 9386980b14
commit b68a1bba9b

@ -1,9 +1,9 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am. # Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Inc. # Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
@ -73,9 +73,11 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION) distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir) top_distdir = $(distdir)
am__remove_distdir = \ am__remove_distdir = \
{ test ! -d "$(distdir)" \ if test -d "$(distdir)"; then \
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr "$(distdir)"; }; } && rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
am__relativize = \ am__relativize = \
dir0=`pwd`; \ dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
@ -104,6 +106,8 @@ am__relativize = \
DIST_ARCHIVES = $(distdir).tar.gz DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@ ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@ AMTAR = @AMTAR@
@ -226,7 +230,7 @@ EXTRA_DIST = \
all: all-recursive all: all-recursive
.SUFFIXES: .SUFFIXES:
am--refresh: am--refresh: Makefile
@: @:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \ @for dep in $?; do \
@ -470,7 +474,11 @@ dist-gzip: distdir
$(am__remove_distdir) $(am__remove_distdir)
dist-bzip2: distdir dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__remove_distdir) $(am__remove_distdir)
dist-lzma: distdir dist-lzma: distdir
@ -478,7 +486,7 @@ dist-lzma: distdir
$(am__remove_distdir) $(am__remove_distdir)
dist-xz: distdir dist-xz: distdir
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__remove_distdir) $(am__remove_distdir)
dist-tarZ: distdir dist-tarZ: distdir
@ -509,6 +517,8 @@ distcheck: dist
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \ *.tar.lzma*) \
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \ *.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \ *.tar.Z*) \
@ -528,6 +538,7 @@ distcheck: dist
&& am__cwd=`pwd` \ && am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \ && $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) dvi \
@ -556,8 +567,16 @@ distcheck: dist
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck: distuninstallcheck:
@$(am__cd) '$(distuninstallcheck_dir)' \ @test -n '$(distuninstallcheck_dir)' || { \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ echo 'ERROR: trying to run $@ with an empty' \
'$$(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
$(am__cd) '$(distuninstallcheck_dir)' || { \
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left after uninstall:" ; \ || { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \ if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \ echo " (check DESTDIR support)"; \
@ -588,10 +607,15 @@ install-am: all-am
installcheck: installcheck-recursive installcheck: installcheck-recursive
install-strip: install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ if test -z '$(STRIP)'; then \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
`test -z '$(STRIP)' || \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic: mostlyclean-generic:
clean-generic: clean-generic:
@ -678,15 +702,15 @@ uninstall-am:
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \ all all-am am--refresh check check-am clean clean-generic \
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \ dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
distclean distclean-generic distclean-tags distcleancheck \ distcheck distclean distclean-generic distclean-tags \
distdir distuninstallcheck dvi dvi-am html html-am info \ distcleancheck distdir distuninstallcheck dvi dvi-am html \
info-am install install-am install-data install-data-am \ html-am info info-am install install-am install-data \
install-dvi install-dvi-am install-exec install-exec-am \ install-data-am install-dvi install-dvi-am install-exec \
install-html install-html-am install-info install-info-am \ install-exec-am install-html install-html-am install-info \
install-man install-pdf install-pdf-am install-ps \ install-info-am install-man install-pdf install-pdf-am \
install-ps-am install-strip installcheck installcheck-am \ install-ps install-ps-am install-strip installcheck \
installdirs installdirs-am maintainer-clean \ installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am tags tags-recursive uninstall uninstall-am pdf-am ps ps-am tags tags-recursive uninstall uninstall-am

72
aclocal.m4 vendored

@ -1,7 +1,8 @@
# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # generated automatically by aclocal 1.11.3 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
# Inc.
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
@ -13,18 +14,21 @@
m4_ifndef([AC_AUTOCONF_VERSION], m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],, m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
[m4_warning([this file was generated for autoconf 2.65. [m4_warning([this file was generated for autoconf 2.68.
You have another version of autoconf. It may work, but is not guaranteed to. You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely. If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])]) To do so, use the procedure documented by the package, typically `autoreconf'.])])
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
# Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 1
# AM_AUTOMAKE_VERSION(VERSION) # AM_AUTOMAKE_VERSION(VERSION)
# ---------------------------- # ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been # Automake X.Y traces this macro to ensure aclocal.m4 has been
@ -34,7 +38,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.11' [am__api_version='1.11'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro. dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.11.1], [], m4_if([$1], [1.11.3], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
]) ])
@ -50,19 +54,21 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.11.1])dnl [AM_AUTOMAKE_VERSION([1.11.3])dnl
m4_ifndef([AC_AUTOCONF_VERSION], m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*- # AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 1
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'. # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
@ -144,14 +150,14 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]]) Usually this means the macro was only invoked conditionally.]])
fi])]) fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009,
# Free Software Foundation, Inc. # 2010, 2011 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 10 # serial 12
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4, # written in clear, in which case automake, when reading aclocal.m4,
@ -191,6 +197,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
# instance it was reported that on HP-UX the gcc test will end up # instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output # making a dummy file named `D' -- because `-MD' means `put the output
# in D'. # in D'.
rm -rf conftest.dir
mkdir conftest.dir mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're # Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory. # using a relative directory.
@ -255,7 +262,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
break break
fi fi
;; ;;
msvisualcpp | msvcmsys) msvc7 | msvc7msys | msvisualcpp | msvcmsys)
# This compiler won't grok `-c -o', but also, the minuso test has # This compiler won't grok `-c -o', but also, the minuso test has
# not run yet. These depmodes are late enough in the game, and # not run yet. These depmodes are late enough in the game, and
# so weak that their functioning should not be impacted. # so weak that their functioning should not be impacted.
@ -320,10 +327,13 @@ AC_DEFUN([AM_DEP_TRACK],
if test "x$enable_dependency_tracking" != xno; then if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp" am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\' AMDEPBACKSLASH='\'
am__nodep='_no'
fi fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])dnl AC_SUBST([AMDEPBACKSLASH])dnl
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
AC_SUBST([am__nodep])dnl
_AM_SUBST_NOTMAKE([am__nodep])dnl
]) ])
# Generate code to set up dependency tracking. -*- Autoconf -*- # Generate code to set up dependency tracking. -*- Autoconf -*-
@ -557,12 +567,15 @@ for _am_header in $config_headers :; do
done done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. # Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
# Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 1
# AM_PROG_INSTALL_SH # AM_PROG_INSTALL_SH
# ------------------ # ------------------
# Define $install_sh. # Define $install_sh.
@ -694,12 +707,15 @@ else
fi fi
]) ])
# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
# Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 1
# AM_PROG_MKDIR_P # AM_PROG_MKDIR_P
# --------------- # ---------------
# Check for `mkdir -p'. # Check for `mkdir -p'.
@ -722,13 +738,14 @@ esac
# Helper functions for option handling. -*- Autoconf -*- # Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. # Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
# Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 4 # serial 5
# _AM_MANGLE_OPTION(NAME) # _AM_MANGLE_OPTION(NAME)
# ----------------------- # -----------------------
@ -736,13 +753,13 @@ AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME) # _AM_SET_OPTION(NAME)
# ------------------------------ # --------------------
# Set option NAME. Presently that only means defining a flag for this option. # Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION], AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS) # _AM_SET_OPTIONS(OPTIONS)
# ---------------------------------- # ------------------------
# OPTIONS is a space-separated list of Automake options. # OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_SET_OPTIONS],
[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
@ -818,12 +835,14 @@ Check your system clock])
fi fi
AC_MSG_RESULT(yes)]) AC_MSG_RESULT(yes)])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 1
# AM_PROG_INSTALL_STRIP # AM_PROG_INSTALL_STRIP
# --------------------- # ---------------------
# One issue with vendor `install' (even GNU) is that you can't # One issue with vendor `install' (even GNU) is that you can't
@ -846,13 +865,13 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])]) AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006, 2008 Free Software Foundation, Inc. # Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
# serial 2 # serial 3
# _AM_SUBST_NOTMAKE(VARIABLE) # _AM_SUBST_NOTMAKE(VARIABLE)
# --------------------------- # ---------------------------
@ -861,13 +880,13 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])])
AC_DEFUN([_AM_SUBST_NOTMAKE]) AC_DEFUN([_AM_SUBST_NOTMAKE])
# AM_SUBST_NOTMAKE(VARIABLE) # AM_SUBST_NOTMAKE(VARIABLE)
# --------------------------- # --------------------------
# Public sister of _AM_SUBST_NOTMAKE. # Public sister of _AM_SUBST_NOTMAKE.
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*- # Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc. # Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
@ -889,10 +908,11 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# a tarball read from stdin. # a tarball read from stdin.
# $(am__untar) < result.tar # $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR], AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility. [# Always define AMTAR for backward compatibility. Yes, it's still used
AM_MISSING_PROG([AMTAR], [tar]) # in the wild :-( We should find a proper way to deprecate it ...
AC_SUBST([AMTAR], ['$${TAR-tar}'])
m4_if([$1], [v7], m4_if([$1], [v7],
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
[m4_case([$1], [ustar],, [pax],, [m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])]) [m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive]) AC_MSG_CHECKING([how to create a $1 tar archive])

611
configure vendored

File diff suppressed because it is too large Load Diff

@ -1,9 +1,9 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am. # Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Inc. # Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
@ -328,10 +328,8 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps): $(am__aclocal_m4_deps):
config.h: stamp-h1 config.h: stamp-h1
@if test ! -f $@; then \ @if test ! -f $@; then rm -f stamp-h1; else :; fi
rm -f stamp-h1; \ @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1 @rm -f stamp-h1
@ -346,7 +344,7 @@ distclean-hdr:
clean-noinstLIBRARIES: clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libdiag.a: $(libdiag_a_OBJECTS) $(libdiag_a_DEPENDENCIES) libdiag.a: $(libdiag_a_OBJECTS) $(libdiag_a_DEPENDENCIES) $(EXTRA_libdiag_a_DEPENDENCIES)
-rm -f libdiag.a -rm -f libdiag.a
$(libdiag_a_AR) libdiag.a $(libdiag_a_OBJECTS) $(libdiag_a_LIBADD) $(libdiag_a_AR) libdiag.a $(libdiag_a_OBJECTS) $(libdiag_a_LIBADD)
$(RANLIB) libdiag.a $(RANLIB) libdiag.a
@ -387,10 +385,10 @@ uninstall-binPROGRAMS:
clean-binPROGRAMS: clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
bin2c$(EXEEXT): $(bin2c_OBJECTS) $(bin2c_DEPENDENCIES) bin2c$(EXEEXT): $(bin2c_OBJECTS) $(bin2c_DEPENDENCIES) $(EXTRA_bin2c_DEPENDENCIES)
@rm -f bin2c$(EXEEXT) @rm -f bin2c$(EXEEXT)
$(LINK) $(bin2c_OBJECTS) $(bin2c_LDADD) $(LIBS) $(LINK) $(bin2c_OBJECTS) $(bin2c_LDADD) $(LIBS)
lnav$(EXEEXT): $(lnav_OBJECTS) $(lnav_DEPENDENCIES) lnav$(EXEEXT): $(lnav_OBJECTS) $(lnav_DEPENDENCIES) $(EXTRA_lnav_DEPENDENCIES)
@rm -f lnav$(EXEEXT) @rm -f lnav$(EXEEXT)
$(CXXLINK) $(lnav_OBJECTS) $(lnav_LDADD) $(LIBS) $(CXXLINK) $(lnav_OBJECTS) $(lnav_LDADD) $(LIBS)
@ -549,10 +547,15 @@ install-am: all-am
installcheck: installcheck-am installcheck: installcheck-am
install-strip: install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ if test -z '$(STRIP)'; then \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
`test -z '$(STRIP)' || \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic: mostlyclean-generic:
clean-generic: clean-generic:

@ -11,6 +11,7 @@ using namespace std;
hist_source::hist_source() hist_source::hist_source()
: hs_bucket_size(1), : hs_bucket_size(1),
hs_group_size(100), hs_group_size(100),
hs_analyzed(false),
hs_label_source(NULL), hs_label_source(NULL),
hs_token_bucket(NULL) hs_token_bucket(NULL)
{ } { }
@ -23,6 +24,8 @@ void hist_source::text_value_for_line(textview_curses &tc,
int grow = row / (this->buckets_per_group() + 1); int grow = row / (this->buckets_per_group() + 1);
int brow = row % (this->buckets_per_group() + 1); int brow = row % (this->buckets_per_group() + 1);
assert(this->hs_analyzed);
if (brow == 0) { if (brow == 0) {
unsigned long width; unsigned long width;
vis_line_t height; vis_line_t height;
@ -56,6 +59,8 @@ void hist_source::text_attrs_for_line(textview_curses &tc,
int row, int row,
string_attrs_t &value_out) string_attrs_t &value_out)
{ {
assert(this->hs_analyzed);
if (this->hs_token_bucket != NULL) { if (this->hs_token_bucket != NULL) {
view_colors &vc = view_colors::singleton(); view_colors &vc = view_colors::singleton();
unsigned long width, avail_width; unsigned long width, avail_width;
@ -92,10 +97,14 @@ void hist_source::text_attrs_for_line(textview_curses &tc,
} }
} }
void hist_source::add_value(int value, bucket_type_t bt, bucket_count_t amount) void hist_source::add_value(unsigned int value,
bucket_type_t bt,
bucket_count_t amount)
{ {
bucket_group_t bg; bucket_group_t bg;
this->hs_analyzed = false;
bg = bucket_group_t(value / this->hs_group_size); bg = bucket_group_t(value / this->hs_group_size);
bucket_array_t &ba = this->hs_groups[bg]; bucket_array_t &ba = this->hs_groups[bg];
@ -104,7 +113,7 @@ void hist_source::add_value(int value, bucket_type_t bt, bucket_count_t amount)
ba.resize(this->buckets_per_group()); ba.resize(this->buckets_per_group());
} }
bucket_count_t &bc = ba[abs(value % this->hs_group_size) / bucket_count_t &bc = ba[(value % this->hs_group_size) /
this->hs_bucket_size][bt]; this->hs_bucket_size][bt];
bc += amount; bc += amount;
@ -146,4 +155,6 @@ void hist_source::analyze(void)
} }
sort(this->hs_group_keys.begin(), this->hs_group_keys.end()); sort(this->hs_group_keys.begin(), this->hs_group_keys.end());
this->hs_analyzed = true;
} }

@ -1,3 +1,7 @@
/**
* @file hist_source.hh
*/
#ifndef __hist_source_hh #ifndef __hist_source_hh
#define __hist_source_hh #define __hist_source_hh
@ -10,14 +14,34 @@
typedef float bucket_count_t; typedef float bucket_count_t;
/** Type for indexes into a group of buckets. */
STRONG_INT_TYPE(int, bucket_group); STRONG_INT_TYPE(int, bucket_group);
/** Type used to differentiate values added to the same row in the histogram */
STRONG_INT_TYPE(int, bucket_type); STRONG_INT_TYPE(int, bucket_type);
/**
* A text source that displays data as a histogram using horizontal bars. Data
* is added to the histogram using the add_value() method. Once all of the
* values have been added, the analyze() method needs to be called to analyze
* the data so that it can be displayed.
*
* For example, if the values (7, 3, 4, 2) were added, they would be displayed
* like so:
*
* ******
* ***
* ****
* **
*/
class hist_source class hist_source
: public text_sub_source { : public text_sub_source {
public: public:
typedef std::map<bucket_type_t, bucket_count_t> bucket_t; typedef std::map<bucket_type_t, bucket_count_t> bucket_t;
/**
* Source for labels on each bucket and group.
*/
class label_source { class label_source {
public: public:
virtual ~label_source() { }; virtual ~label_source() { };
@ -33,11 +57,18 @@ public:
hist_source(); hist_source();
virtual ~hist_source() { }; virtual ~hist_source() { };
void set_bucket_size(int bs) { this->hs_bucket_size = bs; }; void set_bucket_size(unsigned int bs) {
int get_bucket_size(void) const { return this->hs_bucket_size; }; assert(bs > 0);
void set_group_size(int gs) { this->hs_group_size = gs; }; this->hs_bucket_size = bs;
int get_group_size(void) const { return this->hs_group_size; }; };
unsigned int get_bucket_size(void) const { return this->hs_bucket_size; };
void set_group_size(unsigned int gs) {
assert(gs > 0);
this->hs_group_size = gs;
};
unsigned int get_group_size(void) const { return this->hs_group_size; };
void set_label_source(label_source *hls) void set_label_source(label_source *hls)
{ {
@ -118,7 +149,16 @@ public:
return retval; return retval;
}; };
void add_value(int value, bucket_type_t bt, bucket_count_t amount = 1.0); /**
* Add a value to the histogram.
*
* @param value The row in the histogram.
* @param bt The type of data.
* @param amount The amount to add to this row in the histogram.
*/
void add_value(unsigned int value,
bucket_type_t bt,
bucket_count_t amount = 1.0);
void analyze(void); void analyze(void);
protected: protected:
@ -129,10 +169,12 @@ protected:
std::map<bucket_group_t, bucket_array_t> hs_groups; std::map<bucket_group_t, bucket_array_t> hs_groups;
std::vector<bucket_group_t> hs_group_keys; std::vector<bucket_group_t> hs_group_keys;
int hs_bucket_size; /* hours */ unsigned int hs_bucket_size; /* hours */
int hs_group_size; /* days */ unsigned int hs_group_size; /* days */
bucket_count_t hs_min_count; bucket_count_t hs_min_count;
bucket_count_t hs_max_count; bucket_count_t hs_max_count;
/** Indicates that all of the data has been analyze()'d. */
bool hs_analyzed;
label_source *hs_label_source; label_source *hs_label_source;
bucket_t *hs_token_bucket; bucket_t *hs_token_bucket;

@ -191,6 +191,10 @@ throw (error)
throw error(EFBIG); throw error(EFBIG);
} }
/*
* Check to see if the start is inside the cached range or immediately
* after.
*/
if (start < this->lb_file_offset || if (start < this->lb_file_offset ||
start > (off_t)(this->lb_file_offset + this->lb_buffer_size)) { start > (off_t)(this->lb_file_offset + this->lb_buffer_size)) {
/* /*
@ -198,6 +202,7 @@ throw (error)
* whole thing. * whole thing.
*/ */
prefill = 0; prefill = 0;
this->lb_buffer_size = 0;
if ((this->lb_file_size != (size_t)-1) && if ((this->lb_file_size != (size_t)-1) &&
(start + this->lb_buffer_max > this->lb_file_size)) { (start + this->lb_buffer_max > this->lb_file_size)) {
/* /*
@ -210,10 +215,11 @@ throw (error)
else { else {
this->lb_file_offset = start; this->lb_file_offset = start;
} }
this->lb_buffer_size = 0;
} }
else { else {
/* The request is in the cached range. */ /* The request is in the cached range. Record how much extra data is in
* the buffer before the requested range.
*/
prefill = start - this->lb_file_offset; prefill = start - this->lb_file_offset;
} }
assert(this->lb_file_offset <= start); assert(this->lb_file_offset <= start);

@ -87,6 +87,7 @@ public:
{ {
this->lb_file_offset += this->lb_buffer_size; this->lb_file_offset += this->lb_buffer_size;
this->lb_buffer_size = 0; this->lb_buffer_size = 0;
this->lb_file_size = -1;
}; };
/** Release any resources held by this object. */ /** Release any resources held by this object. */
@ -170,9 +171,9 @@ private:
}; };
auto_fd lb_fd; /*< The file to read data from. */ auto_fd lb_fd; /*< The file to read data from. */
gzFile lb_gz_file; gzFile lb_gz_file; /*< File handle for gzipped files. */
bool lb_bz_file; bool lb_bz_file; /*< Flag set for bzip2 compressed files. */
off_t lb_gz_offset; off_t lb_gz_offset; /*< The offset into the compressed file. */
auto_mem<char> lb_buffer; /*< The internal buffer where data is cached */ auto_mem<char> lb_buffer; /*< The internal buffer where data is cached */
@ -187,7 +188,7 @@ private:
*/ */
size_t lb_buffer_size; /*< The amount of cached data in the buffer. */ size_t lb_buffer_size; /*< The amount of cached data in the buffer. */
size_t lb_buffer_max; /*< The size of the buffer memory. */ size_t lb_buffer_max; /*< The size of the buffer memory. */
bool lb_seekable; bool lb_seekable; /*< Flag set for seekable file descriptors. */
}; };
#endif #endif

@ -26,6 +26,7 @@ void listview_curses::reload_data(void)
{ {
if (this->lv_source == NULL) { if (this->lv_source == NULL) {
this->lv_top = vis_line_t(0); this->lv_top = vis_line_t(0);
this->lv_left = 0;
} }
else if (this->lv_top >= this->get_inner_height()) { else if (this->lv_top >= this->get_inner_height()) {
this->lv_top = max(vis_line_t(0), this->lv_top = max(vis_line_t(0),

@ -13,7 +13,7 @@
#include "strong_int.hh" #include "strong_int.hh"
#include "view_curses.hh" #include "view_curses.hh"
/** Strongly-typed for lines to be displayed. */ /** Strongly-typed integer for visible lines. */
STRONG_INT_TYPE(int, vis_line); STRONG_INT_TYPE(int, vis_line);
class listview_curses; class listview_curses;
@ -56,9 +56,7 @@ public:
void set_data_source(list_data_source *src) void set_data_source(list_data_source *src)
{ {
this->lv_source = src; this->lv_source = src;
if (this->lv_source != NULL) { this->reload_data();
this->reload_data();
}
}; };
/** @return The data source delegate. */ /** @return The data source delegate. */
@ -85,14 +83,14 @@ public:
/** @return The curses window this view is attached to. */ /** @return The curses window this view is attached to. */
WINDOW *get_window() { return this->lv_window; }; WINDOW *get_window() { return this->lv_window; };
void set_y(int y) void set_y(unsigned int y)
{ {
if (y != this->lv_y) { if (y != this->lv_y) {
this->lv_y = y; this->lv_y = y;
this->lv_needs_update = true; this->lv_needs_update = true;
} }
}; };
int get_y() { return this->lv_y; }; unsigned int get_y() { return this->lv_y; };
/** /**
* Set the line number to be displayed at the top of the view. If the * Set the line number to be displayed at the top of the view. If the
@ -100,11 +98,13 @@ public:
* new value will be set and the scroll action called. * new value will be set and the scroll action called.
* *
* @param top The new value for top. * @param top The new value for top.
* @param suppress_flash Don't call flash() if the top is out-of-bounds.
*/ */
void set_top(vis_line_t top) void set_top(vis_line_t top, bool suppress_flash = false)
{ {
if (top < 0 || (top > 0 && top >= this->get_inner_height())) { if (top < 0 || (top > 0 && top >= this->get_inner_height())) {
flash(); if (!suppress_flash)
flash();
} }
else if (this->lv_top != top) { else if (this->lv_top != top) {
this->lv_top = top; this->lv_top = top;
@ -116,6 +116,7 @@ public:
/** @return The line number that is displayed at the top. */ /** @return The line number that is displayed at the top. */
vis_line_t get_top() { return this->lv_top; }; vis_line_t get_top() { return this->lv_top; };
/** @return The line number that is displayed at the bottom. */
vis_line_t get_bottom() vis_line_t get_bottom()
{ {
vis_line_t retval, height; vis_line_t retval, height;
@ -132,15 +133,17 @@ public:
* Shift the value of top by the given value. * Shift the value of top by the given value.
* *
* @param offset The amount to change top by. * @param offset The amount to change top by.
* @param suppress_flash Don't call flash() if the offset is out-of-bounds.
* @return The final value of top. * @return The final value of top.
*/ */
vis_line_t shift_top(vis_line_t offset) vis_line_t shift_top(vis_line_t offset, bool suppress_flash = false)
{ {
if (offset < 0 && this->lv_top == 0) { if (offset < 0 && this->lv_top == 0) {
flash(); if (suppress_flash == false)
flash();
} }
else { else {
this->set_top(std::max(vis_line_t(0), this->lv_top + offset)); this->set_top(std::max(vis_line_t(0), this->lv_top + offset), suppress_flash);
} }
return this->lv_top; return this->lv_top;
@ -154,9 +157,9 @@ public:
* *
* @param left The new value for left. * @param left The new value for left.
*/ */
void set_left(int left) void set_left(unsigned int left)
{ {
if (left >= 0 && this->lv_left != left) { if (this->lv_left != left) {
this->lv_left = left; this->lv_left = left;
this->lv_scroll.invoke(this); this->lv_scroll.invoke(this);
this->lv_needs_update = true; this->lv_needs_update = true;
@ -164,7 +167,7 @@ public:
}; };
/** @return The column number that is displayed at the left. */ /** @return The column number that is displayed at the left. */
int get_left() { return this->lv_left; }; unsigned int get_left() { return this->lv_left; };
/** /**
* Shift the value of left by the given value. * Shift the value of left by the given value.
@ -172,9 +175,14 @@ public:
* @param offset The amount to change top by. * @param offset The amount to change top by.
* @return The final value of top. * @return The final value of top.
*/ */
int shift_left(int offset) unsigned int shift_left(int offset)
{ {
this->set_left(std::max(0, this->lv_left + offset)); if (offset < 0 && this->lv_left < (unsigned int)-offset) {
this->set_left(0);
}
else {
this->set_left(this->lv_left + offset);
}
return this->lv_left; return this->lv_left;
}; };
@ -197,10 +205,11 @@ public:
/** @return The absolute or relative height of the window. */ /** @return The absolute or relative height of the window. */
vis_line_t get_height() { return this->lv_height; }; vis_line_t get_height() { return this->lv_height; };
int get_inner_height() const /** @return The number of rows of data in this view's source data. */
vis_line_t get_inner_height() const
{ {
return this->lv_source == NULL ? 0 : return vis_line_t(this->lv_source == NULL ? 0 :
this->lv_source->listview_rows(*this); this->lv_source->listview_rows(*this));
}; };
void set_needs_update() { this->lv_needs_update = true; }; void set_needs_update() { this->lv_needs_update = true; };
@ -244,12 +253,14 @@ protected:
list_data_source *lv_source; /*< The data source delegate. */ list_data_source *lv_source; /*< The data source delegate. */
action lv_scroll; /*< The scroll action. */ action lv_scroll; /*< The scroll action. */
WINDOW *lv_window; /*< The window that contains this view. */ WINDOW *lv_window; /*< The window that contains this view. */
int lv_y; unsigned int lv_y; /*< The y offset of this view. */
vis_line_t lv_top; /*< The line at the top of the view. */ vis_line_t lv_top; /*< The line at the top of the view. */
int lv_left; /*< The column at the left of the view. */ unsigned int lv_left; /*< The column at the left of the view. */
vis_line_t lv_height; /*< The abs/rel height of the view. */ vis_line_t lv_height; /*< The abs/rel height of the view. */
bool lv_needs_update; bool lv_needs_update; /*< Flag to indicate if a display update
bool lv_show_scrollbar; * is needed.
*/
bool lv_show_scrollbar; /*< Draw the scrollbar in the view. */
}; };
#endif #endif

@ -1262,7 +1262,6 @@ static void handle_paging_key(int ch)
if (sscanf(dls.dls_rows[db_row][lpc].c_str(), if (sscanf(dls.dls_rows[db_row][lpc].c_str(),
"%d", "%d",
&line_number) && &line_number) &&
line_number >= 0 &&
line_number < tc->listview_rows(*tc)) { line_number < tc->listview_rows(*tc)) {
tc = &lnav_data.ld_views[LNV_LOG]; tc = &lnav_data.ld_views[LNV_LOG];
tc->set_top(vis_line_t(line_number)); tc->set_top(vis_line_t(line_number));
@ -2267,20 +2266,24 @@ public:
if (lss) { if (lss) {
if (this->lb_selection_start == vis_line_t(-1)) { if (this->lb_selection_start == vis_line_t(-1)) {
this->lb_selection_start = vis_y; this->lb_selection_start = vis_y;
this->lb_selection_last = vis_line_t(-1);
lss->toggle_user_mark(&textview_curses::BM_USER,
this->lb_selection_start,
vis_y);
} }
else { else {
lss->toggle_user_mark(&textview_curses::BM_USER, if (this->lb_selection_last != vis_line_t(-1)) {
this->lb_selection_start, lss->toggle_user_mark(&textview_curses::BM_USER,
this->lb_selection_last); this->lb_selection_start,
lss->toggle_user_mark(&textview_curses::BM_USER, this->lb_selection_last);
this->lb_selection_start, }
vis_y); if (this->lb_selection_start == vis_y) {
this->lb_selection_last = vis_line_t(-1);
}
else {
lss->toggle_user_mark(&textview_curses::BM_USER,
this->lb_selection_start,
vis_y);
this->lb_selection_last = vis_y;
}
} }
this->lb_selection_last = vis_y;
tc->reload_data(); tc->reload_data();
} }
break; break;
@ -2297,7 +2300,8 @@ public:
timersub(&now, &this->lb_last_scroll_time, &scroll_diff); timersub(&now, &this->lb_last_scroll_time, &scroll_diff);
if (scroll_diff.tv_usec > 50000) { if (scroll_diff.tv_usec > 50000) {
tc->shift_top(vis_line_t(this->scroll_polarity(button) * tc->shift_top(vis_line_t(this->scroll_polarity(button) *
this->lb_scroll_repeat)); this->lb_scroll_repeat),
true);
this->lb_scroll_repeat = 0; this->lb_scroll_repeat = 0;
} }
else { else {
@ -2307,11 +2311,11 @@ public:
else { else {
this->lb_scroll_repeat = 1; this->lb_scroll_repeat = 1;
this->lb_last_scroll_time = now; this->lb_last_scroll_time = now;
tc->shift_top(vis_line_t(this->scroll_polarity(button))); tc->shift_top(vis_line_t(this->scroll_polarity(button)), true);
} }
} }
else { else {
tc->shift_top(vis_line_t(this->scroll_polarity(button))); tc->shift_top(vis_line_t(this->scroll_polarity(button)), true);
} }
break; break;
} }

@ -26,7 +26,7 @@ using namespace std;
static time_t BAD_DATE = -1; static time_t BAD_DATE = -1;
static time_t tm2sec(const struct tm *t) time_t tm2sec(const struct tm *t)
{ {
int year; int year;
time_t days; time_t days;
@ -57,6 +57,8 @@ static time_t tm2sec(const struct tm *t)
return BAD_DATE; return BAD_DATE;
} /* must have overflowed */ } /* must have overflowed */
else { else {
if (t->tm_zone)
days -= t->tm_gmtoff;
return days; return days;
} /* must be a valid time */ } /* must be a valid time */
} }

@ -152,4 +152,12 @@ protected:
int lf_time_fmt_lock; int lf_time_fmt_lock;
}; };
/**
* Convert the time stored in a 'tm' struct into epoch time.
*
* @param t The 'tm' structure to convert to epoch time.
* @return The given time in seconds since the epoch.
*/
time_t tm2sec(const struct tm *t);
#endif #endif

@ -141,10 +141,15 @@ class tcsh_history_format : public log_format {
struct tm log_tm; struct tm log_tm;
log_time = log_time_int; log_time = log_time_int;
/*
* NB: We convert any displayed dates to gm time, so we need to
* convert this time to local and then back to gmt.
*/
memset(&log_tm, 0, sizeof(log_tm)); memset(&log_tm, 0, sizeof(log_tm));
log_tm = *localtime( &log_time); log_tm = *localtime( &log_time);
log_tm.tm_zone = NULL;
log_tm.tm_isdst = 0; log_tm.tm_isdst = 0;
dst.push_back(logline(offset, dst.push_back(logline(offset,
tm2sec(&log_tm), tm2sec(&log_tm),
0, 0,

@ -171,8 +171,6 @@ throw (line_buffer::error)
} }
} }
this->lf_line_buffer.invalidate();
/* /*
* The file can still grow between the above fstat and when we're * The file can still grow between the above fstat and when we're
* doing the scanning, so use the line buffer's notion of the file * doing the scanning, so use the line buffer's notion of the file
@ -180,6 +178,8 @@ throw (line_buffer::error)
*/ */
this->lf_index_size = this->lf_line_buffer.get_file_size(); this->lf_index_size = this->lf_line_buffer.get_file_size();
this->lf_line_buffer.invalidate();
retval = true; retval = true;
} }

@ -1,3 +1,6 @@
/**
* @file piper_proc.cc
*/
#include "config.h" #include "config.h"

@ -1,3 +1,6 @@
/**
* @file piper_proc.hh
*/
#ifndef __piper_proc_hh #ifndef __piper_proc_hh
#define __piper_proc_hh #define __piper_proc_hh

@ -118,20 +118,30 @@ protected:
view_colors::role_t sf_role; /*< The color role for this field. */ view_colors::role_t sf_role; /*< The color role for this field. */
}; };
class telltale_field : public status_field { /**
* Data source for the fields to be displayed in a status view.
public: */
};
class status_data_source { class status_data_source {
public: public:
virtual ~status_data_source() { }; virtual ~status_data_source() { };
/**
* @return The number of status_fields in this source.
*/
virtual size_t statusview_fields(void) = 0; virtual size_t statusview_fields(void) = 0;
/**
* Callback used to get a particular field.
*
* @param field The index of the field to return.
* @return A reference to the field at the given index.
*/
virtual status_field &statusview_value_for_field(int field) = 0; virtual status_field &statusview_value_for_field(int field) = 0;
}; };
/**
* A view that displays a collection of fields in a line on the display.
*/
class statusview_curses class statusview_curses
: public view_curses { : public view_curses {
public: public:

@ -5,6 +5,10 @@
#ifndef __termios_guard_hh #ifndef __termios_guard_hh
#define __termios_guard_hh #define __termios_guard_hh
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
/** /**
* RAII class that saves the current termios for a tty and then restores them * RAII class that saves the current termios for a tty and then restores them
* during destruction. * during destruction.

@ -24,6 +24,8 @@ void view_curses::mvwattrline(WINDOW *window,
std::vector<size_t> tab_list; std::vector<size_t> tab_list;
char *buffer; char *buffer;
assert(lr.lr_end != -1);
line_width = lr.length(); line_width = lr.length();
buffer = (char *)alloca(line_width + 1); buffer = (char *)alloca(line_width + 1);

@ -5,6 +5,8 @@
#ifndef __view_curses_hh #ifndef __view_curses_hh
#define __view_curses_hh #define __view_curses_hh
#include "config.h"
#include <assert.h> #include <assert.h>
#include <stdint.h> #include <stdint.h>
#include <limits.h> #include <limits.h>

@ -15,6 +15,7 @@ check_PROGRAMS = \
drive_listview \ drive_listview \
drive_logfile \ drive_logfile \
drive_sequencer \ drive_sequencer \
drive_view_colors \
drive_vt52_curses \ drive_vt52_curses \
drive_readline_curses \ drive_readline_curses \
slicer \ slicer \
@ -23,6 +24,7 @@ check_PROGRAMS = \
test_auto_mem \ test_auto_mem \
test_bookmarks \ test_bookmarks \
test_grep_proc2 \ test_grep_proc2 \
test_hist_source \
test_line_buffer2 \ test_line_buffer2 \
test_pcrepp \ test_pcrepp \
test_top_status test_top_status
@ -44,6 +46,12 @@ test_grep_proc2_SOURCES = \
test_grep_proc2.cc test_grep_proc2.cc
test_grep_proc2_LDADD = $(PCRE_LIBS) -lz test_grep_proc2_LDADD = $(PCRE_LIBS) -lz
test_hist_source_SOURCES = \
../src/hist_source.cc \
../src/view_curses.cc \
test_hist_source.cc
test_hist_source_LDADD = $(CURSES_LIB) -lz
test_line_buffer2_SOURCES = \ test_line_buffer2_SOURCES = \
../src/line_buffer.cc \ ../src/line_buffer.cc \
test_line_buffer2.cc test_line_buffer2.cc
@ -102,6 +110,11 @@ drive_data_scanner_SOURCES = \
../src/data_scanner.cc \ ../src/data_scanner.cc \
drive_data_scanner.cc drive_data_scanner.cc
drive_view_colors_SOURCES = \
../src/view_curses.cc \
drive_view_colors.cc
drive_view_colors_LDADD = $(CURSES_LIB)
drive_vt52_curses_SOURCES = \ drive_vt52_curses_SOURCES = \
../src/vt52_curses.cc \ ../src/vt52_curses.cc \
../src/view_curses.cc \ ../src/view_curses.cc \
@ -162,9 +175,11 @@ TESTS = test_bookmarks \
test_line_buffer2 \ test_line_buffer2 \
test_grep_proc.sh \ test_grep_proc.sh \
test_grep_proc2 \ test_grep_proc2 \
test_hist_source \
test_listview.sh \ test_listview.sh \
test_logfile.sh \ test_logfile.sh \
test_pcrepp \ test_pcrepp \
test_view_colors.sh \
test_vt52_curses.sh \ test_vt52_curses.sh \
test_top_status \ test_top_status \
test_data_parser.sh test_data_parser.sh

@ -1,9 +1,9 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am. # Makefile.in generated by automake 1.11.3 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Inc. # Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
@ -38,17 +38,19 @@ host_triplet = @host@
check_PROGRAMS = drive_data_scanner$(EXEEXT) \ check_PROGRAMS = drive_data_scanner$(EXEEXT) \
drive_line_buffer$(EXEEXT) drive_grep_proc$(EXEEXT) \ drive_line_buffer$(EXEEXT) drive_grep_proc$(EXEEXT) \
drive_listview$(EXEEXT) drive_logfile$(EXEEXT) \ drive_listview$(EXEEXT) drive_logfile$(EXEEXT) \
drive_sequencer$(EXEEXT) drive_vt52_curses$(EXEEXT) \ drive_sequencer$(EXEEXT) drive_view_colors$(EXEEXT) \
drive_readline_curses$(EXEEXT) slicer$(EXEEXT) \ drive_vt52_curses$(EXEEXT) drive_readline_curses$(EXEEXT) \
scripty$(EXEEXT) test_auto_fd$(EXEEXT) test_auto_mem$(EXEEXT) \ slicer$(EXEEXT) scripty$(EXEEXT) test_auto_fd$(EXEEXT) \
test_bookmarks$(EXEEXT) test_grep_proc2$(EXEEXT) \ test_auto_mem$(EXEEXT) test_bookmarks$(EXEEXT) \
test_grep_proc2$(EXEEXT) test_hist_source$(EXEEXT) \
test_line_buffer2$(EXEEXT) test_pcrepp$(EXEEXT) \ test_line_buffer2$(EXEEXT) test_pcrepp$(EXEEXT) \
test_top_status$(EXEEXT) test_top_status$(EXEEXT)
TESTS = test_bookmarks$(EXEEXT) test_auto_fd$(EXEEXT) \ TESTS = test_bookmarks$(EXEEXT) test_auto_fd$(EXEEXT) \
test_auto_mem$(EXEEXT) test_line_buffer.sh \ test_auto_mem$(EXEEXT) test_line_buffer.sh \
test_line_buffer2$(EXEEXT) test_grep_proc.sh \ test_line_buffer2$(EXEEXT) test_grep_proc.sh \
test_grep_proc2$(EXEEXT) test_listview.sh test_logfile.sh \ test_grep_proc2$(EXEEXT) test_hist_source$(EXEEXT) \
test_pcrepp$(EXEEXT) test_vt52_curses.sh \ test_listview.sh test_logfile.sh test_pcrepp$(EXEEXT) \
test_view_colors.sh test_vt52_curses.sh \
test_top_status$(EXEEXT) test_data_parser.sh test_top_status$(EXEEXT) test_data_parser.sh
subdir = test subdir = test
DIST_COMMON = $(dist_noinst_DATA) $(dist_noinst_SCRIPTS) \ DIST_COMMON = $(dist_noinst_DATA) $(dist_noinst_SCRIPTS) \
@ -97,6 +99,10 @@ am_drive_sequencer_OBJECTS = grep_proc.$(OBJEXT) logfile.$(OBJEXT) \
sequence_matcher.$(OBJEXT) drive_sequencer.$(OBJEXT) sequence_matcher.$(OBJEXT) drive_sequencer.$(OBJEXT)
drive_sequencer_OBJECTS = $(am_drive_sequencer_OBJECTS) drive_sequencer_OBJECTS = $(am_drive_sequencer_OBJECTS)
drive_sequencer_DEPENDENCIES = drive_sequencer_DEPENDENCIES =
am_drive_view_colors_OBJECTS = view_curses.$(OBJEXT) \
drive_view_colors.$(OBJEXT)
drive_view_colors_OBJECTS = $(am_drive_view_colors_OBJECTS)
drive_view_colors_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_drive_vt52_curses_OBJECTS = vt52_curses.$(OBJEXT) \ am_drive_vt52_curses_OBJECTS = vt52_curses.$(OBJEXT) \
view_curses.$(OBJEXT) drive_vt52_curses.$(OBJEXT) view_curses.$(OBJEXT) drive_vt52_curses.$(OBJEXT)
drive_vt52_curses_OBJECTS = $(am_drive_vt52_curses_OBJECTS) drive_vt52_curses_OBJECTS = $(am_drive_vt52_curses_OBJECTS)
@ -126,6 +132,10 @@ am_test_grep_proc2_OBJECTS = line_buffer.$(OBJEXT) grep_proc.$(OBJEXT) \
test_grep_proc2.$(OBJEXT) test_grep_proc2.$(OBJEXT)
test_grep_proc2_OBJECTS = $(am_test_grep_proc2_OBJECTS) test_grep_proc2_OBJECTS = $(am_test_grep_proc2_OBJECTS)
test_grep_proc2_DEPENDENCIES = $(am__DEPENDENCIES_1) test_grep_proc2_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_test_hist_source_OBJECTS = hist_source.$(OBJEXT) \
view_curses.$(OBJEXT) test_hist_source.$(OBJEXT)
test_hist_source_OBJECTS = $(am_test_hist_source_OBJECTS)
test_hist_source_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_test_line_buffer2_OBJECTS = line_buffer.$(OBJEXT) \ am_test_line_buffer2_OBJECTS = line_buffer.$(OBJEXT) \
test_line_buffer2.$(OBJEXT) test_line_buffer2.$(OBJEXT)
test_line_buffer2_OBJECTS = $(am_test_line_buffer2_OBJECTS) test_line_buffer2_OBJECTS = $(am_test_line_buffer2_OBJECTS)
@ -156,20 +166,23 @@ CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
SOURCES = $(drive_data_scanner_SOURCES) $(drive_grep_proc_SOURCES) \ SOURCES = $(drive_data_scanner_SOURCES) $(drive_grep_proc_SOURCES) \
$(drive_line_buffer_SOURCES) $(drive_listview_SOURCES) \ $(drive_line_buffer_SOURCES) $(drive_listview_SOURCES) \
$(drive_logfile_SOURCES) $(drive_readline_curses_SOURCES) \ $(drive_logfile_SOURCES) $(drive_readline_curses_SOURCES) \
$(drive_sequencer_SOURCES) $(drive_vt52_curses_SOURCES) \ $(drive_sequencer_SOURCES) $(drive_view_colors_SOURCES) \
$(scripty_SOURCES) $(slicer_SOURCES) $(test_auto_fd_SOURCES) \ $(drive_vt52_curses_SOURCES) $(scripty_SOURCES) \
$(slicer_SOURCES) $(test_auto_fd_SOURCES) \
$(test_auto_mem_SOURCES) $(test_bookmarks_SOURCES) \ $(test_auto_mem_SOURCES) $(test_bookmarks_SOURCES) \
$(test_grep_proc2_SOURCES) $(test_line_buffer2_SOURCES) \ $(test_grep_proc2_SOURCES) $(test_hist_source_SOURCES) \
$(test_pcrepp_SOURCES) $(test_top_status_SOURCES) $(test_line_buffer2_SOURCES) $(test_pcrepp_SOURCES) \
$(test_top_status_SOURCES)
DIST_SOURCES = $(drive_data_scanner_SOURCES) \ DIST_SOURCES = $(drive_data_scanner_SOURCES) \
$(drive_grep_proc_SOURCES) $(drive_line_buffer_SOURCES) \ $(drive_grep_proc_SOURCES) $(drive_line_buffer_SOURCES) \
$(drive_listview_SOURCES) $(drive_logfile_SOURCES) \ $(drive_listview_SOURCES) $(drive_logfile_SOURCES) \
$(drive_readline_curses_SOURCES) $(drive_sequencer_SOURCES) \ $(drive_readline_curses_SOURCES) $(drive_sequencer_SOURCES) \
$(drive_vt52_curses_SOURCES) $(scripty_SOURCES) \ $(drive_view_colors_SOURCES) $(drive_vt52_curses_SOURCES) \
$(slicer_SOURCES) $(test_auto_fd_SOURCES) \ $(scripty_SOURCES) $(slicer_SOURCES) $(test_auto_fd_SOURCES) \
$(test_auto_mem_SOURCES) $(test_bookmarks_SOURCES) \ $(test_auto_mem_SOURCES) $(test_bookmarks_SOURCES) \
$(test_grep_proc2_SOURCES) $(test_line_buffer2_SOURCES) \ $(test_grep_proc2_SOURCES) $(test_hist_source_SOURCES) \
$(test_pcrepp_SOURCES) $(test_top_status_SOURCES) $(test_line_buffer2_SOURCES) $(test_pcrepp_SOURCES) \
$(test_top_status_SOURCES)
DATA = $(dist_noinst_DATA) DATA = $(dist_noinst_DATA)
ETAGS = etags ETAGS = etags
CTAGS = ctags CTAGS = ctags
@ -306,6 +319,12 @@ test_grep_proc2_SOURCES = \
test_grep_proc2.cc test_grep_proc2.cc
test_grep_proc2_LDADD = $(PCRE_LIBS) -lz test_grep_proc2_LDADD = $(PCRE_LIBS) -lz
test_hist_source_SOURCES = \
../src/hist_source.cc \
../src/view_curses.cc \
test_hist_source.cc
test_hist_source_LDADD = $(CURSES_LIB) -lz
test_line_buffer2_SOURCES = \ test_line_buffer2_SOURCES = \
../src/line_buffer.cc \ ../src/line_buffer.cc \
test_line_buffer2.cc test_line_buffer2.cc
@ -364,6 +383,11 @@ drive_data_scanner_SOURCES = \
../src/data_scanner.cc \ ../src/data_scanner.cc \
drive_data_scanner.cc drive_data_scanner.cc
drive_view_colors_SOURCES = \
../src/view_curses.cc \
drive_view_colors.cc
drive_view_colors_LDADD = $(CURSES_LIB)
drive_vt52_curses_SOURCES = \ drive_vt52_curses_SOURCES = \
../src/vt52_curses.cc \ ../src/vt52_curses.cc \
../src/view_curses.cc \ ../src/view_curses.cc \
@ -458,55 +482,61 @@ $(am__aclocal_m4_deps):
clean-checkPROGRAMS: clean-checkPROGRAMS:
-test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
drive_data_scanner$(EXEEXT): $(drive_data_scanner_OBJECTS) $(drive_data_scanner_DEPENDENCIES) drive_data_scanner$(EXEEXT): $(drive_data_scanner_OBJECTS) $(drive_data_scanner_DEPENDENCIES) $(EXTRA_drive_data_scanner_DEPENDENCIES)
@rm -f drive_data_scanner$(EXEEXT) @rm -f drive_data_scanner$(EXEEXT)
$(CXXLINK) $(drive_data_scanner_OBJECTS) $(drive_data_scanner_LDADD) $(LIBS) $(CXXLINK) $(drive_data_scanner_OBJECTS) $(drive_data_scanner_LDADD) $(LIBS)
drive_grep_proc$(EXEEXT): $(drive_grep_proc_OBJECTS) $(drive_grep_proc_DEPENDENCIES) drive_grep_proc$(EXEEXT): $(drive_grep_proc_OBJECTS) $(drive_grep_proc_DEPENDENCIES) $(EXTRA_drive_grep_proc_DEPENDENCIES)
@rm -f drive_grep_proc$(EXEEXT) @rm -f drive_grep_proc$(EXEEXT)
$(CXXLINK) $(drive_grep_proc_OBJECTS) $(drive_grep_proc_LDADD) $(LIBS) $(CXXLINK) $(drive_grep_proc_OBJECTS) $(drive_grep_proc_LDADD) $(LIBS)
drive_line_buffer$(EXEEXT): $(drive_line_buffer_OBJECTS) $(drive_line_buffer_DEPENDENCIES) drive_line_buffer$(EXEEXT): $(drive_line_buffer_OBJECTS) $(drive_line_buffer_DEPENDENCIES) $(EXTRA_drive_line_buffer_DEPENDENCIES)
@rm -f drive_line_buffer$(EXEEXT) @rm -f drive_line_buffer$(EXEEXT)
$(CXXLINK) $(drive_line_buffer_OBJECTS) $(drive_line_buffer_LDADD) $(LIBS) $(CXXLINK) $(drive_line_buffer_OBJECTS) $(drive_line_buffer_LDADD) $(LIBS)
drive_listview$(EXEEXT): $(drive_listview_OBJECTS) $(drive_listview_DEPENDENCIES) drive_listview$(EXEEXT): $(drive_listview_OBJECTS) $(drive_listview_DEPENDENCIES) $(EXTRA_drive_listview_DEPENDENCIES)
@rm -f drive_listview$(EXEEXT) @rm -f drive_listview$(EXEEXT)
$(CXXLINK) $(drive_listview_OBJECTS) $(drive_listview_LDADD) $(LIBS) $(CXXLINK) $(drive_listview_OBJECTS) $(drive_listview_LDADD) $(LIBS)
drive_logfile$(EXEEXT): $(drive_logfile_OBJECTS) $(drive_logfile_DEPENDENCIES) drive_logfile$(EXEEXT): $(drive_logfile_OBJECTS) $(drive_logfile_DEPENDENCIES) $(EXTRA_drive_logfile_DEPENDENCIES)
@rm -f drive_logfile$(EXEEXT) @rm -f drive_logfile$(EXEEXT)
$(CXXLINK) $(drive_logfile_OBJECTS) $(drive_logfile_LDADD) $(LIBS) $(CXXLINK) $(drive_logfile_OBJECTS) $(drive_logfile_LDADD) $(LIBS)
drive_readline_curses$(EXEEXT): $(drive_readline_curses_OBJECTS) $(drive_readline_curses_DEPENDENCIES) drive_readline_curses$(EXEEXT): $(drive_readline_curses_OBJECTS) $(drive_readline_curses_DEPENDENCIES) $(EXTRA_drive_readline_curses_DEPENDENCIES)
@rm -f drive_readline_curses$(EXEEXT) @rm -f drive_readline_curses$(EXEEXT)
$(CXXLINK) $(drive_readline_curses_OBJECTS) $(drive_readline_curses_LDADD) $(LIBS) $(CXXLINK) $(drive_readline_curses_OBJECTS) $(drive_readline_curses_LDADD) $(LIBS)
drive_sequencer$(EXEEXT): $(drive_sequencer_OBJECTS) $(drive_sequencer_DEPENDENCIES) drive_sequencer$(EXEEXT): $(drive_sequencer_OBJECTS) $(drive_sequencer_DEPENDENCIES) $(EXTRA_drive_sequencer_DEPENDENCIES)
@rm -f drive_sequencer$(EXEEXT) @rm -f drive_sequencer$(EXEEXT)
$(CXXLINK) $(drive_sequencer_OBJECTS) $(drive_sequencer_LDADD) $(LIBS) $(CXXLINK) $(drive_sequencer_OBJECTS) $(drive_sequencer_LDADD) $(LIBS)
drive_vt52_curses$(EXEEXT): $(drive_vt52_curses_OBJECTS) $(drive_vt52_curses_DEPENDENCIES) drive_view_colors$(EXEEXT): $(drive_view_colors_OBJECTS) $(drive_view_colors_DEPENDENCIES) $(EXTRA_drive_view_colors_DEPENDENCIES)
@rm -f drive_view_colors$(EXEEXT)
$(CXXLINK) $(drive_view_colors_OBJECTS) $(drive_view_colors_LDADD) $(LIBS)
drive_vt52_curses$(EXEEXT): $(drive_vt52_curses_OBJECTS) $(drive_vt52_curses_DEPENDENCIES) $(EXTRA_drive_vt52_curses_DEPENDENCIES)
@rm -f drive_vt52_curses$(EXEEXT) @rm -f drive_vt52_curses$(EXEEXT)
$(CXXLINK) $(drive_vt52_curses_OBJECTS) $(drive_vt52_curses_LDADD) $(LIBS) $(CXXLINK) $(drive_vt52_curses_OBJECTS) $(drive_vt52_curses_LDADD) $(LIBS)
scripty$(EXEEXT): $(scripty_OBJECTS) $(scripty_DEPENDENCIES) scripty$(EXEEXT): $(scripty_OBJECTS) $(scripty_DEPENDENCIES) $(EXTRA_scripty_DEPENDENCIES)
@rm -f scripty$(EXEEXT) @rm -f scripty$(EXEEXT)
$(CXXLINK) $(scripty_OBJECTS) $(scripty_LDADD) $(LIBS) $(CXXLINK) $(scripty_OBJECTS) $(scripty_LDADD) $(LIBS)
slicer$(EXEEXT): $(slicer_OBJECTS) $(slicer_DEPENDENCIES) slicer$(EXEEXT): $(slicer_OBJECTS) $(slicer_DEPENDENCIES) $(EXTRA_slicer_DEPENDENCIES)
@rm -f slicer$(EXEEXT) @rm -f slicer$(EXEEXT)
$(CXXLINK) $(slicer_OBJECTS) $(slicer_LDADD) $(LIBS) $(CXXLINK) $(slicer_OBJECTS) $(slicer_LDADD) $(LIBS)
test_auto_fd$(EXEEXT): $(test_auto_fd_OBJECTS) $(test_auto_fd_DEPENDENCIES) test_auto_fd$(EXEEXT): $(test_auto_fd_OBJECTS) $(test_auto_fd_DEPENDENCIES) $(EXTRA_test_auto_fd_DEPENDENCIES)
@rm -f test_auto_fd$(EXEEXT) @rm -f test_auto_fd$(EXEEXT)
$(CXXLINK) $(test_auto_fd_OBJECTS) $(test_auto_fd_LDADD) $(LIBS) $(CXXLINK) $(test_auto_fd_OBJECTS) $(test_auto_fd_LDADD) $(LIBS)
test_auto_mem$(EXEEXT): $(test_auto_mem_OBJECTS) $(test_auto_mem_DEPENDENCIES) test_auto_mem$(EXEEXT): $(test_auto_mem_OBJECTS) $(test_auto_mem_DEPENDENCIES) $(EXTRA_test_auto_mem_DEPENDENCIES)
@rm -f test_auto_mem$(EXEEXT) @rm -f test_auto_mem$(EXEEXT)
$(CXXLINK) $(test_auto_mem_OBJECTS) $(test_auto_mem_LDADD) $(LIBS) $(CXXLINK) $(test_auto_mem_OBJECTS) $(test_auto_mem_LDADD) $(LIBS)
test_bookmarks$(EXEEXT): $(test_bookmarks_OBJECTS) $(test_bookmarks_DEPENDENCIES) test_bookmarks$(EXEEXT): $(test_bookmarks_OBJECTS) $(test_bookmarks_DEPENDENCIES) $(EXTRA_test_bookmarks_DEPENDENCIES)
@rm -f test_bookmarks$(EXEEXT) @rm -f test_bookmarks$(EXEEXT)
$(CXXLINK) $(test_bookmarks_OBJECTS) $(test_bookmarks_LDADD) $(LIBS) $(CXXLINK) $(test_bookmarks_OBJECTS) $(test_bookmarks_LDADD) $(LIBS)
test_grep_proc2$(EXEEXT): $(test_grep_proc2_OBJECTS) $(test_grep_proc2_DEPENDENCIES) test_grep_proc2$(EXEEXT): $(test_grep_proc2_OBJECTS) $(test_grep_proc2_DEPENDENCIES) $(EXTRA_test_grep_proc2_DEPENDENCIES)
@rm -f test_grep_proc2$(EXEEXT) @rm -f test_grep_proc2$(EXEEXT)
$(CXXLINK) $(test_grep_proc2_OBJECTS) $(test_grep_proc2_LDADD) $(LIBS) $(CXXLINK) $(test_grep_proc2_OBJECTS) $(test_grep_proc2_LDADD) $(LIBS)
test_line_buffer2$(EXEEXT): $(test_line_buffer2_OBJECTS) $(test_line_buffer2_DEPENDENCIES) test_hist_source$(EXEEXT): $(test_hist_source_OBJECTS) $(test_hist_source_DEPENDENCIES) $(EXTRA_test_hist_source_DEPENDENCIES)
@rm -f test_hist_source$(EXEEXT)
$(CXXLINK) $(test_hist_source_OBJECTS) $(test_hist_source_LDADD) $(LIBS)
test_line_buffer2$(EXEEXT): $(test_line_buffer2_OBJECTS) $(test_line_buffer2_DEPENDENCIES) $(EXTRA_test_line_buffer2_DEPENDENCIES)
@rm -f test_line_buffer2$(EXEEXT) @rm -f test_line_buffer2$(EXEEXT)
$(CXXLINK) $(test_line_buffer2_OBJECTS) $(test_line_buffer2_LDADD) $(LIBS) $(CXXLINK) $(test_line_buffer2_OBJECTS) $(test_line_buffer2_LDADD) $(LIBS)
test_pcrepp$(EXEEXT): $(test_pcrepp_OBJECTS) $(test_pcrepp_DEPENDENCIES) test_pcrepp$(EXEEXT): $(test_pcrepp_OBJECTS) $(test_pcrepp_DEPENDENCIES) $(EXTRA_test_pcrepp_DEPENDENCIES)
@rm -f test_pcrepp$(EXEEXT) @rm -f test_pcrepp$(EXEEXT)
$(CXXLINK) $(test_pcrepp_OBJECTS) $(test_pcrepp_LDADD) $(LIBS) $(CXXLINK) $(test_pcrepp_OBJECTS) $(test_pcrepp_LDADD) $(LIBS)
test_top_status$(EXEEXT): $(test_top_status_OBJECTS) $(test_top_status_DEPENDENCIES) test_top_status$(EXEEXT): $(test_top_status_OBJECTS) $(test_top_status_DEPENDENCIES) $(EXTRA_test_top_status_DEPENDENCIES)
@rm -f test_top_status$(EXEEXT) @rm -f test_top_status$(EXEEXT)
$(CXXLINK) $(test_top_status_OBJECTS) $(test_top_status_LDADD) $(LIBS) $(CXXLINK) $(test_top_status_OBJECTS) $(test_top_status_LDADD) $(LIBS)
@ -526,8 +556,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_logfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_logfile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_readline_curses.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_readline_curses.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_sequencer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_sequencer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_view_colors.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_vt52_curses.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drive_vt52_curses.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grep_proc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grep_proc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hist_source.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line_buffer.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line_buffer.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listview_curses.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listview_curses.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log_format.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log_format.Po@am__quote@
@ -541,6 +573,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_auto_mem.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_auto_mem.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_bookmarks.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_bookmarks.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_grep_proc2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_grep_proc2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_hist_source.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_line_buffer2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_line_buffer2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_pcrepp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_pcrepp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_top_status.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_top_status.Po@am__quote@
@ -730,6 +763,20 @@ bookmarks.obj: ../src/bookmarks.cc
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bookmarks.obj `if test -f '../src/bookmarks.cc'; then $(CYGPATH_W) '../src/bookmarks.cc'; else $(CYGPATH_W) '$(srcdir)/../src/bookmarks.cc'; fi` @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o bookmarks.obj `if test -f '../src/bookmarks.cc'; then $(CYGPATH_W) '../src/bookmarks.cc'; else $(CYGPATH_W) '$(srcdir)/../src/bookmarks.cc'; fi`
hist_source.o: ../src/hist_source.cc
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT hist_source.o -MD -MP -MF $(DEPDIR)/hist_source.Tpo -c -o hist_source.o `test -f '../src/hist_source.cc' || echo '$(srcdir)/'`../src/hist_source.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/hist_source.Tpo $(DEPDIR)/hist_source.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/hist_source.cc' object='hist_source.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o hist_source.o `test -f '../src/hist_source.cc' || echo '$(srcdir)/'`../src/hist_source.cc
hist_source.obj: ../src/hist_source.cc
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT hist_source.obj -MD -MP -MF $(DEPDIR)/hist_source.Tpo -c -o hist_source.obj `if test -f '../src/hist_source.cc'; then $(CYGPATH_W) '../src/hist_source.cc'; else $(CYGPATH_W) '$(srcdir)/../src/hist_source.cc'; fi`
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/hist_source.Tpo $(DEPDIR)/hist_source.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/hist_source.cc' object='hist_source.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o hist_source.obj `if test -f '../src/hist_source.cc'; then $(CYGPATH_W) '../src/hist_source.cc'; else $(CYGPATH_W) '$(srcdir)/../src/hist_source.cc'; fi`
logfile_sub_source.o: ../src/logfile_sub_source.cc logfile_sub_source.o: ../src/logfile_sub_source.cc
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT logfile_sub_source.o -MD -MP -MF $(DEPDIR)/logfile_sub_source.Tpo -c -o logfile_sub_source.o `test -f '../src/logfile_sub_source.cc' || echo '$(srcdir)/'`../src/logfile_sub_source.cc @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT logfile_sub_source.o -MD -MP -MF $(DEPDIR)/logfile_sub_source.Tpo -c -o logfile_sub_source.o `test -f '../src/logfile_sub_source.cc' || echo '$(srcdir)/'`../src/logfile_sub_source.cc
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/logfile_sub_source.Tpo $(DEPDIR)/logfile_sub_source.Po @am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/logfile_sub_source.Tpo $(DEPDIR)/logfile_sub_source.Po
@ -891,14 +938,15 @@ check-TESTS: $(TESTS)
fi; \ fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \ dashes=`echo "$$dashes" | sed s/./=/g`; \
if test "$$failed" -eq 0; then \ if test "$$failed" -eq 0; then \
echo "$$grn$$dashes"; \ col="$$grn"; \
else \ else \
echo "$$red$$dashes"; \ col="$$red"; \
fi; \ fi; \
echo "$$banner"; \ echo "$${col}$$dashes$${std}"; \
test -z "$$skipped" || echo "$$skipped"; \ echo "$${col}$$banner$${std}"; \
test -z "$$report" || echo "$$report"; \ test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
echo "$$dashes$$std"; \ test -z "$$report" || echo "$${col}$$report$${std}"; \
echo "$${col}$$dashes$${std}"; \
test "$$failed" -eq 0; \ test "$$failed" -eq 0; \
else :; fi else :; fi
@ -948,10 +996,15 @@ install-am: all-am
installcheck: installcheck-am installcheck: installcheck-am
install-strip: install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ if test -z '$(STRIP)'; then \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
`test -z '$(STRIP)' || \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic: mostlyclean-generic:
clean-generic: clean-generic:

@ -0,0 +1,70 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "view_curses.hh"
class test_colors : public view_curses {
public:
test_colors()
: tc_window(NULL) {
}
void do_update(void) {
int lpc;
for (lpc = 0; lpc < 16; lpc++) {
char label[64];
attr_line_t al;
line_range lr;
snprintf(label, sizeof(label), "This is line: %d", lpc);
al = label;
lr.lr_start = 0;
lr.lr_end = 40;
this->mvwattrline(this->tc_window,
lpc,
0,
al,
lr,
view_colors::singleton().next_highlight());
}
};
WINDOW *tc_window;
};
int main(int argc, char *argv[])
{
int c, retval = EXIT_SUCCESS;
bool wait_for_input = false;
WINDOW *win;
test_colors tc;
win = initscr();
noecho();
while ((c = getopt(argc, argv, "w")) != -1) {
switch (c) {
case 'w':
wait_for_input = true;
break;
}
}
view_colors::singleton().init();
tc.tc_window = win;
tc.do_update();
refresh();
if (wait_for_input) {
getch();
}
endwin();
return retval;
}

@ -3,6 +3,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
@ -47,6 +48,9 @@
using namespace std; using namespace std;
/**
* An RAII class for opening a PTY and forking a child process.
*/
class child_term { class child_term {
public: public:
@ -139,9 +143,15 @@ protected:
}; };
/**
* @param fd The file descriptor to switch to raw mode.
* @return Zero on success, -1 on error.
*/
static int tty_raw(int fd) static int tty_raw(int fd)
{ {
struct termios attr[1]; struct termios attr[1];
assert(fd >= 0);
if (tcgetattr(fd, attr) == -1) if (tcgetattr(fd, attr) == -1)
return -1; return -1;
@ -157,17 +167,105 @@ static int tty_raw(int fd)
return tcsetattr(fd, TCSANOW, attr); return tcsetattr(fd, TCSANOW, attr);
} }
static void dump_memory(FILE *dst, const char *src, int len)
{
int lpc;
for (lpc = 0; lpc < len; lpc++) {
fprintf(dst, "%02x", src[lpc]);
}
}
static char *hex2bits(const char *src)
{
int len, pos = sizeof(int);
char *retval;
len = strlen(src) / 2;
retval = new char[sizeof(uint32_t) + len];
*((uint32_t *)retval) = len;
while (pos < (sizeof(uint32_t) + len)) {
int val;
sscanf(src, "%2x", &val);
src += 2;
retval[pos] = (char)val;
pos += 1;
}
return retval;
}
typedef enum { typedef enum {
ET_NONE,
ET_READ, ET_READ,
} expect_type_t; } expect_type_t;
struct expect_read {
uint32_t er_length;
char er_data[];
};
struct expect { struct expect {
expect_type_t e_type; expect_type_t e_type;
union { union {
char *b; struct expect_read *read;
} e_arg; } e_arg;
}; };
struct expect_read_state {
uint32_t ers_pos;
};
class expect_handler {
public:
expect_handler() {
memset(&this->eh_state, 0, sizeof(this->eh_state));
};
int process_input(const char *buffer, size_t blen) {
if (this->eh_queue.empty())
return 0;
uint32_t &exp_pos = this->eh_state.es_read.ers_pos;
struct expect &next = this->eh_queue.front();
int cmp_len = min((next.e_arg.read->er_length - exp_pos), (uint32_t)blen);
char *exp_start = &next.e_arg.read->er_data[this->eh_state.es_read.ers_pos];
int retval = 0;
assert(buffer != NULL || blen == 0);
if (memcmp(exp_start, buffer, cmp_len) == 0) {
exp_pos += cmp_len;
if (exp_pos == next.e_arg.read->er_length) {
retval = 1;
if (!this->eh_queue.empty()) {
exp_pos = 0;
this->eh_queue.pop();
}
}
}
else {
printf("Detected output differences at offset %d, "
"expecting:\n ", exp_pos);
dump_memory(stdout, exp_start, cmp_len);
printf("\nGot:\n ");
dump_memory(stdout, buffer, cmp_len);
retval = -1;
}
fprintf(stderr, "pi ret %d\n", retval);
return retval;
};
queue<struct expect> eh_queue;
private:
union {
struct expect_read_state es_read;
} eh_state;
};
typedef enum { typedef enum {
CT_SLEEP, CT_SLEEP,
CT_WRITE, CT_WRITE,
@ -193,37 +291,9 @@ static struct {
FILE *sd_from_child; FILE *sd_from_child;
queue<struct command> sd_replay; queue<struct command> sd_replay;
queue<struct expect> sd_expected;
} scripty_data;
static void dump_memory(FILE *dst, char *src, int len)
{
int lpc;
for (lpc = 0; lpc < len; lpc++) {
fprintf(dst, "%02x", src[lpc]);
}
}
static char *hex2bits(const char *src)
{
int len, pos = sizeof(int);
char *retval;
len = strlen(src) / 2;
retval = new char[sizeof(int) + len];
*((int *)retval) = len;
while (pos < (sizeof(int) + len)) {
int val;
sscanf(src, "%2x", &val);
src += 2;
retval[pos] = (char)val;
pos += 1;
}
return retval; bool sd_user_step;
} } scripty_data;
static void sigchld(int sig) static void sigchld(int sig)
{ {
@ -246,7 +316,18 @@ static void usage(void)
" -t <file> The file where any input sent to the child process\n" " -t <file> The file where any input sent to the child process\n"
" should be stored.\n" " should be stored.\n"
" -f <file> The file where any output from the child process\n" " -f <file> The file where any output from the child process\n"
" should be stored.\n"; " should be stored.\n"
" -r <file> The file containing the input to be sent to the child\n"
" process.\n"
" -e <file> The file containing the expected output from the child\n"
" process.\n"
"\n"
"Examples:\n"
" To record a session for playback later:\n"
" $ scripty -t input.0 -f output.0 -- myCursesApp\n"
"\n"
" To replay the recorded session:\n"
" $ scripty -r input.0 -- myCursesApp\n";
fprintf(stderr, usage_msg, scripty_data.sd_program_name); fprintf(stderr, usage_msg, scripty_data.sd_program_name);
} }
@ -254,18 +335,22 @@ static void usage(void)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int c, fd, retval = EXIT_SUCCESS; int c, fd, retval = EXIT_SUCCESS;
expect_handler ex_handler;
bool passout = true; bool passout = true;
FILE *file; FILE *file;
scripty_data.sd_program_name = argv[0]; scripty_data.sd_program_name = argv[0];
scripty_data.sd_looping = true; scripty_data.sd_looping = true;
while ((c = getopt(argc, argv, "ht:f:r:e:n")) != -1) { while ((c = getopt(argc, argv, "ht:f:r:e:ns")) != -1) {
switch (c) { switch (c) {
case 'h': case 'h':
usage(); usage();
exit(retval); exit(retval);
break; break;
case 's':
scripty_data.sd_user_step = true;
break;
case 't': case 't':
scripty_data.sd_to_child_name = optarg; scripty_data.sd_to_child_name = optarg;
break; break;
@ -292,7 +377,7 @@ int main(int argc, char *argv[])
sp += 1; sp += 1;
if (strcmp(line, "read") == 0) { if (strcmp(line, "read") == 0) {
exp.e_type = ET_READ; exp.e_type = ET_READ;
exp.e_arg.b = hex2bits(sp); exp.e_arg.read = (struct expect_read *)hex2bits(sp);
} }
else { else {
fprintf(stderr, fprintf(stderr,
@ -300,7 +385,7 @@ int main(int argc, char *argv[])
line); line);
retval = EXIT_FAILURE; retval = EXIT_FAILURE;
} }
scripty_data.sd_expected.push(exp); ex_handler.eh_queue.push(exp);
} }
} }
fclose(file); fclose(file);
@ -400,12 +485,12 @@ int main(int argc, char *argv[])
exit(-1); exit(-1);
} }
else { else {
int maxfd, out_len = 0, exp_pos = 0, exp_len = 0; int maxfd, out_len = 0;
bool got_expected = true; bool got_expected = true;
bool got_user_step;
struct timeval last, now; struct timeval last, now;
char out_buffer[8192]; char out_buffer[8192];
fd_set read_fds; fd_set read_fds;
char *exp_data = NULL;
scripty_data.sd_child_pid = ct.get_child_pid(); scripty_data.sd_child_pid = ct.get_child_pid();
signal(SIGINT, sigpass); signal(SIGINT, sigpass);
@ -424,17 +509,7 @@ int main(int argc, char *argv[])
tty_raw(STDIN_FILENO); tty_raw(STDIN_FILENO);
if (!scripty_data.sd_expected.empty()) { if (!ex_handler.eh_queue.empty()) {
struct expect exp = scripty_data.sd_expected.front();
scripty_data.sd_expected.pop();
switch (exp.e_type) {
case ET_READ:
exp_pos = sizeof(int);
exp_len = *((int *)exp.e_arg.b) + sizeof(int);
exp_data = exp.e_arg.b;
break;
}
got_expected = false; got_expected = false;
} }
@ -448,27 +523,25 @@ int main(int argc, char *argv[])
to.tv_usec = 10000; to.tv_usec = 10000;
rc = select(maxfd + 1, &ready_rfds, NULL, NULL, &to); rc = select(maxfd + 1, &ready_rfds, NULL, NULL, &to);
if (rc == 0) { if (rc == 0) {
if (exp_data != NULL && exp_pos == exp_len && !got_expected) { if (!got_expected) {
exp_data = NULL; switch (ex_handler.process_input(NULL, 0)) {
if (!scripty_data.sd_expected.empty()) { case -1:
struct expect exp = scripty_data.sd_expected.front(); scripty_data.sd_looping = false;
retval = EXIT_FAILURE;
delete [] exp_data; break;
scripty_data.sd_expected.pop(); case 0:
switch (exp.e_type) { break;
case ET_READ: case 1:
exp_pos = sizeof(int); got_expected = true;
exp_len = *((int *)exp.e_arg.b) + sizeof(int); break;
exp_data = exp.e_arg.b;
break;
}
}
got_expected = true;
} }
if (!scripty_data.sd_replay.empty() && got_expected) { }
if (!scripty_data.sd_replay.empty() && got_expected &&
(!scripty_data.sd_user_step || got_user_step)) {
struct command cmd = scripty_data.sd_replay.front(); struct command cmd = scripty_data.sd_replay.front();
int len; int len;
fprintf(stderr, " us %d got %d\n", scripty_data.sd_user_step, got_user_step);
scripty_data.sd_replay.pop(); scripty_data.sd_replay.pop();
fprintf(stderr, "replay %zd\n", scripty_data.sd_replay.size()); fprintf(stderr, "replay %zd\n", scripty_data.sd_replay.size());
switch (cmd.c_type) { switch (cmd.c_type) {
@ -482,6 +555,7 @@ int main(int argc, char *argv[])
delete [] cmd.c_arg.b; delete [] cmd.c_arg.b;
break; break;
} }
got_user_step = false;
got_expected = false; got_expected = false;
} }
} }
@ -498,6 +572,7 @@ int main(int argc, char *argv[])
else { else {
char buffer[1024]; char buffer[1024];
fprintf(stderr, "fds ready %d\n", rc);
gettimeofday(&now, NULL); gettimeofday(&now, NULL);
timersub(&now, &last, &diff); timersub(&now, &last, &diff);
if (FD_ISSET(STDIN_FILENO, &ready_rfds)) { if (FD_ISSET(STDIN_FILENO, &ready_rfds)) {
@ -508,6 +583,11 @@ int main(int argc, char *argv[])
else if (rc == 0) { else if (rc == 0) {
FD_CLR(STDIN_FILENO, &read_fds); FD_CLR(STDIN_FILENO, &read_fds);
} }
else if (!scripty_data.sd_replay.empty()) {
if (scripty_data.sd_user_step) {
got_user_step = true;
}
}
else { else {
write(ct.get_fd(), buffer, rc); write(ct.get_fd(), buffer, rc);
if (scripty_data.sd_to_child != NULL) { if (scripty_data.sd_to_child != NULL) {
@ -539,6 +619,7 @@ int main(int argc, char *argv[])
} }
if (FD_ISSET(ct.get_fd(), &ready_rfds)) { if (FD_ISSET(ct.get_fd(), &ready_rfds)) {
rc = read(ct.get_fd(), buffer, sizeof(buffer)); rc = read(ct.get_fd(), buffer, sizeof(buffer));
fprintf(stderr, "read rc %d\n", rc);
if (rc <= 0) { if (rc <= 0) {
scripty_data.sd_looping = false; scripty_data.sd_looping = false;
if (scripty_data.sd_from_child) { if (scripty_data.sd_from_child) {
@ -560,37 +641,16 @@ int main(int argc, char *argv[])
rc); rc);
out_len += rc; out_len += rc;
} }
if (exp_data != NULL) { switch (ex_handler.process_input(buffer, rc)) {
int clen = min((exp_len - exp_pos), rc); case -1:
scripty_data.sd_looping = false;
fprintf(stderr, "cmp %d %d %d %d\n", exp_len, exp_pos, rc, clen); retval = EXIT_FAILURE;
if (memcmp(&exp_data[exp_pos], break;
buffer, case 0:
clen) == 0) { break;
exp_pos += clen; case 1:
fprintf(stderr, "exp %d %d\n", exp_pos, clen); got_expected = true;
if (exp_pos == exp_len) { break;
exp_data = NULL;
if (!scripty_data.sd_expected.empty()) {
struct expect exp = scripty_data.sd_expected.front();
delete [] exp_data;
scripty_data.sd_expected.pop();
switch (exp.e_type) {
case ET_READ:
exp_pos = sizeof(int);
exp_len = *((int *)exp.e_arg.b) + sizeof(int);
exp_data = exp.e_arg.b;
break;
}
}
got_expected = true;
}
}
else {
scripty_data.sd_looping = false;
retval = EXIT_FAILURE;
}
} }
} }
} }
@ -599,8 +659,10 @@ int main(int argc, char *argv[])
} }
} }
if (!scripty_data.sd_expected.empty()) if (!ex_handler.eh_queue.empty()) {
fprintf(stderr, "More input expected from child\n");
retval = EXIT_FAILURE; retval = EXIT_FAILURE;
}
retval = ct.wait_for_child() || retval; retval = ct.wait_for_child() || retval;
} }

@ -0,0 +1,24 @@
#include "config.h"
#include <stdio.h>
#include <assert.h>
#include "hist_source.hh"
int main(int argc, char *argv[])
{
int retval = EXIT_SUCCESS;
hist_source hs;
assert(hs.text_line_count() == 0);
hs.analyze();
hs.add_value(1, bucket_type_t(1));
assert(hs.text_line_count() == 101);
hs.add_value(2, bucket_type_t(1));
assert(hs.text_line_count() == 101);
return retval;
}

@ -0,0 +1,6 @@
#! /bin/bash
run_test ./scripty -n -e ${srcdir}/view_colors_output.0 -- \
./drive_view_colors < /dev/null
on_error_fail_with "view colors are wrong?"

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save