kuro/client.c

35 lines
601 B
C
Raw Normal View History

2024-01-22 07:50:23 +00:00
#include "dat.h"
#include "fns.h"
static char mtpt[256] = {0};
void kuro9p_set_mtpt(char* path) {
strcpy(mtpt, path);
}
void kuro9p_write(char* path, char* data, int len) {
int fd;
char fullpath[256];
strcpy(fullpath, mtpt);
strcat(fullpath, path);
fd = open(fullpath, OWRITE);
if (fd >= 0) {
write(fd, data, len);
close(fd);
}
}
char* kuro9p_read(char* path, char* buf, int len) {
int fd;
char fullpath[256];
strcpy(fullpath, mtpt);
strcat(fullpath, path);
fd = open(fullpath, OREAD);
if (fd >= 0) {
read(fd, buf, len);
close(fd);
}
return buf;
}