add util files
This commit is contained in:
parent
6163a138ce
commit
e01c86a248
10
src/irmc.c
10
src/irmc.c
@ -47,16 +47,6 @@ int translate = 1;
|
||||
int audio_status = 1;
|
||||
|
||||
|
||||
/* get sockaddr, IPv4 or IPv6: */
|
||||
void *get_in_addr(struct sockaddr *sa)
|
||||
{
|
||||
if (sa->sa_family == AF_INET) {
|
||||
return &(((struct sockaddr_in*)sa)->sin_addr);
|
||||
}
|
||||
|
||||
return &(((struct sockaddr_in6*)sa)->sin6_addr);
|
||||
}
|
||||
|
||||
|
||||
// disconnect from the server
|
||||
void inthandler(int sig)
|
||||
|
11
src/util.c
11
src/util.c
@ -44,3 +44,14 @@ int kbhit (void)
|
||||
return FD_ISSET(STDIN_FILENO, &rdfs);
|
||||
}
|
||||
|
||||
/* get sockaddr, IPv4 or IPv6: */
|
||||
void *get_in_addr(struct sockaddr *sa)
|
||||
{
|
||||
if (sa->sa_family == AF_INET) {
|
||||
return &(((struct sockaddr_in*)sa)->sin_addr);
|
||||
}
|
||||
|
||||
return &(((struct sockaddr_in6*)sa)->sin6_addr);
|
||||
}
|
||||
|
||||
|
||||
|
@ -26,4 +26,5 @@
|
||||
void current_utc_time(struct timespec *ts);
|
||||
long fastclock(void);
|
||||
int kbhit (void);
|
||||
void *get_in_addr(struct sockaddr *sa);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user