X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=driver%2Fxscreensaver-getimage-file;h=f7f4c8746d1133042f2817d6058d28d1ceed5974;hb=6cee540bdbb571485cd5e519f89f389faebd0495;hp=36de487e0e7d04e608731572b95f375d0cdc3ff7;hpb=cccbddbc4140cf9a06d7d95cc5c0ca36eb5d6e28;p=xscreensaver diff --git a/driver/xscreensaver-getimage-file b/driver/xscreensaver-getimage-file index 36de487e..f7f4c874 100755 --- a/driver/xscreensaver-getimage-file +++ b/driver/xscreensaver-getimage-file @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# Copyright © 2001, 2002 Jamie Zawinski . +# Copyright © 2001, 2002, 2003 Jamie Zawinski . # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that @@ -24,18 +24,34 @@ # Created: 12-Apr-01. require 5; +#require v5.6; use diagnostics; use strict; use POSIX; use Fcntl; -# use Fcntl ':mode'; # Perl 5.6ism? -use POSIX ':fcntl_h'; # more portable? +# Apparently the "old way" to get S_ISLNK and friends is to do this: +# +use POSIX ':fcntl_h'; + +# But apparently the "new way" is to do this: +# +# use Fcntl ':mode'; +# +# but of course that will generate an error on "old" (pre-5.6?) Perl versions. +# So we do it like this instead: +# +BEGIN { + if (! defined(&S_ISLNK)) { # perhaps defined by "POSIX"? + require Fcntl; + import Fcntl ':mode'; # if not, look for it in "Fcntl". + } +} my $progname = $0; $progname =~ s@.*/@@g; -my $version = q{ $Revision: 1.8 $ }; $version =~ s/^[^0-9]+([0-9.]+).*$/$1/; +my $version = q{ $Revision: 1.12 $ }; $version =~ s/^[^0-9]+([0-9.]+).*$/$1/; my $verbose = 0; @@ -47,7 +63,7 @@ my $verbose = 0; # my @programs = ( "chbg -once -xscreensaver -max_grow 4 -max_size 100", - "xv -root -quit -viewonly -maxpect -noresetroot -quick24 -rmode 5" . + "xv -root -quit -viewonly -maxpect +noresetroot -quick24 -rmode 5" . " -rfg black -rbg black", "xli -quiet -fullscreen -onroot -center -border black", "xloadimage -quiet -fullscreen -onroot -center -border black", @@ -87,7 +103,7 @@ sub find_all_files { local *DIR; if (! opendir (DIR, $dir)) { - print STDERR "$progname: couldn't open $dir: $!\n"; + print STDERR "$progname: couldn't open $dir: $!\n" if ($verbose); return; } my @files = readdir (DIR);