Commits

Palmer, 2E0EOL committed 7d9e4b4 Merge

Merge all completed features from develop into stable

  • Participants
  • Parent commits 448e45b, 7f77841
  • Branches stable

Comments (0)

Files changed (3)

+c9ffb994b19415bd568855d91b2a248e4e806ade 0.0.0
+fb2b4d4657b9c73d530bcc642306a7b0dc48fef2 0.0.1
+0.0.1
+  * 448e45be6c76: BUGFIX: Ensure getc() is called until eof
+
+0.0.0
+  * Initial release
 
 use constant PARAGRAPH_LENGTH => (16);
 
-sub PrintRow($) {
-	my $Line = shift;
+sub SplitPara($) {
+	my $Str = shift;
+	my $l = length($Str);
+	return substr($Str, 0, $l/2) . substr($Str, ($l/2)-1);
+}
+
+sub PrintRow($$) {
+	my ( $Offset, $Line ) = @_;
 	my ( $hex, $printable ) = ( '', '' );
 	my $printed_count = 0;
 	my $hexPadding;
 	foreach my $char ( @$Line ) {
 		$hex .= sprintf('%02X ', ord($char));
 		$char = '.' if ( $char !~ m/\p{PosixPrint}/ );
-		$printable .= "$char ";
+		$printable .= $char;
 		$printed_count++;
 	}
 	$hexPadding = ( PARAGRAPH_LENGTH() - $printed_count ) * 3;
 	while ( $hexPadding-- ) { $hex .= ' '; }
-	printf("%s\t%s\n", $hex, $printable);
+	$printable = "|$printable|" if ( length($printable) );
+	printf("%08X\t%s\t%s\n", $Offset - $printed_count, SplitPara($hex), $printable);
 }
 
 sub Dump($) {
 		$counter++;
 		push(@line, $char);
 		if ( $counter % PARAGRAPH_LENGTH() == 0 ) {
-			PrintRow(\@line);
+			PrintRow($counter, \@line);
 			@line = ( );
 		}
 	}
-	PrintRow(\@line); # Anything remaining.
+	PrintRow($counter, \@line); # Anything remaining.
 }
 
 sub Main() {