diff --git a/bin/ls/main.c b/bin/ls/main.c index a3e47f8..e87ab35 100644 --- a/bin/ls/main.c +++ b/bin/ls/main.c @@ -30,6 +30,7 @@ #include #include #include +#include #define permRead 0x8 @@ -56,12 +57,15 @@ #define typeDirectory 4 #define typeDeleted 8 -int main(int argc,char **argv) { - int i = 0x0,x = 0x0,tmpPerms = 0x0; - char *pwd = 0x0; - char *permsData = 0x0; - FILE *fd; - struct directoryEntry *dirEntry = 0x0; +int main( int argc, char **argv ) { + + int i = 0x0, x = 0x0, tmpPerms = 0x0; + char *pwd = 0x0; + char *permsData = 0x0; + FILE *fd = 0x0; + DIR *dir = 0x0; + + struct directoryEntry *dirEntry = 0x0; unsigned int *segbase = 0x0; @@ -97,14 +101,28 @@ } else { getcwd(pwd,256); -printf("PWD3: %s\n", pwd); + printf("PWD3: %s\n", pwd); + + /* MrOlsen fd = fopen(argv[1],"rb"); if (fd->fd == 0x0) { printf("Error: Reading Directory\n"); exit(1); - } + } + + */ } + dir = opendir( argv[1] ); + + if( dir == 0x0 ) { + + printf("Error: Opening Directory: %s\n", argv[1] ); + + exit(1); + + } + exit(0); dirEntry = (struct directoryEntry *)malloc(fd->size);