cdir and cdown for MacOS X

This is a quick hack to get cdir and cdown from the cdtool package running on MacOS X. It requires at least version 10.2 of MacOS X.

This has not been tested on CD-ROM drives which are not also burners. Due to some oddities in the way one locates and accesses CD-ROM drives under MacOS X, I'm not positive such devices will work. If you try it, let me know if it works (or doesn't work).

I didn't port the CD playing portion of cdtool, since recent Macs (including mine) don't support playing CD audio except via digital audio extraction. I tried to get cdeject to work, but the OS refuses to open the tray, even if the CD is unmounted first. You can use it to close the tray, though. :-P

Changes in version 4: All sessions are now properly displayed (including multiple audio sessions). Also, the bug in version 3 preventing single-session CDs from working has been fixed.

Changes in version 3: now detects the end of the first session and does not allow audio tracks to extend past that point. This will help mixed audio/data CDs, where there's a substantial gap between sessions that previously was added to the end of the final audio track. This will keep multiple audio sessions from working, though; ideally, it would check for the end of the last audio session instead.

Changes in version 2: now supports multiple CD-ROM drives. You can select between them by passing a number (corresponding to the order in which it finds the drives, not the /dev numbering) as the device string.

I can be contacted at crystal@buserror.net. Note that I don't run MacOS X any more, so I don't plan on doing any more work on this port. I don't know if it runs on more recent versions of MacOS X.
You can find other things I've done on my homepage, including a port of cdparanoia to MacOS X.