Subject: [alpine-devel] [PATCH] extra/beep: new aport

From: Leonardo Arena <[email-masked]>
Date: Thu, 19 Feb 2009 14:32:56 +0100

Please see attached patch
leo
From 216f1277ca9b1b7955f1b225be7273f4b17db5a3 Mon Sep 17 00:00:00 2001
From: Leonardo Arena <[email-masked]>
Date: Thu, 19 Feb 2009 13:30:24 +0000
Subject: [PATCH] extra/beep: new aport

---
 extra/beep/APKBUILD                |   29 +++++++++++++++++++++++++++++
 extra/beep/beep-1.2.2-nosuid.patch |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 0 deletions(-)
 create mode 100644 extra/beep/APKBUILD
 create mode 100644 extra/beep/beep-1.2.2-nosuid.patch

diff --git a/extra/beep/APKBUILD b/extra/beep/APKBUILD
new file mode 100644
index 0000000..7429982
--- /dev/null
+++ b/extra/beep/APKBUILD
@@ -0,0 +1,29 @@
+# Contributor: Leonardo Arena <[email-masked]>
+# Maintainer: Leonardo Arena <[email-masked]>
+pkgname=beep
+pkgver=1.2.2
+pkgrel=0
+pkgdesc="A terminal bell"
+url="http://johnath.com/beep"
+license="GPL-2"
+depends="uclibc"
+makedepends=""
+#install=
+subpackages="$pkgname-doc"
+source="http://johnath.com/$pkgname/$pkgname-$pkgver.tar.gz
+        beep-1.2.2-nosuid.patch"
+
+build() {
+	cd "$srcdir/$pkgname-$pkgver"
+	
+	patch beep.c < ../../beep-1.2.2-nosuid.patch
+
+	make || return 1
+
+	install -m755 -D "$srcdir/$pkgname-$pkgver/beep" "$pkgdir"/usr/bin/beep
+	install -m644 -D "$srcdir/$pkgname-$pkgver/beep.1.gz" "$pkgdir"/usr/share/man/man1/beep.1.gz
+}
+
+md5sums="d541419fd7e5642952d7b48cbb40c712  beep-1.2.2.tar.gz
+38e2fc3ea98ced50038799ca80fdd9ee  beep-1.2.2-nosuid.patch"
+
diff --git a/extra/beep/beep-1.2.2-nosuid.patch b/extra/beep/beep-1.2.2-nosuid.patch
new file mode 100644
index 0000000..33e6aff
--- /dev/null
+++ b/extra/beep/beep-1.2.2-nosuid.patch
@@ -0,0 +1,33 @@
+--- beep.c.orig	2005-07-23 13:37:01.000000000 -0400
++++ beep.c	2005-07-23 14:00:55.000000000 -0400
+@@ -218,22 +218,20 @@
+   int i; /* loop counter */
+ 
+   /* try to snag the console */
+-  if((console_fd = open("/dev/console", O_WRONLY)) == -1) {
+-    fprintf(stderr, "Could not open /dev/console for writing.\n");
+-    printf("\a");  /* Output the only beep we can, in an effort to fall back on usefulness */
+-    perror("open");
+-    exit(1);
+-  }
++  console_fd = open("/dev/console", O_WRONLY);
+   
+   /* Beep */
+   for (i = 0; i < parms.reps; i++) {                    /* start beep */
+-    if(ioctl(console_fd, KIOCSOUND, (int)(CLOCK_TICK_RATE/parms.freq)) < 0) {
+-      printf("\a");  /* Output the only beep we can, in an effort to fall back on usefulness */
+-      perror("ioctl");
++    if (console_fd >= 0) {
++      ioctl(console_fd, KIOCSOUND, (int)(CLOCK_TICK_RATE/parms.freq));
++    } else {
++      printf("\a");  /* Output the fall back for usefulness we don't have to be suid to work at all */
++      fflush(stdout);
+     }
+     /* Look ma, I'm not ansi C compatible! */
+     usleep(1000*parms.length);                          /* wait...    */
+-    ioctl(console_fd, KIOCSOUND, 0);                    /* stop beep  */
++    if (console_fd >= 0) 
++       ioctl(console_fd, KIOCSOUND, 0);                 /* stop beep  */
+     if(parms.end_delay || (i+1 < parms.reps))
+        usleep(1000*parms.delay);                        /* wait...    */
+   }                                                     /* repeat.    */
-- 
1.6.1.3

---

From: Natanael Copa <[email-masked]>
Date: Thu, 19 Feb 2009 16:27:12 +0100

> Please see attached patch

wonderful!

applied. thanks!

-nc

> leo

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---