options/ansi: Flush all files on exit and flush all files when fflush(NULL) is called.
Signed-off-by: Dennisbonke <admin@dennisbonke.com>
This commit is contained in:
parent
9fcc48e695
commit
7fbc11f4e2
|
@ -578,6 +578,15 @@ long ftell(FILE *file_base) {
|
|||
}
|
||||
|
||||
int fflush_unlocked(FILE *file_base) {
|
||||
if(file_base == NULL) {
|
||||
// Only flush the files but do not close them.
|
||||
for(auto it : mlibc::global_file_list) {
|
||||
if(int e = it->flush(); e)
|
||||
mlibc::infoLogger() << "mlibc warning: Failed to flush file"
|
||||
<< frg::endlog;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
auto file = static_cast<mlibc::abstract_file *>(file_base);
|
||||
if(file->flush())
|
||||
return EOF;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <frg/random.hpp>
|
||||
#include <mlibc/debug.hpp>
|
||||
|
|
Loading…
Reference in a new issue