myadm

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

commit f2e523fefa140d7c6e6e93d473556778273eb84d
parent 156f1a0a858bd4f95e2e929f49b989aba6fb87a8
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Tue,  3 May 2016 21:12:05 +0200

Remove fput/fget routines.

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

diff --git a/myadm.c b/myadm.c @@ -103,8 +103,6 @@ void *ecalloc(size_t nmemb, size_t size); void editfile(char *file); void editrecord(const Arg *arg); int escape(char *esc, char *s, int sz, char c, char q); -char *fget(char *fn, int *sz); -int fput(char *fn, char *s, int size); Item *getitem(int pos); int *getmaxlengths(Item *items, Field *fields); void itemsel(const Arg *arg); @@ -346,40 +344,6 @@ escape(char *esc, char *s, int sz, char c, char q) { return ei; } -char * -fget(char *fn, int *sz) { - int fd, size; - char *buf; - - fd = open(fn, O_RDONLY); - if(fd == -1) - return NULL; - size = lseek(fd, 0, SEEK_END); - lseek(fd, 0, SEEK_SET); - buf = ecalloc(1, size+1); - read(fd, buf, size); - buf[size] = '\0'; - close(fd); - if(sz) - *sz = size; - return buf; -} - -int -fput(char *fn, char *s, int size) { - int fd; - - fd = open(fn, O_WRONLY | O_TRUNC); - if(fd == -1) - return -1; - if(write(fd, s, size) == -1) { - close(fd); - return -1; - } - close(fd); - return 0; -} - Item * getitem(int pos) { Item *item;