#include #include #include #include #include #include #include void perror(const char *s) { if (s) fprintf(stderr, "%s: ", s); fprintf(stderr, "%s\n", strerror(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); } int rename(const char *oldpath, const char *newpath) { // TODO require a duplex flag in open() hid_t from, to; from = camellia_open(oldpath, OPEN_RW); if (from < 0) { return -1; } to = camellia_open(newpath, OPEN_WRITE | OPEN_CREATE); if (to < 0) { close(from); return -1; } long ret = _sys_duplex(from, to, DUPLEX_REMOVE); close(from); close(to); if (ret < 0) { errno = -ret; return -1; } else { return 0; } } // TODO tmpnam char *tmpnam(char *s) { static char buf[L_tmpnam]; if (!s) s = buf; strcpy(s, "/tmp/tmpnam"); return s; }