add md_get_answer

This commit is contained in:
Andrew Pamment 2019-12-03 11:31:40 +10:00
parent 2e58224cd0
commit f7d4c2013c
2 changed files with 11 additions and 0 deletions

View File

@ -7,6 +7,7 @@
#endif
#include <unistd.h>
#include <time.h>
#include <string.h>
#include "MagiDoor.h"
extern time_t mdtimeout;
@ -45,6 +46,15 @@ char md_getc() {
}
}
char md_get_answer(char *options) {
char c;
c = md_getc();
while (strchr(options, c) == NULL) {
c = md_getc();
}
return c;
}
int md_getstring(char *ptr, int maxlen, char minchar, char maxchar) {
char c;
int len = 0;

View File

@ -27,4 +27,5 @@ extern int md_getstring(char *ptr, int maxlen, char minchar, char maxchar);
extern void md_sendfile(const char *filename, int pause);
extern void md_clr_scr();
extern void md_set_cursor(int y, int x);
extern char md_get_answer(char *options);
#endif