/* soft link routines */ #include #include #include #include #include "lib.h" extern int __mint; /* * If MiNT 0.9 or later is active, use the kernel routines for these; * otherwise, try to choose failure modes that applications will best be * able to handle */ int symlink(old, new) char *old, *new; { char linkname[PATH_MAX]; char path[PATH_MAX]; long r; if (__mint >= 9) { _unx2dos(old, path); _unx2dos(new, linkname); r = Fsymlink(path, linkname); if (r) { errno = -r; return -1; } return r; } errno = EINVAL; return -1; } int readlink(unxname, buf, siz) char *unxname, *buf; int siz; { long r; char filename[PATH_MAX]; char linkto[PATH_MAX+1]; if (__mint < 9) { errno = EINVAL; return -1; } _unx2dos(unxname, filename); r = Freadlink(siz, linkto, filename); if (r < 0) { errno = -r; return -1; } linkto[PATH_MAX] = 0; _dos2unx(linkto, buf); return strlen(buf); }