3 # Copyright (C) 2000-2001 Simon Huggins
4 # date just calls date. You may pass in a strftime compatible formatting
7 # This program is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by the Free
9 # Software Foundation; either version 2 of the License, or (at your option)
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 # You should have received a copy of the GNU General Public License along
18 # with this program; if not, write to the Free Software Foundation, Inc., 59
19 # Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # Outputs date to tmpdir/D
22 # Therefore replaces @D... in sigs via merge.
26 use POSIX qw(strftime);
28 my @found = scansigfile("D");
31 # srand( time() ^ ($$ + ($$ << 15) )); # Since 5.004 not required
33 open(OUT, ">$cfg{'tmpdir'}/D") or htagdie "$0: Could not open $cfg{'tmpdir'}/D: $!\n";
34 reg_deletion("$cfg{'tmpdir'}/D");
35 foreach my $f (@found) {
37 my $date = strftime($cfg{'date_format'} ? $cfg{'date_format'} : "%a %b %e %H:%M:%S %Y", localtime);
38 if (length $date <= $f[1]) {
39 print OUT chunksizealign($date, $f[1], $f[2]);
41 my $diemsg = "Can't fit your chosen date format (";
42 if (defined $cfg{'date_format'}) {
43 $diemsg .= $cfg{'date_format'};
45 $diemsg .= "%a %b %e %H:%M:%S %Y";
47 $diemsg .= ") in <= $f[1].\nPerhaps your space isn't big enough.\nAlternatively modify this script to give less information.\n";