3 # Copyright (C) 2000-2001 Simon Huggins
4 # uptime merely calls uptime. You can influence the output a bit.
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License as published by the Free
8 # Software Foundation; either version 2 of the License, or (at your option)
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 # You should have received a copy of the GNU General Public License along
17 # with this program; if not, write to the Free Software Foundation, Inc., 59
18 # Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # Outputs `uptime` to tmpdir/U
21 # Therefore replaces @U... in sigs via merge.
26 my @found = scansigfile("U");
29 #srand( time() ^ ($$ + ($$ << 15) )); # Since 5.004 not required
31 open(OUT, ">$cfg{'tmpdir'}/U") or htagdie "$0: Could not open $cfg{'tmpdir'}/U: $!\n";
32 reg_deletion("$cfg{'tmpdir'}/U");
33 my $uptime = `uptime`;
35 $uptime =~ s/^.*?(up (?:[0-9]+ days?,)?[^,]+),.*$/$1/ if $cfg{'uptime_time'};
36 $uptime =~ s/[ ]+/ /g;
37 foreach my $f (@found) {
39 if (length $uptime <= $f[1]) {
40 print OUT chunksizealign($uptime, $f[1], $f[2]),"\n";
42 htagdie "Can't fit uptime in <= $f[1].\nPerhaps your space isn't big enough.\nAlternatively modify this script to give less information.\n";