@@ -65,6 +65,7 @@ static int record_number;
65
65
static int format ;
66
66
static int word_bytes ;
67
67
static word_t file_bytes ;
68
+ static word_t file_octets ;
68
69
69
70
/*
70
71
Format:
@@ -450,57 +451,54 @@ read_tape_header (FILE *f, word_t word)
450
451
return word ;
451
452
}
452
453
454
+ static void
455
+ print_info (FILE * f , word_t * fdb )
456
+ {
457
+ int bits_per_byte , file_words ;
458
+
459
+ print_timestamp (f , fdb [5 ]);
460
+ fprintf (f , " %4d" , right (fdb [011 ]));
461
+ file_bytes = fdb [012 ];
462
+ bits_per_byte = (fdb [011 ] >> 24 ) & 077 ;
463
+ word_bytes = bits_per_byte ? 36 / bits_per_byte : 0 ;
464
+ file_words = file_bytes / word_bytes ;
465
+ file_octets = 5 * file_words ;
466
+ file_octets += ((file_bytes % word_bytes ) * bits_per_byte + 7 ) / 8 ;
467
+ fprintf (f , " %lld(%d)\n" ,
468
+ file_bytes , bits_per_byte );
469
+ }
470
+
453
471
static void
454
472
read_file (int offset )
455
473
{
456
- int bits_per_byte ;
457
474
char * p ;
458
475
459
476
if (offset != 0206 )
460
477
{
478
+ if (format == 0 )
479
+ print_info (stderr , block + offset );
480
+
461
481
if (output != NULL )
462
482
close_file ();
463
- return ;
464
483
}
484
+ else
485
+ {
486
+ read_asciz (file_path , & data [0 ]);
465
487
466
- read_asciz (file_path , & data [0 ]);
467
-
468
- p = strchr (file_path , ';' );
469
- if (format == 0 && p != NULL )
470
- p = strchr (p + 1 , ';' );
471
- if (p )
472
- * p = 0 ;
473
-
474
- fprintf (stderr , " %-40s" , file_path );
475
- print_timestamp (stderr , block [offset + 5 ]);
476
- fprintf (stderr , " %4d" , right (block [offset + 011 ]));
477
- file_bytes = block [offset + 012 ];
478
- bits_per_byte = (block [offset + 011 ] >> 24 ) & 077 ;
479
- word_bytes = bits_per_byte ? 36 / bits_per_byte : 0 ;
480
- fprintf (stderr , " %lld(%d)\n" ,
481
- file_bytes , bits_per_byte );
488
+ p = strchr (file_path , ';' );
489
+ if (format == 0 && p != NULL )
490
+ p = strchr (p + 1 , ';' );
491
+ if (p )
492
+ * p = 0 ;
482
493
483
- if (extract )
484
- open_file ();
494
+ fprintf (stderr , " %-40s" , file_path );
485
495
486
- #if 0
487
- fprintf (stderr , "006: %012llo file file_path\n" , data [0 ]);
488
- fprintf (stderr , "Timestamp, last write: " );
489
- print_timestamp (stderr , block [offset + 5 ]);
490
- fputc ('\n' , stderr );
491
- fprintf (stderr , "Timestamp, creation: " );
492
- print_timestamp (stderr , block [offset + 013 ]);
493
- fputc ('\n' , stderr );
494
- fprintf (stderr , "Timestamp, user write: " );
495
- print_timestamp (stderr , block [offset + 014 ]);
496
- fputc ('\n' , stderr );
497
- fprintf (stderr , "Timestamp, last nonwrite: " );
498
- print_timestamp (stderr , block [offset + 015 ]);
499
- fputc ('\n' , stderr );
496
+ if (format > 0 )
497
+ print_info (stderr , block + offset );
500
498
501
- for ( i = offset ; i < offset + 030 ; i ++ )
502
- fprintf ( stderr , "%03o: %012llo\n" , i , block [ i ] );
503
- #endif
499
+ if ( extract )
500
+ open_file ( );
501
+ }
504
502
}
505
503
506
504
static void
0 commit comments