\n"; for ($i = 0; $i < $cnt; $i++) { # push(@list, [$trcnt,$msg,$name,""]); $trcnt = $list[$i][0]; $msg = $list[$i][1]; $name = $list[$i][2]; $txt = $list[$i][3]; #prt("$trcnt $msg $name $txt\n"); $msg = "$txt\n"; $tmp .= $msg; # prt($msg); } $tmp .= "
\n"; $http .= $tmp; $endtable = 0; } } elsif ($hadsp) { $attr .= $ch; } elsif ($ch =~ /\s/) { $hadsp = 1; } else { $tag .= $ch; } } else { if ($ch eq '<') { $intag = 1; $hadsp = 0; $attr = ''; $tag = ''; } else { $txt .= $ch; } } } # end of line if ($intag) { if ($hadsp) { ###$attr .= ' ' if (length($attr)); $attr .= "\n" if (length($attr)); } else { $hadsp = 1; } } else { $txt .= "\n" if (length($txt)); } } write2file($http,$out_file); prt("New HTML wirtten to $out_file\n"); } ######################################### ### MAIN ### parse_args(@ARGV); process_in_file($in_file); pgm_exit(0,""); ######################################## sub need_arg { my ($arg,@av) = @_; pgm_exit(1,"ERROR: [$arg] must have a following argument!\n") if (!@av); } sub parse_args { my (@av) = @_; my ($arg,$sarg); while (@av) { $arg = $av[0]; if ($arg =~ /^-/) { $sarg = substr($arg,1); $sarg = substr($sarg,1) while ($sarg =~ /^-/); if (($sarg =~ /^h/i)||($sarg eq '?')) { give_help(); pgm_exit(0,"Help exit(0)"); } elsif ($sarg =~ /^v/) { if ($sarg =~ /^v.*(\d+)$/) { $verbosity = $1; } else { while ($sarg =~ /^v/) { $verbosity++; $sarg = substr($sarg,1); } } prt("Verbosity = $verbosity\n") if (VERB1()); } elsif ($sarg =~ /^l/) { if ($sarg =~ /^ll/) { $load_log = 2; } else { $load_log = 1; } prt("Set to load log at end. ($load_log)\n") if (VERB1()); } elsif ($sarg =~ /^o/) { need_arg(@av); shift @av; $sarg = $av[0]; $out_file = $sarg; prt("Set out file to [$out_file].\n") if (VERB1()); } else { pgm_exit(1,"ERROR: Invalid argument [$arg]! Try -?\n"); } } else { $in_file = $arg; prt("Set input to [$in_file]\n") if (VERB1()); } shift @av; } if ((length($in_file) == 0) && $debug_on) { $in_file = $def_file; prt("Set DEFAULT input to [$in_file]\n"); } if (length($in_file) == 0) { pgm_exit(1,"ERROR: No input files found in command!\n"); } if (! -f $in_file) { pgm_exit(1,"ERROR: Unable to find in file [$in_file]! Check name, location...\n"); } } sub give_help { prt("$pgmname: version $VERS\n"); prt("Usage: $pgmname [options] in-file\n"); prt("Options:\n"); prt(" --help (-h or -?) = This help, and exit 0.\n"); prt(" --verb[n] (-v) = Bump [or set] verbosity. def=$verbosity\n"); prt(" --load (-l) = Load LOG at end. ($outfile)\n"); prt(" --out