     filename get tar-append-path make-directories ;
 
 ! Multi volume continuation entry
-: typeflag-M ( header -- )
-    <unimplemented-typeflag> throw ;
+: typeflag-M ( header -- ) unknown-typeflag ;
 
 ! GNU long file name
-: typeflag-N ( header -- )
-    <unimplemented-typeflag> throw ;
+: typeflag-N ( header -- ) unknown-typeflag ;
 
 ! Sparse file
-: typeflag-S ( header -- )
-    <unimplemented-typeflag> throw ;
+: typeflag-S ( header -- ) unknown-typeflag ;
 
 ! Volume header
-: typeflag-V ( header -- )
-    <unimplemented-typeflag> throw ;
+: typeflag-V ( header -- ) unknown-typeflag ;
 
 ! Vendor extended header type
-: typeflag-X ( header -- )
-    <unimplemented-typeflag> throw ;
+: typeflag-X ( header -- ) unknown-typeflag ;
 
 : (parse-tar) ( -- )
     512 read 

        ] keep
    ] if ;

TUPLE: unknown-typeflag str ;
: <unknown-typeflag> ( ch -- obj )
    1string \ unknown-typeflag construct-boa ;

TUPLE: unimplemented-typeflag header ;
: <unimplemented-typeflag> ( header -- obj )
    global [ "Unimplemented typeflag: " print dup . flush ] bind
    tar-header-typeflag
    1string \ unimplemented-typeflag construct-boa ;

: tar-append-path ( path -- newpath )
    base-dir get prepend-path ;

! Normal file
: typeflag-0
  tar-header-name tar-append-path binary <file-writer>
  [ read-data-blocks ] keep dispose ;

! Hard link
: typeflag-1 ( header -- )
   <unimplemented-typeflag> throw ;

! Symlink
: typeflag-2 ( header -- )
    <unimplemented-typeflag> throw ;

! character special
: typeflag-3 ( header -- )
    <unimplemented-typeflag> throw ;

! Block special
: typeflag-4 ( header -- )
    <unimplemented-typeflag> throw ;

! Directory
: typeflag-5 ( header -- )
    tar-header-name tar-append-path make-directories ;

! FIFO
: typeflag-6 ( header -- )
    <unimplemented-typeflag> throw ;

! Contiguous file
: typeflag-7 ( header -- )
    <unimplemented-typeflag> throw ;

! Global extended header
: typeflag-8 ( header -- )
    <unimplemented-typeflag> throw ;

! Extended header
: typeflag-9 ( header -- )
    <unimplemented-typeflag> throw ;

! Global POSIX header
: typeflag-g ( header -- )
    <unimplemented-typeflag> throw ;

! Extended POSIX header
: typeflag-x ( header -- )
    <unimplemented-typeflag> throw ;

! Solaris access control list
: typeflag-A ( header -- )
    <unimplemented-typeflag> throw ;

! GNU dumpdir
: typeflag-D ( header -- )
    <unimplemented-typeflag> throw ;

! Solaris extended attribute file
: typeflag-E ( header -- )
    <unimplemented-typeflag> throw ;

! Inode metadata
: typeflag-I ( header -- )
    <unimplemented-typeflag> throw ;

! Long link name
: typeflag-K ( header -- )
    <unimplemented-typeflag> throw ;

! Long file name
: typeflag-L ( header -- )

            { CHAR: S [ typeflag-S ] }
            { CHAR: V [ typeflag-V ] }
            { CHAR: X [ typeflag-X ] }
            [ unknown-typeflag ]
        } case
        ! dup tar-header-size zero? [
            ! out-stream get [ dispose ] when
