Extra error checking, and other stuff
This commit is contained in:
parent
1050ef1b31
commit
ccc6a3c849
4 changed files with 7 additions and 2 deletions
|
@ -13,6 +13,7 @@ int chrcnt = 0;
|
||||||
int lincnt = 1;
|
int lincnt = 1;
|
||||||
int yylex(void);
|
int yylex(void);
|
||||||
extern char* yytext;
|
extern char* yytext;
|
||||||
|
extern struct conf cf;
|
||||||
void yyerror(str)
|
void yyerror(str)
|
||||||
char* str;
|
char* str;
|
||||||
{
|
{
|
||||||
|
@ -82,6 +83,7 @@ devpath:
|
||||||
QUOTE PATH QUOTE
|
QUOTE PATH QUOTE
|
||||||
{
|
{
|
||||||
lprintf(debug, "Modem dev == %s\n", $2);
|
lprintf(debug, "Modem dev == %s\n", $2);
|
||||||
|
cf.modemdev = $2;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
%%
|
%%
|
||||||
|
|
|
@ -39,5 +39,8 @@ void initialize(void)
|
||||||
open_logs();
|
open_logs();
|
||||||
install_handlers();
|
install_handlers();
|
||||||
read_config();
|
read_config();
|
||||||
|
if(init_modem(cf.modemdev) != 1) {
|
||||||
|
lprintf(warn, "warning: modem didn't initialise properly; see previous messages\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ int init_modem(char* dev)
|
||||||
{
|
{
|
||||||
int lres = 0;
|
int lres = 0;
|
||||||
modemfd = open(dev, O_RDWR);
|
modemfd = open(dev, O_RDWR);
|
||||||
if(!modemfd) {
|
if(modemfd == -1) {
|
||||||
lprintf(error, "Error opening modem %s: %s\n", dev, strerror(errno));
|
lprintf(error, "Error opening modem %s: %s\n", dev, strerror(errno));
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ void handclient(sk)
|
||||||
lprintf(debug, "Client said %s.", buffer);
|
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;
|
int s, us, sn;
|
||||||
fd_set fds;
|
fd_set fds;
|
||||||
|
|
Loading…
Reference in a new issue