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';
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user