Fix get string
This commit is contained in:
parent
b5bd8477e4
commit
318b385ce4
@ -60,6 +60,8 @@ int md_getstring(char *ptr, int maxlen, char minchar, char maxchar) {
|
||||
int len = 0;
|
||||
static char lastc = 'x';
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
while (len < maxlen) {
|
||||
c = md_getc();
|
||||
if (c == '\n' || c == '\0') {
|
||||
@ -76,7 +78,7 @@ int md_getstring(char *ptr, int maxlen, char minchar, char maxchar) {
|
||||
}
|
||||
if (c == '\b' || c == 127) {
|
||||
if (len > 0) {
|
||||
md_printf("\x1b[D \x1b[D");
|
||||
md_printf("\b \b");
|
||||
len--;
|
||||
ptr[len] = '\0';
|
||||
}
|
||||
@ -92,4 +94,4 @@ int md_getstring(char *ptr, int maxlen, char minchar, char maxchar) {
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,11 @@
|
||||
#ifndef __MAGIDOOR_H__
|
||||
#define __MAGIDOOR_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define MAGIDOOR_VERSION_MAJOR 1
|
||||
#define MAGIDOOR_VERSION_MINOR 2
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
@ -28,4 +33,4 @@ 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
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user