003 File Manager
Current Path:
/usr/local/bin
usr
/
local
/
bin
/
📁
..
📄
2to3-3.8
(101 B)
📄
ab
(50.54 KB)
📄
addftinfo
(63.84 KB)
📄
afmtodit
(161.91 KB)
📄
apr-1-config
(6.77 KB)
📄
apu-1-config
(6.17 KB)
📄
argon2
(43.3 KB)
📄
bash
(918.65 KB)
📄
bashbug
(6.65 KB)
📄
chardetect
(972 B)
📄
chardetect-3.8
(972 B)
📄
chem
(28.51 KB)
📄
corelist
(15.02 KB)
📄
cpan
(8.17 KB)
📄
curl
(163.47 KB)
📄
curl-config
(7.33 KB)
📄
curve_keygen
(5.88 KB)
📁
db5
📄
db_archive-5
(9.28 KB)
📄
db_archive-5.3
(9.28 KB)
📄
db_checkpoint-5
(10.94 KB)
📄
db_checkpoint-5.3
(10.94 KB)
📄
db_deadlock-5
(11.12 KB)
📄
db_deadlock-5.3
(11.12 KB)
📄
db_dump-5
(13.95 KB)
📄
db_dump-5.3
(13.95 KB)
📄
db_dump185-5
(8.61 KB)
📄
db_dump185-5.3
(8.61 KB)
📄
db_hotbackup-5
(14.74 KB)
📄
db_hotbackup-5.3
(14.74 KB)
📄
db_load-5
(25.35 KB)
📄
db_load-5.3
(25.35 KB)
📄
db_log_verify-5
(12.36 KB)
📄
db_log_verify-5.3
(12.36 KB)
📄
db_printlog-5
(31.88 KB)
📄
db_printlog-5.3
(31.88 KB)
📄
db_recover-5
(10.81 KB)
📄
db_recover-5.3
(10.81 KB)
📄
db_replicate-5
(11.78 KB)
📄
db_replicate-5.3
(11.78 KB)
📄
db_stat-5
(11.89 KB)
📄
db_stat-5.3
(11.89 KB)
📄
db_tuner-5
(17.47 KB)
📄
db_tuner-5.3
(17.47 KB)
📄
db_upgrade-5
(9.81 KB)
📄
db_upgrade-5.3
(9.81 KB)
📄
db_verify-5
(10.36 KB)
📄
db_verify-5.3
(10.36 KB)
📄
dehydrated
(80.89 KB)
📄
distro
(961 B)
📄
distro-3.8
(961 B)
📄
enc2xs
(40.78 KB)
📄
encguess
(3.01 KB)
📄
envsubst
(35.84 KB)
📄
epsffit
(11.11 KB)
📄
eqn
(181.15 KB)
📄
eqn2graph
(3.16 KB)
📄
event_rpcgen.py
(53.66 KB)
📄
extractres
(2.69 KB)
📄
fixdlsrps
(1.53 KB)
📄
fixfmps
(605 B)
📄
fixmacps
(2.11 KB)
📄
fixpsditps
(700 B)
📄
fixpspps
(1.28 KB)
📄
fixscribeps
(485 B)
📄
fixtpps
(705 B)
📄
fixwfwps
(863 B)
📄
fixwpps
(738 B)
📄
fixwwps
(433 B)
📄
ftpasswd
(37.06 KB)
📄
ftpcount
(46.63 KB)
📄
ftpdctl
(328.72 KB)
📄
ftpmail
(13.63 KB)
📄
ftpquota
(32.21 KB)
📄
ftptop
(65.33 KB)
📄
ftpwho
(133.71 KB)
📄
gdbm_dump
(19.02 KB)
📄
gdbm_load
(22.2 KB)
📄
gdbmtool
(115.9 KB)
📄
gdiffmk
(7.51 KB)
📄
getafm
(6.18 KB)
📄
gettext
(36.32 KB)
📄
gettext.sh
(5.07 KB)
📄
glilypond
(18.01 KB)
📄
gperl
(6.5 KB)
📄
gpinyin
(5.03 KB)
📄
grap2graph
(3.08 KB)
📄
grn
(118.4 KB)
📄
grodvi
(150.01 KB)
📄
groff
(130.26 KB)
📄
groffer
(8.06 KB)
📄
grog
(2.73 KB)
📄
grolbp
(149.57 KB)
📄
grolj4
(144.72 KB)
📄
gropdf
(70.41 KB)
📄
grops
(192.28 KB)
📄
grotty
(145.68 KB)
📄
h2ph
(28.55 KB)
📄
h2xs
(59.51 KB)
📄
hpftodit
(158.4 KB)
📄
htdbm
(18.69 KB)
📄
htdigest
(10.75 KB)
📄
htpasswd
(17.62 KB)
📄
httxt2dbm
(10.3 KB)
📄
iconv
(25.27 KB)
📄
idle3.8
(99 B)
📄
includeres
(1.44 KB)
📄
indexinfo
(10.87 KB)
📄
indxbib
(73.84 KB)
📄
innochecksum
(3.44 MB)
📄
instmodsh
(4.2 KB)
📄
json_pp
(4.88 KB)
📄
ldapadd
(67.1 KB)
📄
ldapcompare
(56.88 KB)
📄
ldapdelete
(58.27 KB)
📄
ldapexop
(57.43 KB)
📄
ldapmodify
(67.1 KB)
📄
ldapmodrdn
(56.87 KB)
📄
ldappasswd
(57.66 KB)
📄
ldapsearch
(78.48 KB)
📄
ldapurl
(18.74 KB)
📄
ldapwhoami
(55.38 KB)
📄
libnetcfg
(15.42 KB)
📄
lkbib
(80.95 KB)
📄
logresolve
(10.15 KB)
📄
lookbib
(81.07 KB)
📄
lz4
(68.09 KB)
📄
lz4_decompress
(7.7 KB)
📄
lz4c
(68.09 KB)
📄
lz4cat
(68.09 KB)
📄
mmroff
(3.75 KB)
📄
my_print_defaults
(3.4 MB)
📄
myisam_ftdump
(3.63 MB)
📄
myisamchk
(3.73 MB)
📄
myisamlog
(3.61 MB)
📄
myisampack
(3.66 MB)
📄
mysql
(3.66 MB)
📄
mysql_config
(5.05 KB)
📄
mysql_config_editor
(3.4 MB)
📄
mysql_install_db
(4.96 MB)
📄
mysql_plugin
(3.41 MB)
📄
mysql_secure_installation
(3.56 MB)
📄
mysql_ssl_rsa_setup
(3.44 MB)
📄
mysql_tzinfo_to_sql
(3.37 MB)
📄
mysql_upgrade
(4.16 MB)
📄
mysqladmin
(3.56 MB)
📄
mysqlbinlog
(3.78 MB)
📄
mysqlcheck
(3.57 MB)
📄
mysqld_multi
(26.39 KB)
📄
mysqld_safe
(27.21 KB)
📄
mysqldump
(3.63 MB)
📄
mysqldumpslow
(7.67 KB)
📄
mysqlimport
(3.55 MB)
📄
mysqlpump
(3.92 MB)
📄
mysqlshow
(3.55 MB)
📄
mysqlslap
(3.57 MB)
📄
mysqltest
(3.85 MB)
📄
mysqlxtest
(4.2 MB)
📄
neqn
(919 B)
📄
ngettext
(35.89 KB)
📄
nroff
(3.21 KB)
📄
paperconf
(10.55 KB)
📄
pcre-config
(2.31 KB)
📄
pcre2-config
(2.13 KB)
📄
pcre2grep
(46.03 KB)
📄
pcre2test
(166.76 KB)
📄
pcregrep
(35.81 KB)
📄
pcretest
(103.81 KB)
📄
pdfmom
(3.03 KB)
📄
pdfroff
(20.96 KB)
📄
perl
(7.41 KB)
📄
perl5.32.1
(7.41 KB)
📄
perlbug
(44.21 KB)
📄
perldoc
(274 B)
📄
perlivp
(10.58 KB)
📄
perlthanks
(44.21 KB)
📄
perror
(3.53 MB)
📄
pfbtops
(53.68 KB)
📄
php
(5.31 MB)
📄
php-cgi
(5.24 MB)
📄
php-config
(3.16 KB)
📄
phpize
(4.42 KB)
📄
pic
(231.69 KB)
📄
pic2graph
(3.66 KB)
📄
piconv
(8.17 KB)
📄
pl2pm
(4.44 KB)
📄
pod2html
(4.05 KB)
📄
pod2man
(14.69 KB)
📄
pod2text
(10.56 KB)
📄
pod2usage
(3.86 KB)
📄
podchecker
(3.58 KB)
📄
post-grohtml
(247.92 KB)
📄
pre-grohtml
(129.52 KB)
📄
preconv
(78.54 KB)
📄
protoc
(13.9 KB)
📄
prove
(13.35 KB)
📄
prxs
(9.25 KB)
📄
psbook
(16.39 KB)
📄
psmerge
(1.97 KB)
📄
psnup
(24.64 KB)
📄
psresize
(22.61 KB)
📄
psselect
(17.91 KB)
📄
pstops
(23.34 KB)
📄
ptar
(3.48 KB)
📄
ptardiff
(2.58 KB)
📄
ptargrep
(4.3 KB)
📄
pybabel
(960 B)
📄
pybabel-3.8
(960 B)
📄
pydoc3.8
(84 B)
📄
python3.8
(5.13 KB)
📄
python3.8-config
(3.09 KB)
📄
rbash
(918.65 KB)
📄
refer
(161.39 KB)
📄
replace
(3.38 MB)
📄
resolve_stack_dump
(3.4 MB)
📄
resolveip
(3.4 MB)
📄
roff2dvi
(5.58 KB)
📄
roff2html
(5.58 KB)
📄
roff2pdf
(5.58 KB)
📄
roff2ps
(5.58 KB)
📄
roff2text
(5.58 KB)
📄
roff2x
(5.58 KB)
📄
salt
(948 B)
📄
salt-api
(956 B)
📄
salt-call
(958 B)
📄
salt-cloud
(960 B)
📄
salt-cp
(954 B)
📄
salt-key
(956 B)
📄
salt-master
(962 B)
📄
salt-minion
(962 B)
📄
salt-proxy
(972 B)
📄
salt-run
(956 B)
📄
salt-ssh
(956 B)
📄
salt-syndic
(962 B)
📄
salt-unity
(960 B)
📄
screen
(435.05 KB)
📄
setvhost.sh
(3.05 KB)
📄
shasum
(9.75 KB)
📄
showchar
(2.51 KB)
📄
soelim
(66.83 KB)
📄
splain
(18.97 KB)
📄
spm
(946 B)
📄
streamzip
(5.4 KB)
📄
tbl
(149.71 KB)
📄
tfmtodit
(68.05 KB)
📄
troff
(577.19 KB)
📄
uchardet
(8.03 KB)
📄
unlz4
(68.09 KB)
📄
xml2-config
(1.79 KB)
📄
xmlcatalog
(15.22 KB)
📄
xmllint
(61.66 KB)
📄
xmlwf
(31.56 KB)
📄
xsubpp
(5.05 KB)
📄
zipdetails
(50.05 KB)
📄
zlib_decompress
(7.56 KB)
Editing: glilypond
#! /usr/bin/env perl package main; ######################################################################## # debugging ######################################################################## # See 'Mastering Perl', chapter 4. # use strict; # use warnings; # use diagnostics; use Carp; $SIG{__DIE__} = sub { &Carp::croak; }; use Data::Dumper; ######################################################################## # Legalese ######################################################################## our $Legalese; { use constant VERSION => 'v1.3.1'; # version of glilypond ### This constant 'LICENSE' is the license for this file 'GPL' >= 2 use constant LICENSE => q* glilypond - integrate 'lilypond' into 'groff' files Source file position: '<groff-source>/contrib/glilypond/glilypond.pl' Installed position: '<prefix>/bin/glilypond' Copyright (C) 2013-2018 Free Software Foundation, Inc. Written by Bernd Warken <groff-bernd.warken-72@web.de> Last update: 10 Sep 2015 This file is part of 'GNU groff'. 'GNU groff' is free software: you can redistribute it and/or modify it under the terms of the 'GNU General Public License' as published by the 'Free Software Foundation', either version 2 of the License, or (at your option) any later version. 'GNU groff' is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 'GNU General Public License' for more details. You should have received a copy of the 'GNU General Public License' along with 'groff', see the files 'COPYING' and 'LICENSE' in the top directory of the 'groff' source package. If not, see <http://www.gnu.org/licenses/>. *; $Legalese = { 'version' => VERSION, 'license' => LICENSE, } } ##### end legalese ######################################################################## # global variables and BEGIN ######################################################################## use integer; use utf8; use Cwd qw[]; use File::Basename qw[]; use File::Copy qw[]; use File::HomeDir qw[]; use File::Spec qw[]; use File::Path qw[]; use File::Temp qw[]; use FindBin qw[]; use POSIX qw[]; BEGIN { use constant FALSE => 0; use constant TRUE => 1; use constant EMPTYSTRING => ''; use constant EMPTYARRAY => (); use constant EMPTYHASH => (); our $Globals = { 'before_make' => FALSE, 'groff_version' => EMPTYSTRING, 'prog' => EMPTYSTRING, }; { ( my $volume, my $directory, $Globals->{'prog'} ) = File::Spec->splitpath($0); # $Globals->{'prog'} is 'glilypond' when installed, # 'glilypond.pl' when not } $\ = "\n"; # adds newline at each print $/ = "\n"; # newline separates input $| = 1; # flush after each print or write command { { # script before run of 'make' my $at = '@'; $Globals->{'before_make'} = TRUE if '1.22.4' eq "${at}VERSION${at}"; } my $file_test_pl; my $glilypond_libdir; if ( $Globals->{'before_make'} ) { # in source, not yet installed my $glilypond_dir = $FindBin::Bin; $glilypond_dir = Cwd::realpath($glilypond_dir); $glilypond_libdir = $glilypond_dir; } else { # already installed $Globals->{'groff_version'} = '1.22.4'; $glilypond_libdir = '/usr/local/lib/groff/glilypond'; } unshift(@INC, $glilypond_libdir); umask 0077; # octal output: 'printf "%03o", umask;' } require 'subs.pl'; } #die "test: "; ######################################################################## # OOP declarations for some file handles ######################################################################## require 'oop_fh.pl'; our $stdout = new FH_STDOUT(); our $stderr = new FH_STDERR(); # verbose printing, not clear wether this will be set by '--verbose', # so store this now into a string, which can be gotten later on, when # it will become either STDERR or /dev/null our $v = new FH_STRING(); # for standard output, either STDOUT or output file our $out; # end of FH ######################################################################## # Args: command-line arguments ######################################################################## # command-line arguments are handled in 2 runs: # 1) split short option collections, '=' optargs, and transfer abbrevs # 2) handle the transferred options with subs our $Args = { 'eps_dir' => EMPTYSTRING, # can be overwritten by '--eps_dir' # 'eps-func' has 2 possible values: # 1) 'pdf' '--pdf2eps' (default) # 2) 'ly' from '--ly2eps' 'eps_func' => 'pdf', # files names of temporary files start with this string, # can be overwritten by '--prefix' 'prefix' => 'ly', # delete or do not delete temporary files 'keep_all' => FALSE, # the roff output goes normally to STDOUT, can be a file with '--output' 'output' => EMPTYSTRING, # temporary directory, can be overwritten by '--temp_dir', # empty for default of the program 'temp_dir' => EMPTYSTRING, # regulates verbose output (on STDERR), overwritten by '--verbose' 'verbose' => FALSE, }; { # 'Args' require 'args.pl'; &run_first(); &install_verbose(); &run_second(); &handle_args(); } # end 'Args' ######################################################################## # temporary directory .../tmp/groff/USER/lilypond/TIME ######################################################################## our $Temp = { # store the current directory 'cwd' => Cwd::getcwd(), # directory for EPS files 'eps_dir' => EMPTYSTRING, # temporary directory 'temp_dir' => EMPTYSTRING, }; { # 'Temp' if ( $Args->{'temp_dir'} ) { #---------- # temporary directory was set by '--temp_dir' #---------- my $dir = $Args->{'temp_dir'}; $dir = &path2abs($dir); $dir = &make_dir($dir) or die "The directory '$dir' cannot be used temporarily: $!"; # now '$dir' is a writable directory opendir( my $dh, $dir ) or die "Could not open temporary directory '$dir': $!"; my $file_name; my $found = FALSE; my $prefix = $Args->{'prefix'}; my $re = qr< ^ $prefix _ >x; READDIR: while ( defined($file_name = readdir($dh)) ) { chomp $file_name; if ( $file_name =~ /$re/ ) { # file name starts with $prefix_ $found = TRUE; last READDIR; } next; } $Temp->{'temp_dir'} = $dir; my $n = 0; while ( $found ) { $dir = File::Spec->catdir( $Temp->{'temp_dir'}, ++$n ); next if ( -e $dir ); $dir = &make_dir($dir) or next; $found = FALSE; last; } $Temp->{'temp_dir'} = $dir; } else { # $Args->{'temp_dir'} not given by '--temp_dir' #---------- # temporary directory was not set #---------- { # search for or create a temporary directory my @tempdirs = EMPTYARRAY; { my $tmpdir = File::Spec->tmpdir(); push @tempdirs, $tmpdir if ( $tmpdir && -d $tmpdir && -w $tmpdir ); my $root_dir = File::Spec->rootdir(); # '/' in Unix my $root_tmp = File::Spec->catdir($root_dir, 'tmp'); push @tempdirs, $root_tmp if ( $root_tmp ne $tmpdir && -d $root_tmp && -w $root_tmp ); # home directory of the actual user my $home = File::HomeDir->my_home; my $home_tmp = File::Spec->catdir($home, 'tmp'); push @tempdirs, $home_tmp if ( -d $home_tmp && -w $home_tmp ); # '/var/tmp' in Unix my $var_tmp = File::Spec->catdir('', 'var', 'tmp'); push @tempdirs, $var_tmp if ( -d $var_tmp && -w $var_tmp ); } my @path_extension = qw( groff ); # TEMPDIR/groff/USER/lilypond/<NUMBER> { # '$<' is UID of actual user, # 'getpwuid' gets user name in scalar context my $user = getpwuid($<); push @path_extension, $user if ( $user ); push @path_extension, qw( lilypond ); } TEMPS: foreach ( @tempdirs ) { my $dir; # final directory name in 'while' loop $dir = &path2abs($_); next TEMPS unless ( $dir ); # beginning of directory name my @dir_begin = ( File::Spec->splitdir($dir), @path_extension ); my $n = 0; my $dir_blocked = TRUE; BLOCK: while ( $dir_blocked ) { # should become the final dir name $dir = File::Spec->catdir(@dir_begin, ++$n); next BLOCK if ( -d $dir ); # dir name is now free, create it, and end the blocking my $res = &make_dir( $dir ); die "Could not create directory: $dir" unless ( $res ); $dir = $res; $dir_blocked = FALSE; } next TEMPS unless ( -d $dir && -w $dir ); # $dir is now a writable directory $Temp->{'temp_dir'} = $dir; # tmp/groff/USER/lilypond/TIME last TEMPS; } # end foreach tmp directories } # end to create a temporary directory die "Could not find a temporary directory" unless ( $Temp->{'temp_dir'} && -d $Temp->{'temp_dir'} && -w $Temp->{'temp_dir'} ); } # end temporary directory $v->print( "Temporary directory: '" . $Temp->{'temp_dir'} . "'\n" ); $v->print( "file_prefix: '" . $Args->{'prefix'} . "'" ); #---------- # EPS directory #---------- my $make_dir = FALSE; if ( $Args->{'eps_dir'} ) { # set by '--eps_dir' my $dir = $Args->{'eps_dir'}; $dir = &path2abs($dir); if ( -e $dir ) { goto EMPTY unless ( -w $dir ); # '$dir' is writable if ( -d $dir ) { my $upper_dir = $dir; my $found = FALSE; opendir( my $dh, $upper_dir ) or $found = TRUE; my $prefix = $Args->{'prefix'}; my $re = qr< ^ $prefix _ >x; while ( not $found ) { my $file_name = readdir($dh); if ( $file_name =~ /$re/ ) { # file name starts with $prefix_ $found = TRUE; last; } next; } my $n = 0; while ( $found ) { $dir = File::Spec->catdir($upper_dir, ++$n); next if ( -d $dir ); $found = FALSE; } $make_dir = TRUE; $Temp->{'eps_dir'} = $dir; } else { # '$dir' is not a dir, so unlink it to create it as dir if ( unlink $dir ) { # could remove '$dir' $Temp->{'eps_dir'} = $dir; $make_dir = TRUE; } else { # could not remove $stderr->print( "Could not use EPS dir '" . $dir . "', use temp dir." ); } # end of unlink } # end test of -d $dir } else { $make_dir = TRUE; } # end of if -e $dir if ( $make_dir ) { # make directory '$dir' my $made = FALSE; $dir = &make_dir($dir) and $made = TRUE; if ( $made ) { $Temp->{'eps_dir'} = $dir; $v->print( "Directory for useful EPS files is '" . $dir . "'." ); } else { $v->print( "The EPS directory '" . $dir . "' cannot be used: $!" ); } } else { # '--eps_dir' was not set, so take the temporary directory $Temp->{'eps_dir'} = $Args->{'temp_dir'}; } # end of make dir } EMPTY: unless ( $Temp->{'eps_dir'} ) { # EPS-dir not set or available, use temp dir, # but leave $Temp->{'}eps_dir'} empty $v->print( "Directory for useful EPS files is the " . "temporary directory '" . $Temp->{'temp_dir'} . "'." ); } } # end 'Temp' ######################################################################## # Read: read files or stdin ######################################################################## our $Read = { 'file_numbered' => EMPTYSTRING, 'file_ly' => EMPTYSTRING, # '$file_numbered.ly' }; { # read files or stdin my $ly_number = 0; # number of lilypond file # '$Args->{'prefix'}_[0-9]' my $lilypond_mode = FALSE; my $arg1; # first argument for '.lilypond' my $arg2; # argument for '.lilypond include' my $path_ly; # path of ly-file my $check_file = sub { # for argument of '.lilypond include' my $file = shift; # argument is a file name $file = &path2abs($file); unless ( $file ) { die "Line '.lilypond include' without argument"; return ''; } unless ( -f $file && -r $file ) { die "Argument '$file' in '.lilypond include' is not a readable file"; } return $file; }; # end sub &$check_file() my $increase_ly_number = sub { ++$ly_number; $Read->{'file_numbered'} = $Args->{'prefix'} . '_' . $ly_number; $Read->{'file_ly'} = $Read->{'file_numbered'} . '.ly'; $path_ly = File::Spec->catdir($Temp->{'temp_dir'}, $Read->{'file_ly'} ); }; my %eps_subs = ( 'ly' => \&create_ly2eps, # lilypond creates EPS files 'pdf' => \&create_pdf2eps, # lilypond creates PDF file ); # about lines starting with '.lilypond' my $ly; my $fh_include_file; my %lilypond_args = ( 'start' => sub { $v->print( "\nline: '.lilypond start'" ); die "Line '.lilypond stop' expected." if ( $lilypond_mode ); $lilypond_mode = TRUE; &$increase_ly_number; $v->print( "ly-file: '" . $path_ly . "'" ); $ly = new FH_FILE($path_ly); }, 'end' => sub { $v->print( "line: '.lilypond end'\n" ); die "Expected line '.lilypond start'." unless ( $lilypond_mode ); $lilypond_mode = FALSE; $ly->close(); if ( exists $eps_subs{ $Args->{'eps_func'} } ) { $eps_subs{ $Args->{'eps_func'} }->(); } else { die "Wrong argument for \%eps_subs: " . $Args->{'eps_func'} . "'"; } }, 'include' => sub { # '.lilypond include file...' # this may not be used within lilypond mode next LILYPOND if ( $lilypond_mode ); my $file_arg = shift; my $file = &$check_file($file_arg); next LILYPOND unless ( $file ); # file can be read now # '$fh_write_ly' must be opened &$increase_ly_number; $ly = new FH_FILE($path_ly); my $include = new FH_READ_FILE($file); my $res = $include->read_all(); # is a reference to an array foreach ( @$res ) { chomp; $ly->print($_); } $ly->close(); if ( exists $eps_subs{ $Args->{'eps_func'} } ) { $eps_subs{ $Args->{'eps_func'} }->(); } else { die "Wrong argument for \$eps_subs: '" . $Args->{'eps_func'} . "'"; } }, # end '.lilypond include' ); # end definition %lilypond_args LILYPOND: foreach (<>) { chomp; my $line = $_; # now the lines with '.lilypond ...' if ( / ^ [.'] \s* lilypond ( .* ) $ /x ) { # .lilypond ... my $args = $1; $args =~ s/ ^ \s* //x; $args =~ s/ \s* $ //x; $args =~ s/ ^ ( \S* ) \s* //x; my $arg1 = $1; # 'start', 'end' or 'include' $args =~ s/["'`]//g; my $arg2 = $args; # file argument for '.lilypond include' if ( exists $lilypond_args{$arg1} ) { $lilypond_args{$arg1}->($arg2); next; } else { # not a suitable argument of '.lilypond' $stderr->print( "Unknown command: '$arg1' '$arg2': '$line'" ); } next LILYPOND; } # end if for .lilypond if ( $lilypond_mode ) { # do lilypond-mode # see '.lilypond start' $ly->print( $line ); next LILYPOND; } # do lilypond-mode # unknown line without lilypond unless ( / ^ [.'] \s* lilypond /x ) { # not a '.lilypond' line $out->print($line); next LILYPOND; } } # end foreach <> } # end Read ######################################################################## # clean up ######################################################################## END { exit unless ( defined($Temp->{'temp_dir'}) ); if ( $Args->{'keep_all'} ) { # With --keep_all, no temporary files are removed. $v->print( "keep_all: 'TRUE'" ); $v->print( "No temporary files will be deleted:" ); opendir my $dh_temp, $Temp->{'temp_dir'} or die "Cannot open " . $Temp->{'temp_dir'} . ": $!"; for ( sort readdir $dh_temp ) { next if ( / # omit files starting with a dot ^ \. /x ); if ( / ^ $Args->{'prefix'} _ /x ) { my $file = File::Spec->catfile( $Temp->{'temp_dir'}, $_ ); $v->print( "- " . $file ); next; } next; } # end for sort readdir closedir $dh_temp; } else { # keep_all is not set # Remove all temporary files except the eps files. $v->print( "keep_all: 'FALSE'" ); $v->print( "All temporary files except *.eps will be deleted" ); if ( $Temp->{'eps_dir'} ) { # EPS files are in another dir, remove temp dir if ( &is_subdir( $Temp->{'eps_dir'}, $Temp->{'temp_dir'} ) ) { $v->print( "EPS dir is subdir of temp dir, so keep both." ); } else { # remove temp dir $v->print( "Try to remove temporary directory '" . $Temp->{'temp_dir'} ."':" ); if ( File::Path::remove_tree($Temp->{'temp_dir'}) ) { # remove succeeds $v->print( "...done." ); } else { # did not remove $v->print( "Failure to remove temporary directory." ); } # end test on remove } # end is subdir } else { # no EPS dir, so keep EPS files opendir my $dh_temp, $Temp->{'temp_dir'} or die "Cannot open " . $Temp->{'temp_dir'} . ": $!"; for ( sort readdir $dh_temp ) { next if ( / # omit files starting with a dot ^ \. /x ); next if ( / # omit EPS-files \.eps $ /x ); if ( / ^ $Args->{'prefix'} _ /x ) { # this includes 'PREFIX_temp*' my $file = File::Spec->catfile( $Temp->{'temp_dir'}, $_ ); $v->print( "Remove '" . $file . "'" ); unlink $file or $stderr->print( "Could not remove '$file': $!" ); next; } # end if prefix next; } # end for readdir temp dir closedir $dh_temp; } # end if-else EPS files } # end if-else keep files if ( $Temp->{'eps_dir'} ) { # EPS files in $Temp->{'eps_dir'} are always kept $v->print( "As EPS directrory is set as '" . $Temp->{'eps_dir'} . "', no EPS files there will be deleted." ); opendir my $dh_temp, $Temp->{'eps_dir'} or die "Cannot open '" . $Temp->{'eps_dir'} . ": $!"; for ( sort readdir $dh_temp ) { next if ( / # omit files starting with a dot ^ \. /x ); if ( / ^ $Args->{'prefix'} _ .* \.eps $ /x ) { my $file = File::Spec->catfile( $Temp->{'eps_dir'}, $_ ); $v->print( "- " . $file ); next; } # end if *.eps next; } # end for sort readdir closedir $dh_temp; } 1; } # end package Clean 1; ######################################################################## ### Emacs settings # Local Variables: # mode: CPerl # End:
Upload File
Create Folder