#!/usr/bin/perl -w
#
# Copyright (C) 2001 Julian Fong
#
# Permission to use, copy, modify, distribute, and sell this software
# and its documentation for any purpose is hereby granted without fee,
# provided that the above copyright notice appear in all copies and
# that both that copyright notice and this permission notice appear in
# supporting documentation. No representations are made about the
# suitability of this software for any purpose. It is provided "as
# is" without express or implied warranty.
#
# pastehtml: Like the UNIX utility "paste", except that it outputs
# a chunk of HTML with the appropriate
tags instead.
my ($file, $input, $end, $row);
$input = "fh00";
foreach $file (@ARGV) {
unless (open($input, $file)) {
die ("Can't open $file: $!\n");
}
$input++;
}
print "\n";
$end = 0;
while (!$end) {
$input = "fh00";
$row = " \n";
$end = 1;
for ($file = 0; $file < scalar @ARGV; $file++) {
$line = readline($input);
if (defined($line)) {
chomp($line);
$end = 0;
$row .= " | $line | \n";
} else {
$row .= " | \n";
}
$input++;
}
if (!$end) {
$row .= "
\n";
print $row;
}
}
print "
\n";