[syslinux] rosh patch
Keith Schincke
keith.schincke at gmail.com
Thu Mar 5 19:13:16 PST 2009
Hey Guys,
Below is a patch for the com32/rosh/rosh.c from tonights syslinx git.
The patch does the following:
1) changes the rosh_issp to use an if instead of a case for this simple
test.
2) changes the rosh_dir_arg function to move the readdir() to inside the
while test.
This will let me go through my APUE book.
Let me know if you have any questions.
Keith
--- rosh.orig 2009-03-05 20:32:59.000000000 -0500
+++ rosh.c 2009-03-05 22:09:55.000000000 -0500
@@ -60,11 +60,11 @@
*/
int rosh_issp(char inc)
{
- int rv;
- switch (inc){
- case ' ': case '\t':
- rv = 1; break;
- default: rv = 0;
+ int rv = 0 ;
+
+ if ( ( inc == ' ') || ( inc == '\t') )
+ {
+ rv = 1 ;
}
return rv;
} /* ros_issp */
@@ -384,8 +384,7 @@
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);
@@ -401,7 +400,6 @@
#ifdef DO_DEBUG
// inchar = fgetc(stdin);
#endif /* DO_DEBUG */
- de = readdir(d);
}
closedir(d);
} else if (S_ISREG(fdstat.st_mode)) {
@@ -419,8 +417,7 @@
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;
@@ -438,7 +435,6 @@
// 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