diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-06-18 12:10:20 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-06-18 12:10:20 +0000 |
commit | 3e2864914687b1af9d1ce374ee11b3a799e9561a (patch) | |
tree | 8e6911bfef46a6843e977fda8d837bf6425c7481 /Build/source/utils | |
parent | 1c0abb83d537ef1e3b95ebd92c646a5d70793d93 (diff) |
xpdfopen 0.86
git-svn-id: svn://tug.org/texlive/trunk@34291 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils')
21 files changed, 504 insertions, 219 deletions
diff --git a/Build/source/utils/xpdfopen/Makefile.am b/Build/source/utils/xpdfopen/Makefile.am index 56c8350f6e7..676bdcd3556 100644 --- a/Build/source/utils/xpdfopen/Makefile.am +++ b/Build/source/utils/xpdfopen/Makefile.am @@ -3,7 +3,15 @@ ## Copyright (C) 2009-2014 Peter Breitenlohner <tex-live@tug.org> ## You may freely use, modify and/or distribute this file. ## -ACLOCAL_AMFLAGS = -I ../../m4 +EXTRA_DIST = $(XPDFOPEN_TREE) + +## Changes applied to the original source tree +## +EXTRA_DIST += $(XPDFOPEN_TREE)-PATCHES + +# in case of an SVN repository +dist-hook: + rm -rf `find $(distdir) -name .svn -o -name .deps -o -name .dirstamp -o -name '*.$(OBJEXT)'` AM_CPPFLAGS = $(X_CFLAGS) AM_CFLAGS = $(WARNING_CFLAGS) @@ -12,13 +20,19 @@ LDADD = $(X_LIBS) -lX11 -lXmu $(X_EXTRA_LIBS) bin_PROGRAMS = pdfopen pdfclose -common_sources = externs.h sendx.c sendx.h utils.c utils.h xpdfopen.h +common_sources = \ + @XPDFOPEN_TREE@/sendx.c \ + @XPDFOPEN_TREE@/utils.c -pdfopen_SOURCES = pdfopen.c $(common_sources) +nodist_pdfopen_SOURCES = \ + @XPDFOPEN_TREE@/pdfopen.c \ + $(common_sources) -pdfclose_SOURCES = pdfclose.c $(common_sources) +nodist_pdfclose_SOURCES = \ + @XPDFOPEN_TREE@/pdfclose.c \ + $(common_sources) -dist_man1_MANS = pdfopen.1 +nodist_man1_MANS = $(XPDFOPEN_TREE)/pdfopen.1 # Symlinks within $(man1dir): FILE:LINK indicates LINK.1->FILE.1 man1_links = pdfopen:pdfclose @@ -29,7 +43,5 @@ install-data-hook: install-man1-links uninstall-hook: uninstall-man1-links -EXTRA_DIST = xpdfopen.pdf xpdfopen.tex - -EXTRA_DIST += Makefile.am.orig configure.ac.orig +EXTRA_DIST += xpdfopen.pdf xpdfopen.tex diff --git a/Build/source/utils/xpdfopen/Makefile.in b/Build/source/utils/xpdfopen/Makefile.in index 737efaa7db8..44ccc41102d 100644 --- a/Build/source/utils/xpdfopen/Makefile.in +++ b/Build/source/utils/xpdfopen/Makefile.in @@ -80,12 +80,12 @@ bin_PROGRAMS = pdfopen$(EXEEXT) pdfclose$(EXEEXT) DIST_COMMON = $(top_srcdir)/../../am/man1_links.am \ $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ - $(top_srcdir)/../../build-aux/depcomp $(dist_man1_MANS) \ - ChangeLog README ../../build-aux/compile \ - ../../build-aux/config.guess ../../build-aux/config.sub \ - ../../build-aux/depcomp ../../build-aux/install-sh \ - ../../build-aux/missing ../../build-aux/texinfo.tex \ - ../../build-aux/ylwrap ../../build-aux/ltmain.sh \ + $(top_srcdir)/../../build-aux/depcomp ChangeLog \ + ../../build-aux/compile ../../build-aux/config.guess \ + ../../build-aux/config.sub ../../build-aux/depcomp \ + ../../build-aux/install-sh ../../build-aux/missing \ + ../../build-aux/texinfo.tex ../../build-aux/ylwrap \ + ../../build-aux/ltmain.sh \ $(top_srcdir)/../../build-aux/compile \ $(top_srcdir)/../../build-aux/install-sh \ $(top_srcdir)/../../build-aux/missing @@ -93,7 +93,7 @@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../../m4/kpse-common.m4 \ $(top_srcdir)/../../m4/kpse-warnings.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/version.ac $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ @@ -103,14 +103,18 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" PROGRAMS = $(bin_PROGRAMS) -am__objects_1 = sendx.$(OBJEXT) utils.$(OBJEXT) -am_pdfclose_OBJECTS = pdfclose.$(OBJEXT) $(am__objects_1) -pdfclose_OBJECTS = $(am_pdfclose_OBJECTS) +am__dirstamp = $(am__leading_dot)dirstamp +am__objects_1 = @XPDFOPEN_TREE@/sendx.$(OBJEXT) \ + @XPDFOPEN_TREE@/utils.$(OBJEXT) +nodist_pdfclose_OBJECTS = @XPDFOPEN_TREE@/pdfclose.$(OBJEXT) \ + $(am__objects_1) +pdfclose_OBJECTS = $(nodist_pdfclose_OBJECTS) pdfclose_LDADD = $(LDADD) am__DEPENDENCIES_1 = pdfclose_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) -am_pdfopen_OBJECTS = pdfopen.$(OBJEXT) $(am__objects_1) -pdfopen_OBJECTS = $(am_pdfopen_OBJECTS) +nodist_pdfopen_OBJECTS = @XPDFOPEN_TREE@/pdfopen.$(OBJEXT) \ + $(am__objects_1) +pdfopen_OBJECTS = $(nodist_pdfopen_OBJECTS) pdfopen_LDADD = $(LDADD) pdfopen_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) AM_V_P = $(am__v_P_@AM_V@) @@ -141,8 +145,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(pdfclose_SOURCES) $(pdfopen_SOURCES) -DIST_SOURCES = $(pdfclose_SOURCES) $(pdfopen_SOURCES) +SOURCES = $(nodist_pdfclose_SOURCES) $(nodist_pdfopen_SOURCES) +DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -177,7 +181,7 @@ am__uninstall_files_from_dir = { \ } man1dir = $(mandir)/man1 NROFF = nroff -MANS = $(dist_man1_MANS) +MANS = $(nodist_man1_MANS) 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 @@ -262,6 +266,7 @@ STRIP = @STRIP@ VERSION = @VERSION@ WARNING_CFLAGS = @WARNING_CFLAGS@ XMKMF = @XMKMF@ +XPDFOPEN_TREE = @XPDFOPEN_TREE@ X_CFLAGS = @X_CFLAGS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ X_LIBS = @X_LIBS@ @@ -308,19 +313,27 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -ACLOCAL_AMFLAGS = -I ../../m4 +EXTRA_DIST = $(XPDFOPEN_TREE) $(XPDFOPEN_TREE)-PATCHES xpdfopen.pdf \ + xpdfopen.tex AM_CPPFLAGS = $(X_CFLAGS) AM_CFLAGS = $(WARNING_CFLAGS) LDADD = $(X_LIBS) -lX11 -lXmu $(X_EXTRA_LIBS) -common_sources = externs.h sendx.c sendx.h utils.c utils.h xpdfopen.h -pdfopen_SOURCES = pdfopen.c $(common_sources) -pdfclose_SOURCES = pdfclose.c $(common_sources) -dist_man1_MANS = pdfopen.1 +common_sources = \ + @XPDFOPEN_TREE@/sendx.c \ + @XPDFOPEN_TREE@/utils.c + +nodist_pdfopen_SOURCES = \ + @XPDFOPEN_TREE@/pdfopen.c \ + $(common_sources) + +nodist_pdfclose_SOURCES = \ + @XPDFOPEN_TREE@/pdfclose.c \ + $(common_sources) + +nodist_man1_MANS = $(XPDFOPEN_TREE)/pdfopen.1 # Symlinks within $(man1dir): FILE:LINK indicates LINK.1->FILE.1 man1_links = pdfopen:pdfclose -EXTRA_DIST = xpdfopen.pdf xpdfopen.tex Makefile.am.orig \ - configure.ac.orig all: all-am .SUFFIXES: @@ -402,10 +415,24 @@ uninstall-binPROGRAMS: clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +@XPDFOPEN_TREE@/$(am__dirstamp): + @$(MKDIR_P) @XPDFOPEN_TREE@ + @: > @XPDFOPEN_TREE@/$(am__dirstamp) +@XPDFOPEN_TREE@/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) @XPDFOPEN_TREE@/$(DEPDIR) + @: > @XPDFOPEN_TREE@/$(DEPDIR)/$(am__dirstamp) +@XPDFOPEN_TREE@/pdfclose.$(OBJEXT): @XPDFOPEN_TREE@/$(am__dirstamp) \ + @XPDFOPEN_TREE@/$(DEPDIR)/$(am__dirstamp) +@XPDFOPEN_TREE@/sendx.$(OBJEXT): @XPDFOPEN_TREE@/$(am__dirstamp) \ + @XPDFOPEN_TREE@/$(DEPDIR)/$(am__dirstamp) +@XPDFOPEN_TREE@/utils.$(OBJEXT): @XPDFOPEN_TREE@/$(am__dirstamp) \ + @XPDFOPEN_TREE@/$(DEPDIR)/$(am__dirstamp) pdfclose$(EXEEXT): $(pdfclose_OBJECTS) $(pdfclose_DEPENDENCIES) $(EXTRA_pdfclose_DEPENDENCIES) @rm -f pdfclose$(EXEEXT) $(AM_V_CCLD)$(LINK) $(pdfclose_OBJECTS) $(pdfclose_LDADD) $(LIBS) +@XPDFOPEN_TREE@/pdfopen.$(OBJEXT): @XPDFOPEN_TREE@/$(am__dirstamp) \ + @XPDFOPEN_TREE@/$(DEPDIR)/$(am__dirstamp) pdfopen$(EXEEXT): $(pdfopen_OBJECTS) $(pdfopen_DEPENDENCIES) $(EXTRA_pdfopen_DEPENDENCIES) @rm -f pdfopen$(EXEEXT) @@ -413,14 +440,15 @@ pdfopen$(EXEEXT): $(pdfopen_OBJECTS) $(pdfopen_DEPENDENCIES) $(EXTRA_pdfopen_DEP mostlyclean-compile: -rm -f *.$(OBJEXT) + -rm -f @XPDFOPEN_TREE@/*.$(OBJEXT) distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdfclose.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pdfopen.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendx.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@@XPDFOPEN_TREE@/$(DEPDIR)/pdfclose.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@@XPDFOPEN_TREE@/$(DEPDIR)/pdfopen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@@XPDFOPEN_TREE@/$(DEPDIR)/sendx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@@XPDFOPEN_TREE@/$(DEPDIR)/utils.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @@ -437,9 +465,9 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` -install-man1: $(dist_man1_MANS) +install-man1: $(nodist_man1_MANS) @$(NORMAL_INSTALL) - @list1='$(dist_man1_MANS)'; \ + @list1='$(nodist_man1_MANS)'; \ list2=''; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ @@ -473,7 +501,7 @@ install-man1: $(dist_man1_MANS) uninstall-man1: @$(NORMAL_UNINSTALL) - @list='$(dist_man1_MANS)'; test -n "$(man1dir)" || exit 0; \ + @list='$(nodist_man1_MANS)'; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ @@ -570,6 +598,9 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ @@ -734,6 +765,8 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f @XPDFOPEN_TREE@/$(DEPDIR)/$(am__dirstamp) + -rm -f @XPDFOPEN_TREE@/$(am__dirstamp) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -744,7 +777,7 @@ clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf ./$(DEPDIR) + -rm -rf @XPDFOPEN_TREE@/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -793,7 +826,7 @@ installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf ./$(DEPDIR) + -rm -rf @XPDFOPEN_TREE@/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -819,21 +852,25 @@ uninstall-man: uninstall-man1 .PHONY: CTAGS GTAGS TAGS all all-am am--refresh check check-am clean \ clean-binPROGRAMS clean-cscope clean-generic cscope \ cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \ - dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \ - distcheck distclean distclean-compile distclean-generic \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am \ - install-data-hook install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-man1 install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-hook \ - uninstall-man uninstall-man1 - + dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \ + dist-zip distcheck distclean distclean-compile \ + distclean-generic distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-data \ + install-data-am install-data-hook install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-man1 \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-hook uninstall-man uninstall-man1 + + +# in case of an SVN repository +dist-hook: + rm -rf `find $(distdir) -name .svn -o -name .deps -o -name .dirstamp -o -name '*.$(OBJEXT)'` .PHONY: install-man1-links uninstall-man1-links install-man1-links: diff --git a/Build/source/utils/xpdfopen/configure b/Build/source/utils/xpdfopen/configure index 55b0867418f..f3020eca3b4 100755 --- a/Build/source/utils/xpdfopen/configure +++ b/Build/source/utils/xpdfopen/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for xpdfopen (TeX Live) 0.84. +# Generated by GNU Autoconf 2.69 for xpdfopen (TeX Live) 0.86. # # Report bugs to <tex-k@tug.org>. # @@ -579,16 +579,17 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='xpdfopen (TeX Live)' PACKAGE_TARNAME='xpdfopen--tex-live-' -PACKAGE_VERSION='0.84' -PACKAGE_STRING='xpdfopen (TeX Live) 0.84' +PACKAGE_VERSION='0.86' +PACKAGE_STRING='xpdfopen (TeX Live) 0.86' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' -ac_unique_file="pdfopen.c" +ac_unique_file="xpdfopen-0.86/pdfopen.c" ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +XPDFOPEN_TREE X_EXTRA_LIBS X_LIBS X_PRE_LIBS @@ -1240,7 +1241,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 xpdfopen (TeX Live) 0.84 to adapt to many kinds of systems. +\`configure' configures xpdfopen (TeX Live) 0.86 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1311,7 +1312,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xpdfopen (TeX Live) 0.84:";; + short | recursive ) echo "Configuration of xpdfopen (TeX Live) 0.86:";; esac cat <<\_ACEOF @@ -1414,7 +1415,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -xpdfopen (TeX Live) configure 0.84 +xpdfopen (TeX Live) configure 0.86 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1619,7 +1620,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 xpdfopen (TeX Live) $as_me 0.84, which was +It was created by xpdfopen (TeX Live) $as_me 0.86, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3542,7 +3543,7 @@ fi # Define the identity of the package. PACKAGE='xpdfopen--tex-live-' - VERSION='0.84' + VERSION='0.86' cat >>confdefs.h <<_ACEOF @@ -5291,6 +5292,9 @@ fi fi +XPDFOPEN_TREE=xpdfopen-0.86 + + ac_config_files="$ac_config_files Makefile" @@ -5868,7 +5872,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 xpdfopen (TeX Live) $as_me 0.84, which was +This file was extended by xpdfopen (TeX Live) $as_me 0.86, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5925,7 +5929,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="\\ -xpdfopen (TeX Live) config.status 0.84 +xpdfopen (TeX Live) config.status 0.86 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/utils/xpdfopen/configure.ac b/Build/source/utils/xpdfopen/configure.ac index ad638dd35ae..5ca9c179ac6 100644 --- a/Build/source/utils/xpdfopen/configure.ac +++ b/Build/source/utils/xpdfopen/configure.ac @@ -6,9 +6,10 @@ dnl This file is free software; the copyright holder dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl -AC_INIT([xpdfopen (TeX Live)], [0.84], [tex-k@tug.org]) +m4_include([version.ac])[] dnl define xpdfopen_version +AC_INIT([xpdfopen (TeX Live)], xpdfopen_version, [tex-k@tug.org]) AC_PREREQ([2.65]) -AC_CONFIG_SRCDIR([pdfopen.c]) +AC_CONFIG_SRCDIR([xpdfopen-]xpdfopen_version[/pdfopen.c]) AC_CONFIG_AUX_DIR([../../build-aux]) AC_CONFIG_MACRO_DIR([../../m4]) @@ -19,6 +20,8 @@ AC_PROG_CC dnl Find Xlibs. AC_PATH_XTRA +AC_SUBST([XPDFOPEN_TREE], [xpdfopen-]xpdfopen_version) + AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/Build/source/utils/xpdfopen/version.ac b/Build/source/utils/xpdfopen/version.ac new file mode 100644 index 00000000000..9dbb748cd69 --- /dev/null +++ b/Build/source/utils/xpdfopen/version.ac @@ -0,0 +1,11 @@ +dnl +dnl Copyright (C) 2014 Peter Breitenlohner <tex-live@tug.org> +dnl +dnl This file is free software; the copyright holder +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. +dnl +dnl -------------------------------------------------------- +dnl +dnl m4-include this file to define the current xpdfopen version +m4_define([xpdfopen_version], [0.86]) diff --git a/Build/source/utils/xpdfopen/xpdfopen-0.86-PATCHES/ChangeLog b/Build/source/utils/xpdfopen/xpdfopen-0.86-PATCHES/ChangeLog new file mode 100644 index 00000000000..e040c3cf9f5 --- /dev/null +++ b/Build/source/utils/xpdfopen/xpdfopen-0.86-PATCHES/ChangeLog @@ -0,0 +1,16 @@ +2014-06-18 Peter Breitenlohner <peb@mppmu.mpg.de> + + * patch-01-unsigned (new): Avoid undefined behavior. + +2014-05-28 Peter Breitenlohner <peb@mppmu.mpg.de> + + Import xpdfopen-0.86. + +2014-05-24 Peter Breitenlohner <peb@mppmu.mpg.de> + + Import xpdfopen-0.85. + +2014-05-17 Peter Breitenlohner <peb@mppmu.mpg.de> + + Import xpdfopen-0.84. + diff --git a/Build/source/utils/xpdfopen/xpdfopen-0.86-PATCHES/TL-Changes b/Build/source/utils/xpdfopen/xpdfopen-0.86-PATCHES/TL-Changes new file mode 100644 index 00000000000..e2b63b35229 --- /dev/null +++ b/Build/source/utils/xpdfopen/xpdfopen-0.86-PATCHES/TL-Changes @@ -0,0 +1,9 @@ +Changes applied to the xpdfopen-0.86/ tree as obtained from: + http://cs.acadiau.ca/~jdiamond/xpdfopen/xpdfopen-0.86.tar.gz + +Removed: + Makefile.in + aclocal.m4 + configure + pdfopen.pdf + diff --git a/Build/source/utils/xpdfopen/xpdfopen-0.86-PATCHES/patch-01-unsigned b/Build/source/utils/xpdfopen/xpdfopen-0.86-PATCHES/patch-01-unsigned new file mode 100644 index 00000000000..7e4a4ceaa12 --- /dev/null +++ b/Build/source/utils/xpdfopen/xpdfopen-0.86-PATCHES/patch-01-unsigned @@ -0,0 +1,14 @@ + Avoid undefined behavior when char is signed. + +diff -ur xpdfopen-0.86.orig/sendx.c xpdfopen-0.86/sendx.c +--- xpdfopen-0.86.orig/sendx.c 2012-01-28 01:39:39.000000000 +0100 ++++ xpdfopen-0.86/sendx.c 2014-06-18 08:13:50.000000000 +0200 +@@ -229,7 +229,7 @@ + */ + if (ks < 256) + { +- event.state = isupper((char)ks); ++ event.state = isupper((unsigned char)ks); + switch (ks) + { + case 0x08: diff --git a/Build/source/utils/xpdfopen/ChangeLog b/Build/source/utils/xpdfopen/xpdfopen-0.86/ChangeLog index 65416356847..5e22620685f 100644 --- a/Build/source/utils/xpdfopen/ChangeLog +++ b/Build/source/utils/xpdfopen/xpdfopen-0.86/ChangeLog @@ -1,3 +1,25 @@ +2014-05-24 Jim Diamond <jim.diamond@acadiau.ca> + * pdfopen.c: fixed -g (goto named destination) option for AR9. + * README: update for V 0.86. + + +2014-05-22 Jim Diamond <jim.diamond@acadiau.ca> + + * pdfopen.c: add -g (goto named destination) option. + NOTE: notwithstanding the man page for AR 9.5.5 on + Linux, I can't get -g <named-dest> to work with AR9. + Allow use of '--file', '-V', '-?', '--page' and + '--goto' options for compatibility with (various and + sundry versions of) ms-windows pdfopen programs. + For consistency, add a '--viewer' form of that option, + but keep the '-viewer' form for backward compatibility. + Redo help text for all this. + * pdfclose.c allow use of '--file' option for compatibility + with ms-windows pdfclose program. + * pdfopen.1: update man page accordingly. + * README: updates for V 0.85. + + 2014-05-16 Jim Diamond <jim.diamond@acadiau.ca> * pdfopen.c: add -p option, update for externs.h @@ -10,22 +32,6 @@ * README: update for V 0.84. * Makefile.am update for externs.h, remove archaic pdfopen-AR-7-and-8.c -2013-07-05 Peter Breitenlohner <peb@mppmu.mpg.de> - - * Makefile.am: Moved Makefile fragments to ../../am/. - -2012-12-15 Peter Breitenlohner <peb@mppmu.mpg.de> - - * configure.ac: Use KPSE_BASIC to enable silent rules. - -2012-11-20 Peter Breitenlohner <peb@mppmu.mpg.de> - - * Makefile.am: Avoid use of deprecated INCLUDES. - -2012-03-29 Peter Breitenlohner <peb@mppmu.mpg.de> - - * utils.c: Move extern decl from here ... - * utils.h: ... to here. 2012-01-28 Jim Diamond <jim.diamond@acadiau.ca> @@ -36,6 +42,7 @@ * configure.ac: update for V 0.83. * README: update for V 0.83. + 2011-05-28 Jim Diamond <jim.diamond@acadiau.ca> * pdfopen.c: add -v and --version options. @@ -44,6 +51,7 @@ * pdfclose.1: add version number to usage information. * configure.ac: update for V 0.82. + 2011-05-17 Jim Diamond <jim.diamond@acadiau.ca> * pdfopen.c: add -h and --help options. @@ -54,7 +62,7 @@ * xpdfopen.h: add support for evince. * pdfclose.c: add support for evince. * configure.ac: update for V 0.81. - + 2010-05-03 Jim Diamond <jim.diamond@acadiau.ca> @@ -82,7 +90,7 @@ * sendx.c: Reset the error status in open_channel() so that an error return doesn't become permanent. Fixed mask param in XSendEvent(). - + 2010-04-21 Jim Diamond <jim.diamond@acadiau.ca> diff --git a/Build/source/utils/xpdfopen/Makefile.am.orig b/Build/source/utils/xpdfopen/xpdfopen-0.86/Makefile.am index b41b46db6b7..b41b46db6b7 100644 --- a/Build/source/utils/xpdfopen/Makefile.am.orig +++ b/Build/source/utils/xpdfopen/xpdfopen-0.86/Makefile.am diff --git a/Build/source/utils/xpdfopen/README b/Build/source/utils/xpdfopen/xpdfopen-0.86/README index 2b25b7782fa..3c7d6ba0c58 100644 --- a/Build/source/utils/xpdfopen/README +++ b/Build/source/utils/xpdfopen/xpdfopen-0.86/README @@ -1,5 +1,5 @@ --------------------------------------------------------------------------- -xpdfopen 0.84 - Send open/close commands to Acrobat Reader, xpdf and evince +xpdfopen 0.86 - Send open/close commands to Acrobat Reader, xpdf and evince --------------------------------------------------------------------------- This is a Linux (X11) implementation of Fabrice Popineau's pdfclose/ @@ -35,6 +35,16 @@ Version 0.83 adds the -r/-reset_focus option for pdfopen. Version 0.84 adds 'load at given page' support (-p option) for Adobe Reader 9, evince (at least 3.12, maybe earlier) and xpdf. +Version 0.85 adds 'load at named destination' support (-g/--goto option) + for xpdf, evince and (supposedly) AR9. The AR9 man page + claims it should work, but it doesn't for me. I left + the allegedly-correct code there anyway, in case it works + for other people in other places. + Also add aliases for option names to make ms-windows + users feel at home. + +Version 0.86 fixes 'load at named destination' for AR9. + The AR command lines do not behave precisely the same as under Windows, because the Linux Reader behaves somewhat differently: it is not @@ -43,24 +53,26 @@ scriptable, but it is possible to 'fake' key-presses. pdfopen has the following call sequence: pdfopen [-r|-reset_focus] \ - [-viewer <ar9|ar9-tab|ar8|ar7|ar5|xpdf|evince>] \ - [-p <page number>] \ - <pdf file name> + [-viewer/--viewer <ar9|ar9-tab|ar8|ar7|ar5|xpdf|evince>] \ + [-p/--page <page number>] \ + [-g/--goto <named destination>] \ + [--file] <pdf file name> -The 'ar9' version uses the '-openInNewInstance' option, the 'ar9-tab' +The "ar9" version uses AR9's "-openInNewInstance" option, the "ar9-tab" version does not (so if there is already an AR9 window open, a new tab will be opened in that window). pdfclose has the following call sequence: - pdfclose <pdf file name> + pdfclose [--file] <pdf file name> This program closes an existing AR5, AR7, AR8, AR9, xpdf or evince window displaying the given PDF file. -Version 0.84 compiles on Linux (Slackware64 14.1, anyway) with +Version 0.85 compiles on Linux (Slackware64 14.1, anyway) with the following command: gcc -Wall pdfopen.c sendx.c utils.c -o pdfopen -lX11 -s + gcc -Wall pdfclose.c sendx.c utils.c -o pdfclose -lX11 -s should you not want to go through the process of creating and running a configure program. diff --git a/Build/source/utils/xpdfopen/configure.ac.orig b/Build/source/utils/xpdfopen/xpdfopen-0.86/configure.ac index 7c529a6d4b7..42f7b9a31bc 100644 --- a/Build/source/utils/xpdfopen/configure.ac.orig +++ b/Build/source/utils/xpdfopen/xpdfopen-0.86/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl this is for autoconf 2.5x -AC_INIT(pdfopen, 0.83, jim.diamond@acadiau.ca) +AC_INIT(pdfopen, 0.86, jim.diamond@acadiau.ca) AC_CONFIG_AUX_DIR(config) diff --git a/Build/source/utils/xpdfopen/externs.h b/Build/source/utils/xpdfopen/xpdfopen-0.86/externs.h index 2aff4f858ef..2aff4f858ef 100644 --- a/Build/source/utils/xpdfopen/externs.h +++ b/Build/source/utils/xpdfopen/xpdfopen-0.86/externs.h diff --git a/Build/source/utils/xpdfopen/pdfclose.c b/Build/source/utils/xpdfopen/xpdfopen-0.86/pdfclose.c index 1fe905e1e9b..95de13e79cc 100644 --- a/Build/source/utils/xpdfopen/pdfclose.c +++ b/Build/source/utils/xpdfopen/xpdfopen-0.86/pdfclose.c @@ -1,9 +1,8 @@ /* * pdfclose.c: (attempt to) close a PDF viewer displaying argv[1]. * - * Modified by Jim Diamond (jim.diamond@acadiau.ca) 2010/04/21 (V 0.80) - * and again 2011/05/17 (V 0.81 -- 0.84) - * and Peter Breitenlohner <tex-live@tug.org> (2009). + * Modified by Peter Breitenlohner <tex-live@tug.org> (2009) + * and Jim Diamond (jim.diamond@acadiau.ca) 2010--2014 (V 0.80 -- 0.86). * * This program does not take a viewer argument, and just tries to close * any known viewer displaying the given file. @@ -25,7 +24,7 @@ static void usage(void) { fprintf(stderr, "%s version %s\n", progname, VERSION); - fprintf(stderr, "Usage: %s <file.pdf>\n", progname); + fprintf(stderr, "Usage: %s [--file] <file.pdf>\n", progname); } @@ -51,13 +50,19 @@ try_name(const char * filename, const char * title_format) int main (int argc, char * argv[]) { + progname = argv[0]; - if (argc != 2) + if (argc < 2 || argc > 3 || (argc == 3 && strcmp("--file", argv[1]))) { usage(); return EXIT_FAILURE; } + if (argc == 3) + { + argv++; + argc--; + } if (try_name(argv[1], AR9_WIN_NAME_FMT)) /* This gets both AR8 & AR9 */ if (try_name(argv[1], XPDF_WIN_NAME_FMT)) diff --git a/Build/source/utils/xpdfopen/pdfopen.1 b/Build/source/utils/xpdfopen/xpdfopen-0.86/pdfopen.1 index c70cbe9594e..23b8f84f61b 100644 --- a/Build/source/utils/xpdfopen/pdfopen.1 +++ b/Build/source/utils/xpdfopen/xpdfopen-0.86/pdfopen.1 @@ -1,36 +1,48 @@ .\" This manpage is licensed under the GNU Public License -.TH PDFOPEN 1 2014-05-16 "pdfopen 0.84" "" +.TH PDFOPEN 1 2014-05-24 "pdfopen 0.86" "" . .SH NAME pdfopen, pdfclose \- open or close a PDF file viewer . .SH SYNOPSIS .B pdfopen -[\fIOPTION\fP] -\fIFILE.PDF\fP +[ \fIoptions\fP ]\ +[ +.B --file +]\ +\fIfile.pdf\fP .br .B pdfclose -\fIFILE.PDF\fP +[ +.B --file +]\ +\fIfile.pdf\fP . .SH OPTIONS .TP 8 -.B -h, --help -output help and exit +.B -h, --help, -? +output help and exit. .TP -.B -v, --version -output the version number and exit +.B -v, --version, -V +output the version number and exit. .TP -.B -p <n> +.B -p <n>, --page <n> when starting the viewer, display page <n> of the document (notes: not all viewers support this feature, and even in those cases this option -only has effect when the document is initially loaded) +only has effect when the document is initially loaded). This option +is over-ridden by \fB-g\fP. +.TP +.B -g <named destination>, --goto <named destination> +when starting the viewer, display the page of the document containing +the named destination (notes: not all viewers support this feature, +and even in those cases this option only has effect when the document +is initially loaded). .TP .B -r, --reset_focus after sending commands to the PDF viewer, attempt to reset the input focus to -the window which had focus before the commands were sent +the window which had focus before the commands were sent. .TP -.B -viewer -<\fIar9\fP|\fIar9-tab\fP|\fIar8\fP|\fIar7\fP|\fIar5\fP|\fIxpdf\fP|\fIevince\fP> +.B -viewer, --viewer <\fIar9\fP|\fIar9-tab\fP|\fIar8\fP|\fIar7\fP|\fIar5\fP|\fIxpdf\fP|\fIevince\fP> use (respectively) Adobe Reader 9 (in a new window), Adobe Reader 9 (in a new tab of a running AR9, if any), Adobe Reader 8, Adobe Reader 7, Adobe Reader 5, xpdf or evince as the @@ -74,7 +86,7 @@ document vary from one version of \fBacroread\fP to another; consequently, if you are using a version of \fBacroread\fP other than AR9, you should explicitly specify the viewer program. -Version 0.84 of \fBpdfopen\fP accepts the following viewer options: +This version of \fBpdfopen\fP accepts the following viewer options: .br \fIar9\fP, \fIar9-tab\fP, \fIar8\fP, \fIar7\fP, \fIar5\fP, \fIxpdf\fP, and \fIevince\fP. @@ -106,8 +118,8 @@ find compiled versions of these programs on a system using another window system, they are very unlikely to be of any use to you. Source and binaries of the programs can be downloaded from -CTAN://support/xpdfopen/ -(e.g., http://mirror.ctan.org/support/xpdfopen). +\f(CWCTAN://support/xpdfopen/\fR +(e.g., \f(CWhttp://mirror.ctan.org/support/xpdfopen\fR). . .SH CAVEATS If you use @@ -134,7 +146,7 @@ window. This can be annoying. The \fB-reset_focus\fP option can be used to deal with this problem. . .SH AUTHOR -This manual page was written by Jim Diamond <Jim.Diamond@acadiau.ca>. +This manual page was written by Jim Diamond <\f(CWJim.Diamond@acadiau.ca\fP>. I am the current maintainer of the X11 versions of .B pdfopen and diff --git a/Build/source/utils/xpdfopen/pdfopen.c b/Build/source/utils/xpdfopen/xpdfopen-0.86/pdfopen.c index 2575e8d4bbf..664a4061663 100644 --- a/Build/source/utils/xpdfopen/pdfopen.c +++ b/Build/source/utils/xpdfopen/xpdfopen-0.86/pdfopen.c @@ -13,18 +13,28 @@ * Note 2: if there are two instances of acroread displaying that file, * only one is reloaded. * - * Further modified 2010/05/03 to work with ar5, and to include some code - * that does *not* work with okular (see note below). - * - * Modified 2014/05/16 (V 0.84) to add capability to open a pdf file - * at a specified page (currently working with AR9, xpdf and evince). - * * Note 3: Unlike xpdf and AR[5,7,8,9], okular will not accept X events * from this program unless the okular window has focus. On my system * (Slackware64 13.0, using fvwm2), the functions I added to sendx.c to try * to change the focus to the okular window do not work. (See also the * comments in sendx.c.) If anyone cares to contribute working code, * please send it to me for inclusion. + + * Further modified 2010/05/03 to work with ar5, and to include some code + * that does *not* work with okular (see note below). + * + * Modified 2014/05/16 (V 0.84) to add capability to open a pdf file + * at a specified page (currently working with AR9, xpdf and evince). + * + * Modified 2014/05/22 (V 0.85) to allow '--file' option, for + * "compatibility" with windows pdfopen/pdfclose calling sequence. + * Drive by: allow '--viewer' for consistency's sake. + * Also allow '-V', '-?' and '--page' for compatibility. + * Added --goto/-g option... this works in (at least) xpdf 3.03, + * evince 3.12.1. + * + * Modified 2014/05/24 (V 0.86) so that -g works in AR 9.5.5 and + * possibly other AR9 versions. */ #include <stdio.h> @@ -44,9 +54,12 @@ #define MAX_RELOAD_CMDS 10 #define MAX_PRE_PAGE_OPTIONS 2 /* See struct defn below */ #define MAX_POST_PAGE_OPTIONS 1 /* See struct defn below */ +#define MAX_PRE_DEST_OPTIONS 2 /* See struct defn below */ +#define MAX_POST_DEST_OPTIONS 1 /* See struct defn below */ /* Overkill ... */ #define MAX_OPTIONS (10 + MAX_PRE_PAGE_OPTIONS \ - + MAX_POST_PAGE_OPTIONS) + + MAX_POST_PAGE_OPTIONS + MAX_PRE_DEST_OPTIONS \ + + MAX_POST_DEST_OPTIONS) /* A string unlikely to be used as a real command by a PDF viewer */ #define FORK_EXEC_CMD "*FORK EXEC*" @@ -103,6 +116,9 @@ typedef struct * End list with a NULL. */ const char * initial_page_post_options[MAX_POST_PAGE_OPTIONS + 1]; /* */ + /* Ditto for named destinations */ + const char * initial_dest_pre_options[MAX_PRE_DEST_OPTIONS + 1]; /* */ + const char * initial_dest_post_options[MAX_POST_DEST_OPTIONS + 1]; /* */ } pdf_viewer_t; @@ -128,6 +144,8 @@ pdf_viewer_t pdf_viewers[] = {NULL}, {"Ctrl-R", NULL}, {"/a", "page=%d", NULL}, + {NULL}, + {"/a", "nameddest=%s", NULL}, {NULL} }, {"ar9-tab", "acroread", USE_SENDX, @@ -135,7 +153,9 @@ pdf_viewer_t pdf_viewers[] = {NULL}, {NULL}, {"Ctrl-R", NULL}, + {"/a", "page=%d", NULL}, {NULL}, + {"/a", "nameddest='%s'", NULL}, {NULL} }, {"ar8", "acroread", USE_SENDX, @@ -144,6 +164,8 @@ pdf_viewer_t pdf_viewers[] = {NULL}, {"Ctrl-W", FORK_EXEC_CMD, NULL}, {NULL}, + {NULL}, + {NULL}, {NULL} }, {"ar7", "acroread", USE_SENDX, @@ -152,6 +174,8 @@ pdf_viewer_t pdf_viewers[] = {NULL}, {"Ctrl-W", "Alt-Left", NULL}, {NULL}, + {NULL}, + {NULL}, {NULL} }, {"ar5", "acroread", USE_SENDX, @@ -160,6 +184,8 @@ pdf_viewer_t pdf_viewers[] = {NULL}, {"Ctrl-W", "Alt-Left", NULL}, {NULL}, + {NULL}, + {NULL}, {NULL} }, /* @@ -174,7 +200,9 @@ pdf_viewer_t pdf_viewers[] = {NULL}, {"r", NULL}, {NULL}, - {"%d", NULL} + {"%d", NULL}, + {NULL}, + {"+%s", NULL} }, {"evince", "evince", USE_SENDX, EVINCE_WIN_NAME, EVINCE_WIN_NAME_FMT, @@ -182,6 +210,8 @@ pdf_viewer_t pdf_viewers[] = {NULL}, {"Ctrl-R", NULL}, {"-i", "%d", NULL}, + {NULL}, + {"-n", "%s", NULL}, {NULL} }, #ifdef TRY_OCULAR @@ -191,6 +221,8 @@ pdf_viewer_t pdf_viewers[] = {NULL}, {FOCUS_IN, "Fn-F5", FOCUS_OUT, NULL}, {NULL}, + {NULL}, + {NULL}, {NULL} }, #endif @@ -207,29 +239,31 @@ usage(void) int viewers = sizeof(pdf_viewers) / sizeof(pdf_viewers[0]); fprintf(stderr, "This is version %s of %s.\n", VERSION, progname); - fprintf(stderr, "Usage:\n %s [-h|--help]\n", progname); - fprintf(stderr, " Show this help and exit.\n"); - - fprintf(stderr, " %s [-v|--version]\n", progname); - fprintf(stderr, " Show the version number and exit.\n"); - - fprintf(stderr, " %s [-r|--reset_focus] [-viewer <prog>] [-p <n>] " - "<file.pdf>\n", progname); + fprintf(stderr, "Usage:\n %s [-h|--help|-?]\n" + " Show this help and exit.\n\n", progname); + fprintf(stderr, " %s [-v|--version]\n" + " Show the version number and exit.\n\n", progname); + fprintf(stderr, " %s [-r|--reset_focus] [[-]-viewer <prog>]\n" + "\t\t[-p|--page <n>] [-g|--goto <named-dest>] " + "[--file] <file.pdf>\n", progname); fprintf(stderr, " If the PDF viewer <prog> is displaying <file.pdf>, " - "reload that file.\n"); - fprintf(stderr, " Otherwise call <prog> to display <file.pdf>.\n"); - fprintf(stderr, " If '-r' or '--reset_focus' is used, attempt to"); - fprintf(stderr, " reset the input focus\n"); - fprintf(stderr, " after calling the viewer program.\n"); - fprintf(stderr, " If the viewer allows it and is not already\n"); - fprintf(stderr, " running, the argument of -p specifies the\n"); - fprintf(stderr, " first page to display.\n"); - fprintf(stderr, " The default viewer program is %s.\n", DEFAULT_VIEWER); - fprintf(stderr, " Implemented viewers:"); + "reload that file;\n" + " Otherwise call <prog> to display <file.pdf>.\n" + " If '-r' or '--reset_focus' is used, attempt to " + "reset the input focus\n" + " after calling the viewer program.\n" + " If the viewer allows it and is not already " + "running, the argument\n of -p/--page specifies the " + "first page to display.\n" + " If the viewer allows it and is not already " + "running, the argument\n of -g/--goto specifies the " + "named destination to view.\n NOTE: -g overrides -p\n\n"); + fprintf(stderr, "The default viewer program is %s.\n", DEFAULT_VIEWER); + fprintf(stderr, "Implemented viewers:"); for (i = 0; i < viewers - 1; i++) fprintf(stderr, " '%s'", pdf_viewers[i].short_name); fprintf(stderr, " and '%s'.\n", pdf_viewers[viewers - 1].short_name); - fprintf(stderr, " Note: ar9 uses acroread's -openInNewInstance argument," + fprintf(stderr, "Note: ar9 uses acroread's -openInNewInstance argument," " ar9-tab does not.\n"); } @@ -288,8 +322,7 @@ send_command(const char * window_name, const char * reload_cmd) /* - * Try to reload the file. - * If not successful, try to start up a new instance of the viewer program. + * reload_file(): Try to reload the given file. * Return 0 on success, non-0 otherwise. * * If reset_focus is true, (attempt to) reset the input focus to the @@ -298,24 +331,23 @@ send_command(const char * window_name, const char * reload_cmd) */ static int -view_file(const char * filename, int viewer_index, int focus_reset, - int initial_page) +reload_file(const char * filename, int viewer_index, int focus_reset) { - char * window_name; - pid_t pid; int success = 0; pdf_viewer_t pdf_viewer = pdf_viewers[viewer_index]; const char ** reload_cmds = pdf_viewer.reload_cmds; + char * window_name; - /* First try to reload the file */ switch (pdf_viewers[viewer_index].method) { case USE_SENDX: window_name = make_window_name(pdf_viewer.window_name_fmt, filename); if (window_name == NULL) return 99; + if (focus_reset) (void)set_focus(window_name); + while (*reload_cmds) { /* @@ -363,88 +395,168 @@ view_file(const char * filename, int viewer_index, int focus_reset, if (success) return 0; + return 1; +} + +/* + * view_file(): (Attempt to) reload or view the given filename. + * + * First call reload_file() in case the given viewer is already + * displaying the given file. + * + * If that is unsuccessful, try to start up a new instance of the + * given viewer with the given file. + * + * If dest != NULL, and the viewer allows it, on initial opening of + * the file go to that named destination. + * As of V 0.85, this is implemented for xpdf, evince, and, according + * to the man page for acroread 9.5.5, for ar9. + * Otherwise, if the viewer allows it, open the document at the given + * page. + */ + +static int +view_file(const char * filename, int viewer_index, int focus_reset, + int initial_page, char * dest) +{ + pid_t pid; + pdf_viewer_t pdf_viewer = pdf_viewers[viewer_index]; + const char * argv_list[2 * MAX_OPTIONS + 3]; + const char ** p; + int i = 0; + + /* First try to reload the file */ + if (reload_file(filename, viewer_index, focus_reset) == 0) + { + /* Success! */ + return 0; + } + /* * No luck re-loading the file. * (Try to) start a new instance of the viewer program. + * Start by forking into the background. */ - if ((pid = fork()) == 0) + pid = fork(); + if (pid < 0) { - const char * argv_list[2 * MAX_OPTIONS + 3]; - const char ** p; - int i = 0; + fprintf(stderr, "%s: fork() failed!?\n", progname); + return 10; + } + if (pid > 0) + return 0; - argv_list[i++] = pdf_viewer.program_name; - for (p = pdf_viewer.exec_pre_options; *p;) - argv_list[i++] = *p++; + /* Child code: */ + argv_list[i++] = pdf_viewer.program_name; + for (p = pdf_viewer.exec_pre_options; *p;) + argv_list[i++] = *p++; - if (pdf_viewer.initial_page_pre_options[0] != NULL) - { - int j = 0; - char * buf; + if (pdf_viewer.initial_page_pre_options[0] != NULL && dest == NULL) + { + int j = 0; + char * buf; - while (pdf_viewer.initial_page_pre_options[j + 1] != NULL) - argv_list[i++] = pdf_viewer.initial_page_pre_options[j++]; + while (pdf_viewer.initial_page_pre_options[j + 1] != NULL) + argv_list[i++] = pdf_viewer.initial_page_pre_options[j++]; - /* 10 is more than enough for the page number */ - buf = malloc(strlen(pdf_viewer.initial_page_pre_options[j]) + 10); - if (buf != NULL) - { - /* 1e8 or more pages? I doubt it. */ - sprintf(buf, pdf_viewer.initial_page_pre_options[j], - initial_page > 99999999 ? 1 : initial_page); - argv_list[i++] = buf; - } - else - fprintf(stderr, "%s: unable to allocate memory for page " - "specification!!\n" - "Crossing fingers and continuing.", progname); + /* 10 is more than enough for the page number */ + buf = malloc(strlen(pdf_viewer.initial_page_pre_options[j]) + 10); + if (buf != NULL) + { + /* 1e8 or more pages? I doubt it. */ + sprintf(buf, pdf_viewer.initial_page_pre_options[j], + initial_page > 99999999 ? 1 : initial_page); + argv_list[i++] = buf; } + else + fprintf(stderr, "%s: unable to allocate memory for page " + "specification!!\n" + "Crossing fingers and continuing.", progname); + } + + if (pdf_viewer.initial_dest_pre_options[0] != NULL && dest != NULL) + { + int j = 0; + char * buf; - argv_list[i++] = filename; + while (pdf_viewer.initial_dest_pre_options[j + 1] != NULL) + argv_list[i++] = pdf_viewer.initial_dest_pre_options[j++]; - if (pdf_viewer.initial_page_post_options[0] != NULL) + buf = malloc(strlen(pdf_viewer.initial_dest_pre_options[j]) + + strlen(dest) + 1); + if (buf != NULL) { - int j = 0; - char * buf; - - while (pdf_viewer.initial_page_post_options[j + 1] != NULL) - argv_list[i++] = pdf_viewer.initial_page_post_options[j++]; - - buf = malloc(strlen(pdf_viewer.initial_page_post_options[j]) + 10); - if (buf != NULL) - { - sprintf(buf, pdf_viewer.initial_page_post_options[j], - initial_page > 99999999 ? 1 : initial_page); - argv_list[i++] = buf; - } - else - fprintf(stderr, "%s: unable to allocate memory for page " - "specification!!\n" - "Crossing fingers and continuing.", progname); + sprintf(buf, pdf_viewer.initial_dest_pre_options[j], dest); + argv_list[i++] = buf; } + else + fprintf(stderr, "%s: unable to allocate memory for named-dest " + "specification!!\n" + "Crossing fingers and continuing.", progname); + } - argv_list[i++] = NULL; -#ifdef DEBUG + argv_list[i++] = filename; + + if (pdf_viewer.initial_page_post_options[0] != NULL && dest == NULL) + { + int j = 0; + char * buf; + + while (pdf_viewer.initial_page_post_options[j + 1] != NULL) + argv_list[i++] = pdf_viewer.initial_page_post_options[j++]; + + buf = malloc(strlen(pdf_viewer.initial_page_post_options[j]) + 10); + if (buf != NULL) { - int k = 0; - for (; k < i-1; k++) - fprintf(stderr, "%s\n", argv_list[k]); + sprintf(buf, pdf_viewer.initial_page_post_options[j], + initial_page > 99999999 ? 1 : initial_page); + argv_list[i++] = buf; } -#endif - if (execvp(pdf_viewer.program_name, (char **)argv_list)) + else + fprintf(stderr, "%s: unable to allocate memory for page " + "specification!!\n" + "Crossing fingers and continuing.", progname); + } + + if (pdf_viewer.initial_dest_post_options[0] != NULL && dest != NULL) + { + int j = 0; + char * buf; + + while (pdf_viewer.initial_dest_post_options[j + 1] != NULL) + argv_list[i++] = pdf_viewer.initial_dest_post_options[j++]; + + buf = malloc(strlen(pdf_viewer.initial_dest_post_options[j]) + + strlen(dest) + 1); + if (buf != NULL) { - fprintf(stderr, "%s: %s startup failed\n", progname, - pdf_viewer.program_name); - return 5; + sprintf(buf, pdf_viewer.initial_dest_post_options[j], dest); + argv_list[i++] = buf; } + else + fprintf(stderr, "%s: unable to allocate memory for named-dest " + "specification!!\n" + "Crossing fingers and continuing.", progname); } - else if (pid < 0) + + argv_list[i++] = NULL; +#ifdef DEBUG { - fprintf(stderr, "%s: fork() failed!?\n", progname); - return 10; + int k = 0; + if (dest == NULL) + fprintf(stderr, "dest == NULL\n"); + else + fprintf(stderr, "dest == '%s'\n", dest); + for (; k < i-1; k++) + fprintf(stderr, "%s\n", argv_list[k]); } - - return 0; +#endif + execvp(pdf_viewer.program_name, (char **)argv_list); + + /* If we are here, Something Bad happened. */ + fprintf(stderr, "%s: %s startup failed\n", progname, + pdf_viewer.program_name); + return 5; } @@ -454,6 +566,8 @@ main(int argc, char * argv[]) { const char * viewer = pdf_viewers[0].short_name; char * env_viewer; + char * file = NULL; + char * dest = NULL; int i; int initial_page = 1; int viewer_index = -1; @@ -467,13 +581,15 @@ main(int argc, char * argv[]) if (env_viewer != NULL) viewer = env_viewer; - if (argc < 1 || !strcmp(argv[0], "-h") || !strcmp(argv[0], "--help")) + if (argc < 1 || !strcmp(argv[0], "-h") || !strcmp(argv[0], "--help") + || !strcmp(argv[0], "-?")) { usage(); - return argc < 2 ? EXIT_FAILURE : EXIT_SUCCESS; + return argc < 1 ? EXIT_FAILURE : EXIT_SUCCESS; } - if (!strcmp(argv[0], "-v") || !strcmp(argv[0], "--version")) + if (!strcmp(argv[0], "-v") || !strcmp(argv[0], "-V") + || !strcmp(argv[0], "--version")) { printf("This is pdfopen version %s\n", VERSION); return EXIT_SUCCESS; @@ -489,7 +605,8 @@ main(int argc, char * argv[]) continue; } - if (argc >= 2 && !strcmp(argv[0], "-viewer")) + if (argc >= 2 + && (!strcmp(argv[0], "-viewer") || !strcmp(argv[0], "--viewer"))) { viewer = argv[1]; argc -= 2; @@ -497,7 +614,25 @@ main(int argc, char * argv[]) continue; } - if (argc >= 2 && !strcmp(argv[0], "-p")) + if (argc >= 2 + && (!strcmp(argv[0], "-g") || !strcmp(argv[0], "--goto"))) + { + dest = argv[1]; + argc -= 2; + argv += 2; + continue; + } + + if (argc >= 2 && !strcmp(argv[0], "--file")) + { + file = argv[1]; + argc -= 2; + argv += 2; + continue; + } + + if (argc >= 2 + && (!strcmp(argv[0], "-p") || !strcmp(argv[0], "--page"))) { initial_page = atoi(argv[1]); argc -= 2; @@ -508,14 +643,20 @@ main(int argc, char * argv[]) break; } - /* Should only have 1 filename left now */ - if (argc != 1) + /* + * Should either have no args left (--file seen above) or + * --file was not seen and there is one arg left. + */ + if ( ! ((argc == 0 && file != NULL) || (argc == 1 && file == NULL)) ) { fprintf(stderr, "%s: invalid argument(s)\n", progname); usage(); return EXIT_FAILURE; } + if (argc == 1) + file = argv[0]; + for (i = 0; i < sizeof(pdf_viewers) / sizeof(pdf_viewers[0]); i++) { if (!strcmp(pdf_viewers[i].short_name, viewer)) @@ -533,7 +674,7 @@ main(int argc, char * argv[]) return EXIT_FAILURE; } - if (view_file(argv[0], viewer_index, focus_reset, initial_page)) + if (view_file(file, viewer_index, focus_reset, initial_page, dest)) return EXIT_FAILURE; return EXIT_SUCCESS; diff --git a/Build/source/utils/xpdfopen/sendx.c b/Build/source/utils/xpdfopen/xpdfopen-0.86/sendx.c index a056279a48b..1fd4f0dbdc6 100644 --- a/Build/source/utils/xpdfopen/sendx.c +++ b/Build/source/utils/xpdfopen/xpdfopen-0.86/sendx.c @@ -229,7 +229,7 @@ sendx_channel(KeySym ks, int km) */ if (ks < 256) { - event.state = isupper((char)ks); + event.state = isupper((unsigned char)ks); switch (ks) { case 0x08: @@ -392,6 +392,7 @@ set_focus(const char * wname) } + int reset_focus(void) { diff --git a/Build/source/utils/xpdfopen/sendx.h b/Build/source/utils/xpdfopen/xpdfopen-0.86/sendx.h index 569a33f9494..569a33f9494 100644 --- a/Build/source/utils/xpdfopen/sendx.h +++ b/Build/source/utils/xpdfopen/xpdfopen-0.86/sendx.h diff --git a/Build/source/utils/xpdfopen/utils.c b/Build/source/utils/xpdfopen/xpdfopen-0.86/utils.c index 5201b2dba58..5201b2dba58 100644 --- a/Build/source/utils/xpdfopen/utils.c +++ b/Build/source/utils/xpdfopen/xpdfopen-0.86/utils.c diff --git a/Build/source/utils/xpdfopen/utils.h b/Build/source/utils/xpdfopen/xpdfopen-0.86/utils.h index b9fe88574cb..b9fe88574cb 100644 --- a/Build/source/utils/xpdfopen/utils.h +++ b/Build/source/utils/xpdfopen/xpdfopen-0.86/utils.h diff --git a/Build/source/utils/xpdfopen/xpdfopen.h b/Build/source/utils/xpdfopen/xpdfopen-0.86/xpdfopen.h index cf7e4f8c3f6..bd40be932c8 100644 --- a/Build/source/utils/xpdfopen/xpdfopen.h +++ b/Build/source/utils/xpdfopen/xpdfopen-0.86/xpdfopen.h @@ -9,7 +9,7 @@ #ifndef XPDFOPEN_H #define XPDFOPEN_H -#define VERSION "0.84" +#define VERSION "0.86" /* * <prog>_WIN_NAME is the name of the window when no file is open. |