Added command line options to enable . and ..
This commit is contained in:
+12
-2
@@ -55,7 +55,7 @@ use constant D_UNIQ => 5;
|
|||||||
use constant D_NUMWORDS => 8; # Eight words in a direntry
|
use constant D_NUMWORDS => 8; # Eight words in a direntry
|
||||||
|
|
||||||
# Globals
|
# Globals
|
||||||
my $debug = 0;
|
my ($debug,$wantdot,$wantdotdot)=(0,0,0);
|
||||||
my @Block; # Array of blocks and words in each block
|
my @Block; # Array of blocks and words in each block
|
||||||
my @Freelist; # List of free block numbers
|
my @Freelist; # List of free block numbers
|
||||||
my $nextinum = 1; # i-num 0 is never used
|
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] );
|
dprintf("Added a dd entry to i-num %d\n", $Dirstack[0]->[2] );
|
||||||
|
|
||||||
# Also add a "." entry to this directory
|
# Also add a "." entry to this directory
|
||||||
|
if ($wantdot) {
|
||||||
add_direntry( ".", $inum );
|
add_direntry( ".", $inum );
|
||||||
dprint("Added a . entry to ourselves\n");
|
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",
|
dprintf( "Made directory %s perms %06o uid %d in inum %d\n\n",
|
||||||
$dirname, $perms, $uid, $inum );
|
$dirname, $perms, $uid, $inum );
|
||||||
@@ -617,10 +625,12 @@ sub usage {
|
|||||||
|
|
||||||
### MAIN PROGRAM
|
### MAIN PROGRAM
|
||||||
|
|
||||||
my ( $format, $output ) = ( "list", "image.fs" );
|
my ( $format, $output ) = ( "simh", "image.fs" );
|
||||||
|
|
||||||
GetOptions(
|
GetOptions(
|
||||||
'debug|d' => \$debug,
|
'debug|d' => \$debug,
|
||||||
|
'dot|1' => \$wantdot,
|
||||||
|
'dotdot|2' => \$wantdotdot,
|
||||||
'format|f=s' => \$format,
|
'format|f=s' => \$format,
|
||||||
'output|o=s' => \$output,
|
'output|o=s' => \$output,
|
||||||
) or usage();
|
) or usage();
|
||||||
|
|||||||
Reference in New Issue
Block a user