ftp://netsw.org/x11/tools/desktop/xscreensaver-4.07.tar.gz
[xscreensaver] / driver / xscreensaver-getimage-file
index 2da17d5958522b907faeff90deed9f1583398441..140d08a80638684cea33e1c0d96b081dee951981 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-# Copyright © 2001, 2002 Jamie Zawinski <jwz@jwz.org>.
+# Copyright © 2001, 2002, 2003 Jamie Zawinski <jwz@jwz.org>.
 #
 # Permission to use, copy, modify, distribute, and sell this software and its
 # documentation for any purpose is hereby granted without fee, provided that
@@ -29,10 +29,28 @@ use strict;
 
 use POSIX;
 use Fcntl;
-use Fcntl ':mode';
+
+# 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.11 $ }; $version =~ s/^[^0-9]+([0-9.]+).*$/$1/;
 
 my $verbose = 0;
 
@@ -44,7 +62,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",
@@ -84,7 +102,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);