An eject functionality is rather handy on software controlled CD-ROM laptops (e.g. Apple ones) ... - Rene Rebe --- ./src/Makefile 1998-09-25 14:07:09.000000000 +0200 +++ ./src/Makefile 2003-12-24 21:47:07.000000000 +0100 @@ -66,7 +66,7 @@ addstringstack.o expandtilde.o splitcmd.o addstringtostack.o \ dokill.o dogrep.o dochown.o dosleep.o expandbackquotes.o dols.o \ listdir.o listfile.o listoutput.o domknod.o dowc.o domount.o \ - doumount.o dotouch.o + doumount.o dotouch.o doeject.o # entry point for making foo: --- ./src/doeject.c 1970-01-01 01:00:00.000000000 +0100 +++ ./src/doeject.c 2003-12-24 22:03:09.000000000 +0100 @@ -0,0 +1,33 @@ +#include "kiss.h" + +#include + +int doeject (Stringstack s) +{ + register int + i; + + /* need at least one arg */ + if (s.nstr == 1) { + error ("Bad commandline.\n" + "Usage: %s device\n", progname); + return (0); + } + + for (i = 1; i < s.nstr; i++) { + int status; + int fd = open(s.str[i], O_RDONLY|O_NONBLOCK); + + if (fd == -1) { + warning ("%s: unable to open %s\n", progname, s.str[i]); + continue; + } + + status = ioctl(fd, CDROMEJECT); + if (status != 0) { + error ("%s: failed\n"); + } + close (fd); + } + return (0); +} --- ./src/kiss.c 1998-09-25 14:07:10.000000000 +0200 +++ ./src/kiss.c 2003-12-24 21:34:31.000000000 +0100 @@ -32,6 +32,7 @@ { "chown", dochown, 0 }, { "cp", docp, 0 }, { "echo", doecho, 0 }, + { "eject", doeject, 0 }, { "exec", doexec, 1 }, { "exit", doquit, 1 }, { "grep", dogrep, 0 }, --- ./srx/kiss.h 1998-09-25 14:07:10.000000000 +0200 +++ ./src/kiss.h 2003-12-24 21:33:24.000000000 +0100 @@ -194,6 +194,7 @@ extern int dochown (Stringstack s); extern int docp (Stringstack s); extern int doecho (Stringstack s); +extern int doeject (Stringstack s); extern int doexec (Stringstack s); extern int dogrep (Stringstack s); extern int dohelp (Stringstack s);