It looks like glob() subsumes the function of readdir(). There are some nasty details with allocated results, too...
You could, however, combine fnmatch() with readdir(). http://linux.die.net/man/3/fnmatch On Tue, 2014-07-08 at 11:44 +0800, Elias Mårtenson wrote: > How about adding support for a dyadic form where the left-side > argument is a glob pattern to be used when matching the file names? > > > http://linux.die.net/man/3/glob > > > > Regards, > Elias > > > On 8 July 2014 00:52, David Lamkins <dlamk...@gmail.com> wrote: > Thanks, Jüergen. I'll change my code tonight to use the new > calls. > > > I like your solution to readdir() access. I fell asleep last > night pondering how best to do that. > > > On Mon, Jul 7, 2014 at 9:44 AM, Juergen Sauermann > <juergen.sauerm...@t-online.de> wrote: > Hi David, > > I have added rename (FILE_IO[27]), SVN 364. > > I didn't do readdir() because that would need you to > opendir(), > loop around readdir() and closedir(). > > Instead FILE_IO[28] returns the entire directory as a > matrix in one go. > > Every row is a dirent struct but with a different > order: > > filename > d_ino; /* inode number */ > d_off; /* not an offset; see NOTES */ > d_reclen; /* length of this record */ > d_type; /* type of file; not supported > > The reason for the different order is that not all > fields are present in every file system, > so I thought I should put all non-optional fields > before the optional field, making the columns > of the result more portable. > > > /// Jürgen > > > > > > On 07/07/2014 09:31 AM, David B. Lamkins wrote: > > > There are two functions that I'd like to access via > lib_file_io: > > readdir() and rename(). > > > > I'm currently implementing these via popen() through > lib_file_io, but > > that seems inelegant... > > > > I have immediate application for these calls in the > component file > > library. > > > > > > > > > > > > > -- > "Far out in the uncharted backwaters of the unfashionable end > of the Western Spiral arm of the Galaxy lies a small > unregarded yellow sun. Orbiting this at a distance of roughly > ninety-eight million miles is an utterly insignificant little > blue-green planet whose ape-descended life forms are so > amazingly primitive that they still think programming in Java > is a pretty neat idea." > > -- With apologies to Douglas Adams, who I like to think would > have appreciated this. > > > http://soundcloud.com/davidlamkins > http://reverbnation.com/lamkins > http://reverbnation.com/lcw > http://lamkins-guitar.com/ > http://lamkins.net/ > http://successful-lisp.com/ > >