projects
/
retrobench
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
added read_cpuid and MTRR support checking before trying to set them
[retrobench]
/
src
/
dos
/
logger.c
1
#include <stdio.h>
2
#include <string.h>
3
#include <errno.h>
4
#include <unistd.h>
5
#include <fcntl.h>
6
#include "logger.h"
7
8
int init_logger(const char *fname)
9
{
10
int fd;
11
if((fd = open(fname, O_CREAT | O_WRONLY | O_TRUNC, 0644)) == -1) {
12
fprintf(stderr, "init_logger: failed to open %s: %s\n", fname, strerror(errno));
13
return -1;
14
}
15
16
close(1);
17
close(2);
18
dup(fd);
19
dup(fd);
20
return 0;
21
}
22
23
void stop_logger(void)
24
{
25
init_logger("CON");
26
}