From 007893960d3e39aacc9652ff2630af2f43c1c64f Mon Sep 17 00:00:00 2001 From: kewl fft Date: Sun, 24 Jan 2021 17:40:32 -0500 Subject: [PATCH] flush buffer if more than 32 char --- dse.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dse.c b/dse.c index ef1a6de..6760237 100644 --- a/dse.c +++ b/dse.c @@ -180,23 +180,21 @@ int crypt(char *keyfile, int encrypt, char *src, char *dst) return status; } - /*=====================================================================*/ - int passgets(char *s, int n) { int c; char *t; - t = s; while(--n >= 0) { c = getchar(); - if(c < 32 || c > 126) break; + if(c == '\n') break; *s++ = c; } *s = 0; + if(n<0) while (getchar() != '\n') { }; // n char or more, flush the rest of the buffer containing the linefeed return s != t; } @@ -216,7 +214,7 @@ int password(char *pass) return 1; } } - printf("\nError\n"); + printf("Error\n"); return 0; }