]> arthur.barton.de Git - Beep.git/commitdiff
Imported sources into GIT repository. main
authorAlexander Barton <alex@barton.de>
Wed, 11 Feb 2009 22:50:23 +0000 (23:50 +0100)
committerAlexander Barton <alex@barton.de>
Wed, 11 Feb 2009 22:50:23 +0000 (23:50 +0100)
Makefile [new file with mode: 0644]
beep.c [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..8324206
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,27 @@
+# The ultimate Makefile for ... beep!
+# By Alex Barton, alex@barton.de
+# Last changes: 2003-04-09
+
+PREFIX = /usr/local
+
+CFLAGS = -Wall -ansi -pedantic
+LDFLAGS =
+
+BINDIR = $(PREFIX)/bin
+
+all: beep
+
+beep: beep.o
+       $(CC) beep.o $(LDFLAGS) -o beep
+
+beep.o: beep.c
+       $(CC) -c $(CFLAGS) beep.c
+
+clean:
+       rm -f core *.o beep
+
+install: beep
+       cp beep $(BINDIR)/beep
+       chmod 4755 $(BINDIR)/beep
+
+# -eof-
diff --git a/beep.c b/beep.c
new file mode 100644 (file)
index 0000000..d3aa03f
--- /dev/null
+++ b/beep.c
@@ -0,0 +1,41 @@
+/*
+ * beep.c -- Let's beep a little bit ;-)
+ * Written by Alex Barton, alex@barton.de, 2000-11-18
+ * Last changes: 2003-04-09, alex
+ */
+
+#define COUNT 3
+
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+
+int main( void )
+{
+       FILE *fd;
+       int i = 0;
+
+       fd = fopen( "/dev/console", "w" );
+       if( ! fd )
+       {
+               /* Oops, Fehler ... */
+               printf( "Can't open /dev/console: %s\n", strerror( errno ));
+               return 1;
+       }
+
+       /* Ok, Datei (Device) geƶffnet ... */
+       while( i < COUNT )
+       {
+               fputs( "\x07", fd );
+               fflush( fd );
+               i++;
+               if( i >= COUNT ) break;
+               sleep( 1 );
+       }
+       fclose( fd );
+
+       return 0;
+} /* main */
+
+/* -eof- */