summaryrefslogtreecommitdiff
path: root/extra/eject
diff options
context:
space:
mode:
authorParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
committerParabola <dev@list.parabolagnulinux.org>2011-04-05 14:26:38 +0000
commit415856bdd4f48ab4f2732996f0bae58595092bbe (patch)
treeede2018b591f6dfb477fe9341ba17b9bc000fab9 /extra/eject
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'extra/eject')
-rw-r--r--extra/eject/PKGBUILD24
-rw-r--r--extra/eject/eject-2.1.5-handle-spaces.patch57
2 files changed, 81 insertions, 0 deletions
diff --git a/extra/eject/PKGBUILD b/extra/eject/PKGBUILD
new file mode 100644
index 000000000..a10bdcab4
--- /dev/null
+++ b/extra/eject/PKGBUILD
@@ -0,0 +1,24 @@
+# $Id: PKGBUILD 84697 2010-07-03 16:22:38Z ibiru $
+# Maintainer: dorphell <dorphell@archlinux.org>
+# Contributor: Tom Newsom <Jeepster@gmx.co.uk>
+
+pkgname=eject
+pkgver=2.1.5
+pkgrel=4
+pkgdesc="Eject is a program for ejecting removable media under software control"
+arch=('i686' 'x86_64')
+url="http://ca.geocities.com/jefftranter@rogers.com/eject.html"
+license=('GPL')
+depends=('glibc')
+source=(ftp://mirrors.kernel.org/slackware/slackware-13.1/source/a/$pkgname/$pkgname-$pkgver.tar.bz2
+ eject-2.1.5-handle-spaces.patch)
+md5sums=('5a6cab2184ae4ed21128054d931d558f'
+ '595b97c3bd56fd41e3b01b07885f81dc')
+
+build() {
+ cd $srcdir/$pkgname
+ patch -Np0 -i ../eject-2.1.5-handle-spaces.patch || return 1
+ ./configure --prefix=/usr --mandir=/usr/share/man || return 1
+ make || return 1
+ make DESTDIR=$pkgdir install || return 1
+}
diff --git a/extra/eject/eject-2.1.5-handle-spaces.patch b/extra/eject/eject-2.1.5-handle-spaces.patch
new file mode 100644
index 000000000..692368fa5
--- /dev/null
+++ b/extra/eject/eject-2.1.5-handle-spaces.patch
@@ -0,0 +1,57 @@
+http://bugs.gentoo.org/151257
+
+--- eject.c
++++ eject.c
+@@ -370,6 +370,30 @@ static int FileExists(const char *name,
+
+
+ /*
++ * Linux mangles spaces in mount points by changing them to an octal string
++ * of '\040'. So lets scan the mount point and fix it up by replacing all
++ * occurrences off '\0##' with the ASCII value of 0##. Requires a writable
++ * string as input as we mangle in place. Some of this was taken from the
++ * util-linux package.
++ */
++#define octalify(a) ((a) & 7)
++#define tooctal(s) (64*octalify(s[1]) + 8*octalify(s[2]) + octalify(s[3]))
++#define isoctal(a) (((a) & ~7) == '0')
++static char *DeMangleMount(char *s)
++{
++ char *tmp = s;
++ while ((tmp = strchr(tmp, '\\')) != NULL) {
++ if (isoctal(tmp[1]) && isoctal(tmp[2]) && isoctal(tmp[3])) {
++ tmp[0] = tooctal(tmp);
++ memmove(tmp+1, tmp+4, strlen(tmp)-3);
++ }
++ ++tmp;
++ }
++ return s;
++}
++
++
++/*
+ * Given name, such as foo, see if any of the following exist:
+ *
+ * foo (if foo starts with '.' or '/')
+@@ -884,8 +908,8 @@ static int MountedDevice(const char *nam
+ if (((strcmp(s1, name) == 0) || (strcmp(s2, name) == 0)) ||
+ ((maj != -1) && (maj == mtabmaj) && (min == mtabmin))) {
+ FCLOSE(fp);
+- *deviceName = strdup(s1);
+- *mountName = strdup(s2);
++ *deviceName = DeMangleMount(strdup(s1));
++ *mountName = DeMangleMount(strdup(s2));
+ return 1;
+ }
+ }
+@@ -928,8 +952,8 @@ static int MountableDevice(const char *n
+ rc = sscanf(line, "%1023s %1023s", s1, s2);
+ if (rc >= 2 && s1[0] != '#' && strcmp(s2, name) == 0) {
+ FCLOSE(fp);
+- *deviceName = strdup(s1);
+- *mountName = strdup(s2);
++ *deviceName = DeMangleMount(strdup(s1));
++ *mountName = DeMangleMount(strdup(s2));
+ return 1;
+ }
+ }