Browse Source

added an eject command to kiss

git-svn-id: http://www.rocklinux.org/svn/rock-linux/trunk@2060 c5f82cb5-29bc-0310-9cd0-bff59a50e3bc
rocklinux
Rene Rebe 21 years ago
parent
commit
c6609c9159
2 changed files with 74 additions and 0 deletions
  1. +1
    -0
      Documentation/Developers/CHANGELOG-RENE
  2. +73
    -0
      package/base/kiss/eject_feature.patch

+ 1
- 0
Documentation/Developers/CHANGELOG-RENE

@ -2,6 +2,7 @@
*) 2003-12-25 (2.0.0-rc3 - 2.0.0-rc4)
- ALSA OSS emulation and no IDESCSI for 2.6
- added a eject command to kiss
*) 2003-12-24 (2.0.0-rc3 - 2.0.0-rc4)

+ 73
- 0
package/base/kiss/eject_feature.patch

@ -0,0 +1,73 @@
An eject functionality is rather handy on software controlled CD-ROM
laptops (e.g. Apple ones) ...
- Rene Rebe <rene@rocklinux.org>
--- 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 <linux/cdrom.h>
+
+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 },
--- kiss-0.21/src/kiss.h 1998-09-25 14:07:10.000000000 +0200
+++ kiss-0.21-rxr/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);

Loading…
Cancel
Save