// A test program for GeekOS user mode

#include "libuser.h"
#include "libio.h"

void PrintDirectory(char *name)
{
    int fd;

    // read the directory
    fd = Open(name, O_READ);
    if (fd < 0) {
	Printf("Error unable to open %s\n", name);
	return;
    }
    else {
       Printf("Opened %s successfully\n", name);
       Close(fd);
       return;
    }
}

int Main( int argc, char **argv )
{
    if (argc != 2) {
        Printf("Usage: ls <filename>\n");
	Exit();
    }

    PrintDirectory(argv[1]);

    return 0;
}