[syslinux] rosh patch V2, while readdir
Geert Stappers
stappers at stappers.nl
Sun Apr 12 02:49:40 PDT 2009
Op 20090306 om 21:41 schreef Keith Schincke:
> Here is a second version of my patch from last night.
>
> It uses the provided ctype function isspace and does the same readdir().
> I remove the rosh_issp() function. I admit to being a bit liberal with my
> use of braces and spaces.
>
> We all of the habit of knowing we can invent a more perfect wheel.
>
> Let me know if you have any questions.
>
> Keith
as reminder, the while readdir part
diff --git a/com32/rosh/rosh.c b/com32/rosh/rosh.c
index b42af58..dc3f64d 100644
--- a/com32/rosh/rosh.c
+++ b/com32/rosh/rosh.c
@@ -369,8 +369,7 @@ ROSH_DEBUG("--'%s'\n", filestr);
if (S_ISDIR(fdstat.st_mode)) {
ROSH_DEBUG("PATH '%s' is a directory\n", ifilstr);
d = fdopendir(fd);
- de = readdir(d);
- while (de != NULL) {
+ while ( de = readdir(d) ) {
#ifdef DO_DEBUG
filestr2[0] = 0;
file2pos = strlen(filestr);
@@ -386,7 +385,6 @@ ROSH_DEBUG("--'%s'\n", filestr);
#ifdef DO_DEBUG
// inchar = fgetc(stdin);
#endif /* DO_DEBUG */
- de = readdir(d);
}
closedir(d);
} else if (S_ISREG(fdstat.st_mode)) {
@@ -404,8 +402,7 @@ ROSH_DEBUG("--'%s'\n", filestr);
d = opendir(filestr);
if (d != NULL) {
printf("DIR:'%s' %8d %8d\n", d->dd_name, d->dd_fd, d->dd_sect);
- de = readdir(d);
- while (de != NULL) {
+ while ( de = readdir(d) ) {
filepos++;
#ifdef DO_DEBUG
// if (strlen(de->d_name) > 25) de->d_name[25] = 0;
@@ -423,7 +420,6 @@ printf("'%s'\n", de->d_name);
// fgets(instr, ROSH_CMD_SZ, stdin);
#endif /* DO_DEBUG */
free(de);
- de = readdir(d);
// if(filepos>15){ de = NULL; printf("Force Break\n");}
}
printf("Dir.dd_fd: '%8d'\n", d->dd_fd);
More information about the Syslinux
mailing list