home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl
-
- ($me = $0) =~ s,.*/,,;
-
- $FORTUNE = '/usr/games/fortune';
- $TMP = "/tmp/$me.$$";
-
- die "can't run $FORTUNE: $!" unless -x $FORTUNE;
-
- open (FORTUNE, "$FORTUNE @ARGV | expand |");
- while (<FORTUNE>) {
- $rows++;
- $cols = length if $cols < length;
- $fortune .= $_;
- }
- (close FORTUNE) || die "bad pclose on $FORTUNE: $?";
-
- $rows++, $cols++;
-
- open (TMP, ">$TMP") || die "can't write $TMP: $!";
- print TMP $fortune;
- close TMP;
-
- system 'xterm', '-geometry', "${cols}x${rows}",
- '-n', 'xfort',
- '-e', 'less', "-P(hit q to quit)", $TMP;
-
- unlink $TMP;
-