1
0
mirror of https://github.com/livingcomputermuseum/pdp7-unix.git synced 2026-02-09 18:01:55 +00:00

Added command line options to enable . and ..

This commit is contained in:
Warren Toomey
2016-03-17 09:08:37 +10:00
parent b3b868ed50
commit fbbe0c6729

View File

@@ -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();