#!/usr/bin/perl # $Id: unsquish-flu,v 1.2 2003/03/24 05:00:38 tomj Exp $ # This expands a compressed FLutterwumper stream, mainly # for testing. Characters less then " " are ignored. # Set true if Model 423 supports the big repeat command. my $bigrep= 0; my $c= undef; # most recent command character, my $lastc= undef; # for detecting runs my $count= 0; # length of run, my $linelen= 0; # output a newline every so often my ($charsin, $charsout); # in and out counts my ($longest_run, $run_total, $run_count, $run_maxed)= (0, 0, 0, 0); # Turn on autoflush (which see), else printing isn't flushed # to the pipe until the program terminates. use Getopt::Std; use vars qw/$opt_h $opt_q/; getopts ('qh'); print STDERR "squish-flu -h for usage\n" if not $opt_q; &usage() if $opt_h; $|= 1; foreach (<>) { # from stdin, chomp; my @I= split //, $_; while (scalar @I) { $_= shift @I; if ($_ eq "<") { $_= shift @I; $_= ord $_; $i= $_ - 32; while ($i--) { print $lastc; } } else { print $_; $lastc= $_; } } } sub usage { print << "USAGE"; Uncompress a squish-flu compressed Flutterwumper command stream. Mainly for testing. -q Quiet, no chatter. USAGE exit; }