add md_get_answer
This commit is contained in:
parent
2e58224cd0
commit
f7d4c2013c
10
MD_Getc.c
10
MD_Getc.c
@ -7,6 +7,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <string.h>
|
||||||
#include "MagiDoor.h"
|
#include "MagiDoor.h"
|
||||||
|
|
||||||
extern time_t mdtimeout;
|
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) {
|
int md_getstring(char *ptr, int maxlen, char minchar, char maxchar) {
|
||||||
char c;
|
char c;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
@ -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_sendfile(const char *filename, int pause);
|
||||||
extern void md_clr_scr();
|
extern void md_clr_scr();
|
||||||
extern void md_set_cursor(int y, int x);
|
extern void md_set_cursor(int y, int x);
|
||||||
|
extern char md_get_answer(char *options);
|
||||||
#endif
|
#endif
|
Loading…
x
Reference in New Issue
Block a user