Extra error checking, and other stuff

This commit is contained in:
dcp1990 2005-06-01 20:53:09 +00:00
parent 1050ef1b31
commit ccc6a3c849
4 changed files with 7 additions and 2 deletions

View File

@ -13,6 +13,7 @@ int chrcnt = 0;
int lincnt = 1;
int yylex(void);
extern char* yytext;
extern struct conf cf;
void yyerror(str)
char* str;
{
@ -82,6 +83,7 @@ devpath:
QUOTE PATH QUOTE
{
lprintf(debug, "Modem dev == %s\n", $2);
cf.modemdev = $2;
}
;
%%

View File

@ -39,5 +39,8 @@ void initialize(void)
open_logs();
install_handlers();
read_config();
if(init_modem(cf.modemdev) != 1) {
lprintf(warn, "warning: modem didn't initialise properly; see previous messages\n");
}
}

View File

@ -57,7 +57,7 @@ int init_modem(char* dev)
{
int lres = 0;
modemfd = open(dev, O_RDWR);
if(!modemfd) {
if(modemfd == -1) {
lprintf(error, "Error opening modem %s: %s\n", dev, strerror(errno));
return -2;
}

View File

@ -57,7 +57,7 @@ void handclient(sk)
lprintf(debug, "Client said %s.", buffer);
}
void network(void)
void network(void) /* name is misleading because we also do modem IO here */
{
int s, us, sn;
fd_set fds;