/* Sleeps until CD/DVD/etc tray is closed. Perfect for writing * shell/perl scripts to impliment mass burning. * * -MadCamel 2004, public domain */ #define CDDEV "/dev/cdr" #include #include #include #include #include #include #include #include #include #include #include #include int main() { int fd; if ((fd = open(CDDEV, O_RDONLY|O_NONBLOCK)) < 0) { perror(CDDEV); return(1); } while ((ioctl(fd, CDROM_DRIVE_STATUS, NULL)) == CDS_TRAY_OPEN) sleep(1); }