<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">eval '(exit $?0)' &amp;&amp; eval 'exec perl -S $0 ${1+"$@"}' &amp;&amp; eval 'exec perl -S $0 $argv:q'
  if 0;
use strict;
$^W=1; # turn warning on
#
# acroread_new
#
# Copyright (C) 2002 Heiko Oberdiek.
#
# This program may be distributed and/or modified under the
# conditions of the LaTeX Project Public License, either version 1.2
# of this license or (at your option) any later version.
# The latest version of this license is in
#   http://www.latex-project.org/lppl.txt
# and version 1.2 or later is part of all distributions of LaTeX
# version 1999/12/01 or later.
#
# This file "acroread_new.pl" may be renamed to "acroread_new"
# for installation purposes.
#
# Documentation: acroread_new --help
#
my $file      = "acroread_new.pl";
my $program   = uc($&amp;) if $file =~ /^([\w_]+)/;
my $version   = "1.0";
my $date      = "2002/01/10";
my $author    = "Heiko Oberdiek";
my $copyright = "Copyright (c) 2002 by $author.";
#
# History:
#   2002/01/10 v1.0: First version.
#

my $tempdir      = "/tmp";
my $basename     = "\L$program\E_$$";

my @acroreadoptions = ();
foreach(@ARGV) {
  if (/^--tempdir=(.*)$/) {
    $tempdir = $1;
    next;
  }
  if (/^--basename=(.*)$/) {
    $basename = $1;
    next;
  }
  if (/^--help$/) {
    print &lt;&lt;"END_OF_HELP";
$program $version, $date - $copyright

Function: If acroread is started again, it will use
  a previously started instance. Exiting acroread will
  close all windows that belongs to that instance.
  This script runs acroread with a changed name, so
  several instances of acroread can be started
  independently from each other.

Caution: ~/.acrorc is read and written by each
  acroread instance. That can cause problems,
  if several instances are closed at the same
  time, for example.

Syntax: \L$program\E [options] [arguments for acroread]

Options:
  --help             print usage
  --tempdir=&lt;name&gt;   directory &lt;name&gt; for temporary files ($tempdir)
  --basename=&lt;name&gt;  basename of the acroread instance ($basename)

The help screen of acroread is available by option "-help".

END_OF_HELP
    exit 0;
  }
  push(@acroreadoptions, $_);
}
$tempdir .= "/" unless $tempdir eq "" or $tempdir =~ /\/$/;

my $acroread_org = `which acroread`;
my $acroread_new = "$tempdir$basename.sh";
my $cmd_new      = "$tempdir$basename.bin";

sub clean {
  unlink($acroread_new);
  unlink($cmd_new);
}

$SIG{__DIE__} = \&amp;clean;
$SIG{'HUP'}   = \&amp;clean;
$SIG{'QUIT'}  = \&amp;clean;
$SIG{'TERM'}  = \&amp;clean;

open(IN, $acroread_org) or
    die "!!! Error: Cannot open `$acroread_org'!\n";
open(OUT, "&gt;$acroread_new") or
    die "!!! Error: Cannot write `$acroread_new'!\n";

while (&lt;IN&gt;) {
  print OUT;
  if (/^ACRO_EXEC_CMD=/) {
    print OUT &lt;&lt;"ENDMARK";

\#
\# [$program] Make link for new acroread instance.
\#
ACRO_EXEC_CMD_NEW="$cmd_new"
ln -s "\$ACRO_EXEC_CMD" "\$ACRO_EXEC_CMD_NEW"
if [ -h "\$ACRO_EXEC_CMD_NEW" ] ; then
  ACRO_EXEC_CMD="\$ACRO_EXEC_CMD_NEW"
else
  echo "ERROR: Creation of symbolic link '\$ACRO_EXEC_CMD_NEW' failed."
  exit 1
fi

ENDMARK
  }
}
close(IN);
close(OUT);
chmod('0500', $acroread_new);

system("$acroread_new @acroreadoptions");

clean();

__END__
</pre></body></html>