mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2025-04-19 17:37:09 +02:00
23 lines
386 B
C
23 lines
386 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
#include "fileutil.h"
|
|
|
|
int setvbuf(FILE * restrict fp, char * restrict buf, int mode, size_t size)
|
|
{
|
|
if(fp->bufmode != _IONBF || fp->buf) {
|
|
fflush(fp);
|
|
}
|
|
|
|
__fp_remove_buffer(fp);
|
|
fp->bufmode = _IONBF;
|
|
|
|
if(mode == _IONBF)
|
|
return 0;
|
|
|
|
if(!__fp_set_buffer(fp, buf, size))
|
|
return -1;
|
|
|
|
fp->bufmode = mode;
|
|
return 0;
|
|
}
|