4 I just got so tired of being limited to printf("\a"); when I wanted a terminal
5 beep. This program isn't supposed to be anything stupendous, it's just
6 supposed to get the job done. Its intended purpose in life is to live inside
7 shell/perl scripts, and allow a little more granularity than you get with the
8 default terminal bell. Maybe I'm the only one who thinks this is useful. :)
10 If for any reason you decide you need to, contact me:
15 And beep can generally be found at:
17 http://johnath.com/beep/
19 For installation instructions, see INSTALL.
20 For copying and (non-)warranty information, see COPYING.
21 For usage information, check the man page.
23 fryguy (Ryan Weaver) at freshmeat.net has packaged beep in RPM format and has
24 promised to try to get new rpms out with each new source release. RPMs can be
25 found, among other places, at:
27 ftp://ftp.falsehope.com/pub/beep/
31 ftp://ftp.freshmeat.net/pub/rpms/beep/
37 As noted in the man page, some users are running into a situation where beep
38 dies with a complaint from ioctl(). The reason for this, as Peter Tirsek was
39 nice enough to point out to me, stems from how the kernel handles beep's
40 attempt to poke at (for non-programmers: ioctl is a sort of catch-all function
41 that lets you poke at things that have no other predefined poking-at mechanism)
42 the tty, which is how it beeps. The short story is, the kernel checks that
45 - you are the superuser
46 - you own the current tty
48 What this means is that root can always make beep work (to the best of my
49 knowledge!), and that any local user can make beep work, BUT a non-root remote
50 user cannot use beep in it's natural state. What's worse, an xterm, or other
51 x-session counts, as far as the kernel is concerned, as 'remote', so beep
52 won't work from a non-priviledged xterm either. I had originally chalked this
53 up to a bug, but there's actually nothing I can do about it, and it really is
54 a Good Thing that the kernel does things this way. There is also a solution.
56 By default beep is not installed with the suid bit set, because that would
57 just be zany. On the other hand, if you do make it suid root, all your
58 problems with beep bailing on ioctl calls will magically vanish, which is
59 pleasant, and the only reason not to is that any suid program is a potential
60 security hole. Conveniently, beep is very short, so auditing it is pretty
63 Decide for yourself, of course, but it looks safe to me - there's only one
64 buffer and fgets doesn't let it overflow, there's only one file opening, and
65 while there is a potential race condition there, it's with /dev/console. If
66 someone can exploit this race by replacing /dev/console, you've got bigger
69 So the quick solution is beep is not beeping when you want it to is:
73 # chmod 4755 /usr/bin/beep
75 (or wherever you put it)
77 The one snag is that this will give any little nitwit the ability to run beep
78 successfully - make sure this is what you want. If it isn't, a slightly more
79 complex fix would be something like:
81 # chgrp beep /usr/bin/beep
82 # chmod 4750 /usr/bin/beep
84 and then add only beep-worthy users to the 'beep' group.
89 A surprising number of people have sent in requests, or even patches, to help
90 beep play multiple, different sounds off a single invocation. I had always
91 thought that if people wanted a more complex melody, they would just do
94 $ cat << EOF > song.sh
96 beep <first beep's options>
97 beep <second beep's options>
101 Nevertheless, because of repeated and vociferous demand, version 1.2 (and
102 presumably all later versions) include the -n/--new switch which allows you to
103 use one command line to create multiple beeps. Check the man page for
104 details. I have also had a couple people suggest that I encourage the
105 development of such shell scripts/command lines, even collect the particularly
106 melodious ones. Certainly if anyone feels like sending some to me, I will put
107 them somewhere visible, or even include them as a sample. I think Dvorak's New
108 World Symphony, 4th Movement, for example, would make a lovely shell script.
109 I also wouldn't mind a rendition of BNL's If I had a million dollars. But by
110 all means, be creative.
112 All files copyright (C) Johnathan Nightingale, 2002.
113 All files distributed under the GNU general public license.