     drop ;
     ! <string-writer> [ read-data-blocks ] keep
     ! >string [ zero? ] trim-tail filename set
-    ! filename get tar-prepend-path make-directories ;
+    ! filename get prepend-current-directory make-directories ;
 
 ! Multi volume continuation entry
 : typeflag-M ( header -- ) unknown-typeflag ;

    ] if ;

: parse-tar-header ( seq -- obj )
    [ header-checksum ] keep over zero-checksum = [
        2drop
        \ tar-header new
            0 >>size
            0 >>checksum
    ] [
        [ read-tar-header ] with-string-reader
        [ checksum>> = [ checksum-error ] unless ] keep
    ] if ;

ERROR: unknown-typeflag ch ;
M: unknown-typeflag summary ( obj -- str )
    ch>> 1string "Unknown typeflag: " prepend ;

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

: read/write-blocks ( tar-header path -- )
    binary [ read-data-blocks ] with-file-writer ;

! Normal file
: typeflag-0 ( header -- )
    dup name>> tar-prepend-path read/write-blocks ;

! Hard link
: typeflag-1 ( header -- ) unknown-typeflag ;


! Directory
: typeflag-5 ( header -- )
    name>> prepend-current-directory make-directories ;

! FIFO
: typeflag-6 ( header -- ) unknown-typeflag ;
