CVSROOT: ciabot.pl - use basename for program name
glen
glen at pld-linux.org
Thu Mar 27 21:21:13 CET 2008
Author: glen Date: Thu Mar 27 20:21:13 2008 GMT
Module: CVSROOT Tag: HEAD
---- Log message:
- use basename for program name
---- Files affected:
CVSROOT:
ciabot.pl (1.22 -> 1.23)
---- Diffs:
================================================================
Index: CVSROOT/ciabot.pl
diff -u CVSROOT/ciabot.pl:1.22 CVSROOT/ciabot.pl:1.23
--- CVSROOT/ciabot.pl:1.22 Thu Jan 24 02:25:15 2008
+++ CVSROOT/ciabot.pl Thu Mar 27 21:21:07 2008
@@ -138,6 +138,11 @@
open STDERR, '>&STDOUT' or die "Can't dup stdout: $!";
}
+sub basename {
+ $_[0] =~ m{([^/]+)$};
+ $1;
+}
+
### Input data loading
@@ -145,14 +150,16 @@
# and then the list of files modified.
# Modified by jcarlyle for cvs 1.12 (30-May-04)
-$dir[0] = shift @ARGV or die "$0: no directory specified\n";
+my $PROGRAM = basename $0;
+
+$dir[0] = shift @ARGV or die "$PROGRAM: no directory specified\n";
while($ARGV[0])
{
push @files, shift @ARGV;
}
-$dirfiles[0] = "@files" or die "$0: no files specified\n";
+$dirfiles[0] = "@files" or die "$PROGRAM: no files specified\n";
# Guess module name.
@@ -237,9 +244,9 @@
defined(my $pid = fork) or die "Can't fork: $!";
exit if $pid;
- warn "$0: sleeping $sync_delay seconds\n";
+ warn "$PROGRAM: sleeping $sync_delay seconds\n";
sleep($sync_delay);
- warn "$0: collecting files and removing syncfile\n";
+ warn "$PROGRAM: collecting files and removing syncfile\n";
open(FF, $syncfile);
my ($dirnum) = 1; # 0 is the one we got triggerred for
@@ -324,7 +331,7 @@
if ($xml_rpc) {
- warn "$0: send out xml-rpc message\n";
+ warn "$PROGRAM: send out xml-rpc message\n";
daemonize();
# We gotta be careful from now on. We silence all the warnings because
@@ -348,7 +355,7 @@
### Send out the mail
-warn "$0: send out the mail\n";
+warn "$PROGRAM: send out the mail\n";
# Open our mail program
@@ -372,6 +379,6 @@
# Close the mail
close MAIL;
-die "$0: sendmail exit status " . ($? >> 8) . "\n" unless ($? == 0);
+die "$PROGRAM: sendmail exit status " . ($? >> 8) . "\n" unless ($? == 0);
# vi: set sw=2:
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/CVSROOT/ciabot.pl?r1=1.22&r2=1.23&f=u
More information about the pld-cvs-commit
mailing list