Mail Archives: djgpp-workers/2000/12/31/14:19:10
> > strcpy (lowername, name);
> > strlwr (lowername);
> > if (strcmp (name, lowername) != 0) {
> > printf ("%s -> %s\n", name, lowername);
> > if (rename (name, lowername) != 0) {
> This is not supposed to work with stock v2.03. I only committed
> yesterday the changes that make this work, so before that, even the
> CVS version won't DTRT.
I'll admit that this particular code was taken from a tool written for
Linux (except for the added __opendir_flags). And, upon testing, it
indeed doesn't work.
But I've been using a similar tool (relevant snippet below) since 1998,
and it has always worked just fine, so I had no reason to think it
wouldn't work. Guess it matters that below, both args to rename() are
lowercase.
== snippet start
DIR *d = opendir(".");
struct dirent *de;
while (de = readdir(d))
{
if (DirsToo || (access(de->d_name, D_OK)))
rename (de->d_name, strlwr(de->d_name));
}
== end snippet
- Raw text -