Changeset 612 for trunk/user


Ignore:
Timestamp:
Jan 11, 2019, 6:35:07 PM (3 years ago)
Author:
alain
Message:

Fix several bugs in vfs.c, fatfs.c, and devfs.c to support
the <.> and <..> directory entries.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/user/ksh/ksh.c

    r611 r612  
    758758    DIR            * dir;
    759759
    760         if (argc != 2 )
     760        if (argc > 2 )
    761761    {
    762762                printf("  usage: ls [path]\n");
     
    764764    else
    765765    {
    766 
    767 // handle case with no argument
    768 // TODO if ( argc == 1 ) path = ".";
     766        // handle case with no argument
    769767
    770768        // get target directory path
    771         pathname = argv[1];
     769        if ( argc == 1 ) strcpy( pathname , "." );
     770        else             pathname = argv[1];
    772771
    773772        // open target directory
     
    788787        while ( (entry = readdir(dir)) != NULL )
    789788            {
    790                     printf(" - %s\n", entry->d_name);
     789                    printf("%s\n", entry->d_name);
    791790            }
    792791
Note: See TracChangeset for help on using the changeset viewer.