diff --git a/tools/mkfs7 b/tools/mkfs7 index 52a4806..6f8839b 100755 --- a/tools/mkfs7 +++ b/tools/mkfs7 @@ -55,7 +55,7 @@ use constant D_UNIQ => 5; use constant D_NUMWORDS => 8; # Eight words in a direntry # Globals -my $debug = 0; +my ($debug,$wantdot,$wantdotdot)=(0,0,0); my @Block; # Array of blocks and words in each block my @Freelist; # List of free block numbers my $nextinum = 1; # i-num 0 is never used @@ -334,8 +334,16 @@ sub make_dir { dprintf("Added a dd entry to i-num %d\n", $Dirstack[0]->[2] ); # Also add a "." entry to this directory - add_direntry( ".", $inum ); - dprint("Added a . entry to ourselves\n"); + if ($wantdot) { + add_direntry( ".", $inum ); + dprint("Added a . entry to ourselves\n"); + } + + # and a ".." directory to the previous one on the stack + if ($wantdotdot && defined($Dirstack[-2])) { + add_direntry( "..", $Dirstack[-2]->[2] ); + dprintf("Added a .. entry to i-num %d\n", $Dirstack[-2]->[2] ); + } dprintf( "Made directory %s perms %06o uid %d in inum %d\n\n", $dirname, $perms, $uid, $inum ); @@ -617,10 +625,12 @@ sub usage { ### MAIN PROGRAM -my ( $format, $output ) = ( "list", "image.fs" ); +my ( $format, $output ) = ( "simh", "image.fs" ); GetOptions( 'debug|d' => \$debug, + 'dot|1' => \$wantdot, + 'dotdot|2' => \$wantdotdot, 'format|f=s' => \$format, 'output|o=s' => \$output, ) or usage();