diff options
| -rw-r--r-- | tools/afcclient.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/afcclient.c b/tools/afcclient.c index 8e12b3c..2667e52 100644 --- a/tools/afcclient.c +++ b/tools/afcclient.c | |||
| @@ -141,6 +141,7 @@ static void print_usage(int argc, char **argv, int is_error) | |||
| 141 | #ifndef HAVE_READLINE | 141 | #ifndef HAVE_READLINE |
| 142 | #ifdef _WIN32 | 142 | #ifdef _WIN32 |
| 143 | #define BS_CC '\b' | 143 | #define BS_CC '\b' |
| 144 | #define getch _getch | ||
| 144 | #else | 145 | #else |
| 145 | #define BS_CC 0x7f | 146 | #define BS_CC 0x7f |
| 146 | #define getch getchar | 147 | #define getch getchar |
| @@ -155,12 +156,18 @@ static void get_input(char *buf, int maxlen) | |||
| 155 | break; | 156 | break; |
| 156 | } | 157 | } |
| 157 | if (isprint(c)) { | 158 | if (isprint(c)) { |
| 158 | if (len < maxlen-1) | 159 | if (len < maxlen-1) { |
| 159 | buf[len++] = c; | 160 | buf[len++] = c; |
| 161 | #ifdef _WIN32 | ||
| 162 | fputc(c, stdout); | ||
| 163 | #endif | ||
| 164 | } | ||
| 160 | } else if (c == BS_CC) { | 165 | } else if (c == BS_CC) { |
| 161 | if (len > 0) { | 166 | if (len > 0) { |
| 162 | fputs("\b \b", stdout); | 167 | fputs("\b \b", stdout); |
| 163 | len--; | 168 | len--; |
| 169 | } else { | ||
| 170 | fputc(0x07, stdout); | ||
| 164 | } | 171 | } |
| 165 | } | 172 | } |
| 166 | } | 173 | } |
