#include "types.h"
#include "dir.h"
#include "stdio.h"

_main(argc,argv)
int argc;
char **argv;
{
	if (argc < 2)
		ls(".");
	else
		ls(argv[1]);
	exit(0);
}


ls(path)
char *path;
{
    struct direct buf;
    FILE *d;
    
    d = fopen(path,"r");
    if (d == NULL)
    {
	perror(path);
	return;
    }

    while (fread(&buf,sizeof(buf),1,d))
    {
	if (buf.d_name[0] == '\0' || buf.d_ino == 0)
	    continue;

	printf("%14s\n",buf.d_name);
    }

    fclose(d);
}

