File: beep.c

package info (click to toggle)
licq 1.3.4-2
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 22,048 kB
  • ctags: 8,640
  • sloc: cpp: 76,924; sh: 9,845; ansic: 5,424; perl: 3,449; lex: 857; xml: 804; php: 691; makefile: 393; csh: 48
file content (25 lines) | stat: -rw-r--r-- 474 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdlib.h>
#include <Xlib.h>

/* Simple program to beep the X11 bell at the specified volumen (0 - 100)
   compile with:
   gcc beep.c -o beep -I/usr/include/X11 -L/usr/X11/lib -lX11
 */

int main(int argc, char **argv)
{
  unsigned short v = 50;
  Display *d = XOpenDisplay(getenv("DISPLAY"));
  if (d != NULL)
  {
    if (argc > 1) v = atoi(argv[1]);
    if (!v ) v = 100;
    XBell(d, v);
    XCloseDisplay(d);
  }
  else
  {
    printf("\a");
  }
  return 0;
}