]> cloudbase.mooo.com Git - z180-stamp.git/commitdiff
my_getchar() parameter: allow return without new character
authorLeo C <erbl259-lmu@yahoo.de>
Thu, 23 Oct 2014 00:15:50 +0000 (02:15 +0200)
committerLeo C <erbl259-lmu@yahoo.de>
Thu, 23 Oct 2014 00:15:50 +0000 (02:15 +0200)
avr/cli_readline.c
avr/con-utils.c
avr/main.c
include/con-utils.h

index 17d549464a2ae9ccedf7b9c4faf403a7ac7af53c..6b5f47e5ed27403bb37b3377cf31dd16adaf078d 100644 (file)
@@ -74,7 +74,7 @@ static char *delete_char (char *buffer, char *p, int *colp, int *np, int plen)
 #define CREAD_HIST_CHAR                ('!')
 
 #define getcmd_putch(ch)       putchar(ch)
-#define getcmd_getch()         my_getchar()
+#define getcmd_getch()         my_getchar(1)
 #define getcmd_cbeep()         getcmd_putch('\a')
 
 #define HIST_MAX               5
@@ -500,7 +500,7 @@ static int cli_readline_into_buffer(const FLASH char *const prompt, char *buffer
 
        for (;;) {
 
-               c = my_getchar();
+               c = my_getchar(1);
 
                /*
                 * Special character handling
index 02657b9a2ccceb94798d0a0a52a2d1684c3be664..b8017ed4f7f70a1528ef2e747f1d5d645efb5925 100644 (file)
@@ -12,14 +12,14 @@ uint_fast8_t tstc(void)
        return serial_tstc();
 }
 
-int my_getchar(void)
+int my_getchar(uint_fast8_t waitforchar)
 {
        int c;
        
        do {
                bg_shed();
                c = serial_getc();
-       } while (c < 0);
+       } while ((c < 0) && waitforchar);
 
        return c;
 }
@@ -57,7 +57,7 @@ uint_fast8_t confirm_yesno(void)
                ;
        i = 0;
        while (i < sizeof(str_input)) {
-               str_input[i] = my_getchar();
+               str_input[i] = my_getchar(1);
                putchar(str_input[i]);
                if (str_input[i] == '\r')
                        break;
index 2955630a2168f69cb88c1919914194f9c6069ad2..2a1ecd372150dcfeaa83e7b001a6f640cefc822c 100644 (file)
@@ -144,7 +144,7 @@ static int abortboot(int  bootdelay)
         */
        if (bootdelay >= 0) {
                if (tstc()) {   /* we got a key press   */
-                       (void) my_getchar();  /* consume input  */
+                       (void) my_getchar(1);  /* consume input */
                        my_puts_P(PSTR("\b\b\b 0"));
                        abort = 1;      /* don't auto boot      */
                }
index f03dfb33abaafa02aa4b1689cf5867f3ffd334df..15a3ce82b9befddf2b3434fc44c4a0089dc67966 100644 (file)
@@ -3,7 +3,7 @@
 
 uint_fast8_t tstc(void);
 
-int my_getchar(void);
+int my_getchar(uint_fast8_t waitforchar);
 
 /* test if ctrl-c was pressed */
 uint_fast8_t ctrlc(void);