diff options
author | midipix <writeonce@midipix.org> | 2019-01-01 05:30:34 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2019-01-01 05:37:59 -0500 |
commit | b6f827d6939397e99d72b1dc8480c72364d8905c (patch) | |
tree | 74c198de06f27fa0e7fd8649838924ead5a879a6 /src/internal/sofort_dprintf_impl.c | |
parent | b95a5b04a4a3b6bf0b86080abce1436f0b7aee1c (diff) | |
download | sofort-b6f827d6939397e99d72b1dc8480c72364d8905c.tar.bz2 sofort-b6f827d6939397e99d72b1dc8480c72364d8905c.tar.xz |
sofort: split-up: keep build-system elements, move extras to sofortex.
Diffstat (limited to 'src/internal/sofort_dprintf_impl.c')
-rw-r--r-- | src/internal/sofort_dprintf_impl.c | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/src/internal/sofort_dprintf_impl.c b/src/internal/sofort_dprintf_impl.c deleted file mode 100644 index 01f1ee1..0000000 --- a/src/internal/sofort_dprintf_impl.c +++ /dev/null @@ -1,56 +0,0 @@ -#include <stdio.h> -#include <stdarg.h> -#include <stdlib.h> -#include <unistd.h> -#include <errno.h> - -int sfrt_dprintf(int fd, const char * fmt, ...) -{ - int ret; - int cnt; - int size; - va_list ap; - char * ch; - char * buf; - char chbuf[2048]; - - va_start(ap,fmt); - - size = sizeof(chbuf); - buf = ((cnt = vsnprintf(chbuf,size,fmt,ap)) < size) - ? chbuf : malloc(cnt + 1); - - va_end(ap); - - if (buf == chbuf) { - (void)0; - - } else if (buf) { - va_start(ap,fmt); - vsprintf(buf,fmt,ap); - va_end(ap); - - } else { - return -1; - } - - ret = 0; - ch = buf; - - for (; cnt && ret>=0; ) { - ret = write(fd,ch,cnt); - - while ((ret < 0) && (errno == EINTR)) - ret = write(fd,ch,cnt); - - ch += ret; - cnt -= ret; - } - - ret = (ret < 0) ? -1 : ch - buf; - - if (buf != chbuf) - free(buf); - - return ret; -} |