summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Egger <christoph@debian.org>2019-01-07 22:09:08 +0100
committerChristoph Egger <christoph@debian.org>2019-01-07 22:09:08 +0100
commita83ee5d3dcb57f4b9487a7266524c947a3343317 (patch)
tree86a7a29de0ee35a907c385de8eb91a8057609b0b
parent21f1888e42e959a3b90c04e862a3dcec64faab5a (diff)
parent149e4a3ed3c782ba18f6d4b4bffecb551481c5fb (diff)
Updated version 2.1.2 from 'upstream/2.1.2'
with Debian dir 5771e281a0e9b291783d9dba10fe35f0ef1bf845
-rw-r--r--Makefile.in15
-rw-r--r--NEWS.md23
-rw-r--r--README.md7
-rw-r--r--aclocal.m4265
-rw-r--r--completion/Makefile.in13
-rw-r--r--completion/_pdfgrep9
-rw-r--r--completion/pdfgrep9
-rwxr-xr-xconfig.guess188
-rwxr-xr-xconfig.sub73
-rwxr-xr-xconfigure211
-rw-r--r--configure.ac2
-rw-r--r--doc/Makefile.in13
-rw-r--r--doc/pdfgrep.1238
-rw-r--r--doc/pdfgrep.txt164
-rw-r--r--src/Makefile.am2
-rw-r--r--src/Makefile.in60
-rw-r--r--src/cache.cc3
-rw-r--r--src/cache.h7
-rw-r--r--src/exclude.cc2
-rw-r--r--src/exclude.h6
-rw-r--r--src/intervals.cc98
-rw-r--r--src/intervals.h85
-rw-r--r--src/output.cc14
-rw-r--r--src/output.h9
-rw-r--r--src/pdfgrep.cc153
-rw-r--r--src/pdfgrep.h19
-rw-r--r--src/regengine.cc25
-rw-r--r--src/regengine.h23
-rw-r--r--src/search.cc61
-rw-r--r--src/search.h6
-rw-r--r--testsuite/Makefile.in17
-rw-r--r--testsuite/README.md1
-rw-r--r--testsuite/config/Makefile.in13
-rw-r--r--testsuite/lib/Makefile.in13
-rw-r--r--testsuite/lib/pdfgrep.exp19
-rw-r--r--testsuite/pdfgrep.tests/Makefile.am3
-rw-r--r--testsuite/pdfgrep.tests/Makefile.in16
-rw-r--r--testsuite/pdfgrep.tests/only_filenames.exp290
-rw-r--r--testsuite/pdfgrep.tests/page_range.exp124
-rw-r--r--testsuite/pdfgrep.tests/patternlist.exp78
-rw-r--r--testsuite/pdfgrep.tests/regex.exp44
41 files changed, 1842 insertions, 579 deletions
diff --git a/Makefile.in b/Makefile.in
index f534a4e..2997d56 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -135,7 +135,7 @@ am__recursive_targets = \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
- cscope distdir dist dist-all distcheck
+ cscope distdir distdir-am dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
$(LISP)config.h.in
# Read a list of newline-separated strings from the standard input,
@@ -350,8 +350,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -484,7 +484,10 @@ distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
diff --git a/NEWS.md b/NEWS.md
index 047c348..03423ce 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,3 +1,26 @@
+Version 2.1.2 [2018-11-19]
+---------------------------
+
+ - Bugfix: Fix crash when compiled with hardened compiler flags
+ (specifically -D_GLIBCXX_ASSERTIONS)
+
+Version 2.1.1 [2018-05-22]
+---------------------------
+
+ - Bugfix: Fix build with libunac support enabled
+
+Version 2.1.0 [2018-04-28]
+---------------------------
+
+ - New option `--page-range` to limit search to a set of pages
+ - New option `--file/-f` to read patterns from a file
+ - New option `--regexp/-e` to specify multiple patterns (combined with OR).
+ - New options `--files-with-matches/-l` and `--files-without-match/-L` to only
+ list filenames of files that contain or don't contain matches.
+ - Major manpage restructuring. It's now divided into subsections like the GNU
+ grep's manpage.
+ - Bugfix: Actually stop searching after first match with `-q`
+
Version 2.0.1 [2017-03-06]
---------------------------
diff --git a/README.md b/README.md
index 1ee0a03..8b245fe 100644
--- a/README.md
+++ b/README.md
@@ -26,15 +26,18 @@ For a complete documentation, please consult the [manpage].
- poppler-cpp (poppler >= 0.14) (http://poppler.freedesktop.org/)
- libgcrypt (https://www.gnu.org/software/libgcrypt/)
- optionally libpcre (http://www.pcre.org/)
-
+
## Building
-... is easy. Just use the standard procedure:
+To build `pdfgrep`, use the standard procedure:
./configure
make
sudo make install
+Depending on your OS, you need to have `-dev` or `-devel` packages
+installed for all dependencies.
+
The `./configure` script can take lots of options to customize the
build process, the most important of which are:
diff --git a/aclocal.m4 b/aclocal.m4
index 230fe6d..bdcf296 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,6 +1,6 @@
-# generated automatically by aclocal 1.15 -*- Autoconf -*-
+# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -164,9 +164,9 @@ AC_DEFUN([AM_PATH_LIBGCRYPT],
AC_SUBST(LIBGCRYPT_LIBS)
])
-dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
-dnl serial 11 (pkg-config-0.29.1)
-dnl
+# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 11 (pkg-config-0.29.1)
+
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
dnl
@@ -440,7 +440,75 @@ AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR
-# Copyright (C) 2002-2014 Free Software Foundation, Inc.
+dnl PKG_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl [ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND],
+dnl [DESCRIPTION], [DEFAULT])
+dnl ------------------------------------------
+dnl
+dnl Prepare a "--with-" configure option using the lowercase
+dnl [VARIABLE-PREFIX] name, merging the behaviour of AC_ARG_WITH and
+dnl PKG_CHECK_MODULES in a single macro.
+AC_DEFUN([PKG_WITH_MODULES],
+[
+m4_pushdef([with_arg], m4_tolower([$1]))
+
+m4_pushdef([description],
+ [m4_default([$5], [build with ]with_arg[ support])])
+
+m4_pushdef([def_arg], [m4_default([$6], [auto])])
+m4_pushdef([def_action_if_found], [AS_TR_SH([with_]with_arg)=yes])
+m4_pushdef([def_action_if_not_found], [AS_TR_SH([with_]with_arg)=no])
+
+m4_case(def_arg,
+ [yes],[m4_pushdef([with_without], [--without-]with_arg)],
+ [m4_pushdef([with_without],[--with-]with_arg)])
+
+AC_ARG_WITH(with_arg,
+ AS_HELP_STRING(with_without, description[ @<:@default=]def_arg[@:>@]),,
+ [AS_TR_SH([with_]with_arg)=def_arg])
+
+AS_CASE([$AS_TR_SH([with_]with_arg)],
+ [yes],[PKG_CHECK_MODULES([$1],[$2],$3,$4)],
+ [auto],[PKG_CHECK_MODULES([$1],[$2],
+ [m4_n([def_action_if_found]) $3],
+ [m4_n([def_action_if_not_found]) $4])])
+
+m4_popdef([with_arg])
+m4_popdef([description])
+m4_popdef([def_arg])
+
+])dnl PKG_WITH_MODULES
+
+dnl PKG_HAVE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl [DESCRIPTION], [DEFAULT])
+dnl -----------------------------------------------
+dnl
+dnl Convenience macro to trigger AM_CONDITIONAL after PKG_WITH_MODULES
+dnl check._[VARIABLE-PREFIX] is exported as make variable.
+AC_DEFUN([PKG_HAVE_WITH_MODULES],
+[
+PKG_WITH_MODULES([$1],[$2],,,[$3],[$4])
+
+AM_CONDITIONAL([HAVE_][$1],
+ [test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"])
+])dnl PKG_HAVE_WITH_MODULES
+
+dnl PKG_HAVE_DEFINE_WITH_MODULES(VARIABLE-PREFIX, MODULES,
+dnl [DESCRIPTION], [DEFAULT])
+dnl ------------------------------------------------------
+dnl
+dnl Convenience macro to run AM_CONDITIONAL and AC_DEFINE after
+dnl PKG_WITH_MODULES check. HAVE_[VARIABLE-PREFIX] is exported as make
+dnl and preprocessor variable.
+AC_DEFUN([PKG_HAVE_DEFINE_WITH_MODULES],
+[
+PKG_HAVE_WITH_MODULES([$1],[$2],[$3],[$4])
+
+AS_IF([test "$AS_TR_SH([with_]m4_tolower([$1]))" = "yes"],
+ [AC_DEFINE([HAVE_][$1], 1, [Enable ]m4_tolower([$1])[ support])])
+])dnl PKG_HAVE_DEFINE_WITH_MODULES
+
+# Copyright (C) 2002-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -452,10 +520,10 @@ AS_VAR_IF([$1], [""], [$5], [$4])dnl
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.15'
+[am__api_version='1.16'
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.
-m4_if([$1], [1.15], [],
+m4_if([$1], [1.16.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -471,14 +539,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.15])dnl
+[AM_AUTOMAKE_VERSION([1.16.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -530,7 +598,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
# AM_COND_IF -*- Autoconf -*-
-# Copyright (C) 2008-2014 Free Software Foundation, Inc.
+# Copyright (C) 2008-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -567,7 +635,7 @@ fi[]dnl
# AM_CONDITIONAL -*- Autoconf -*-
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -598,7 +666,7 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -789,13 +857,12 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
@@ -803,49 +870,41 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
- case $CONFIG_FILES in
- *\'*) eval set x "$CONFIG_FILES" ;;
- *) set x $CONFIG_FILES ;;
- esac
+ # TODO: see whether this extra hack can be removed once we start
+ # requiring Autoconf 2.70 or later.
+ AS_CASE([$CONFIG_FILES],
+ [*\'*], [eval set x "$CONFIG_FILES"],
+ [*], [set x $CONFIG_FILES])
shift
- for mf
+ # Used to flag and report bootstrapping failures.
+ am_rc=0
+ for am_mf
do
# Strip MF so we end up with the name of the file.
- mf=`echo "$mf" | sed -e 's/:.*$//'`
- # Check whether this is an Automake generated Makefile or not.
- # We used to match only the files named 'Makefile.in', but
- # some people rename them; so instead we look at the file content.
- # Grep'ing the first line is not enough: some people post-process
- # each Makefile.in and add a new line on top of each file to say so.
- # Grep'ing the whole file is not good either: AIX grep has a line
+ am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile which includes
+ # dependency-tracking related rules and includes.
+ # Grep'ing the whole file directly is not great: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
- if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
- dirpart=`AS_DIRNAME("$mf")`
- else
- continue
- fi
- # Extract the definition of DEPDIR, am__include, and am__quote
- # from the Makefile without running 'make'.
- DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
- test -z "$DEPDIR" && continue
- am__include=`sed -n 's/^am__include = //p' < "$mf"`
- test -z "$am__include" && continue
- am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
- # Find all dependency output files, they are included files with
- # $(DEPDIR) in their names. We invoke sed twice because it is the
- # simplest approach to changing $(DEPDIR) to its actual value in the
- # expansion.
- for file in `sed -n "
- s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
- sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
- # Make sure the directory exists.
- test -f "$dirpart/$file" && continue
- fdir=`AS_DIRNAME(["$file"])`
- AS_MKDIR_P([$dirpart/$fdir])
- # echo "creating $dirpart/$file"
- echo '# dummy' > "$dirpart/$file"
- done
+ sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
+ || continue
+ am_dirpart=`AS_DIRNAME(["$am_mf"])`
+ am_filepart=`AS_BASENAME(["$am_mf"])`
+ AM_RUN_LOG([cd "$am_dirpart" \
+ && sed -e '/# am--include-marker/d' "$am_filepart" \
+ | $MAKE -f - am--depfiles]) || am_rc=$?
done
+ if test $am_rc -ne 0; then
+ AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
+ for automatic dependency tracking. Try re-running configure with the
+ '--disable-dependency-tracking' option to at least be able to build
+ the package (albeit without support for automatic dependency tracking).])
+ fi
+ AS_UNSET([am_dirpart])
+ AS_UNSET([am_filepart])
+ AS_UNSET([am_mf])
+ AS_UNSET([am_rc])
+ rm -f conftest-deps.mk
}
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
@@ -854,18 +913,17 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
-# This code is only required when automatic dependency tracking
-# is enabled. FIXME. This creates each '.P' file that we will
-# need in order to bootstrap the dependency handling code.
+# This code is only required when automatic dependency tracking is enabled.
+# This creates each '.Po' and '.Plo' makefile fragment that we'll need in
+# order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
- [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
-])
+ [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])])
# Do all the work for Automake. -*- Autoconf -*-
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -952,8 +1010,8 @@ AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
# For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see:
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
AC_SUBST([mkdir_p], ['$(MKDIR_P)'])
# We need awk for the "check" target (and possibly the TAP driver). The
# system "awk" is bad on some platforms.
@@ -1020,7 +1078,7 @@ END
Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation
-that behaves properly: <http://www.gnu.org/software/coreutils/>.
+that behaves properly: <https://www.gnu.org/software/coreutils/>.
If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
@@ -1062,7 +1120,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1083,7 +1141,7 @@ if test x"${install_sh+set}" != xset; then
fi
AC_SUBST([install_sh])])
-# Copyright (C) 2003-2014 Free Software Foundation, Inc.
+# Copyright (C) 2003-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1104,7 +1162,7 @@ AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1112,49 +1170,42 @@ AC_SUBST([am__leading_dot])])
# AM_MAKE_INCLUDE()
# -----------------
-# Check to see how make treats includes.
+# Check whether make has an 'include' directive that can support all
+# the idioms we need for our automatic dependency tracking code.
AC_DEFUN([AM_MAKE_INCLUDE],
-[am_make=${MAKE-make}
-cat > confinc << 'END'
+[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive])
+cat > confinc.mk << 'END'
am__doit:
- @echo this is the am__doit target
+ @echo this is the am__doit target >confinc.out
.PHONY: am__doit
END
-# If we don't find an include directive, just comment out the code.
-AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from 'make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
- am__include=include
- am__quote=
- _am_result=GNU
- ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
- echo '.include "confinc"' > confmf
- case `$am_make -s -f confmf 2> /dev/null` in #(
- *the\ am__doit\ target*)
- am__include=.include
- am__quote="\""
- _am_result=BSD
- ;;
- esac
-fi
-AC_SUBST([am__include])
-AC_SUBST([am__quote])
-AC_MSG_RESULT([$_am_result])
-rm -f confinc confmf
-])
+# BSD make does it like this.
+echo '.include "confinc.mk" # ignored' > confmf.BSD
+# Other make implementations (GNU, Solaris 10, AIX) do it like this.
+echo 'include confinc.mk # ignored' > confmf.GNU
+_am_result=no
+for s in GNU BSD; do
+ AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out])
+ AS_CASE([$?:`cat confinc.out 2>/dev/null`],
+ ['0:this is the am__doit target'],
+ [AS_CASE([$s],
+ [BSD], [am__include='.include' am__quote='"'],
+ [am__include='include' am__quote=''])])
+ if test "$am__include" != "#"; then
+ _am_result="yes ($s style)"
+ break
+ fi
+done
+rm -f confinc.* confmf.*
+AC_MSG_RESULT([${_am_result}])
+AC_SUBST([am__include])])
+AC_SUBST([am__quote])])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
-# Copyright (C) 1997-2014 Free Software Foundation, Inc.
+# Copyright (C) 1997-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1193,7 +1244,7 @@ fi
# Helper functions for option handling. -*- Autoconf -*-
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1222,7 +1273,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
-# Copyright (C) 1999-2014 Free Software Foundation, Inc.
+# Copyright (C) 1999-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1269,7 +1320,7 @@ AC_LANG_POP([C])])
# For backward compatibility.
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1288,7 +1339,7 @@ AC_DEFUN([AM_RUN_LOG],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
-# Copyright (C) 1996-2014 Free Software Foundation, Inc.
+# Copyright (C) 1996-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1369,7 +1420,7 @@ AC_CONFIG_COMMANDS_PRE(
rm -f conftest.file
])
-# Copyright (C) 2009-2014 Free Software Foundation, Inc.
+# Copyright (C) 2009-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1429,7 +1480,7 @@ AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
])
-# Copyright (C) 2001-2014 Free Software Foundation, Inc.
+# Copyright (C) 2001-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1457,7 +1508,7 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
-# Copyright (C) 2006-2014 Free Software Foundation, Inc.
+# Copyright (C) 2006-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -1476,7 +1527,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
# Check how to create a tarball. -*- Autoconf -*-
-# Copyright (C) 2004-2014 Free Software Foundation, Inc.
+# Copyright (C) 2004-2018 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
diff --git a/completion/Makefile.in b/completion/Makefile.in
index 87690f6..7808c61 100644
--- a/completion/Makefile.in
+++ b/completion/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -305,8 +305,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -408,7 +408,10 @@ ctags CTAGS:
cscope cscopelist:
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
diff --git a/completion/_pdfgrep b/completion/_pdfgrep
index b1d6a3f..150092d 100644
--- a/completion/_pdfgrep
+++ b/completion/_pdfgrep
@@ -2,7 +2,7 @@
# Zsh completion for pdfgrep.
-# Copyright (C) 2017 by Hans-Peter Deifel (hpd@hpdeifel.de)
+# Copyright (C) 2012-2018 by Hans-Peter Deifel (hpd@hpdeifel.de)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -26,6 +26,8 @@ _arguments -s -S -A "-*" \
"(-F --fixed-strings -P --perl-regexp)"{-P,--perl-regexp}"[use Perl compatible regular expression syntax]" \
"(-H --with-filename -h --no-filename)"{-H,--with-filename}"[print filename for each match]" \
"(-h --no-filename -H --with-filename)"{-h,--no-filename}"[don't print filename]" \
+ "(-l --files-with-matches -L --files-without-match)"{-l,--files-with-matches}"[print only names of matching files]" \
+ "(-l --files-with-matches -L --files-without-match)"{-L,--files-without-match}"[print only names of non-matching files]" \
"(-c --count)"{-c,--count}"[print only a count of matches per file]" \
"(-p --page-count)"{-p,--page-count}"[count matches per page]" \
"(-C --context)"{-C,--context=}"[specify lines of context]:lines" \
@@ -37,6 +39,7 @@ _arguments -s -S -A "-*" \
"(-r -R --recursive --dereference-recursive)"{-R,--dereference-recursive}"[search directories recursively, follow symlinks]" \
"*--exclude=[skip files]:exclude" \
"*--include=[opposite of exclude]:include" \
+ "--page-range=[limit search to a set of pages]:page-range" \
"(- 1)--help[display help information]" \
"(- 1)"{-V,--version}"[display version information]" \
"(-q --quiet)"{-q,--quiet}"[suppress all normal output]" \
@@ -47,5 +50,7 @@ _arguments -s -S -A "-*" \
"--debug[enable debug output]" \
"--warn-empty[warn if a PDF file contains no text]" \
"--unac[remove accents and ligatures]" \
- '1: :_guard "^-*" pattern' \
+ "(-e --regexp 1)"{-e,--regexp}"[use argument as pattern]:pattern" \
+ "(-f --file 1)"{-f,--file}"[read patterns from file]:pattern" \
+ '(-e --regexp -f --file)1: :_guard "^-*" pattern' \
'*:pdf file:_files -g "*.pdf(-.)"'
diff --git a/completion/pdfgrep b/completion/pdfgrep
index 372f76e..e156004 100644
--- a/completion/pdfgrep
+++ b/completion/pdfgrep
@@ -1,6 +1,6 @@
# Bash completion for pdfgrep
#
-# Copyright (C) 2017 by Hans-Peter Deifel (hpd@hpdeifel.de)
+# Copyright (C) 2015-2018 by Hans-Peter Deifel (hpd@hpdeifel.de)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,6 +29,8 @@ _pdfgrep()
-P --perl-regexp \
-H --with-filename \
-h --no-filename \
+ -l --files-with-matches \
+ -L --files-without-match \
-c --count \
-p --page-count \
-C --context \
@@ -39,6 +41,7 @@ _pdfgrep()
-r -R --recursive \
--exclude \
--include \
+ --page-range \
--help \
-V --version \
-q --quiet \
@@ -49,13 +52,15 @@ _pdfgrep()
--debug \
--warn-empty \
--unac \
+ -e --regexp \
+ -f --file \
)
case "${prev}" in
--color)
COMPREPLY=( $(compgen -W "always never auto" -- ${cur}) )
;;
- --exclude|--include|--password|-m|--max-count|--match-prefix-separator)
+ --exclude|--include|--password|-m|--max-count|--match-prefix-separator|--page-range|-e|--regexp|-f|--file)
COMPREPLY=( )
;;
*)
diff --git a/config.guess b/config.guess
index 6c32c86..2193702 100755
--- a/config.guess
+++ b/config.guess
@@ -1,8 +1,8 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2014 Free Software Foundation, Inc.
+# Copyright 1992-2017 Free Software Foundation, Inc.
-timestamp='2014-11-04'
+timestamp='2017-05-27'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ timestamp='2014-11-04'
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
#
# Please send patches to <config-patches@gnu.org>.
@@ -50,7 +50,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -168,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+ /sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || \
+ echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
+ earmv*)
+ arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+ endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
+ machine=${arch}${endian}-unknown
+ ;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
+ # to ELF recently (or will in the future) and ABI.
case "${UNAME_MACHINE_ARCH}" in
+ earm*)
+ os=netbsdelf
+ ;;
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -197,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
os=netbsd
;;
esac
+ # Determine ABI tags.
+ case "${UNAME_MACHINE_ARCH}" in
+ earm*)
+ expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+ abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
+ ;;
+ esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
@@ -207,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
release='-gnu'
;;
*)
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}"
+ echo "${machine}-${os}${release}${abi}"
exit ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
@@ -223,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
exit ;;
+ *:LibertyBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
+ exit ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
@@ -235,6 +256,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit ;;
+ *:Sortix:*:*)
+ echo ${UNAME_MACHINE}-unknown-sortix
+ exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
@@ -251,42 +275,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
case "$ALPHA_CPU_TYPE" in
"EV4 (21064)")
- UNAME_MACHINE="alpha" ;;
+ UNAME_MACHINE=alpha ;;
"EV4.5 (21064)")
- UNAME_MACHINE="alpha" ;;
+ UNAME_MACHINE=alpha ;;
"LCA4 (21066/21068)")
- UNAME_MACHINE="alpha" ;;
+ UNAME_MACHINE=alpha ;;
"EV5 (21164)")
- UNAME_MACHINE="alphaev5" ;;
+ UNAME_MACHINE=alphaev5 ;;
"EV5.6 (21164A)")
- UNAME_MACHINE="alphaev56" ;;
+ UNAME_MACHINE=alphaev56 ;;
"EV5.6 (21164PC)")
- UNAME_MACHINE="alphapca56" ;;
+ UNAME_MACHINE=alphapca56 ;;
"EV5.7 (21164PC)")
- UNAME_MACHINE="alphapca57" ;;
+ UNAME_MACHINE=alphapca57 ;;
"EV6 (21264)")
- UNAME_MACHINE="alphaev6" ;;
+ UNAME_MACHINE=alphaev6 ;;
"EV6.7 (21264A)")
- UNAME_MACHINE="alphaev67" ;;
+ UNAME_MACHINE=alphaev67 ;;
"EV6.8CB (21264C)")
- UNAME_MACHINE="alphaev68" ;;
+ UNAME_MACHINE=alphaev68 ;;
"EV6.8AL (21264B)")
- UNAME_MACHINE="alphaev68" ;;
+ UNAME_MACHINE=alphaev68 ;;
"EV6.8CX (21264D)")
- UNAME_MACHINE="alphaev68" ;;
+ UNAME_MACHINE=alphaev68 ;;
"EV6.9A (21264/EV69A)")
- UNAME_MACHINE="alphaev69" ;;
+ UNAME_MACHINE=alphaev69 ;;
"EV7 (21364)")
- UNAME_MACHINE="alphaev7" ;;
+ UNAME_MACHINE=alphaev7 ;;
"EV7.9 (21364A)")
- UNAME_MACHINE="alphaev79" ;;
+ UNAME_MACHINE=alphaev79 ;;
esac
# A Pn.n version is a patched version.
# A Vn.n version is a released version.
# A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$?
trap '' 0
@@ -359,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
- SUN_ARCH="i386"
+ SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
- SUN_ARCH="x86_64"
+ SUN_ARCH=x86_64
fi
fi
echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
@@ -393,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
exit ;;
sun*:*:4.2BSD:*)
UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
case "`/bin/arch`" in
sun3)
echo m68k-sun-sunos${UNAME_RELEASE}
@@ -618,13 +642,13 @@ EOF
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
532) # CPU_PA_RISC2_0
case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
- '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ 32) HP_ARCH=hppa2.0n ;;
+ 64) HP_ARCH=hppa2.0w ;;
+ '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
esac ;;
esac
fi
@@ -663,11 +687,11 @@ EOF
exit (0);
}
EOF
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
- if [ ${HP_ARCH} = "hppa2.0w" ]
+ if [ ${HP_ARCH} = hppa2.0w ]
then
eval $set_cc_for_build
@@ -680,12 +704,12 @@ EOF
# $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
# => hppa64-hp-hpux11.23
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
grep -q __LP64__
then
- HP_ARCH="hppa2.0w"
+ HP_ARCH=hppa2.0w
else
- HP_ARCH="hppa64"
+ HP_ARCH=hppa64
fi
fi
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
@@ -790,14 +814,14 @@ EOF
echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
+ FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
@@ -813,10 +837,11 @@ EOF
UNAME_PROCESSOR=`/usr/bin/uname -p`
case ${UNAME_PROCESSOR} in
amd64)
- echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- *)
- echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ UNAME_PROCESSOR=x86_64 ;;
+ i386)
+ UNAME_PROCESSOR=i586 ;;
esac
+ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
@@ -879,7 +904,7 @@ EOF
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
@@ -902,7 +927,7 @@ EOF
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+ if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arc:Linux:*:* | arceb:Linux:*:*)
@@ -933,6 +958,9 @@ EOF
crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
+ e2k:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
@@ -945,6 +973,9 @@ EOF
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
+ k1om:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
@@ -970,6 +1001,9 @@ EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
+ mips64el:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
openrisc*:Linux:*:*)
echo or1k-unknown-linux-${LIBC}
exit ;;
@@ -1002,6 +1036,9 @@ EOF
ppcle:Linux:*:*)
echo powerpcle-unknown-linux-${LIBC}
exit ;;
+ riscv32:Linux:*:* | riscv64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
@@ -1021,7 +1058,7 @@ EOF
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
@@ -1100,7 +1137,7 @@ EOF
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
- # prints for the "djgpp" host, or else GDB configury will decide that
+ # prints for the "djgpp" host, or else GDB configure will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
@@ -1249,6 +1286,9 @@ EOF
SX-8R:SUPER-UX:*:*)
echo sx8r-nec-superux${UNAME_RELEASE}
exit ;;
+ SX-ACE:SUPER-UX:*:*)
+ echo sxace-nec-superux${UNAME_RELEASE}
+ exit ;;
Power*:Rhapsody:*:*)
echo powerpc-apple-rhapsody${UNAME_RELEASE}
exit ;;
@@ -1262,16 +1302,23 @@ EOF
UNAME_PROCESSOR=powerpc
fi
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
i386) UNAME_PROCESSOR=x86_64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
fi
+ # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
+ if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_PPC >/dev/null
+ then
+ UNAME_PROCESSOR=powerpc
+ fi
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
# Avoid executing cc on OS X 10.9, as it ships with a stub
@@ -1286,7 +1333,7 @@ EOF
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
UNAME_PROCESSOR=`uname -p`
- if test "$UNAME_PROCESSOR" = "x86"; then
+ if test "$UNAME_PROCESSOR" = x86; then
UNAME_PROCESSOR=i386
UNAME_MACHINE=pc
fi
@@ -1295,15 +1342,18 @@ EOF
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
- NEO-?:NONSTOP_KERNEL:*:*)
+ NEO-*:NONSTOP_KERNEL:*:*)
echo neo-tandem-nsk${UNAME_RELEASE}
exit ;;
NSE-*:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
+ NSR-*:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit ;;
+ NSX-*:NONSTOP_KERNEL:*:*)
+ echo nsx-tandem-nsk${UNAME_RELEASE}
+ exit ;;
*:NonStop-UX:*:*)
echo mips-compaq-nonstopux
exit ;;
@@ -1317,7 +1367,7 @@ EOF
# "uname -m" is not consistent, so use $cputype instead. 386
# is converted to i386 for consistency with other x86
# operating systems.
- if test "$cputype" = "386"; then
+ if test "$cputype" = 386; then
UNAME_MACHINE=i386
else
UNAME_MACHINE="$cputype"
@@ -1359,7 +1409,7 @@ EOF
echo i386-pc-xenix
exit ;;
i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
exit ;;
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
@@ -1370,23 +1420,25 @@ EOF
x86_64:VMkernel:*:*)
echo ${UNAME_MACHINE}-unknown-esx
exit ;;
+ amd64:Isilon\ OneFS:*:*)
+ echo x86_64-unknown-onefs
+ exit ;;
esac
cat >&2 <<EOF
$0: unable to guess system type
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
+This script (version $timestamp), has failed to recognize the
+operating system you are using. If your script is old, overwrite
+config.guess and config.sub with the latest versions from:
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
and
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
+If $0 has already been updated, send the following data and any
+information you think might be pertinent to config-patches@gnu.org to
+provide the necessary information to handle your system.
config.guess timestamp = $timestamp
diff --git a/config.sub b/config.sub
index 7ffe373..40ea5df 100755
--- a/config.sub
+++ b/config.sub
@@ -1,8 +1,8 @@
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2014 Free Software Foundation, Inc.
+# Copyright 1992-2017 Free Software Foundation, Inc.
-timestamp='2014-12-03'
+timestamp='2017-04-02'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -33,7 +33,7 @@ timestamp='2014-12-03'
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
@@ -53,8 +53,7 @@ timestamp='2014-12-03'
me=`echo "$0" | sed -e 's,.*/,,'`
usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
- $0 [OPTION] ALIAS
+Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name.
@@ -68,7 +67,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -117,8 +116,8 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
- knetbsd*-gnu* | netbsd*-gnu* | \
- kopensolaris*-gnu* | \
+ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
+ kopensolaris*-gnu* | cloudabi*-eabi* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -255,15 +254,16 @@ case $basic_machine in
| arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
+ | ba \
| be32 | be64 \
| bfin \
| c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
- | epiphany \
- | fido | fr30 | frv \
+ | e2k | epiphany \
+ | fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
- | i370 | i860 | i960 | ia64 \
+ | i370 | i860 | i960 | ia16 | ia64 \
| ip2k | iq2000 \
| k1om \
| le32 | le64 \
@@ -301,11 +301,12 @@ case $basic_machine in
| open8 | or1k | or1knd | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
+ | pru \
| pyramid \
| riscv32 | riscv64 \
| rl78 | rx \
| score \
- | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@@ -314,6 +315,7 @@ case $basic_machine in
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \
+ | wasm32 \
| we32k \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
@@ -376,17 +378,18 @@ case $basic_machine in
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
+ | ba-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
- | elxsi-* \
+ | e2k-* | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
- | i*86-* | i860-* | i960-* | ia64-* \
+ | i*86-* | i860-* | i960-* | ia16-* | ia64-* \
| ip2k-* | iq2000-* \
| k1om-* \
| le32-* | le64-* \
@@ -427,13 +430,15 @@ case $basic_machine in
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+ | pru-* \
| pyramid-* \
+ | riscv32-* | riscv64-* \
| rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
@@ -442,6 +447,7 @@ case $basic_machine in
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| visium-* \
+ | wasm32-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
@@ -518,6 +524,9 @@ case $basic_machine in
basic_machine=i386-pc
os=-aros
;;
+ asmjs)
+ basic_machine=asmjs-unknown
+ ;;
aux)
basic_machine=m68k-apple
os=-aux
@@ -638,6 +647,14 @@ case $basic_machine in
basic_machine=m68k-bull
os=-sysv3
;;
+ e500v[12])
+ basic_machine=powerpc-unknown
+ os=$os"spe"
+ ;;
+ e500v[12]-*)
+ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=$os"spe"
+ ;;
ebmon29k)
basic_machine=a29k-amd
os=-ebmon
@@ -933,6 +950,9 @@ case $basic_machine in
nsr-tandem)
basic_machine=nsr-tandem
;;
+ nsx-tandem)
+ basic_machine=nsx-tandem
+ ;;
op50n-* | op60c-*)
basic_machine=hppa1.1-oki
os=-proelf
@@ -1017,7 +1037,7 @@ case $basic_machine in
ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
+ ppcle | powerpclittle)
basic_machine=powerpcle-unknown
;;
ppcle-* | powerpclittle-*)
@@ -1027,7 +1047,7 @@ case $basic_machine in
;;
ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
- ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ ppc64le | powerpc64little)
basic_machine=powerpc64le-unknown
;;
ppc64le-* | powerpc64little-*)
@@ -1228,6 +1248,9 @@ case $basic_machine in
basic_machine=a29k-wrs
os=-vxworks
;;
+ wasm32)
+ basic_machine=wasm32-unknown
+ ;;
w65*)
basic_machine=w65-wdc
os=-none
@@ -1373,18 +1396,18 @@ case $os in
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* | -aros* \
+ | -aos* | -aros* | -cloudabi* | -sortix* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -bitrig* | -openbsd* | -solidbsd* \
+ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* | -cegcc* \
+ | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
+ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
@@ -1393,7 +1416,8 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \
+ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1525,6 +1549,8 @@ case $os in
;;
-nacl*)
;;
+ -ios)
+ ;;
-none)
;;
*)
@@ -1620,6 +1646,9 @@ case $basic_machine in
sparc-* | *-sun)
os=-sunos4.1.1
;;
+ pru-*)
+ os=-elf
+ ;;
*-be)
os=-beos
;;
diff --git a/configure b/configure
index 0bdeaa9..e4e67f7 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for pdfgrep 2.0.1.
+# Generated by GNU Autoconf 2.69 for pdfgrep 2.1.2.
#
# Report bugs to <pdfgrep-users@pdfgrep.org>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='pdfgrep'
PACKAGE_TARNAME='pdfgrep'
-PACKAGE_VERSION='2.0.1'
-PACKAGE_STRING='pdfgrep 2.0.1'
+PACKAGE_VERSION='2.1.2'
+PACKAGE_STRING='pdfgrep 2.1.2'
PACKAGE_BUGREPORT='pdfgrep-users@pdfgrep.org'
PACKAGE_URL=''
@@ -677,7 +677,6 @@ am__nodep
AMDEPBACKSLASH
AMDEP_FALSE
AMDEP_TRUE
-am__quote
am__include
DEPDIR
OBJEXT
@@ -751,7 +750,8 @@ PACKAGE_VERSION
PACKAGE_TARNAME
PACKAGE_NAME
PATH_SEPARATOR
-SHELL'
+SHELL
+am__quote'
ac_subst_files=''
ac_user_opts='
enable_option_checking
@@ -1326,7 +1326,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures pdfgrep 2.0.1 to adapt to many kinds of systems.
+\`configure' configures pdfgrep 2.1.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1396,7 +1396,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of pdfgrep 2.0.1:";;
+ short | recursive ) echo "Configuration of pdfgrep 2.1.2:";;
esac
cat <<\_ACEOF
@@ -1524,7 +1524,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-pdfgrep configure 2.0.1
+pdfgrep configure 2.1.2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1931,7 +1931,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by pdfgrep $as_me 2.0.1, which was
+It was created by pdfgrep $as_me 2.1.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2280,7 +2280,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
-am__api_version='1.15'
+am__api_version='1.16'
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
@@ -2795,7 +2795,7 @@ fi
# Define the identity of the package.
PACKAGE='pdfgrep'
- VERSION='2.0.1'
+ VERSION='2.1.2'
cat >>confdefs.h <<_ACEOF
@@ -2825,8 +2825,8 @@ MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
# For better backward compatibility. To be removed once Automake 1.9.x
# dies out for good. For more background, see:
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
-# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <https://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
mkdir_p='$(MKDIR_P)'
# We need awk for the "check" target (and possibly the TAP driver). The
@@ -2877,7 +2877,7 @@ END
Aborting the configuration process, to ensure you take notice of the issue.
You can download and install GNU coreutils to get an 'rm' implementation
-that behaves properly: <http://www.gnu.org/software/coreutils/>.
+that behaves properly: <https://www.gnu.org/software/coreutils/>.
If you want to complete the configuration process using your problematic
'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM
@@ -3401,45 +3401,45 @@ DEPDIR="${am__leading_dot}deps"
ac_config_commands="$ac_config_commands depfiles"
-
-am_make=${MAKE-make}
-cat > confinc << 'END'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5
+$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; }
+cat > confinc.mk << 'END'
am__doit:
- @echo this is the am__doit target
+ @echo this is the am__doit target >confinc.out
.PHONY: am__doit
END
-# If we don't find an include directive, just comment out the code.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
-$as_echo_n "checking for style of include used by $am_make... " >&6; }
am__include="#"
am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# Ignore all kinds of additional output from 'make'.
-case `$am_make -s -f confmf 2> /dev/null` in #(
-*the\ am__doit\ target*)
- am__include=include
- am__quote=
- _am_result=GNU
- ;;
-esac
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
- echo '.include "confinc"' > confmf
- case `$am_make -s -f confmf 2> /dev/null` in #(
- *the\ am__doit\ target*)
- am__include=.include
- am__quote="\""
- _am_result=BSD
+# BSD make does it like this.
+echo '.include "confinc.mk" # ignored' > confmf.BSD
+# Other make implementations (GNU, Solaris 10, AIX) do it like this.
+echo 'include confinc.mk # ignored' > confmf.GNU
+_am_result=no
+for s in GNU BSD; do
+ { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
+ (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ case $?:`cat confinc.out 2>/dev/null` in #(
+ '0:this is the am__doit target') :
+ case $s in #(
+ BSD) :
+ am__include='.include' am__quote='"' ;; #(
+ *) :
+ am__include='include' am__quote='' ;;
+esac ;; #(
+ *) :
;;
- esac
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
-$as_echo "$_am_result" >&6; }
-rm -f confinc confmf
+esac
+ if test "$am__include" != "#"; then
+ _am_result="yes ($s style)"
+ break
+ fi
+done
+rm -f confinc.* confmf.*
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
+$as_echo "${_am_result}" >&6; }
# Check whether --enable-dependency-tracking was given.
if test "${enable_dependency_tracking+set}" = set; then :
@@ -6546,7 +6546,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by pdfgrep $as_me 2.0.1, which was
+This file was extended by pdfgrep $as_me 2.1.2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -6612,7 +6612,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-pdfgrep config.status 2.0.1
+pdfgrep config.status 2.1.2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -6731,7 +6731,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
#
# INIT-COMMANDS
#
-AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"
_ACEOF
@@ -7350,29 +7350,35 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
# Older Autoconf quotes --file arguments for eval, but not when files
# are listed without --file. Let's play safe and only enable the eval
# if we detect the quoting.
- case $CONFIG_FILES in
- *\'*) eval set x "$CONFIG_FILES" ;;
- *) set x $CONFIG_FILES ;;
- esac
+ # TODO: see whether this extra hack can be removed once we start
+ # requiring Autoconf 2.70 or later.
+ case $CONFIG_FILES in #(
+ *\'*) :
+ eval set x "$CONFIG_FILES" ;; #(
+ *) :
+ set x $CONFIG_FILES ;; #(
+ *) :
+ ;;
+esac
shift
- for mf
+ # Used to flag and report bootstrapping failures.
+ am_rc=0
+ for am_mf
do
# Strip MF so we end up with the name of the file.
- mf=`echo "$mf" | sed -e 's/:.*$//'`
- # Check whether this is an Automake generated Makefile or not.
- # We used to match only the files named 'Makefile.in', but
- # some people rename them; so instead we look at the file content.
- # Grep'ing the first line is not enough: some people post-process
- # each Makefile.in and add a new line on top of each file to say so.
- # Grep'ing the whole file is not good either: AIX grep has a line
+ am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile which includes
+ # dependency-tracking related rules and includes.
+ # Grep'ing the whole file directly is not great: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
- if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
- dirpart=`$as_dirname -- "$mf" ||
-$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$mf" : 'X\(//\)[^/]' \| \
- X"$mf" : 'X\(//\)$' \| \
- X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$mf" |
+ sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \
+ || continue
+ am_dirpart=`$as_dirname -- "$am_mf" ||
+$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$am_mf" : 'X\(//\)[^/]' \| \
+ X"$am_mf" : 'X\(//\)$' \| \
+ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$am_mf" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
@@ -7390,53 +7396,48 @@ $as_echo X"$mf" |
q
}
s/.*/./; q'`
- else
- continue
- fi
- # Extract the definition of DEPDIR, am__include, and am__quote
- # from the Makefile without running 'make'.
- DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
- test -z "$DEPDIR" && continue
- am__include=`sed -n 's/^am__include = //p' < "$mf"`
- test -z "$am__include" && continue
- am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
- # Find all dependency output files, they are included files with
- # $(DEPDIR) in their names. We invoke sed twice because it is the
- # simplest approach to changing $(DEPDIR) to its actual value in the
- # expansion.
- for file in `sed -n "
- s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
- sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
- # Make sure the directory exists.
- test -f "$dirpart/$file" && continue
- fdir=`$as_dirname -- "$file" ||
-$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$file" : 'X\(//\)[^/]' \| \
- X"$file" : 'X\(//\)$' \| \
- X"$file" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
+ am_filepart=`$as_basename -- "$am_mf" ||
+$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$am_mf" : 'X\(//\)$' \| \
+ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$am_mf" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
}
- /^X\(\/\/\)$/{
+ /^X\/\(\/\/\)$/{
s//\1/
q
}
- /^X\(\/\).*/{
+ /^X\/\(\/\).*/{
s//\1/
q
}
s/.*/./; q'`
- as_dir=$dirpart/$fdir; as_fn_mkdir_p
- # echo "creating $dirpart/$file"
- echo '# dummy' > "$dirpart/$file"
- done
+ { echo "$as_me:$LINENO: cd "$am_dirpart" \
+ && sed -e '/# am--include-marker/d' "$am_filepart" \
+ | $MAKE -f - am--depfiles" >&5
+ (cd "$am_dirpart" \
+ && sed -e '/# am--include-marker/d' "$am_filepart" \
+ | $MAKE -f - am--depfiles) >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } || am_rc=$?
done
+ if test $am_rc -ne 0; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "Something went wrong bootstrapping makefile fragments
+ for automatic dependency tracking. Try re-running configure with the
+ '--disable-dependency-tracking' option to at least be able to build
+ the package (albeit without support for automatic dependency tracking).
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ { am_dirpart=; unset am_dirpart;}
+ { am_filepart=; unset am_filepart;}
+ { am_mf=; unset am_mf;}
+ { am_rc=; unset am_rc;}
+ rm -f conftest-deps.mk
}
;;
diff --git a/configure.ac b/configure.ac
index 104470a..3e9da61 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([pdfgrep], [2.0.1], [pdfgrep-users@pdfgrep.org])
+AC_INIT([pdfgrep], [2.1.2], [pdfgrep-users@pdfgrep.org])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_HEADER([config.h])
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 3d57df1..b88e365 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -295,8 +295,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -355,7 +355,10 @@ ctags CTAGS:
cscope cscopelist:
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
diff --git a/doc/pdfgrep.1 b/doc/pdfgrep.1
index 3d3a27d..c314f58 100644
--- a/doc/pdfgrep.1
+++ b/doc/pdfgrep.1
@@ -1,13 +1,13 @@
'\" t
.\" Title: pdfgrep
.\" Author: [see the "AUTHORS" section]
-.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
-.\" Date: 01/25/2017
+.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
+.\" Date: 11/19/2018
.\" Manual: Pdfgrep Manual
-.\" Source: Pdfgrep 2.0
+.\" Source: Pdfgrep 2.1.1
.\" Language: English
.\"
-.TH "PDFGREP" "1" "01/25/2017" "Pdfgrep 2\&.0" "Pdfgrep Manual"
+.TH "PDFGREP" "1" "11/19/2018" "Pdfgrep 2\&.1\&.1" "Pdfgrep Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -28,24 +28,32 @@
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
-pdfgrep \- search pdf files for a regular expression
+pdfgrep \- search PDF files for a regular expression
.SH "SYNOPSIS"
.sp
+.nf
\fBpdfgrep\fR [\fIOPTION\fR\&...] \fIPATTERN\fR [\fIFILE\fR\&...]
+\fBpdfgrep\fR [\fIOPTION\fR\&...] [\fB\-e\fR \fIPATTERN\fR | \fB\-f\fR \fIFILE\fR] [\fIFILE\fR\&...]
+.fi
.SH "DESCRIPTION"
.sp
-Search for \fIPATTERN\fR in each \fIFILE\fR\&. \fIPATTERN\fR is an extended regular expression\&.
+Search for \fIPATTERN\fR in each PDF \fIFILE\fR and print matching lines\&. By default, \fIPATTERN\fR is an extended regular expression\&.
.sp
-\fBpdfgrep\fR works much like grep, with one distinction: It operates on pages and not on lines\&.
+\fBpdfgrep\fR tries to be mostly compatible with \fBGNU grep\fR with some PDF\-specific distinctions and additional options\&. Most notably, \fB\-n\fR prints page instead of line numbers\&.
.SH "OPTIONS"
+.SS "General Information"
.PP
-\fB\-i\fR, \fB\-\-ignore\-case\fR
+\fB\-\-help\fR
.RS 4
-Ignore case distinctions in both the
-\fIPATTERN\fR
-and the input files\&.
+Print a short summary of the options\&.
.RE
.PP
+\fB\-V\fR, \fB\-\-version\fR
+.RS 4
+Show version information\&.
+.RE
+.SS "Pattern Interpretation"
+.PP
\fB\-F\fR, \fB\-\-fixed\-strings\fR
.RS 4
Interpret
@@ -53,11 +61,6 @@ Interpret
as a list of fixed strings separated by newlines, any of which is to be matched\&.
.RE
.PP
-\fB\-\-cache\fR
-.RS 4
-Use a cache for the rendered text to speed up the operation on large files\&.
-.RE
-.PP
\fB\-P\fR, \fB\-\-perl\-regexp\fR
.RS 4
Interpret
@@ -65,21 +68,32 @@ Interpret
as a Perl compatible regular expression (PCRE)\&. See
\fIpcresyntax\fR(3) for a quick overview\&.
.RE
+.SS "Matching Control"
.PP
-\fB\-H\fR, \fB\-\-with\-filename\fR
+\fB\-e\fR \fIPATTERN\fR, \fB\-\-regexp=\fR\fIPATTERN\fR
.RS 4
-Print the file name for each match\&. This is the default setting when there is more than one file to search\&.
+Use
+\fIPATTERN\fR
+as the pattern to search for\&. If this option is specified multiple times or combined with
+\fB\-\-file\fR, all patterns are tried in turn until one of them matches\&.
.RE
.PP
-\fB\-h\fR, \fB\-\-no\-filename\fR
+\fB\-f\fR \fIFILE\fR, \fB\-\-file=\fR\fIFILE\fR
.RS 4
-Suppress the prefixing of file name on output\&. This is the default setting when there is only one file to search\&.
+Read patterns from
+\fIFILE\fR, one per line\&. If
+\fIFILE\fR
+contains multiple patterns or if this option is applied multiple times or combined with
+\fB\-e\fR, all patterns are tried in turn until one of them matches\&. An empty pattern list matches nothing\&.
.RE
.PP
-\fB\-n\fR, \fB\-\-page\-number\fR
+\fB\-i\fR, \fB\-\-ignore\-case\fR
.RS 4
-Prefix each match with the number of the page where it was found\&.
+Ignore case distinctions in both the
+\fIPATTERN\fR
+and the input files\&.
.RE
+.SS "General Output Control"
.PP
\fB\-c\fR, \fB\-\-count\fR
.RS 4
@@ -95,25 +109,63 @@ Like
.PP
\fB\-\-color\fR \fIWHEN\fR
.RS 4
-Surround file names, page numbers and matched text with escape sequences to display them in color on the terminal\&. (The default setting is
-\fBauto\fR)\&.
+Surround file names, page numbers and matched text with escape sequences to display them in color on the terminal\&.
\fIWHEN\fR
can be:
-.PP
+.TS
+tab(:);
+lt lt
+lt lt
+lt lt.
+T{
\fBalways\fR
-.RS 4
+T}:T{
Always use colors, even when stdout is not a terminal\&.
+T}
+T{
+\fBnever\fR
+T}:T{
+Do not use colors\&.
+T}
+T{
+\fBauto\fR
+T}:T{
+Use colors only when stdout is a terminal (this is the default)\&.
+T}
+.TE
+.sp 1
.RE
.PP
-\fBnever\fR
+\fB\-L\fR, \fB\-\-files\-without\-match\fR
.RS 4
-Do not use colors\&.
+Suppress normal output\&. Instead print the name of each input file that doesn\(cqt contain a match\&. This works well with
+\fB\-Z\fR, but many other output options like
+\fB\-n\fR
+or
+\fB\-c\fR
+are ignored when
+\fB\-L\fR
+is specified\&.
.RE
.PP
-\fBauto\fR
+\fB\-l\fR, \fB\-\-files\-with\-matches\fR
.RS 4
-Use colors only when stdout is a terminal\&.
+Suppress normal output\&. Instead print the name of each input file that contains a match\&. This works well with
+\fB\-Z\fR, but many other output options like
+\fB\-n\fR
+or
+\fB\-c\fR
+are ignored when
+\fB\-l\fR
+is specified\&.
.RE
+.PP
+\fB\-m\fR, \fB\-\-max\-count\fR \fINUM\fR
+.RS 4
+Stop reading a file after
+\fINUM\fR
+matches\&. When the \-c or \-\-count option is also used, pdfgrep does not output a count greater than
+\fINUM\fR\&.
.RE
.PP
\fB\-o\fR, \fB\-\-only\-matching\fR
@@ -121,19 +173,45 @@ Use colors only when stdout is a terminal\&.
Print only the matched part of a line without any surrounding context\&.
.RE
.PP
-\fB\-r\fR, \fB\-\-recursive\fR
+\fB\-q\fR, \fB\-\-quiet\fR
.RS 4
-Recursively search all files (restricted by
-\fB\-\-include\fR
-and
-\fB\-\-exclude\fR) under each directory, following symlinks only if they are on the command line\&.
+Suppress all normal output to stdout\&. Exit immediately with exit status 0 if a match is found, even in case of errors\&. Use this if you only care about the presence of matches, not their number or content\&.
.RE
+.SS "Line Prefix Control"
.PP
-\fB\-R\fR, \fB\-\-dereference\-recursive\fR
+\fB\-H\fR, \fB\-\-with\-filename\fR
.RS 4
-Same as
-\fB\-r\fR, but follows all symlinks\&.
+Print the file name for each match\&. This is the default setting when there is more than one file to search\&.
+.RE
+.PP
+\fB\-h\fR, \fB\-\-no\-filename\fR
+.RS 4
+Suppress the prefixing of file name on output\&. This is the default setting when there is only one file to search\&.
+.RE
+.PP
+\fB\-n\fR, \fB\-\-page\-number\fR
+.RS 4
+Prefix each match with the number of the page where it was found\&.
+.RE
+.PP
+\fB\-Z\fR, \fB\-\-null\fR
+.RS 4
+Output a null byte (called
+\fINUL\fR
+in ASCII and \*(Aq\e0\*(Aq in C) instead of the colon that usually separates a filename from the rest of the line\&. This option makes the output unambiguous in the presence of colons, spaces or newlines in the filename\&. It can be used in conjunction with commands such as
+\fIxargs\ \&\-0\fR
+or
+\fIperl\ \&\-0\fR\&.
+.RE
+.PP
+\fB\-\-match\-prefix\-separator\fR \fISEP\fR
+.RS 4
+Changes the colon used to separate filename, line number and text in the output to
+\fISEP\fR, which can be an arbitrary string\&. This is useful when filenames contain colons, but only for interactive usage\&. For scripting,
+\fB\-\-null\fR
+should be used\&.
.RE
+.SS "Context Control"
.PP
\fB\-A\fR \fINUM\fR, \fB\-\-after\-context=NUM\fR
.RS 4
@@ -161,6 +239,21 @@ lines of context before and after matching lines\&. Contiguous groups of matches
\fB\-\-\fR\&. With
\fB\-o\fR, this option has no effect\&.
.RE
+.SS "File Selection"
+.PP
+\fB\-r\fR, \fB\-\-recursive\fR
+.RS 4
+Recursively search all files (restricted by
+\fB\-\-include\fR
+and
+\fB\-\-exclude\fR) under each directory, following symlinks only if they are on the command line\&.
+.RE
+.PP
+\fB\-R\fR, \fB\-\-dereference\-recursive\fR
+.RS 4
+Same as
+\fB\-r\fR, but follows all symlinks\&.
+.RE
.PP
\fB\-\-exclude=\fR\fIGLOB\fR
.RS 4
@@ -180,6 +273,12 @@ Only search files whose base name matches
for details\&. The default is
\fI*\&.pdf\fR\&.
.RE
+.SS "Other Options"
+.PP
+\fB\-\-cache\fR
+.RS 4
+Use a cache for the rendered text to speed up the operation on large files\&.
+.RE
.PP
\fB\-\-password=\fR\fIPASSWORD\fR
.RS 4
@@ -191,30 +290,13 @@ that this password will show up in your command history and the output of
is important\&.
.RE
.PP
-\fB\-m\fR, \fB\-\-max\-count\fR \fINUM\fR
-.RS 4
-Stop reading a file after
-\fINUM\fR
-matches\&. When the \-c or \-\-count option is also used, pdfgrep does not output a count greater than
-\fINUM\fR\&.
-.RE
-.PP
-\fB\-Z\fR, \fB\-\-null\fR
-.RS 4
-Output a null byte (called
-\fINUL\fR
-in ASCII and \*(Aq\e0\*(Aq in C) instead of the colon that usually separates a filename from the rest of the line\&. This option makes the output unambiguous in the presence of colons, spaces or newlines in the filename\&. It can be used in conjunction with commands such as
-\fIxargs\ \&\-0\fR
-or
-\fIperl\ \&\-0\fR\&.
-.RE
-.PP
-\fB\-\-match\-prefix\-separator\fR \fISEP\fR
+\fB\-\-page\-range=\fR\fIRANGE\fR
.RS 4
-Changes the colon used to separate filename, line number and text in the output to
-\fISEP\fR, which can be an arbitrary string\&. This is useful when filenames contain colons, but only for interactive usage\&. For scripting,
-\fB\-\-null\fR
-should be used\&.
+Limit search to a specified set of pages\&.
+\fIRANGE\fR
+is a comma separated list of either a single page number or a range expression of the form
+PAGE1\-PAGE2\&. Example:
+2\-3,5,7\-10\&.
.RE
.PP
\fB\-\-debug\fR
@@ -242,20 +324,6 @@ for details\&.
.sp
\fBThis option is experimental and only available if pdfgrep is compiled with unac support\&.\fR
.RE
-.PP
-\fB\-q\fR, \fB\-\-quiet\fR
-.RS 4
-Suppress all normal output to stdout\&. Exit immediately with exit status zero if a match is found, even in case of errors\&. Use this if you only care about the presence of matches, not their number or content\&.
-.RE
-.sp
-Errors will be printed and the exit codes will be returned (see below)\&.
-.PP
-\fB\-\-help\fR
-.RS 4
-Print a short summary of the options\&.
-.RE
-.sp
-\fB\-V\fR, \fB\-\-version\fR Show version information\&.
.SH "EXIT STATUS"
.sp
Normally, the exit status is 0 if at least one match is found, 1 if no match is found and 2 if an error occurred\&. But if the \fB\-\-quiet\fR or \fB\-q\fR option is used and a match was found, \fBpdfgrep\fR will return 0 regardless of errors\&.
@@ -295,7 +363,7 @@ is enabled\&. At most 200 cache entries older than a day are retained\&.
.RE
.SH "EXAMPLES"
.PP
-\fBPrint the first ten lines matching \fR\fB\fIpattern\fR\fR\fB and print their page number\fR
+\fBPrint the first ten lines matching \fR\fB\fIpattern\fR\fR\fB and print their page number:\fR
.RS 4
.sp
.if n \{\
@@ -309,7 +377,7 @@ pdfgrep \-n \-\-max\-count 10 pattern foo\&.pdf
.\}
.RE
.PP
-\fBSearch all \&.pdf files whose names begin with \fR\fB\fIfoo\fR\fR\fB recursively in the current directory\fR
+\fBSearch all \&.pdf files whose names begin with \fR\fB\fIfoo\fR\fR\fB recursively in the current directory:\fR
.RS 4
.sp
.if n \{\
@@ -323,7 +391,21 @@ pdfgrep \-r \-\-include "foo*\&.pdf" pattern
.\}
.RE
.PP
-\fBSearch all \&.pdf files that are smaller than 12M recursively in the current directory\fR
+\fBSearch all PDFs in the current directory for \fR\fB\fIfoo\fR\fR\fB that also contain \fR\fB\fIbar\fR\fR\fB:\fR
+.RS 4
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+pdfgrep \-Z \-\-files\-with\-matches "bar" *\&.pdf | xargs \-0 pdfgrep \-H foo
+.fi
+.if n \{\
+.RE
+.\}
+.RE
+.PP
+\fBSearch all \&.pdf files that are smaller than 12M recursively in the current directory:\fR
.RS 4
.sp
.if n \{\
diff --git a/doc/pdfgrep.txt b/doc/pdfgrep.txt
index eec998b..5e13f69 100644
--- a/doc/pdfgrep.txt
+++ b/doc/pdfgrep.txt
@@ -5,40 +5,54 @@
:man version: {pdfgrepversion}
== NAME
-pdfgrep - search pdf files for a regular expression
+pdfgrep - search PDF files for a regular expression
== SYNOPSIS
+[verse]
*pdfgrep* ['OPTION'...] 'PATTERN' ['FILE'...]
+*pdfgrep* ['OPTION'...] [*-e* 'PATTERN' | *-f* 'FILE'] ['FILE'...]
== DESCRIPTION
-Search for 'PATTERN' in each 'FILE'. 'PATTERN' is an extended regular
-expression.
-*pdfgrep* works much like grep, with one distinction: It operates on
-pages and not on lines.
+Search for 'PATTERN' in each PDF 'FILE' and print matching lines. By
+default, 'PATTERN' is an extended regular expression.
+
+*pdfgrep* tries to be mostly compatible with *GNU grep* with some
+ PDF-specific distinctions and additional options. Most notably, *-n*
+ prints page instead of line numbers.
== OPTIONS
-*-i*, *--ignore-case* :: Ignore case distinctions in both the
- 'PATTERN' and the input files.
+=== General Information
+
+*--help* :: Print a short summary of the options.
+
+*-V*, *--version* :: Show version information.
+
+=== Pattern Interpretation
*-F*, *--fixed-strings* :: Interpret 'PATTERN' as a list of fixed
strings separated by newlines, any of which is to be matched.
-*--cache* :: Use a cache for the rendered text to speed up the
- operation on large files.
-
*-P*, *--perl-regexp* :: Interpret 'PATTERN' as a Perl compatible
regular expression (PCRE). See 'pcresyntax'(3) for a quick overview.
-*-H*, *--with-filename* :: Print the file name for each match. This is
- the default setting when there is more than one file to search.
+=== Matching Control
-*-h*, *--no-filename* :: Suppress the prefixing of file name on
- output. This is the default setting when there is only one file to
- search.
+*-e* 'PATTERN', *--regexp=*'PATTERN' :: Use 'PATTERN' as the pattern
+ to search for. If this option is specified multiple times or
+ combined with *--file*, all patterns are tried in turn until one of
+ them matches.
-*-n*, *--page-number* :: Prefix each match with the number of the page
- where it was found.
+*-f* 'FILE', *--file=*'FILE' :: Read patterns from 'FILE', one per
+ line. If 'FILE' contains multiple patterns or if this option is
+ applied multiple times or combined with *-e*, all patterns are tried
+ in turn until one of them matches. An empty pattern list matches
+ nothing.
+
+*-i*, *--ignore-case* :: Ignore case distinctions in both the
+ 'PATTERN' and the input files.
+
+=== General Output Control
*-c*, *--count* :: Suppress normal output. Instead print the number of
matches for each input file. Note that unlike grep, multiple matches
@@ -48,21 +62,63 @@ pages and not on lines.
per page. Implies *-n*.
*--color* 'WHEN' :: Surround file names, page numbers and matched text
- with escape sequences to display them in color on the terminal. (The
- default setting is *auto*). 'WHEN' can be:
+ with escape sequences to display them in color on the terminal.
+ 'WHEN' can be:
++
+[horizontal]
*always* ;; Always use colors, even when stdout is not a terminal.
*never* ;; Do not use colors.
- *auto* ;; Use colors only when stdout is a terminal.
+ *auto* ;; Use colors only when stdout is a terminal (this is the
+ default).
+
+*-L*, *--files-without-match* :: Suppress normal output. Instead print
+ the name of each input file that doesn't contain a match. This works
+ well with *-Z*, but many other output options like *-n* or *-c* are
+ ignored when *-L* is specified.
+
+*-l*, *--files-with-matches* :: Suppress normal output. Instead print
+ the name of each input file that contains a match. This works well
+ with *-Z*, but many other output options like *-n* or *-c* are
+ ignored when *-l* is specified.
+
+*-m*, *--max-count* 'NUM' :: Stop reading a file after 'NUM' matches.
+ When the -c or --count option is also used, pdfgrep does not output
+ a count greater than 'NUM'.
*-o*, *--only-matching* :: Print only the matched part of a line
without any surrounding context.
-*-r*, *--recursive*:: Recursively search all files (restricted by
- *--include* and *--exclude*) under each directory, following symlinks
- only if they are on the command line.
+*-q*, *--quiet* :: Suppress all normal output to stdout. Exit
+ immediately with exit status 0 if a match is found, even in case of
+ errors. Use this if you only care about the presence of matches, not
+ their number or content.
-*-R*, *--dereference-recursive*:: Same as *-r*, but follows all
- symlinks.
+=== Line Prefix Control
+
+*-H*, *--with-filename* :: Print the file name for each match. This is
+ the default setting when there is more than one file to search.
+
+*-h*, *--no-filename* :: Suppress the prefixing of file name on
+ output. This is the default setting when there is only one file to
+ search.
+
+*-n*, *--page-number* :: Prefix each match with the number of the page
+ where it was found.
+
+*-Z*, *--null* :: Output a null byte (called 'NUL' in ASCII and \'\0'
+ in C) instead of the colon that usually separates a filename from
+ the rest of the line. This option makes the output unambiguous in
+ the presence of colons, spaces or newlines in the filename. It can
+ be used in conjunction with commands such as 'xargs -0' or
+ 'perl -0'.
+
+*--match-prefix-separator* 'SEP' :: Changes the colon used to separate
+ filename, line number and text in the output to 'SEP', which can be
+ an arbitrary string. This is useful when filenames contain colons,
+ but only for interactive usage. For scripting, *--null* should be
+ used.
+
+=== Context Control
*-A* 'NUM', *--after-context=NUM*:: Print 'NUM' lines of context after
matching lines. Contiguous groups of matches are separated by a line
@@ -76,6 +132,15 @@ pages and not on lines.
after matching lines. Contiguous groups of matches are separated by
a line containing *--*. With *-o*, this option has no effect.
+=== File Selection
+
+*-r*, *--recursive*:: Recursively search all files (restricted by
+ *--include* and *--exclude*) under each directory, following symlinks
+ only if they are on the command line.
+
+*-R*, *--dereference-recursive*:: Same as *-r*, but follows all
+ symlinks.
+
*--exclude=*'GLOB' :: Skip files whose base name matches 'GLOB'. See
'glob'(7) for wildcards you can use. You can use this option
multiple times to exclude more patterns. It takes precedence over
@@ -85,6 +150,11 @@ pages and not on lines.
*--include=*'GLOB' :: Only search files whose base name matches
'GLOB'. See *--exclude* for details. The default is '*.pdf'.
+=== Other Options
+
+*--cache* :: Use a cache for the rendered text to speed up the
+ operation on large files.
+
*--password=*'PASSWORD' :: Use PASSWORD to decrypt the PDF-files. Can
be specified multiple times; all passwords will be tried on all
PDFs.
@@ -92,22 +162,10 @@ pages and not on lines.
the output of 'ps'(1). So please do not use this if the security of
'PASSWORD' is important.
-*-m*, *--max-count* 'NUM' :: Stop reading a file after 'NUM' matches.
- When the -c or --count option is also used, pdfgrep does not output
- a count greater than 'NUM'.
-
-*-Z*, *--null* :: Output a null byte (called 'NUL' in ASCII and \'\0'
- in C) instead of the colon that usually separates a filename from
- the rest of the line. This option makes the output unambiguous in
- the presence of colons, spaces or newlines in the filename. It can
- be used in conjunction with commands such as 'xargs -0' or
- 'perl -0'.
-
-*--match-prefix-separator* 'SEP' :: Changes the colon used to separate
- filename, line number and text in the output to 'SEP', which can be
- an arbitrary string. This is useful when filenames contain colons,
- but only for interactive usage. For scripting, *--null* should be
- used.
+*--page-range=*'RANGE' :: Limit search to a specified set of pages.
+ 'RANGE' is a comma separated list of either a single page number or
+ a range expression of the form `PAGE1-PAGE2`. Example:
+ `2-3,5,7-10`.
*--debug* :: Enable debug output. *Note*: Due to limitations of
poppler before version 0.30.0, some debug output is also printed
@@ -125,18 +183,6 @@ pages and not on lines.
*This option is experimental and only available if pdfgrep is
compiled with unac support.*
-*-q*, *--quiet* :: Suppress all normal output to stdout. Exit
- immediately with exit status zero if a match is found, even in case
- of errors. Use this if you only care about the presence of matches,
- not their number or content.
-
-Errors will
- be printed and the exit codes will be returned (see below).
-
-*--help* :: Print a short summary of the options.
-
-*-V*, *--version* Show version information.
-
== EXIT STATUS
Normally, the exit status is 0 if at least one match is found, 1 if no
match is found and 2 if an error occurred. But if the *--quiet* or
@@ -161,19 +207,25 @@ variable.
retained.
== Examples
-*Print the first ten lines matching 'pattern' and print their page number* ::
+*Print the first ten lines matching 'pattern' and print their page number:* ::
+
--------------------------------------------------
pdfgrep -n --max-count 10 pattern foo.pdf
--------------------------------------------------
-*Search all .pdf files whose names begin with 'foo' recursively in the current directory* ::
+*Search all .pdf files whose names begin with 'foo' recursively in the current directory:* ::
+
--------------------------------------------------
pdfgrep -r --include "foo*.pdf" pattern
--------------------------------------------------
-*Search all .pdf files that are smaller than 12M recursively in the current directory* ::
+*Search all PDFs in the current directory for 'foo' that also contain 'bar':*::
++
+--------------------------------------------------
+pdfgrep -Z --files-with-matches "bar" *.pdf | xargs -0 pdfgrep -H foo
+--------------------------------------------------
+
+*Search all .pdf files that are smaller than 12M recursively in the current directory:* ::
+
--------------------------------------------------
find . -name "*.pdf" -size -12M -print0 | xargs -0 pdfgrep pattern
diff --git a/src/Makefile.am b/src/Makefile.am
index dc703f2..9587efe 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
bin_PROGRAMS = pdfgrep
-pdfgrep_SOURCES = pdfgrep.h pdfgrep.cc output.cc output.h exclude.cc exclude.h regengine.h regengine.cc search.h search.cc cache.h cache.cc
+pdfgrep_SOURCES = pdfgrep.h pdfgrep.cc output.cc output.h exclude.cc exclude.h regengine.h regengine.cc search.h search.cc cache.h cache.cc intervals.h intervals.cc
pdfgrep_LDADD = $(poppler_cpp_LIBS) $(unac_LIBS) $(libpcre_LIBS) $(cov_LDFLAGS) $(LIBGCRYPT_LIBS)
AM_CPPFLAGS = $(poppler_cpp_CFLAGS) $(unac_CFLAGS) $(libpcre_CFLAGS) $(cov_CFLAGS) $(LIBGCRYPT_CFLAGS)
diff --git a/src/Makefile.in b/src/Makefile.in
index a09634d..c90ce70 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -104,7 +104,7 @@ am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_pdfgrep_OBJECTS = pdfgrep.$(OBJEXT) output.$(OBJEXT) \
exclude.$(OBJEXT) regengine.$(OBJEXT) search.$(OBJEXT) \
- cache.$(OBJEXT)
+ cache.$(OBJEXT) intervals.$(OBJEXT)
pdfgrep_OBJECTS = $(am_pdfgrep_OBJECTS)
am__DEPENDENCIES_1 =
pdfgrep_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
@@ -124,7 +124,11 @@ am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
+am__maybe_remake_depfiles = depfiles
+am__depfiles_remade = ./$(DEPDIR)/cache.Po ./$(DEPDIR)/exclude.Po \
+ ./$(DEPDIR)/intervals.Po ./$(DEPDIR)/output.Po \
+ ./$(DEPDIR)/pdfgrep.Po ./$(DEPDIR)/regengine.Po \
+ ./$(DEPDIR)/search.Po
am__mv = mv -f
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
@@ -298,7 +302,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
unac_CFLAGS = @unac_CFLAGS@
unac_LIBS = @unac_LIBS@
-pdfgrep_SOURCES = pdfgrep.h pdfgrep.cc output.cc output.h exclude.cc exclude.h regengine.h regengine.cc search.h search.cc cache.h cache.cc
+pdfgrep_SOURCES = pdfgrep.h pdfgrep.cc output.cc output.h exclude.cc exclude.h regengine.h regengine.cc search.h search.cc cache.h cache.cc intervals.h intervals.cc
pdfgrep_LDADD = $(poppler_cpp_LIBS) $(unac_LIBS) $(libpcre_LIBS) $(cov_LDFLAGS) $(LIBGCRYPT_LIBS)
AM_CPPFLAGS = $(poppler_cpp_CFLAGS) $(unac_CFLAGS) $(libpcre_CFLAGS) $(cov_CFLAGS) $(LIBGCRYPT_CFLAGS)
all: all-am
@@ -322,8 +326,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -387,12 +391,19 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exclude.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdfgrep.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regengine.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exclude.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/intervals.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdfgrep.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regengine.Po@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search.Po@am__quote@ # am--include-marker
+
+$(am__depfiles_remade):
+ @$(MKDIR_P) $(@D)
+ @echo '# dummy' >$@-t && $(am__mv) $@-t $@
+
+am--depfiles: $(am__depfiles_remade)
.cc.o:
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -460,7 +471,10 @@ cscopelist-am: $(am__tagged_files)
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@@ -532,7 +546,13 @@ clean: clean-am
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
- -rm -rf ./$(DEPDIR)
+ -rm -f ./$(DEPDIR)/cache.Po
+ -rm -f ./$(DEPDIR)/exclude.Po
+ -rm -f ./$(DEPDIR)/intervals.Po
+ -rm -f ./$(DEPDIR)/output.Po
+ -rm -f ./$(DEPDIR)/pdfgrep.Po
+ -rm -f ./$(DEPDIR)/regengine.Po
+ -rm -f ./$(DEPDIR)/search.Po
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
@@ -578,7 +598,13 @@ install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
- -rm -rf ./$(DEPDIR)
+ -rm -f ./$(DEPDIR)/cache.Po
+ -rm -f ./$(DEPDIR)/exclude.Po
+ -rm -f ./$(DEPDIR)/intervals.Po
+ -rm -f ./$(DEPDIR)/output.Po
+ -rm -f ./$(DEPDIR)/pdfgrep.Po
+ -rm -f ./$(DEPDIR)/regengine.Po
+ -rm -f ./$(DEPDIR)/search.Po
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
@@ -598,7 +624,7 @@ uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
-.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
+.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-binPROGRAMS clean-generic cscopelist-am ctags ctags-am \
distclean distclean-compile distclean-generic distclean-tags \
distdir dvi dvi-am html html-am info info-am install \
diff --git a/src/cache.cc b/src/cache.cc
index 4d028b6..c78bcb0 100644
--- a/src/cache.cc
+++ b/src/cache.cc
@@ -1,6 +1,7 @@
/***************************************************************************
- * Copyright (C) 2017 by Christian Dietrich *
+ * Copyright (C) 2016 by Christian Dietrich *
* stettberger@dokucode.de *
+ * Copyright (C) 2017-2018 by Hans-Peter Deifel <hpd@hpdeifel.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
diff --git a/src/cache.h b/src/cache.h
index 33e9719..9a623c8 100644
--- a/src/cache.h
+++ b/src/cache.h
@@ -1,6 +1,7 @@
/***************************************************************************
- * Copyright (C) 2017 by Christian Dietrich *
+ * Copyright (C) 2016 by Christian Dietrich *
* stettberger@dokucode.de *
+ * Copyright (C) 2017-2018 by Hans-Peter Deifel <hpd@hpdeifel.de> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -46,3 +47,7 @@ void limit_cachesize(const char *cache, int entries);
int find_cache_directory(std::string &dir);
#endif
+
+/* Local Variables: */
+/* mode: c++ */
+/* End: */
diff --git a/src/exclude.cc b/src/exclude.cc
index be9d646..45cdcb9 100644
--- a/src/exclude.cc
+++ b/src/exclude.cc
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2017 by Hans-Peter Deifel *
+ * Copyright (C) 2011-2018 by Hans-Peter Deifel *
* hpd@hpdeifel.de *
* *
* This program is free software; you can redistribute it and/or modify *
diff --git a/src/exclude.h b/src/exclude.h
index 5f1c4ae..202b8fa 100644
--- a/src/exclude.h
+++ b/src/exclude.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2017 by Hans-Peter Deifel *
+ * Copyright (C) 2011-2018 by Hans-Peter Deifel *
* hpd@hpdeifel.de *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -32,3 +32,7 @@ bool is_excluded(const ExcludeList &list, const std::string &name);
bool excludes_empty(ExcludeList &list);
#endif
+
+/* Local Variables: */
+/* mode: c++ */
+/* End: */
diff --git a/src/intervals.cc b/src/intervals.cc
new file mode 100644
index 0000000..25bbaa4
--- /dev/null
+++ b/src/intervals.cc
@@ -0,0 +1,98 @@
+/***************************************************************************
+ * Copyright (C) 2017-2018 by Hans-Peter Deifel *
+ * hpd@hpdeifel.de *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA. *
+ ***************************************************************************/
+
+#include "intervals.h"
+
+#include <algorithm>
+#include <sstream>
+#include <iostream>
+#include <stdexcept>
+
+#include "output.h"
+
+// The interval container data structure could be much more sophisticated (e.g
+// by using interval trees or even sorted lists), but as the number of intervals
+// in typical use cases is small, this shouldn't make much difference and could
+// actually be harmful.
+//
+// tl;dr Measure before you optimize
+
+void IntervalContainer::addInterval(Interval i) {
+ intervals.push_back(i);
+}
+
+bool IntervalContainer::contains(int element) const {
+ // We interpret the empty container as one interval containing
+ // everything. This makes sense in the pdfgrep case: If the user doesn't
+ // restrict the intervals she want's all pages to be searched.
+ if (intervals.empty())
+ return true;
+
+ auto predicate = [=](const Interval &a) {return a.contains(element);};
+
+ return std::find_if(intervals.begin(), intervals.end(), predicate)
+ != intervals.end();
+}
+
+static Interval parse_interval(const std::string str) {
+ size_t minus = str.find("-");
+
+ int from, to;
+ try {
+ // only one int, not a range
+ if (minus == std::string::npos) {
+ from = to = std::stoi(str);
+ } else {
+ auto from_str = str.substr(0, minus);
+ auto to_str = str.substr(minus+1, str.length()-minus);
+
+ from = std::stoi(from_str);
+ to = std::stoi(to_str);
+ }
+ } catch (std::invalid_argument e) {
+ err() << "Invalid page range \"" << str << "\". "
+ << "Expected a single page or a range PAGE1-PAGE2." << std::endl;
+ exit(EXIT_ERROR);
+ }
+
+ if (from <= 0 || to <= 0) {
+ err() << "Invalid page range \"" << str << "\". "
+ << "Page numbers must be positive." << std::endl;
+ exit(EXIT_ERROR);
+ }
+
+ if (to < from) {
+ err() << "warning: Page range is empty: " << str << std::endl;
+ }
+
+ return Interval(from, to);
+}
+
+IntervalContainer IntervalContainer::fromString(const std::string str) {
+ IntervalContainer c;
+ std::stringstream tokens(str);
+
+ std::string interval;
+ while (std::getline(tokens, interval, ',')) {
+ c.addInterval(parse_interval(interval));
+ }
+
+ return c;
+}
diff --git a/src/intervals.h b/src/intervals.h
new file mode 100644
index 0000000..e3441ce
--- /dev/null
+++ b/src/intervals.h
@@ -0,0 +1,85 @@
+/***************************************************************************
+ * Copyright (C) 2017-2018 by Hans-Peter Deifel *
+ * hpd@hpdeifel.de *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
+ * Boston, MA 02110-1301 USA. *
+ ***************************************************************************/
+
+#ifndef INTERVALS_H
+#define INTERVALS_H
+
+#include <vector>
+#include <string>
+
+/* This file implements a interval container that supports insertion and
+ * inclusion tests for integer intervals.
+ *
+ * Used for the --page-range feature
+ */
+
+struct Interval {
+ /* from and to are inclusive. */
+ Interval(int from, int to) {
+ this->from = from;
+ this->to = to;
+ }
+
+ int from;
+ int to;
+
+ inline bool contains(int element) const {
+ return element >= from && element <= to;
+ }
+};
+
+class IntervalContainer {
+public:
+ IntervalContainer() {}
+
+ /** Parses a string into intervals.
+ *
+ * This accepts the format used for the --page-range option: A comma
+ * separated list of intervals, which can be either a single integer or
+ * two integers separated by a minus character. Whitespace is not
+ * allowed.
+ *
+ * More precisely, the following grammar is implemented:
+ *
+ * INTERVALS ::= 𝝴 | INTERVAL ',' INTERVALS
+ * INTERVAL ::= int | int '-' int
+ *
+ */
+ static IntervalContainer fromString(const std::string str);
+
+ void addInterval(Interval i);
+
+ /** Returns true if either the element is contained in any interval or
+ * this container is empty.
+ *
+ * The latter case is there to simplify --page-range. If no intervals
+ * are specified, we want to search every page.
+ */
+ bool contains(int element) const;
+
+private:
+ std::vector<Interval> intervals;
+};
+
+#endif /* INTERVALS_H */
+
+/* Local Variables: */
+/* mode: c++ */
+/* End: */
diff --git a/src/output.cc b/src/output.cc
index 7f0d4d1..9661cbe 100644
--- a/src/output.cc
+++ b/src/output.cc
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2017 by Hans-Peter Deifel *
+ * Copyright (C) 2011-2018 by Hans-Peter Deifel *
* hpd@hpdeifel.de *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -87,6 +87,17 @@ std::ostream& line_prefix(const Outconf& outconf, const std::string& filename,
return cout;
}
+void print_only_filename(const Outconf& outconf, const std::string& filename) {
+ with_color(outconf.color, outconf.colors.filename,
+ cout << filename;);
+
+ if (outconf.null_byte_sep) {
+ cout << '\0';
+ } else {
+ cout << endl;
+ }
+}
+
std::ostream& line_prefix(const Outconf& outconf, const std::string& filename,
bool in_context) {
if (outconf.filename) {
@@ -106,6 +117,7 @@ std::ostream& line_prefix(const Outconf& outconf, const std::string& filename,
return cout;
}
+
// Invariant: matches can't be empty
void print_matches(const context& context, const std::vector<match>& matches) {
const match& first_match = matches.front();
diff --git a/src/output.h b/src/output.h
index 3369ed8..b6c7d9f 100644
--- a/src/output.h
+++ b/src/output.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2017 by Hans-Peter Deifel *
+ * Copyright (C) 2011-2018 by Hans-Peter Deifel *
* hpd@hpdeifel.de *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -48,6 +48,9 @@ void print_only_match(const struct context &context, const struct match &match);
*/
void print_matches(const context& context, const std::vector<match>& matches);
+/* print the filename, useful for --files-{with-match,without-matches} */
+void print_only_filename(const Outconf& outconf, const std::string& filename);
+
// Print `lines` lines of context before the match. If lines is smaller than 0,
// use the value from context.outconf.
void print_context_before(const context& context, const match& match, int lines = -1);
@@ -68,3 +71,7 @@ std::ostream& line_prefix(const Outconf& outconf, const std::string& filename,
bool in_context);
#endif
+
+/* Local Variables: */
+/* mode: c++ */
+/* End: */
diff --git a/src/pdfgrep.cc b/src/pdfgrep.cc
index 8857325..7f8bdf8 100644
--- a/src/pdfgrep.cc
+++ b/src/pdfgrep.cc
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2017 by Hans-Peter Deifel *
+ * Copyright (C) 2010-2018 by Hans-Peter Deifel *
* hpd@hpdeifel.de *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -59,6 +59,7 @@
#include "regengine.h"
#include "search.h"
#include "cache.h"
+#include "intervals.h"
using namespace std;
@@ -79,10 +80,12 @@ enum {
WARN_EMPTY_OPTION,
UNAC_OPTION,
CACHE_OPTION,
+ PAGE_RANGE_OPTION,
};
struct option long_options[] =
{
+ // name, has_arg, *flag, val
{"ignore-case", 0, 0, 'i'},
{"perl-regexp", 0, 0, 'P'},
{"page-number", 0, 0, 'n'},
@@ -111,22 +114,27 @@ struct option long_options[] =
{"after-context", 1, 0, 'A'},
{"before-context", 1, 0, 'B'},
{"context", 1, 0, 'C'},
+ {"page-range", 1, 0, PAGE_RANGE_OPTION},
+ {"regexp", 1, 0, 'e'},
+ {"file", 1, 0, 'f'},
+ {"files-with-matches", 0, 0, 'l'},
+ {"files-without-match", 0, 0, 'L'},
{0, 0, 0, 0}
};
#ifdef HAVE_UNAC
/* convenience layer over libunac. */
-static char *simple_unac(const Options &opts, char *string)
+string simple_unac(const Options &opts, const string str)
{
if (!opts.use_unac)
- return string;
+ return str;
char *res = NULL;
size_t reslen = 0;
- if (unac_string("UTF-8", string, strlen(string), &res, &reslen)) {
+ if (unac_string("UTF-8", str.c_str(), str.size(), &res, &reslen)) {
perror("pdfgrep: Failed to remove accents: ");
- return strdup(string);
+ return str;
}
return res;
@@ -230,23 +238,25 @@ static void print_help(char *self)
<< "Search for PATTERN in each FILE." << endl
<< "PATTERN is, by default, an extended regular expression." << endl
<< endl
- << "Options:" << endl
- << " -i, --ignore-case\t\tIgnore case distinctions" << endl
- << " -P, --pcre\t\t\tUse Perl compatible regular expressions (PCRE)" << endl
- << " -H, --with-filename\t\tPrint the file name for each match" << endl
- << " -h, --no-filename\t\tSuppress the prefixing of file name on output" << endl
- << " -n, --page-number\t\tPrint page number with output lines" << endl
- << " -c, --count\t\t\tPrint only a count of matches per file" << endl
- << " --color WHEN\t\tUse colors for highlighting;" << endl
- << "\t\t\t\tWHEN can be `always', `never' or `auto'" << endl
- << " -p, --page-count\t\tPrint only a count of matches per page" << endl
- << " -m, --max-count NUM\t\tStop reading after NUM matching lines (per file)" << endl
- << " -q, --quiet\t\t\tSuppress normal output" << endl
- << " -r, --recursive\t\tSearch directories recursively" << endl
- << " -R, --dereference-recursive\tLikewise, but follow all symlinks" << endl
- << " --cache\t\tUse cache for faster operation" << endl
- << " --help\t\t\tPrint this help" << endl
- << " -V, --version\t\t\tShow version information" << endl;
+ << "Commonly used options:" << endl
+ << " -i, --ignore-case Ignore case distinctions" << endl
+ << " -P, --pcre Use Perl compatible regular expressions (PCRE)" << endl
+ << " -H, --with-filename Print the file name for each match" << endl
+ << " -h, --no-filename Suppress the prefixing of file name on output" << endl
+ << " -n, --page-number Print page number with output lines" << endl
+ << " -c, --count Print only a count of matches per file" << endl
+ << " --color WHEN Use colors for highlighting;" << endl
+ << " WHEN can be `always', `never' or `auto'" << endl
+ << " -p, --page-count Print only a count of matches per page" << endl
+ << " -m, --max-count NUM Stop reading after NUM matching lines (per file)" << endl
+ << " -q, --quiet Suppress normal output" << endl
+ << " -r, --recursive Search directories recursively" << endl
+ << " -R, --dereference-recursive Likewise, but follow all symlinks" << endl
+ << " --cache Use cache for faster operation" << endl
+ << " --help Print this help" << endl
+ << " -V, --version Show version information" << endl << endl
+ << "The above list is only a selection of commonly used options. Please refer" << endl
+ << "to the man page for a complete list." << endl;
}
static void print_version()
@@ -254,7 +264,7 @@ static void print_version()
cout << "This is " << PACKAGE << " version " << VERSION << "." << endl << endl;
cout << "Using poppler version " << poppler::version_string().c_str() << endl;
#ifdef HAVE_UNAC
- cout << "Using unac version " << unac_version() << endl;
+ cout << "Using libunac version " << unac_version() << endl;
#endif
#ifdef HAVE_LIBPCRE
cout << "Using libpcre version " << pcre_version() << endl;
@@ -410,6 +420,28 @@ static bool parse_int(const char *str, int *i)
return true;
}
+bool read_pattern_file(string filename, vector<string> &patterns)
+{
+ ifstream file(filename);
+
+ if (!file.is_open()) {
+ err() << filename << ": " << strerror(errno) << endl;
+ return false;
+ }
+
+ string line;
+ while (getline(file, line)) {
+ patterns.push_back(line);
+ }
+
+ if (file.bad()) {
+ err() << filename << ": " << strerror(errno) << endl;
+ return false;
+ }
+
+ return true;
+}
+
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 29
static void handle_poppler_errors(const string &msg, void *_opts)
{
@@ -447,8 +479,12 @@ int main(int argc, char** argv)
COLOR_NEVER
} use_colors = COLOR_AUTO;
+ // patterns specified with --regex or --file
+ vector<string> patterns;
+ bool patterns_specified = false;
+
while (1) {
- int c = getopt_long(argc, argv, "icA:B:C:nrRhHVPpqm:FoZ",
+ int c = getopt_long(argc, argv, "icA:B:C:nrRhHVPpqm:FoZe:f:lL",
long_options, NULL);
if (c == -1)
@@ -603,6 +639,29 @@ int main(int argc, char** argv)
options.outconf.context_mode = true;
break;
+ case PAGE_RANGE_OPTION:
+ options.page_range = IntervalContainer::fromString(optarg);
+ break;
+
+ case 'e':
+ patterns_specified = true;
+ patterns.push_back(string(optarg));
+ break;
+
+ case 'f':
+ patterns_specified = true;
+ if (!read_pattern_file(string(optarg), patterns))
+ exit(EXIT_ERROR);
+ break;
+
+ case 'l':
+ options.only_filenames = OnlyFilenames::WITH_MATCHES;
+ break;
+
+ case 'L':
+ options.only_filenames = OnlyFilenames::WITHOUT_MATCH;
+ break;
+
/* In these two cases, getopt already prints an
* error message
*/
@@ -615,30 +674,49 @@ int main(int argc, char** argv)
}
}
- if (argc == optind || (argc - optind < 2 && options.recursive == Recursion::NONE)) {
+ int remaining_args = argc - optind;
+ int required_args = 0;
+ if (!patterns_specified) required_args++;
+ if (options.recursive == Recursion::NONE) required_args++;
+
+ if (remaining_args < required_args) {
print_usage(argv[0]);
exit(EXIT_ERROR);
}
- char *pattern = argv[optind++];
-#ifdef HAVE_UNAC
- pattern = simple_unac(options, pattern);
-#endif
-
unique_ptr<Regengine> re;
if (re_engine == (RE_FIXED | RE_PCRE)) {
err() << "--pcre and --fixed cannot be used together" << endl;
exit(EXIT_ERROR);
}
+
+ auto make_regengine = [&](const string pattern) -> unique_ptr<Regengine> {
+#ifdef HAVE_UNAC
+ const string new_pattern = simple_unac(options, pattern);
+#else
+ const string new_pattern = move(pattern);
+#endif
#ifdef HAVE_LIBPCRE
- if (re_engine == RE_PCRE) {
- re.reset(new PCRERegex(pattern, options.ignore_case));
- } else
+ if (re_engine == RE_PCRE) {
+ return unique_ptr<PCRERegex>(new PCRERegex(new_pattern, options.ignore_case));
+ } else
#endif // HAVE_LIBPCRE
- if (re_engine == RE_FIXED) {
- re.reset(new FixedString(pattern, options.ignore_case));
+ if (re_engine == RE_FIXED) {
+ return unique_ptr<FixedString>(new FixedString(new_pattern, options.ignore_case));
+ } else {
+ return unique_ptr<PosixRegex>(new PosixRegex(new_pattern, options.ignore_case));
+ }
+
+ };
+
+ if (patterns.empty()) {
+ re = make_regengine(argv[optind++]);
} else {
- re.reset(new PosixRegex(pattern, options.ignore_case));
+ auto patt_list = std::unique_ptr<PatternList>(new PatternList());
+ for (auto p : patterns) {
+ patt_list->add_pattern(make_regengine(p));
+ }
+ re = move(patt_list);
}
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 29
@@ -671,6 +749,9 @@ int main(int argc, char** argv)
options.outconf.context_mode = false;
}
+ // TODO Warn about --files-{with-matches,without-match} and other output
+ // options
+
if (excludes_empty(options.includes))
exclude_add(options.includes, "*.pdf");
diff --git a/src/pdfgrep.h b/src/pdfgrep.h
index 6a7731d..93c52ae 100644
--- a/src/pdfgrep.h
+++ b/src/pdfgrep.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2017 by Hans-Peter Deifel *
+ * Copyright (C) 2015-2018 by Hans-Peter Deifel *
* hpd@hpdeifel.de *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -23,6 +23,7 @@
#include "config.h"
#include "exclude.h"
+#include "intervals.h"
#include <vector>
#include <string>
@@ -67,6 +68,11 @@ struct Outconf {
Colorconf colors;
};
+enum class OnlyFilenames {
+ NOPE,
+ WITH_MATCHES,
+ WITHOUT_MATCH
+};
struct Options {
bool ignore_case = false;
@@ -87,6 +93,17 @@ struct Options {
ExcludeList includes;
bool use_cache = false;
std::string cache_directory;
+ IntervalContainer page_range;
+ OnlyFilenames only_filenames = OnlyFilenames::NOPE;
};
+#ifdef HAVE_UNAC
+/* convenience layer over libunac */
+std::string simple_unac(const Options &opts, const std::string str);
+#endif
+
#endif /* PDFGREP_H */
+
+/* Local Variables: */
+/* mode: c++ */
+/* End: */
diff --git a/src/regengine.cc b/src/regengine.cc
index f2f0e5e..491d7b1 100644
--- a/src/regengine.cc
+++ b/src/regengine.cc
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2017 by Hans-Peter Deifel *
+ * Copyright (C) 2015-2018 by Hans-Peter Deifel *
* hpd@hpdeifel.de *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -32,10 +32,29 @@
#include "output.h"
#include "pdfgrep.h"
-// regex(3)
-
using namespace std;
+bool PatternList::exec(const string &str, size_t offset, struct match &m) const
+{
+ struct match m_copy = m;
+
+ for (auto &r : patterns) {
+ if (r->exec(str, offset, m_copy)) {
+ m.start = m_copy.start;
+ m.end = m_copy.end;
+ return true;
+ }
+ }
+ return false;
+}
+
+
+void PatternList::add_pattern(unique_ptr<Regengine> pattern) {
+ patterns.push_back(move(pattern));
+}
+
+// regex(3)
+
PosixRegex::PosixRegex(const string &pattern, bool case_insensitive)
{
int regex_flags = REG_EXTENDED | (case_insensitive ? REG_ICASE : 0);
diff --git a/src/regengine.h b/src/regengine.h
index bac3661..0b7b4a5 100644
--- a/src/regengine.h
+++ b/src/regengine.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2017 by Hans-Peter Deifel *
+ * Copyright (C) 2015-2018 by Hans-Peter Deifel *
* hpd@hpdeifel.de *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -31,6 +31,7 @@
#endif
#include <vector>
#include <string>
+#include <memory>
struct match;
@@ -43,6 +44,22 @@ public:
virtual ~Regengine() {}
};
+// This matches the union of a set of patterns
+//
+// It just tries all patterns in turn. This could be more efficient by using
+// some engine-specific way of combining patterns, e.g with "|" in the posix
+// case.
+class PatternList : public Regengine
+{
+public:
+ PatternList() {}
+ ~PatternList() {}
+ bool exec(const std::string &str, size_t offset, struct match &m) const override;
+ void add_pattern(std::unique_ptr<Regengine> pattern);
+private:
+ std::vector<std::unique_ptr<Regengine>> patterns;
+};
+
class PosixRegex : public Regengine
{
public:
@@ -76,3 +93,7 @@ private:
};
#endif /* REGENGINE_H */
+
+/* Local Variables: */
+/* mode: c++ */
+/* End: */
diff --git a/src/search.cc b/src/search.cc
index ffea9f6..89d416c 100644
--- a/src/search.cc
+++ b/src/search.cc
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2017 by Hans-Peter Deifel *
+ * Copyright (C) 2015-2018 by Hans-Peter Deifel *
* hpd@hpdeifel.de *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -44,10 +44,6 @@ static int search_page(const Options &opts, const string &text, size_t pagenum,
const string &filename, const Regengine &re,
SearchState &state);
-#ifdef HAVE_UNAC
-/* convenience layer over libunac */
-static string simple_unac(const Options &opts, string str);
-#endif
static string maybe_unac(const Options &opts, string std);
static void handle_match(const Options &opts, const string &filename, size_t page,
vector<match> &line, vector<match> &last_line, const match &mt,
@@ -58,8 +54,11 @@ static void flush_line_matches(const Options &opts, const string &filename, size
static string page_text(poppler::page &page) {
poppler::byte_array arr = page.text(page.page_rect(poppler::media_box)).to_utf8();
- char *c_str = &arr[0];
- return string(c_str, arr.size());
+ if (arr.empty()) {
+ return string();
+ } else {
+ return string(arr.data(), arr.size());
+ }
}
int search_document(const Options &opts, unique_ptr<poppler::document> doc,
@@ -72,6 +71,9 @@ int search_document(const Options &opts, unique_ptr<poppler::document> doc,
size_t doc_pages = static_cast<size_t>(doc->pages());
for (size_t pagenum = 1; pagenum <= doc_pages; pagenum++) {
+ if (opts.page_range.contains(pagenum) == false)
+ continue;
+
string text;
if (!opts.use_cache || !cache->get_page(pagenum, text)) {
unique_ptr<poppler::page> page(doc->create_page(pagenum-1));
@@ -98,7 +100,19 @@ int search_document(const Options &opts, unique_ptr<poppler::document> doc,
int page_count = search_page(opts, text, pagenum,
filename, re, state);
- if (page_count > 0 && opts.pagecount && !opts.quiet) {
+ if (page_count > 0 && opts.quiet) {
+ break;
+ }
+
+ if (opts.only_filenames == OnlyFilenames::WITH_MATCHES
+ && page_count > 0) {
+ if (!opts.quiet) {
+ print_only_filename(opts.outconf, filename);
+ }
+ break;
+ }
+ if (page_count > 0 && opts.pagecount &&
+ opts.only_filenames == OnlyFilenames::NOPE && !opts.quiet) {
line_prefix(opts.outconf, filename, false, pagenum) << page_count << endl;
}
@@ -107,7 +121,13 @@ int search_document(const Options &opts, unique_ptr<poppler::document> doc,
}
}
- if (opts.count && !opts.quiet) {
+ if (opts.only_filenames == OnlyFilenames::WITHOUT_MATCH
+ && state.total_count == 0
+ && !opts.quiet) {
+ print_only_filename(opts.outconf, filename);
+ }
+
+ if (opts.count && opts.only_filenames == OnlyFilenames::NOPE && !opts.quiet) {
line_prefix(opts.outconf, filename, false) << state.total_count << endl;
}
@@ -150,7 +170,7 @@ static int search_page(const Options &opts, const string &page_text,
state.total_count++;
page_count++;
- if (opts.quiet) {
+ if (opts.quiet || opts.only_filenames == OnlyFilenames::WITH_MATCHES) {
return page_count;
}
@@ -195,7 +215,8 @@ static void flush_line_matches(const Options &opts, const string &filename, size
struct context cntxt = {filename, page, opts.outconf};
// We don't want any output:
- if (line.empty() || opts.count || opts.pagecount)
+ if (line.empty() || opts.count || opts.pagecount
+ || opts.only_filenames != OnlyFilenames::NOPE)
goto out;
// context printing
@@ -242,24 +263,6 @@ static void handle_match(const Options &opts, const string &filename, size_t pag
}
}
-#ifdef HAVE_UNAC
-static string simple_unac(const Options &opts, string str)
-{
- if (!opts.use_unac)
- return str;
-
- char *res = NULL;
- size_t reslen = 0;
-
- if (unac_string("UTF-8", str.c_str(), str.size(), &res, &reslen)) {
- perror("pdfgrep: Failed to remove accents: ");
- return str;
- }
-
- return res;
-}
-#endif
-
static string maybe_unac(const Options &opts, string str) {
#ifdef HAVE_UNAC
return simple_unac(opts, str);
diff --git a/src/search.h b/src/search.h
index f3fa82c..7d6be48 100644
--- a/src/search.h
+++ b/src/search.h
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2017 by Hans-Peter Deifel *
+ * Copyright (C) 2015-2018 by Hans-Peter Deifel *
* hpd@hpdeifel.de *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -35,3 +35,7 @@ int search_document(const Options &opts, std::unique_ptr<poppler::document> doc,
#endif /* SEARCH_H */
+
+/* Local Variables: */
+/* mode: c++ */
+/* End: */
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in
index 298bbdb..cabd55a 100644
--- a/testsuite/Makefile.in
+++ b/testsuite/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -132,7 +132,7 @@ am__recursive_targets = \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
- distdir
+ distdir distdir-am
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
@@ -328,8 +328,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -445,7 +445,7 @@ check-DEJAGNU: site.exp
EXPECT=$(EXPECT); export EXPECT; \
if $(SHELL) -c "$(RUNTEST) --version" > /dev/null 2>&1; then \
exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \
- if $(RUNTEST) $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \
+ if $(RUNTEST) $(RUNTESTDEFAULTFLAGS) $(AM_RUNTESTFLAGS) $(RUNTESTFLAGS); \
then :; else exit_status=1; fi; \
done; \
else echo "WARNING: could not find '$(RUNTEST)'" 1>&2; :;\
@@ -482,7 +482,10 @@ distclean-DEJAGNU:
rm -f $$tool.sum $$tool.log; \
done
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
diff --git a/testsuite/README.md b/testsuite/README.md
index 7bbebfa..00b06ac 100644
--- a/testsuite/README.md
+++ b/testsuite/README.md
@@ -53,6 +53,7 @@ the following functions and variables should be of interest:
- `required_poppler_version`: The least poppler version that this test
does require.
- `requires_pcre_support`: Whether this test requires libpcre support.
+- `requires_unac_support`: Whether this test requires libunac support.
### Procedures
diff --git a/testsuite/config/Makefile.in b/testsuite/config/Makefile.in
index 9d4f384..2b6d847 100644
--- a/testsuite/config/Makefile.in
+++ b/testsuite/config/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -260,8 +260,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -279,7 +279,10 @@ ctags CTAGS:
cscope cscopelist:
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
diff --git a/testsuite/lib/Makefile.in b/testsuite/lib/Makefile.in
index 36f89b4..e6be757 100644
--- a/testsuite/lib/Makefile.in
+++ b/testsuite/lib/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -260,8 +260,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -279,7 +279,10 @@ ctags CTAGS:
cscope cscopelist:
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
diff --git a/testsuite/lib/pdfgrep.exp b/testsuite/lib/pdfgrep.exp
index 5e3f051..b967fd9 100644
--- a/testsuite/lib/pdfgrep.exp
+++ b/testsuite/lib/pdfgrep.exp
@@ -29,7 +29,7 @@ proc pdfgrep_noerr args {
}
}
-# The version of poppler, that this pdfgrep is built against.
+# The version of poppler that this pdfgrep is built against.
# Format [Major Minor Patchlevel]
#
# You can disable all poppler version checks (for example, if you have a patched
@@ -40,6 +40,9 @@ set poppler_version {0 0 0}
# Is pdfgrep compiled with pcre support?
set have_pcre false
+# Is pdfgrep compiled with libunac support?
+set have_unac false
+
# Parse the output of pdfgrep --version, to get the configuration parameters.
log_user 0
pdfgrep --version
@@ -48,6 +51,9 @@ while {1} {
-re "Using poppler version (\[^\r\]+)\r\n" {
set poppler_version [split $expect_out(1,string) "."]
}
+ -re "Using libunac version \[^\r\]*\r\n" {
+ set have_unac true
+ }
-re "Using libpcre version \[^\r\]*\r\n" {
set have_pcre true
}
@@ -64,6 +70,10 @@ set required_poppler_version {0 0 0}
# pdfgrep is not build with libpcre support.
set requires_pcre_support false
+# This can be set in test scripts to generate UNSUPPORTED test results, if
+# pdfgrep is not build with libunac support.
+set requires_unac_support false
+
# Syntax: pdfgrep_expect args pattern
#
# Spawns pdfgrep with args, fail on stderr and compares the output with pattern.
@@ -204,8 +214,10 @@ proc pxfail arg {
proc when_supported {action arg} {
global poppler_version required_poppler_version
global requires_pcre_support have_pcre
+ global requires_unac_support have_unac
if {[poppler_greater] && \
- (!$requires_pcre_support || $have_pcre)} {
+ (!$requires_pcre_support || $have_pcre) && \
+ (!$requires_unac_support || $have_unac)} {
$action $arg
} else {
unsupported "$arg -- required configuration was not found"
@@ -213,9 +225,10 @@ proc when_supported {action arg} {
}
proc reset_configuration {} {
- global required_poppler_version requires_pcre_support
+ global required_poppler_version requires_pcre_support requires_unac_support
set required_poppler_version {0 0 0}
set requires_pcre_support false
+ set requires_unac_support false
}
########################################
diff --git a/testsuite/pdfgrep.tests/Makefile.am b/testsuite/pdfgrep.tests/Makefile.am
index 2cc3af4..1854ee8 100644
--- a/testsuite/pdfgrep.tests/Makefile.am
+++ b/testsuite/pdfgrep.tests/Makefile.am
@@ -8,5 +8,8 @@ EXTRA_DIST =color.exp \
regex.exp \
usage.exp \
context.exp \
+ page_range.exp \
+ patternlist.exp \
+ only_filenames.exp \
cache.exp
diff --git a/testsuite/pdfgrep.tests/Makefile.in b/testsuite/pdfgrep.tests/Makefile.in
index b750a18..2d52782 100644
--- a/testsuite/pdfgrep.tests/Makefile.in
+++ b/testsuite/pdfgrep.tests/Makefile.in
@@ -1,7 +1,7 @@
-# Makefile.in generated by automake 1.15 from Makefile.am.
+# Makefile.in generated by automake 1.16.1 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -249,6 +249,9 @@ EXTRA_DIST = color.exp \
regex.exp \
usage.exp \
context.exp \
+ page_range.exp \
+ patternlist.exp \
+ only_filenames.exp \
cache.exp
all: all-am
@@ -271,8 +274,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
@@ -290,7 +293,10 @@ ctags CTAGS:
cscope cscopelist:
-distdir: $(DISTFILES)
+distdir: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) distdir-am
+
+distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
diff --git a/testsuite/pdfgrep.tests/only_filenames.exp b/testsuite/pdfgrep.tests/only_filenames.exp
new file mode 100644
index 0000000..aa513ae
--- /dev/null
+++ b/testsuite/pdfgrep.tests/only_filenames.exp
@@ -0,0 +1,290 @@
+clear_pdfdir
+
+set one [mkpdf one "foo"]
+set two [mkpdf two "bar"]
+set three [mkpdf three "foobar"]
+set four [mkpdf four "baz"]
+
+######################################################################
+
+set test "files-with-matches"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --files-with-matches "foo" $one $two $three $four \
+"$one
+$three"
+
+######################################################################
+
+set test "files-without-match"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --files-without-match "foo" $one $two $three $four \
+"$two
+$four"
+
+######################################################################
+
+set test "recursive files-with-matches"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect -l -r "foo" $pdfdir \
+ "(($one|$three)(\n)?){2}"
+
+######################################################################
+
+set test "recursive files-without-match"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect -L -r "foo" $pdfdir \
+ "(($two|$four)(\n)?){2}"
+
+######################################################################
+
+set test "files-with-matches and -Z"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --null --files-with-matches "foo" $one $two $three $four \
+"$one\0$three\0"
+
+######################################################################
+
+set test "files-without-match and -Z"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect -Z --files-without-match "foo" $one $two $three $four \
+"$two\0$four\0"
+
+######################################################################
+
+set test "files-with-matches and --with-filename"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --with-filename --files-with-matches "foo" $one $two $three $four \
+"$one
+$three"
+
+######################################################################
+
+set test "files-with-matches and --no-filename"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --no-filename --files-with-matches "foo" $one $two $three $four \
+"$one
+$three"
+
+######################################################################
+
+set test "files-without-match and --with-filename"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --with-filename --files-without-match "foo" $one $two $three $four \
+"$two
+$four"
+
+######################################################################
+
+set test "files-without-match and --no-filename"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --no-filename --files-without-match "foo" $one $two $three $four \
+"$two
+$four"
+
+######################################################################
+
+set test "files-with-matches and --page-number"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --page-number --files-with-matches "foo" $one $two $three $four \
+"$one
+$three"
+
+######################################################################
+
+set test "files-without-match and --page-number"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --page-number --files-without-match "foo" $one $two $three $four \
+"$two
+$four"
+
+######################################################################
+
+set test "files-with-matches and --page-count"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --page-count --files-with-matches "foo" $one $two $three $four \
+"$one
+$three"
+
+######################################################################
+
+set test "files-without-match and --page-count"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --page-count --files-without-match "foo" $one $two $three $four \
+"$two
+$four"
+
+######################################################################
+
+set test "files-with-matches and --only-matching"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --only-matching --files-with-matches "foo" $one $two $three $four \
+"$one
+$three"
+
+######################################################################
+
+set test "files-without-match and --only-matching"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --only-matching --files-without-match "foo" $one $two $three $four \
+"$two
+$four"
+
+######################################################################
+
+set test "files-with-matches and --context"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --context 3 --files-with-matches "foo" $one $two $three $four \
+"$one
+$three"
+
+######################################################################
+
+set test "files-without-match and --context"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --context 3 --files-without-match "foo" $one $two $three $four \
+"$two
+$four"
+
+######################################################################
+
+set test "files-with-matches and --count"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --count --files-with-matches "foo" $one $two $three $four \
+"$one
+$three"
+
+######################################################################
+
+set test "files-without-match and --count"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --count --files-without-match "foo" $one $two $three $four \
+"$two
+$four"
+
+######################################################################
+
+set test "files-with-matches and --quiet"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --quiet --files-with-matches "foo" $one $two $three $four ""
+expect_exit_status 0
+
+######################################################################
+
+set test "files-without-match and --quiet"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --quiet --files-without-match "foo" $one $two $three $four ""
+expect_exit_status 0
+
+######################################################################
+
+set test "files-with-matches (unsuccessful)"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --files-with-matches "barfoo" $one $two $three $four ""
+expect_exit_status 1
+
+######################################################################
+
+set test "files-without-match (unsuccessful)"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --files-without-match "barfoo" $one $two $three $four \
+"$one
+$two
+$three
+$four"
+expect_exit_status 1
diff --git a/testsuite/pdfgrep.tests/page_range.exp b/testsuite/pdfgrep.tests/page_range.exp
new file mode 100644
index 0000000..2e52bfd
--- /dev/null
+++ b/testsuite/pdfgrep.tests/page_range.exp
@@ -0,0 +1,124 @@
+set test "page range with range"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+clear_pdfdir
+set pdf [mkpdf foo {
+ first page
+ \newpage
+ second page
+ \newpage
+ third page
+}]
+
+pdfgrep_expect --page-range 1-2 page $pdf \
+"first page
+second page"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+expect_exit_status 0
+
+######################################################################
+
+set test "page range with single page"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --page-range 2 page $pdf \
+"second page"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+expect_exit_status 0
+
+######################################################################
+
+set test "page range with both"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --page-range 1-2,3 page $pdf \
+"first page
+second page
+third page"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+expect_exit_status 0
+
+######################################################################
+
+set test "invalid page range"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect_error --page-range foo page $pdf
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+expect_exit_status 2
+
+######################################################################
+
+set test "invalid number in page range"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect_error --page-range 0--2 page $pdf
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+expect_exit_status 2
+
+######################################################################
+
+set test "invalid number in page range"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect_error --page-range 1-foo page $pdf
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+expect_exit_status 2
+
+######################################################################
+
+set test "empty page range"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect_error --page-range 2-1 page $pdf
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+expect_exit_status 1
diff --git a/testsuite/pdfgrep.tests/patternlist.exp b/testsuite/pdfgrep.tests/patternlist.exp
new file mode 100644
index 0000000..e9168f3
--- /dev/null
+++ b/testsuite/pdfgrep.tests/patternlist.exp
@@ -0,0 +1,78 @@
+# These are tests for --regex and --file
+
+set test "-e"
+
+clear_pdfdir
+set pdf [mkpdf pdf {
+ line1\\
+ line2\\
+ -a dash
+}]
+
+pdfgrep_expect -e line $pdf \
+"line1
+line2"
+
+######################################################################
+
+set test "-e multiple times"
+
+pdfgrep_expect --regexp 1 -e 2 $pdf \
+"line1
+line2"
+
+######################################################################
+
+set test "-e argument with a dash"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect -e -a $pdf \
+"-a dash"
+
+######################################################################
+
+set test "--file"
+
+set filename "$pdfdir/patternfile"
+set fileId [open "$filename" "w"]
+puts $fileId "1"
+puts $fileId "2"
+close $fileId
+
+pdfgrep_expect --file "$filename" $pdf \
+"line1
+line2"
+
+######################################################################
+
+set test "--file used twice"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+set filename2 "$pdfdir/patternfile2"
+set fileId [open "$filename2" "w"]
+puts $fileId "dash"
+close $fileId
+
+pdfgrep_expect -f "$filename" --file "$filename2" $pdf \
+"line1
+line2
+-a dash"
+
+######################################################################
+
+set test "--file and --regexp"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+pdfgrep_expect --file "$filename" --regexp "dash" $pdf \
+"line1
+line2
+-a dash"
diff --git a/testsuite/pdfgrep.tests/regex.exp b/testsuite/pdfgrep.tests/regex.exp
index 6a3b4f3..e1bef4e 100644
--- a/testsuite/pdfgrep.tests/regex.exp
+++ b/testsuite/pdfgrep.tests/regex.exp
@@ -237,3 +237,47 @@ set test "Invalid regex -- PCRE"
pdfgrep_expect_error -Pr "(" .
expect_exit_status 2
+
+######################################################################
+
+clear_pdfdir
+set pdf [mkpdf empty {
+line1\\\\
+line2
+}]
+
+set test "^ only matches the beginning of a page"
+
+pdfgrep_expect "^line" $pdf "line1"
+
+######################################################################
+
+set test "^ only matches the beginning of a page -- PCRE"
+
+set requires_pcre_support true
+
+pdfgrep_expect -P "^line" $pdf "line1"
+
+######################################################################
+
+set test "\$ only matches the end of a page"
+
+# FIXME This currently fails, but shouldn't. The problem is that the last line
+# ends with a newline chraracter and so "line.\n$" would match, but "line.$"
+# doesn't.
+#
+# See bug #14 for details.
+
+pdfgrep_expect_x "line.\$" $pdf "line2"
+
+######################################################################
+
+set test "\$ only matches the end of a page -- PCRE"
+
+# See poppler bug 91644
+# https://bugs.freedesktop.org/show_bug.cgi?id=91644
+set required_poppler_version {0 36 0}
+
+set requires_pcre_support true
+
+pdfgrep_expect -P "line.\$" $pdf "line2"