summaryrefslogtreecommitdiff
path: root/src/user/lib/stdio/misc.c
blob: d74c197a317dc31cf09d38a77debd346e9b6797e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

void perror(const char *s) {
	if (s) fprintf(stderr, "%s: ", s);
	fprintf(stderr, "errno %d\n", errno);
}

int puts(const char *s) {
	return printf("%s\n", s);
}

int getchar(void) {
	return fgetc(stdin);
}

int putchar(int c) {
	return fputc(c, stdout);
}

off_t lseek(int fd, off_t off, int whence) {
	(void)fd; (void)off; (void)whence;
	errno = ENOSYS;
	return -1;
}

int remove(const char *path) {
	return unlink(path);
}

// TODO! VFSOP_MOVE
int rename(const char *old, const char *new) {
	(void)old; (void)new;
	errno = ENOSYS;
	return -1;
}

// TODO tmpnam
char *tmpnam(char *s) {
	static char buf[L_tmpnam];
	if (!s) s = buf;
	strcpy(s, "/tmp/tmpnam");
	return s;
}