Skip to content
Snippets Groups Projects
Commit 9748a701 authored by rswindell's avatar rswindell
Browse files

ansi_getxy() now returns bool instead of void (false on timeout).

parent 1bd21619
No related branches found
No related tags found
No related merge requests found
...@@ -107,7 +107,7 @@ void sbbs_t::ansi_getlines() ...@@ -107,7 +107,7 @@ void sbbs_t::ansi_getlines()
} }
} }
void sbbs_t::ansi_getxy(int* x, int* y) bool sbbs_t::ansi_getxy(int* x, int* y)
{ {
int rsp=0, ch; int rsp=0, ch;
...@@ -129,8 +129,10 @@ void sbbs_t::ansi_getxy(int* x, int* y) ...@@ -129,8 +129,10 @@ void sbbs_t::ansi_getxy(int* x, int* y)
start=time(NULL); start=time(NULL);
} }
else if(isdigit(ch) && rsp==2) { else if(isdigit(ch) && rsp==2) {
(*y)*=10; if(y!=NULL) {
(*y)+=(ch&0xf); (*y)*=10;
(*y)+=(ch&0xf);
}
start=time(NULL); start=time(NULL);
} }
else if(ch==';' && rsp>=2) { else if(ch==';' && rsp>=2) {
...@@ -138,8 +140,10 @@ void sbbs_t::ansi_getxy(int* x, int* y) ...@@ -138,8 +140,10 @@ void sbbs_t::ansi_getxy(int* x, int* y)
start=time(NULL); start=time(NULL);
} }
else if(isdigit(ch) && rsp==3) { else if(isdigit(ch) && rsp==3) {
(*x)*=10; if(x!=NULL) {
(*x)+=(ch&0xf); (*x)*=10;
(*x)+=(ch&0xf);
}
start=time(NULL); start=time(NULL);
} }
else if(ch=='R' && rsp) else if(ch=='R' && rsp)
...@@ -149,7 +153,9 @@ void sbbs_t::ansi_getxy(int* x, int* y) ...@@ -149,7 +153,9 @@ void sbbs_t::ansi_getxy(int* x, int* y)
} }
if(time(NULL)-start>TIMEOUT_ANSI_GETXY) { if(time(NULL)-start>TIMEOUT_ANSI_GETXY) {
lprintf("Node %d !TIMEOUT in ansi_getxy", cfg.node_num); lprintf("Node %d !TIMEOUT in ansi_getxy", cfg.node_num);
break; return(false);
} }
} }
return(true);
} }
...@@ -338,7 +338,7 @@ public: ...@@ -338,7 +338,7 @@ public:
/* ansi_term.cpp */ /* ansi_term.cpp */
char * ansi(int atr); /* Returns ansi escape sequence for atr */ char * ansi(int atr); /* Returns ansi escape sequence for atr */
void ansi_getxy(int* x, int* y); bool ansi_getxy(int* x, int* y);
void ansi_getlines(void); void ansi_getlines(void);
/* Command Shell Methods */ /* Command Shell Methods */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment