add util files

master
Gerolf Ziegenhain 6 years ago
parent 5dad7c3f64
commit 6163a138ce
  1. 14
      src/irmc.c
  2. 14
      src/util.c
  3. 16
      src/util.h

@ -45,20 +45,6 @@ char last_sender[16];
/* settings */
int translate = 1;
int audio_status = 1;
int kbhit (void)
{
struct timeval tv;
fd_set rdfs;
tv.tv_sec = 0;
tv.tv_usec = 0;
FD_ZERO(&rdfs);
FD_SET (STDIN_FILENO, &rdfs);
select (STDIN_FILENO+1, &rdfs, NULL, NULL, &tv);
return FD_ISSET(STDIN_FILENO, &rdfs);
}
/* get sockaddr, IPv4 or IPv6: */

@ -29,4 +29,18 @@ long fastclock(void)
return r;
}
int kbhit (void)
{
struct timeval tv;
fd_set rdfs;
tv.tv_sec = 0;
tv.tv_usec = 0;
FD_ZERO(&rdfs);
FD_SET (STDIN_FILENO, &rdfs);
select (STDIN_FILENO+1, &rdfs, NULL, NULL, &tv);
return FD_ISSET(STDIN_FILENO, &rdfs);
}

@ -1,5 +1,20 @@
#include <time.h>
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <math.h>
#include <fcntl.h>
#include <pthread.h>
#include <signal.h>
#include <arpa/inet.h>
#ifdef __MACH__
@ -10,4 +25,5 @@
void current_utc_time(struct timespec *ts);
long fastclock(void);
int kbhit (void);

Loading…
Cancel
Save