aboutsummaryrefslogtreecommitdiffstats
path: root/com32/rosh/rosh.c
diff options
context:
space:
mode:
authorLiu Aleaxander <Aleaxander@gmail.com>2009-08-27 07:37:44 +0800
committerLiu Aleaxander <Aleaxander@gmail.com>2009-08-27 07:37:44 +0800
commit6fcebf4ed2be8de96ff106c3755c7776f1c66804 (patch)
treeec1e010f2f2620dde41dd311a72030a305a0a445 /com32/rosh/rosh.c
parentedfcc9f1e582d0adb4da88330505771eccd59e6a (diff)
downloadsyslinux-6fcebf4ed2be8de96ff106c3755c7776f1c66804.tar.gz
syslinux-6fcebf4ed2be8de96ff106c3755c7776f1c66804.tar.xz
syslinux-6fcebf4ed2be8de96ff106c3755c7776f1c66804.zip
Core: opendir/readdir/closedir stuff added
Here're some big changes: 1. The vfs-dir stuff added. 2. The dir-functions in com32/lib are mostly rewritten. 3. with little change on rosh for avoid the compile error Well, I don't think it's a good vfs-dir interface. Signed-off-by: Liu Aleaxander <Aleaxander@gmail.com>
Diffstat (limited to 'com32/rosh/rosh.c')
-rw-r--r--com32/rosh/rosh.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/com32/rosh/rosh.c b/com32/rosh/rosh.c
index 631c780e..c634a940 100644
--- a/com32/rosh/rosh.c
+++ b/com32/rosh/rosh.c
@@ -389,7 +389,7 @@ void rosh_dir_arg(const char *ifilstr, const char *pwdstr)
ROSH_DEBUG("--'%s'\n", filestr);
}
fd = open(filestr, O_RDONLY);
- if (fd != -1) {
+ if (fd == -1) {
status = fstat(fd, &fdstat);
if (S_ISDIR(fdstat.st_mode)) {
ROSH_DEBUG("PATH '%s' is a directory\n", ifilstr);
@@ -428,14 +428,14 @@ void rosh_dir_arg(const char *ifilstr, const char *pwdstr)
filepos = 0;
d = opendir(filestr);
if (d != NULL) {
- printf("DIR:'%s' %08x %8d\n", d->dd_name, d->dd_fd,
- d->dd_sect);
+ printf("DIR:'%s' %08x %8d\n", d->dd_name, (int)d->dd_sect,
+ d->dd_offset);
de = readdir(d);
while (de != NULL) {
filepos++;
#ifdef DO_DEBUG
// if (strlen(de->d_name) > 25) de->d_name[25] = 0;
- switch (de->d_mode) {
+ switch (de->d_type) {
case 16:
ty = 'D';
break;
@@ -445,8 +445,6 @@ void rosh_dir_arg(const char *ifilstr, const char *pwdstr)
default:
ty = '*';
}
- printf("@%8d:%8d:%4d ", (int)de->d_ino, (int)de->d_size,
- de->d_mode);
#endif /* DO_DEBUG */
// printf("%s\n", de->d_name);
printf("'%s'\n", de->d_name);
@@ -458,7 +456,6 @@ void rosh_dir_arg(const char *ifilstr, const char *pwdstr)
de = readdir(d);
// if(filepos>15){ de = NULL; printf("Force Break\n");}
}
- printf("Dir.dd_fd: '%8d'\n", d->dd_fd);
closedir(d);
} else {
rosh_error(0, "dir:NULL", filestr);