input_terminator_t get_input_terminated_by(input_terminator_mask_t terminators,
char *out, BYTE outlen);
char *get_input(void);
+BYTE cgetn_input(char *s, BYTE len);
void cget_return(void);
char retry_or_quit(void);
char *format_euro(char *s, int maxlen, int cent);
return output;
}
-/* wait until user pressed RETURN, ignore all other input */
+BYTE cgetn_input(char *s, BYTE len) {
+ memset(s, '\0', len);
+ get_input_terminated_by(INPUT_TERMINATOR_RETURN, s, len);
+ return strlen(s);
+}
+
void cget_return() {
BYTE c;
while (1) {
BYTE c = 0, i = 0;
int negative = 1;
char entered[5] = {'1', 0, 0, 0, 0};
- char *input, name[20];
+ char name[MAX_ITEM_NAME_LENGTH + 1];
int price;
clrscr();
- memset(name, '\0', sizeof(name));
cprintf("\r\nWas soll gekauft werden?\r\n");
- input = get_input();
- strncpy(name, input, sizeof(name));
- if (*name == '\0')
+ if (cgetn_input(name, sizeof(name)) == 0)
return;
cprintf("\r\nWie teuer ist \"%s\" (in cents)?\r\n", name);