
#! /bin/sh

# Merging PS files, as found here : http://ktmatu.com/info/merge-pdf-files/

cat <<EOF

%!PS
% Written by Helge Blischke, see
% http://groups.google.com/groups?ic=1&selm=3964A684.49D%40srz-berlin.de
%
% The following 2 procs encapsulate the jobs to be processed
% much as is done with EPS images:
/_begin_job_
{
        /tweak_save save def
        /tweak_dc countdictstack def
        /tweak_oc count 1 sub def
        userdict begin
}bind def

/_end_job_
{
        count tweak_oc sub{pop}repeat
        countdictstack tweak_dc sub{end}repeat
        tweak_save restore
}bind def

% Now, add your jobs like this:
EOF

for file in $*
do
  echo "_begin_job_"
  echo "($file) run "
  echo "_end_job_"
  echo
done
