@@ -163,31 +163,49 @@ if (defined $opt_t) {
163
163
$fmt = \&hex2;
164
164
} elsif ($opt_t eq ' x4' ) {
165
165
$fmt = \&hex4;
166
+ } elsif ($opt_t eq ' x8' ) {
167
+ $fmt = \&hex8;
166
168
} elsif ($opt_t eq ' o1' ) {
167
169
$fmt = \&octal1;
168
170
} elsif ($opt_t eq ' o2' ) {
169
171
$fmt = \&octal2;
170
172
} elsif ($opt_t eq ' o4' ) {
171
173
$fmt = \&octal4;
174
+ } elsif ($opt_t eq ' o8' ) {
175
+ $fmt = \&octal8;
172
176
} elsif ($opt_t eq ' d1' ) {
173
177
$fmt = \&decimal1;
174
178
} elsif ($opt_t eq ' d2' ) {
175
179
$fmt = \&decimal2;
176
180
} elsif ($opt_t eq ' d4' ) {
177
181
$fmt = \&decimal4;
182
+ } elsif ($opt_t eq ' d8' ) {
183
+ $fmt = \&decimal8;
178
184
} elsif ($opt_t eq ' u1' ) {
179
185
$fmt = \&udecimal1;
180
186
} elsif ($opt_t eq ' u2' ) {
181
187
$fmt = \&udecimal2;
182
188
} elsif ($opt_t eq ' u4' ) {
183
189
$fmt = \&udecimal4;
190
+ } elsif ($opt_t eq ' u8' ) {
191
+ $fmt = \&udecimal8;
184
192
} elsif ($opt_t eq ' a' ) {
185
193
$fmt = \&char7bit;
186
194
} elsif ($opt_t eq ' c' ) {
187
195
$fmt = \&char1;
188
196
} else {
189
197
warn " $Program : unexpected output format specifier\n " ;
190
- exit EX_FAILURE;
198
+ exit EX_FAILURE;
199
+ }
200
+ if ($opt_t =~ m /\A [doux] 8\Z / ) {
201
+ my $has_quad = eval {
202
+ unpack ' Q' , ' ' ;
203
+ 1;
204
+ };
205
+ unless ($has_quad ) {
206
+ warn " $Program : 64-bit perl needed for $opt_t format\n " ;
207
+ exit EX_FAILURE;
208
+ }
191
209
}
192
210
}
193
211
@@ -397,6 +415,26 @@ sub hex4 {
397
415
$strfmt = ' %.8x ' x (scalar @arr );
398
416
}
399
417
418
+ sub hex8 {
419
+ @arr = unpack ' Q*' , $data . zeropad(length ($data ), 8);
420
+ $strfmt = ' %.16x ' x (scalar @arr );
421
+ }
422
+
423
+ sub octal8 {
424
+ @arr = unpack ' Q*' , $data . zeropad(length ($data ), 8);
425
+ $strfmt = ' %.22o ' x (scalar @arr );
426
+ }
427
+
428
+ sub udecimal8 {
429
+ @arr = unpack ' Q*' , $data . zeropad(length ($data ), 8);
430
+ $strfmt = ' %22u ' x (scalar @arr );
431
+ }
432
+
433
+ sub decimal8 {
434
+ @arr = unpack ' Q*' , $data . zeropad(length ($data ), 8);
435
+ $strfmt = ' %22d ' x (scalar @arr );
436
+ }
437
+
400
438
sub zeropad {
401
439
my ($len , $wantbytes ) = @_ ;
402
440
my $remain = $len % $wantbytes ;
@@ -518,15 +556,19 @@ Select output format as one of the following:
518
556
o1 1-byte unsigned octal
519
557
o2 2-byte unsigned octal
520
558
o4 4-byte unsigned octal
559
+ o8 8-byte unsigned octal
521
560
d1 1-byte signed decimal
522
561
d2 2-byte signed decimal
523
562
d4 4-byte signed decimal
563
+ d8 8-byte signed decimal
524
564
u1 1-byte unsigned decimal
525
565
u2 2-byte unsigned decimal
526
566
u4 4-byte unsigned decimal
567
+ u8 8-byte unsigned decimal
527
568
x1 1-byte unsigned hexadecimal
528
569
x2 2-byte unsigned hexadecimal
529
570
x4 4-byte unsigned hexadecimal
571
+ x8 8-byte unsigned hexadecimal
530
572
531
573
This option overrides other formatting options.
532
574
0 commit comments