An eject functionality is rather handy on software controlled CD-ROM laptops (e.g. Apple ones) ... - Rene Rebe --- kiss-0.21/src/Makefile 1998-09-25 14:07:09.000000000 +0200 +++ kiss-0.21-eject/src/Makefile 2004-03-06 15:11:57.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: --- kiss-0.21/src/doeject.c 1970-01-01 01:00:00.000000000 +0100 +++ kiss-0.21-eject/src/doeject.c 2004-03-06 17:08:46.000000000 +0100 @@ -0,0 +1,37 @@ +#include "kiss.h" + +#if __GNUC__ == 3 && __GNUC_MINOR__ > 2 +#define __attribute_const__ __attribute__ ((const)) +#endif + +#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); +} --- kiss-0.21/src/kiss.c 1998-09-25 14:07:10.000000000 +0200 +++ kiss-0.21-eject/src/kiss.c 2004-03-06 15:11:57.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 }, --- kiss-0.21/src/kiss.h 1998-09-25 14:07:10.000000000 +0200 +++ kiss-0.21-eject/src/kiss.h 2004-03-06 15:11:57.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);