--- file_not_specified_in_diff +++ file_not_specified_in_diff @@ -, +, @@ --- scripts/pdf90 +++ scripts/pdf90 @@ -43,12 +43,12 @@ for d in /etc /usr/share/etc /usr/local/share /usr/local/etc do if test -f $d/pdfnup.conf; then echo "Reading site configuration from $d/pdfnup.conf" - source $d/pdfnup.conf + . $d/pdfnup.conf fi done if test -f ~/.pdfnup.conf; then echo "Reading user defaults from ~/.pdfnup.conf"; - source ~/.pdfnup.conf; + . ~/.pdfnup.conf; fi ####################################################################### ## @@ -71,8 +71,8 @@ ## ## Check that necessary LaTeX packages are installed ## -PATH=`dirname "$pdflatex"`:$PATH -export PATH +modifyPath="${pdflatex%/*}" +[ -n "$modifyPath" ] && export PATH="$modifyPath:$PATH" case `kpsewhich pdfpages.sty` in "") echo "pdf90: pdfpages.sty not installed"; exit 1;; esac @@ -136,6 +136,19 @@ ## ## That's the arguments done. ## + +mkTempDir='' +trap 'test -n "$mkTempDir" && test -d "$mkTempDir" && \ + rm -rf -- "$mkTempDir" && mkTempDir=""; \ + trap - EXIT HUP INT TERM' EXIT HUP INT TERM +if ! command -v mktemp >/dev/null 2>&1 || \ + ! mkTempDir=`mktemp -d -- "$tempfileDir/pdf90.XXXXXX"` +then + echo "pdf90: cannot create temporary directory" + exit 2 +fi +tempfileDir=$mkTempDir + ## ## Now work on the input file (or files in turn) ## --- scripts/pdfjoin +++ scripts/pdfjoin @@ -50,12 +50,12 @@ for d in /etc /usr/share/etc /usr/local/share /usr/local/etc do if test -f $d/pdfnup.conf; then echo "Reading site configuration from $d/pdfnup.conf" - source $d/pdfnup.conf + . $d/pdfnup.conf fi done if test -f ~/.pdfnup.conf; then echo "Reading user defaults from ~/.pdfnup.conf"; - source ~/.pdfnup.conf; + . ~/.pdfnup.conf; fi ####################################################################### ## @@ -99,8 +99,8 @@ ## ## Check that necessary LaTeX packages are installed ## -PATH=`dirname "$pdflatex"`:$PATH -export PATH +modifyPath="${pdflatex%/*}" +[ -n "$modifyPath" ] && export PATH="$modifyPath:$PATH" case `kpsewhich pdfpages.sty` in "") echo "pdfjoin: pdfpages.sty not installed"; exit 1;; esac @@ -171,6 +171,19 @@ ## ## That's the arguments done. ## + +mkTempDir='' +trap 'test -n "$mkTempDir" && test -d "$mkTempDir" && \ + rm -rf -- "$mkTempDir" && mkTempDir=""; \ + trap - EXIT HUP INT TERM' EXIT HUP INT TERM +if ! command -v mktemp >/dev/null 2>&1 || \ + ! mkTempDir=`mktemp -d -- "$tempfileDir/pdfjoin.XXXXXX"` +then + echo "pdfjoin: cannot create temporary directory" + exit 2 +fi +tempfileDir=$mkTempDir + ## ## Now work on the input files ## --- scripts/pdfnup +++ scripts/pdfnup @@ -57,12 +57,12 @@ for d in /etc /usr/share/etc /usr/local/share /usr/local/etc do if test -f $d/pdfnup.conf; then echo "Reading site configuration from $d/pdfnup.conf" - source $d/pdfnup.conf + . $d/pdfnup.conf fi done if test -f ~/.pdfnup.conf; then echo "Reading user defaults from ~/.pdfnup.conf"; - source ~/.pdfnup.conf; + . ~/.pdfnup.conf; fi ####################################################################### ## @@ -134,8 +134,8 @@ ## ## Check that necessary LaTeX packages are installed ## -PATH=`dirname "$pdflatex"`:$PATH -export PATH +modifyPath="${pdflatex%/*}" +[ -n "$modifyPath" ] && export PATH="$modifyPath:$PATH" case `kpsewhich pdfpages.sty` in "") echo "pdfnup: pdfpages.sty not installed"; exit 1;; esac @@ -232,6 +232,20 @@ ## ## That's the arguments done. ## + +mkTempDir='' +trap 'test -n "$mkTempDir" && test -d "$mkTempDir" && \ + rm -rf -- "$mkTempDir" && mkTempDir=""; \ + trap - EXIT HUP INT TERM' EXIT HUP INT TERM +if ! command -v mktemp >/dev/null 2>&1 || \ + ! mkTempDir=`mktemp -d -- "$tempfileDir/pdfnup.XXXXXX"` +then + echo "pdfnup: cannot create temporary directory" + exit 2 +fi +tempfileDir=$mkTempDir + +## ## Next sort out paper orientation, if not specified ## x=`echo $nup | sed 's/..$//'`