myadm

Simple MySQL client for the terminal
git clone git://git.bitsmanent.org/myadm
Log | Files | Refs | README | LICENSE

commit 016d23e22b61eadcedf8b2f528ba2681b3e369c0
parent 497b5ec48c4f5af85b50bafb96ac6e95db967e60
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Mon, 25 Apr 2016 16:42:41 +0200

fget() eats the last \n inserted by editors.

Diffstat:
Mmyadm.c | 2++
1 file changed, 2 insertions(+), 0 deletions(-)

diff --git a/myadm.c b/myadm.c @@ -379,6 +379,8 @@ fget(char *fn, int *sz) { lseek(fd, 0, SEEK_SET); buf = ecalloc(1, *sz+1); read(fd, buf, *sz); + if(*sz && buf[*sz - 1] == '\n') + --*sz; buf[*sz] = '\0'; close(fd); return buf;