#!/usr/bin/env perl # goldendict.wrapper - Wrapper that starts "gpodder" main program. # License: Creative Commons Attribution-NonCommercial-ShareALike 2.5 # Revision: 180317 # Note: License applies to wrapper only. "goldendict" itself is a # separate package that's distributed under the GNU General Public # License, version 3 (June 2007). #--------------------------------------------------------------------- # license information #--------------------------------------------------------------------- #@@@ #--------------------------------------------------------------------- # standard module setup #--------------------------------------------------------------------- require 5.6.1; use strict; use Carp; use warnings; # Trap warnings $SIG {__WARN__} = sub { die @_; }; #--------------------------------------------------------------------- # basic constants #--------------------------------------------------------------------- use constant ZERO => 0; # Zero use constant ONE => 1; # One use constant FALSE => 0; # Boolean FALSE use constant TRUE => 1; # Boolean TRUE #--------------------------------------------------------------------- # program parameters #--------------------------------------------------------------------- # $PREFIX specifies an absolute path for "gpodder's" "install" tree. # Note: The path shouldn't end with a slash. # $PROGNAME should be equal to this wrapper's filename, minus any # path component. # $TARGET_PROGRAM specifies an absolute path for the target executa- # ble. # Presently, $TARGET_PROGRAM should be equal to a directory path [end- # ing with a forward slash], plus $PROGNAME, plus the filename exten- # sion ".bin". If these conventions are changed, the filename speci- # fied by $TARGET_PROGRAM [disregarding the path component] must be # different than the name of this script, or infinite loops may oc- # cur. my $PREFIX = '__META_PREFIX__' ; my $PROGNAME = '__META_EXEWORD__' ; my $TARGET_PROGRAM = "$PREFIX/bin/$PROGNAME.bin"; #--------------------------------------------------------------------- # support routines #--------------------------------------------------------------------- # Future change: Document this routine. sub ExecTarget { my $data; # Data buffer my $n; # Scratch (integer) my $str; # Scratch (string ) #--------------------------------------------------------------------- # Wrap it up. $ENV {'ALLTRAYICON'} = "$PREFIX/data/icon_pavucontrol.png"; exec "alltray", "--hide", $TARGET_PROGRAM, @ARGV; exit ONE; # Shouldn't be reached } #--------------------------------------------------------------------- # main routine #--------------------------------------------------------------------- sub Main { my $HOME; # Absolute path for "home" directory #--------------------------------------------------------------------- # Initial setup. # Identify "home" directory $HOME = $ENV {HOME}; exit ONE unless defined $HOME; chdir $HOME; # Go to "home" directory #--------------------------------------------------------------------- # Run target program. &ExecTarget(); } #--------------------------------------------------------------------- # main program #--------------------------------------------------------------------- &Main(); # Call the main routine exit ZERO; # Not reached