OpenSDE Packages Database (without history before r20070)
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.

92 lines
2.9 KiB

  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 - 2006 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) ...
  18. - Rene Rebe <rene@exactcode.de>
  19. --- kiss-0.21/src/Makefile 1998-09-25 14:07:09.000000000 +0200
  20. +++ kiss-0.21-eject/src/Makefile 2004-03-06 15:11:57.000000000 +0100
  21. @@ -66,7 +66,7 @@
  22. addstringstack.o expandtilde.o splitcmd.o addstringtostack.o \
  23. dokill.o dogrep.o dochown.o dosleep.o expandbackquotes.o dols.o \
  24. listdir.o listfile.o listoutput.o domknod.o dowc.o domount.o \
  25. - doumount.o dotouch.o
  26. + doumount.o dotouch.o doeject.o
  27. # entry point for making
  28. foo:
  29. --- kiss-0.21/src/doeject.c 1970-01-01 01:00:00.000000000 +0100
  30. +++ kiss-0.21-eject/src/doeject.c 2004-03-06 17:08:46.000000000 +0100
  31. @@ -0,0 +1,37 @@
  32. +#include "kiss.h"
  33. +
  34. +#if __GNUC__ == 3 && __GNUC_MINOR__ > 2
  35. +#define __attribute_const__ __attribute__ ((const))
  36. +#endif
  37. +
  38. +#include <linux/cdrom.h>
  39. +
  40. +int doeject (Stringstack s)
  41. +{
  42. + register int
  43. + i;
  44. +
  45. + /* need at least one arg */
  46. + if (s.nstr == 1) {
  47. + error ("Bad commandline.\n"
  48. + "Usage: %s device\n", progname);
  49. + return (0);
  50. + }
  51. +
  52. + for (i = 1; i < s.nstr; i++) {
  53. + int status;
  54. + int fd = open(s.str[i], O_RDONLY|O_NONBLOCK);
  55. +
  56. + if (fd == -1) {
  57. + warning ("%s: unable to open %s\n", progname, s.str[i]);
  58. + continue;
  59. + }
  60. +
  61. + status = ioctl(fd, CDROMEJECT);
  62. + if (status != 0) {
  63. + error ("%s: failed\n");
  64. + }
  65. + close (fd);
  66. + }
  67. + return (0);
  68. +}
  69. --- kiss-0.21/src/kiss.c 1998-09-25 14:07:10.000000000 +0200
  70. +++ kiss-0.21-eject/src/kiss.c 2004-03-06 15:11:57.000000000 +0100
  71. @@ -32,6 +32,7 @@
  72. { "chown", dochown, 0 },
  73. { "cp", docp, 0 },
  74. { "echo", doecho, 0 },
  75. + { "eject", doeject, 0 },
  76. { "exec", doexec, 1 },
  77. { "exit", doquit, 1 },
  78. { "grep", dogrep, 0 },
  79. --- kiss-0.21/src/kiss.h 1998-09-25 14:07:10.000000000 +0200
  80. +++ kiss-0.21-eject/src/kiss.h 2004-03-06 15:11:57.000000000 +0100
  81. @@ -194,6 +194,7 @@
  82. extern int dochown (Stringstack s);
  83. extern int docp (Stringstack s);
  84. extern int doecho (Stringstack s);
  85. +extern int doeject (Stringstack s);
  86. extern int doexec (Stringstack s);
  87. extern int dogrep (Stringstack s);
  88. extern int dohelp (Stringstack s);