Pete's Log: it's globtastic

Entry #619, (Coding, Hacking, & CS stuff)
(posted when I was 22 years old.)

Alright, that was much easier than expected. In less than 90 lines and less than one hour, I implemented a standalone directory glob matcher. It's even relatively quick, provided you don't let it loose on /afs. Doh! Someday I'll remember that doing a readdir of /afs is a bad idea. Stupid non nd.edu cells. But it handles stuff like /usr/include/*/*.h and /h*/pr*jk*/*/*/*.c without any trouble or too much delay. The latter matched 137 files and took under 0.04 seconds of CPU time to run. So I'll consider it quick enough for my intents.

Adding the stuff to the parser code took a bit more, since there were a variety of issues to deal with other than simply scanning a directory for matches. And of course I made a wide variety of stupid mistakes in merging the two bits of code together. But in the end, victory was mine. My shell parsing code now supports globs. Yay!