f = strchr(f, '\n');
if (f)
*(f++) = '\0';
- nullTrailingSpace(Bootorder[i]);
+ Bootorder[i] = nullTrailingSpace(Bootorder[i]);
dprintf(1, "%d: %s\n", i+1, Bootorder[i]);
i++;
} while (f);
next = strchr(linkname, '\n');
if (next)
*next++ = '\0';
- while (*linkname && *linkname <= ' ')
- linkname++;
char *comment = strchr(linkname, '#');
if (comment)
*comment = '\0';
- nullTrailingSpace(linkname);
+ linkname = nullTrailingSpace(linkname);
char *destname = strchr(linkname, ' ');
if (!destname)
continue;
*destname++ = '\0';
- while (*destname && *destname <= ' ')
- destname++;
+ destname = nullTrailingSpace(destname);
// Lookup destname and create new romfile entry for linkname
struct romfile_s *ufile = romfile_find(destname);
if (!ufile)
}
// Remove any trailing blank characters (spaces, new lines, carriage returns)
-void
+char *
nullTrailingSpace(char *buf)
{
int len = strlen(buf);
char *end = &buf[len-1];
while (end >= buf && *end <= ' ')
*(end--) = '\0';
+ while (*buf && *buf <= ' ')
+ buf++;
+ return buf;
}
void *memmove(void *d, const void *s, size_t len);
char *strtcpy(char *dest, const char *src, size_t len);
char *strchr(const char *s, int c);
-void nullTrailingSpace(char *buf);
+char *nullTrailingSpace(char *buf);
#endif // string.h