More bugfixes

This commit is contained in:
dcp1990 2005-06-28 02:00:06 +00:00
parent 9cb193a306
commit e06ab2dde6
4 changed files with 28 additions and 6 deletions

View File

@ -123,7 +123,6 @@ char *sendwr(str, bufferback, howmuch)
write(modemfd, "\r\n", 3);
fds[0].fd = modemfd;
fds[0].events = POLLRDNORM;
fcntl(modemfd, F_SETFL, O_NONBLOCK);
switch(poll(fds, 1, 3000)) {
case 0:
pthread_cond_signal(&mpcond);
@ -146,7 +145,24 @@ char *sendwr(str, bufferback, howmuch)
pthread_mutex_lock(&modemmx);
write(modemfd, str, strlen(str) + 1);
write(modemfd, "\r\n", 3);
fgets(bufferback, howmuch, modem);
fds[0].fd = modemfd;
fds[0].events = POLLRDNORM;
switch(poll(fds, 1, 3000)) {
case 0:
pthread_cond_signal(&mpcond);
pthread_mutex_unlock(&modemmx);
snprintf(bufferback, howmuch, "*MODEM TIMEOUT*");
return bufferback;
case -1:
lprintf(error, "poll in sendwr: %s\n", strerror(errno));
pthread_cond_signal(&mpcond);
pthread_mutex_unlock(&modemmx);
return bufferback;
default:
/* fgets(bufferback, howmuch, modem); */
read(modemfd, bufferback, howmuch);
break;
}
pthread_mutex_unlock(&modemmx);
}
return bufferback;

View File

@ -27,7 +27,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $Amigan: phoned/phoned/modems/rockwell.c,v 1.8 2005/06/26 21:44:40 dcp1990 Exp $ */
/* $Amigan: phoned/phoned/modems/rockwell.c,v 1.9 2005/06/28 02:00:08 dcp1990 Exp $ */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@ -147,6 +147,8 @@ void rw_voice_init(void)
rw_sdev(dialup);
stmod("AT#CID=2");
stmod("AT#CLS=8");
stmod("ATE0");
stmod("ATV0");
}
void rw_set_rings(rings)
int rings;

View File

@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/* $Amigan: phoned/phoned/remote.c,v 1.17 2005/06/28 00:52:17 dcp1990 Exp $ */
/* $Amigan: phoned/phoned/remote.c,v 1.18 2005/06/28 02:00:06 dcp1990 Exp $ */
/* system includes */
#include <string.h>
#include <stdio.h>
@ -42,6 +42,7 @@
#include <sys/ioctl.h>
#include <ctype.h>
#include <sys/uio.h>
#include <fcntl.h>
#include <errno.h>
/* us */
#include <phoned.h>
@ -366,6 +367,8 @@ char *parse_command(cmd, cont, s)
free(rc);
*cont = 0;
RNF("500 OK: Parser tested.\n");
} else if(CHK("bye")) {
return NULL;
} else if(CHK("tmop")) {
if(argvect[1] != NULL) {
cid_t *rc;
@ -418,7 +421,7 @@ void begin_dialogue(fp, fd)
} else if(rc == -1) {
lprintf(error, "Error with recv: %s\n", strerror(errno));
break;
}
} else if(rc < 3) continue;
if((c = strrchr(buffer, '\n')) != NULL)
*c = '\0';
rcode = parse_command(buffer, &keep_going, &si);
@ -428,7 +431,7 @@ void begin_dialogue(fp, fd)
break;
}
if(si.freeit) free(rcode);
}
} else break;
}
if(si.l != NULL) {
pthread_mutex_lock(&usermx);

View File

@ -42,6 +42,7 @@
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/un.h>
#include <fcntl.h>
#include <errno.h>
#include <pthread.h>