From 36fa067cc53064757aef22c6d6168f1d414afae2 Mon Sep 17 00:00:00 2001 From: Gerolf Ziegenhain Date: Wed, 8 Jul 2015 22:38:29 +0200 Subject: [PATCH] cleanup --- src/irmc.c | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/irmc.c b/src/irmc.c index 82aebc5..0dbbd27 100644 --- a/src/irmc.c +++ b/src/irmc.c @@ -9,16 +9,15 @@ #include #include #include +#include #include #include #include #ifdef __MACH__ -#define LIBOSS_INTERNAL -#include //will not be used for audio any more #else -#include -#include -#include + #include + #include + #include #endif #include #include @@ -27,8 +26,8 @@ #include #ifdef __MACH__ -#include -#include + #include + #include #endif #define DEBUG 0 @@ -77,8 +76,7 @@ void current_utc_time(struct timespec *ts) { } /* a better clock() in milliseconds */ -long -fastclock(void) +long fastclock(void) { struct timespec t; long r; @@ -117,8 +115,7 @@ void *get_in_addr(struct sockaddr *sa) } // connect to server and send my id. -void -identifyclient(void) +void identifyclient(void) { tx_sequence++; id_packet.sequence = tx_sequence; @@ -127,8 +124,7 @@ identifyclient(void) } // disconnect from the server -void -inthandler(int sig) +void inthandler(int sig) { signal(sig, SIG_IGN); send(fd_socket, &disconnect_packet, SIZE_COMMAND_PACKET, 0); @@ -137,8 +133,7 @@ inthandler(int sig) exit(1); } -void -txloop (void) +void txloop (void) { key_press_t1 = fastclock(); tx_timeout = 0; @@ -170,8 +165,7 @@ txloop (void) } } -int -commandmode(void) +int commandmode(void) { char cmd[32]; int i; @@ -226,8 +220,7 @@ commandmode(void) } -void -message(int msg) +void message(int msg) { switch(msg){ case 1: @@ -256,7 +249,9 @@ message(int msg) } fflush(0); } - + + +/* Main Loop */ int main(int argc, char *argv[]) { char buf[MAXDATASIZE]; @@ -351,7 +346,7 @@ int main(int argc, char *argv[]) } - fcntl(fd_socket, F_SETFL, O_NONBLOCK); + fcntl(fd_socket, F_SETFL, O_NONBLOCK); if (p == NULL) { fprintf(stderr, "Failed to connect.\n"); return 2; @@ -411,10 +406,13 @@ int main(int argc, char *argv[]) else { if(length < 0) { + printf("beep no"); beep(0.0, abs(length)/1000.); } else { + printf("beep yes"); + beep(1000.0, length/1000.); } }