]> arthur.barton.de Git - Beep.git/blob - beep.c
Imported sources into GIT repository.
[Beep.git] / beep.c
1 /*
2  * beep.c -- Let's beep a little bit ;-)
3  * Written by Alex Barton, alex@barton.de, 2000-11-18
4  * Last changes: 2003-04-09, alex
5  */
6
7 #define COUNT 3
8
9 #include <errno.h>
10 #include <stdio.h>
11 #include <unistd.h>
12 #include <string.h>
13
14 int main( void )
15 {
16         FILE *fd;
17         int i = 0;
18
19         fd = fopen( "/dev/console", "w" );
20         if( ! fd )
21         {
22                 /* Oops, Fehler ... */
23                 printf( "Can't open /dev/console: %s\n", strerror( errno ));
24                 return 1;
25         }
26
27         /* Ok, Datei (Device) geƶffnet ... */
28         while( i < COUNT )
29         {
30                 fputs( "\x07", fd );
31                 fflush( fd );
32                 i++;
33                 if( i >= COUNT ) break;
34                 sleep( 1 );
35         }
36         fclose( fd );
37
38         return 0;
39 } /* main */
40
41 /* -eof- */