@@ -65,6 +65,7 @@ static int record_number;
6565static int format ;
6666static int word_bytes ;
6767static word_t file_bytes ;
68+ static word_t file_octets ;
6869
6970/*
7071Format:
@@ -450,57 +451,54 @@ read_tape_header (FILE *f, word_t word)
450451 return word ;
451452}
452453
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+
453471static void
454472read_file (int offset )
455473{
456- int bits_per_byte ;
457474 char * p ;
458475
459476 if (offset != 0206 )
460477 {
478+ if (format == 0 )
479+ print_info (stderr , block + offset );
480+
461481 if (output != NULL )
462482 close_file ();
463- return ;
464483 }
484+ else
485+ {
486+ read_asciz (file_path , & data [0 ]);
465487
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 ;
482493
483- if (extract )
484- open_file ();
494+ fprintf (stderr , " %-40s" , file_path );
485495
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 );
500498
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+ }
504502}
505503
506504static void
0 commit comments