You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.9 KiB

# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# T2 SDE: package/.../kiss/eject_feature.patch
# Copyright (C) 2004 - 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# --- T2-COPYRIGHT-NOTE-END ---
An eject functionality is rather handy on software controlled CD-ROM
laptops (e.g. Apple ones) ...
- Rene Rebe <rene@exactcode.de>
--- 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 <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);
+}
--- 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);