diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-08-20 17:19:10 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-08-20 17:19:10 +0000 |
commit | ffb8022a33b6f8c31f97c8344440a876e42cfad4 (patch) | |
tree | 4c04957c8f7bb689a6c890d921b3c73892ecf02e /main | |
parent | 766d50c6b9d851a2a4b1fd2de6f7e57d97581a23 (diff) | |
download | aports-ffb8022a33b6f8c31f97c8344440a876e42cfad4.tar.bz2 aports-ffb8022a33b6f8c31f97c8344440a876e42cfad4.tar.xz |
main/busybox: second version of beep applet
Diffstat (limited to 'main')
-rw-r--r-- | main/busybox/0001-add-simple-beep-applet-second-version.patch (renamed from main/busybox/0001-add-simple-beep-applet.patch) | 93 | ||||
-rw-r--r-- | main/busybox/APKBUILD | 6 |
2 files changed, 65 insertions, 34 deletions
diff --git a/main/busybox/0001-add-simple-beep-applet.patch b/main/busybox/0001-add-simple-beep-applet-second-version.patch index 004d607919..834026fa35 100644 --- a/main/busybox/0001-add-simple-beep-applet.patch +++ b/main/busybox/0001-add-simple-beep-applet-second-version.patch @@ -1,16 +1,16 @@ -From 23c387cd9d1c833679bee898ef49738be8c64727 Mon Sep 17 00:00:00 2001 +From b36908b21def4916b10c62ae3e28cacb9073556e Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Date: Tue, 18 Aug 2009 22:28:09 +0200 -Subject: [PATCH] add simple beep applet +Subject: [PATCH] add simple beep applet, second version Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> --- include/applets.h | 1 + - include/usage.h | 9 ++++++ - miscutils/Config.in | 6 ++++ + include/usage.h | 9 +++++ + miscutils/Config.in | 6 +++ miscutils/Kbuild | 1 + - miscutils/beep.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++ - 5 files changed, 87 insertions(+), 0 deletions(-) + miscutils/beep.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++ + 5 files changed, 118 insertions(+), 0 deletions(-) create mode 100644 miscutils/beep.c diff --git a/include/applets.h b/include/applets.h @@ -76,10 +76,10 @@ index 23d7d8d..8cf3406 100644 lib-$(CONFIG_CROND) += crond.o diff --git a/miscutils/beep.c b/miscutils/beep.c new file mode 100644 -index 0000000..4c25454 +index 0000000..81755d8 --- /dev/null +++ b/miscutils/beep.c -@@ -0,0 +1,70 @@ +@@ -0,0 +1,101 @@ +/* vi: set sw=4 ts=4: */ +/* + * beep implementation for busybox @@ -106,38 +106,67 @@ index 0000000..4c25454 +#define LENGTH (50) +#define DELAY (0) +#define REPETITIONS (1) ++#if 0 ++typedef struct beep { ++ struct beep *next; ++ unsigned freq, length, delay, rep; ++} beep_t; ++static beep_t* new_beep(void) { ++ beep_t *beep = (beep_t*)xzalloc(sizeof(beep_t)); ++ beep->freq = FREQ; ++ beep->length = LENGTH; ++ beep->delay = DELAY; ++ beep->rep = REPETITIONS; ++ return beep; ++} ++#endif ++#define GET_ARG do { if (!*++opt) opt = *++argv; } while (0) ++#define NEW_BEEP() { \ ++ freq = FREQ; \ ++ length = LENGTH; \ ++ delay = DELAY; \ ++ rep = REPETITIONS; \ ++ } ++ +int beep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; +int beep_main(int argc UNUSED_PARAM, char **argv) +{ + int speaker = get_console_fd_or_die(); -+ llist_t *_freq = NULL, *_length = NULL, *_delay = NULL, *_rep = NULL; + unsigned freq, length, delay, rep; + unsigned long ioctl_arg; -+ unsigned opt; + -+ opt_complementary = "f::l::d::r::"; -+ opt = getopt32(argv, "f:l:d:r:n", &_freq, &_length, &_delay, &_rep); ++ NEW_BEEP() ++ while (*++argv) { ++ char *opt = *argv; + -+ do { -+ if (opt & OPT_f && _freq) -+ freq = xatoul((char*)(llist_pop(&_freq))); -+ else -+ freq = FREQ; -+ if (opt & OPT_l && _length) -+ length = xatoul((char*)(llist_pop(&_length))); -+ else -+ length = LENGTH; -+ if (opt & OPT_d && _delay) -+ delay = xatoul((char*)(llist_pop(&_delay))); -+ else -+ delay = DELAY; -+ if (opt & OPT_r && _rep) -+ rep = xatoul((char*)(llist_pop(&_rep))); -+ else -+ rep = REPETITIONS; ++ while (*opt == '-') ++ ++opt; + ++ switch (*opt) { ++ case 'f': ++ GET_ARG; ++ freq = xatoul(opt); ++ continue; ++ case 'l': ++ GET_ARG; ++ length = xatoul(opt); ++ continue; ++ case 'd': ++ GET_ARG; ++ delay = xatoul(opt); ++ continue; ++ case 'r': ++ GET_ARG; ++ freq = xatoul(opt); ++ continue; ++ case 'n': ++ break; ++ default: ++ bb_show_usage(); ++ break; ++ } + while (rep) { -+//bb_info_msg("rep[%d] freq=%d, length=%d, delay=%d\n", rep, freq, length, delay); ++//bb_info_msg("rep[%d] freq=%d, length=%d, delay=%d", rep, freq, length, delay); + ioctl_arg = (int)(CLOCK_TICK_RATE/freq); + xioctl(speaker, KIOCSOUND, (void*)ioctl_arg); + usleep(1000 * length); @@ -145,7 +174,9 @@ index 0000000..4c25454 + if (rep--) + usleep(delay); + } -+ } while (_freq || _length || _delay || _rep); ++ if (opt && *opt == 'n') ++ NEW_BEEP() ++ } + if (ENABLE_FEATURE_CLEAN_UP) + close(speaker); + return EXIT_SUCCESS; diff --git a/main/busybox/APKBUILD b/main/busybox/APKBUILD index dc3cee4884..0bf896cc13 100644 --- a/main/busybox/APKBUILD +++ b/main/busybox/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=busybox pkgver=1.14.3 -pkgrel=5 +pkgrel=6 pkgdesc="Size optimized toolbox of many common UNIX utilities" url=http://busybox.net license="GPL-2" @@ -11,7 +11,7 @@ triggers="busybox.trigger:/bin /usr/bin /sbin /usr/sbin /lib/modules/*" source="http://busybox.net/downloads/$pkgname-$pkgver.tar.bz2 $pkgname-1.11.1-bb.patch 0001-install-compat-fix-for-mode-of-created-files.patch - 0001-add-simple-beep-applet.patch + 0001-add-simple-beep-applet-second-version.patch bb-tar-numeric-owner.patch busybox-sed-3.patch busyboxconfig" @@ -49,7 +49,7 @@ build() { md5sums="d170bf5f97a41aec3a505eab690d5699 busybox-1.14.3.tar.bz2 4c0f3b486eaa0674961b7ddcd0c60a9b busybox-1.11.1-bb.patch 73d39c57483084298c7e46bdbbbea8d1 0001-install-compat-fix-for-mode-of-created-files.patch -ba66abc89c56df842c9b81759c78d890 0001-add-simple-beep-applet.patch +3ba0529f64aadae6ce95c683e6182988 0001-add-simple-beep-applet-second-version.patch 0b5b2d7db201f90cd08f4a3164ee29a1 bb-tar-numeric-owner.patch b75c3f419f8392dfdadd92aa24fdba8c busybox-sed-3.patch 3ece68eb92d97f3362dab7d838074d10 busyboxconfig" |