auto
     ˆÊÉÑ463ÄÃÎ Ï    ‹      Í”_o›0Åßû)îü°7¸ù+m­aë Ò"¥I”2MÓ4M6`0²�±îÓÏ„¬M«F]&í	s9÷p~ú*^EÉ—õ>&WXú°˜G@<ÄÏã1NâþÁÄgK¤°¶9GlÛÖoÇ¾Ò9&,lUNÐX-SësËIxF»Zx´Œ»+P+m)ÂyÍÅOP ÚY#¹˜àÎh4ÓkÅÅ÷Jñ])¾oê¦¢Ø·9#<8Ñ­â·Ý†/7s=û(l»÷ì–:¤¶€¬”y«RYå`t”©ªnKVßø¹Ì°Òäë<Z}s:´E×R…Y@ÞEÁòb\’pÉ*A‘=­¹ê5f,¸„2“‚Ÿ_÷âkùë´aÜkbaR-+U}/E‡xŒšªÒ4Ì±NA¡�U½„?7–>Æúr3[&ñ|Ó�„w÷éžý4$\»Zm!–Z¤VéÛCöÞèu½5ÍÅŸ[8$Ó2/,	<xRùœL•\èc S(ny®%s‘ï–ÇY…FcoðÖ½�áô|0ø?(„m•¾ñSæe²Ì£Ê¿gúËíˆ‡ƒJqæ)ö?•ßJbþ·    6   ˆl–äY>””¾R( *û�rãaS�ÿ�þB#Y¹�çÛ p€þÓƒi·CÒÄÏ Û    #!/usr/bin/perl
#
# tl-paper
#
# query and change paper settings using TLPaper
# this is independent from tlmgr
#
# Copyright 2011-2015 Norbert Preining
# This file is licensed under the GNU General Public License version 3
# or any later version.
#

BEGIN {
  $^W = 1;
  chomp ($mydir = `dirname $0`);
  unshift (@INC, "/usr/share/texlive/tlpkg");
}

$^W = 1;
use strict;
use Cwd qw/abs_path/;
use Pod::Usage;
use Getopt::Long qw(:config no_autoabbrev permute);
use TeXLive::TLPaper;

# overwrite the default paper config settings
our %paper_config_name = (
  "xdvi"     => "XDvi-paper",
  "pdftex"   => "pdftexconfig.tex",
  "dvips"    => "config-paper.ps",
  "dvipdfmx" => "dvipdfmx-paper.cfg",
  "context"  => "cont-sys-paper.tex",
);

binmode(STDOUT, ":utf8");
binmode(STDERR, ":utf8");

&main();

sub main {
  # the script always runs in sys mode
  chomp(my $texmfsysconfig = `kpsewhich -var-value=TEXMFSYSCONFIG`);
  chomp(my $texmfsysvar = `kpsewhich -var-value=TEXMFSYSVAR`);
  $ENV{"TEXMFCONFIG"} = $texmfsysconfig;
  $ENV{"TEXMFVAR"} = $texmfsysvar;

  my $action = shift @ARGV;
  $action = "status" if !defined($action);
  if ($action =~ m/^status$/i) {  # "tl-paper status" shows the current settings
    TeXLive::TLPaper::paper_all($texmfsysvar,undef);
    
  } elsif ($action =~ m/^list$/i) { # "tl-paper list prg" lists options for prg
    my $prg = shift @ARGV;
    if (!$prg) {
      # currently, pdftex has the most restricted set of paper sizes
      $prg = "pdftex";
    }
    # the following actually also *reads* the configuration and returns
    # a list where the first item is the one selected.
    my $paperref = TeXLive::TLPaper::get_paper_list($prg);
    my ($current_paper, @other_options) = @{$paperref};
    for my $i ($current_paper, sort @other_options) {
      print "$i\n";
    }
    # for simply getting the list of supported paper sizes without reading
    # anything, one can use:
    # my @paper_options = keys(%{${prg}_papersize});

  } elsif ($action =~ m/^set$/i) { # "tl-paper set <prg|all> <paper>" sets paper
    my $prg = shift @ARGV;
    my $newpaper = shift @ARGV;

    if ($prg !~ m/^(xdvi|pdftex|dvips|dvipdfmx|context|all)$/i) {
      usage();
      exit 1;
    }
    # set TEXMFVAR and TEXMFSYSVAR to TEXMFDIST (which is == TEXMFMAIN)
    # so that we always find either the system provided config file
    # as distributed in /usr/share/texlive/texmf-dist, or, if the
    # admin decided to override that, a copy in TEXMFSYSCONFIG
    # but *not* the one we have created at some point in history
    # in TEXMF(SYS)VAR
    chomp(my $texmfdist = `kpsewhich -var-value=TEXMFDIST`);
    $ENV{"TEXMFVAR"} = $ENV{"TEXMFSYSVAR"} = $texmfdist;
    if ($prg =~ m/^all$/i) {
      if ($newpaper !~ /^(a4|letter)$/) {
        # we cannot deal with that for now, only a4|letter supported for
        # all programs
        print "tl-paper: cannot change setting for all programs to $newpaper\n\n";
        exit 1;
      }
      TeXLive::TLPaper::paper_all($texmfsysvar,$newpaper);
    
    } else {
      TeXLive::TLPaper::do_paper($prg,$texmfsysvar,$newpaper);
    }
  
    # we probably have changed the paper, so run the execute actions
    # as announced by TLPaper, that is $::files_changed and 
    # $::regenerate_all_formats.
    #
    # but we do not do this here, but rely on the libpaper shell
    # script to do the rest

  } elsif ($action =~ m/^get$/i) { # "tl-paper get prg" gets paper setting for prg
    my $prg = shift @ARGV;
    if ($prg !~ m/^(xdvi|pdftex|dvips|