miax: fix compilation errors under uClibc-ng and musl
[feed/telephony.git] / net / miax / patches / 010-usleep.patch
1 --- a/modem.c
2 +++ b/modem.c
3 @@ -76,10 +76,11 @@ int tty_modem(char* send, char *receive) {
4
5 int l=0, in=0, out=0, timeout=10;
6 char tmp[4096];
7 + struct timespec h = {0, 100 * 1000 * 1000};
8
9 if (strlen(send)) {
10 while ((timeout--) > 0) {
11 - usleep(100000);
12 + nanosleep(&h, NULL);
13 ioctl(fd_modem,TIOCMGET,&out);
14 if (out & TIOCM_CTS) {
15 l=write(fd_modem,send,strlen(send));
16 @@ -97,7 +98,7 @@ int tty_modem(char* send, char *receive) {
17 strncat(receive,tmp,in);
18 if (strchr(receive,'\r')) { break; }
19 }
20 - else { usleep(100000); }
21 + else { nanosleep(&h, NULL); }
22 }
23 if (strlen(receive) > 0 && debug > 3) { fprintf(stderr, "%s\n", receive); }
24