better warning
[Printer-EVOLIS.git] / evolis-printer.pl
index 34a2e48..1a7a1f2 100755 (executable)
@@ -18,9 +18,9 @@ sub save_pbm;
 while(<>) {
        die "no escape at beginning",dump($_) unless s/^(\x00*)\x1B//;
        warn "WARNING: ", length($1), " extra nulls before ESC\n" if $1;
-       chomp;
        my @a = split(/;/,$_);
        my $c = shift @a;
+       chomp $c;
        if ( $c eq 'Pmi' ) {
                print "$_ mode insertion @a\n";
        } elsif ( $c eq 'Pc' ) {
@@ -42,7 +42,7 @@ while(<>) {
        } elsif ( $c eq 'Db' ) {
                my ( $color, $two, $data ) = @a;
                print "$c;$color;$two;... bitmap\n";
-               $two eq '2' or die '2';
+               $two eq '2' or die 'only 2 colors supported';
                my $path = "$name-Db-$color-$page.pbm"; $page++;
                save_pbm $path, 648, 1015, $data;       # FIXME 1016?
        } elsif ( $c eq 'Dbc' ) { # XXX not in cups
@@ -50,7 +50,7 @@ while(<>) {
                print "$c;$color;$line;$len;... download bitmap compressed\n";
                while ( $len > length($comp) ) {
                        warn "# slurp more ",length($comp), " < $len\n";
-                       $comp .= $/ . <>;
+                       $comp .= <>;
                }
                $len == length $comp or warn "wrong length $len != ", length $comp;