Files

34 lines
695 B
C
Raw Permalink Normal View History

2018-02-23 00:57:47 +00:00
#include "config.h"
#include <_ansi.h>
#include <_syslist.h>
#include <reent.h>
#include <errno.h>
#include <sys/iosupport.h>
#ifdef REENTRANT_SYSCALLS_PROVIDED
2018-05-27 20:47:46 +01:00
int _link_r( struct _reent *r, const char *existing, const char *new) {
2018-02-23 00:57:47 +00:00
#else
2018-05-27 20:47:46 +01:00
int _link( const char *existing, const char *new) {
2018-02-23 00:57:47 +00:00
struct _reent *r = _REENT;
#endif
int ret;
int sourceDev = FindDevice(existing);
int destDev = FindDevice(new);
ret = -1;
if ( sourceDev == destDev) {
if (devoptab_list[destDev]->link_r) {
r->deviceData = devoptab_list[destDev]->deviceData;
ret = devoptab_list[destDev]->link_r( r, existing, new);
} else {
r->_errno = ENOSYS;
}
} else {
r->_errno = EXDEV;
}
return ret;
}