From 9ec2b8a00df375fc2481655e141a21912113deef Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 17 Aug 2004 23:25:09 +0000 Subject: Remove new lines properly --- tools/mkha1.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/mkha1.c b/tools/mkha1.c index 3124e48..5ac3fd3 100644 --- a/tools/mkha1.c +++ b/tools/mkha1.c @@ -100,6 +100,12 @@ static char* check_value(ha_buffer_t* buf, char* value, const char* name) printf("%s: ", name); fgets(t, 256, stdin); value = t; + + t = value + strlen(value); + + /* Remove any new lines from end */ + while(t > value && (*(t - 1) == '\n' || *(t - 1) == '\r')) + *(--t) = 0; } if(value[0] == 0) -- cgit v1.2.3