Dash:
[t2.git] / package / shells / kiss / eject_feature.patch
blobcb4b44cafcd408f74b98d4b6ed0307df9684b8cb
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../kiss/eject_feature.patch
5 # Copyright (C) 2004 - 2005 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 # --- T2-COPYRIGHT-NOTE-END ---
16 An eject functionality is rather handy on software controlled CD-ROM
17 laptops (e.g. Apple ones) ...
19 - Rene Rebe <rene@exactcode.de>
22 --- kiss-0.21/src/Makefile 1998-09-25 14:07:09.000000000 +0200
23 +++ kiss-0.21-eject/src/Makefile 2004-03-06 15:11:57.000000000 +0100
24 @@ -66,7 +66,7 @@
25 addstringstack.o expandtilde.o splitcmd.o addstringtostack.o \
26 dokill.o dogrep.o dochown.o dosleep.o expandbackquotes.o dols.o \
27 listdir.o listfile.o listoutput.o domknod.o dowc.o domount.o \
28 - doumount.o dotouch.o
29 + doumount.o dotouch.o doeject.o
31 # entry point for making
32 foo:
33 --- kiss-0.21/src/doeject.c 1970-01-01 01:00:00.000000000 +0100
34 +++ kiss-0.21-eject/src/doeject.c 2004-03-06 17:08:46.000000000 +0100
35 @@ -0,0 +1,37 @@
36 +#include "kiss.h"
38 +#if __GNUC__ == 3 && __GNUC_MINOR__ > 2
39 +#define __attribute_const__ __attribute__ ((const))
40 +#endif
42 +#include <linux/cdrom.h>
44 +int doeject (Stringstack s)
46 + register int
47 + i;
49 + /* need at least one arg */
50 + if (s.nstr == 1) {
51 + error ("Bad commandline.\n"
52 + "Usage: %s device\n", progname);
53 + return (0);
54 + }
56 + for (i = 1; i < s.nstr; i++) {
57 + int status;
58 + int fd = open(s.str[i], O_RDONLY|O_NONBLOCK);
60 + if (fd == -1) {
61 + warning ("%s: unable to open %s\n", progname, s.str[i]);
62 + continue;
63 + }
65 + status = ioctl(fd, CDROMEJECT);
66 + if (status != 0) {
67 + error ("%s: failed\n");
68 + }
69 + close (fd);
70 + }
71 + return (0);
73 --- kiss-0.21/src/kiss.c 1998-09-25 14:07:10.000000000 +0200
74 +++ kiss-0.21-eject/src/kiss.c 2004-03-06 15:11:57.000000000 +0100
75 @@ -32,6 +32,7 @@
76 { "chown", dochown, 0 },
77 { "cp", docp, 0 },
78 { "echo", doecho, 0 },
79 + { "eject", doeject, 0 },
80 { "exec", doexec, 1 },
81 { "exit", doquit, 1 },
82 { "grep", dogrep, 0 },
83 --- kiss-0.21/src/kiss.h 1998-09-25 14:07:10.000000000 +0200
84 +++ kiss-0.21-eject/src/kiss.h 2004-03-06 15:11:57.000000000 +0100
85 @@ -194,6 +194,7 @@
86 extern int dochown (Stringstack s);
87 extern int docp (Stringstack s);
88 extern int doecho (Stringstack s);
89 +extern int doeject (Stringstack s);
90 extern int doexec (Stringstack s);
91 extern int dogrep (Stringstack s);
92 extern int dohelp (Stringstack s);