📄 unlink_r.c
字号:
#include <stdio.h>#include <types.h>#include <reent.h>#include <errno.h>#include <devices.h>#include <ioctl.h>#include <string.h>#include <sysdefs.h>int _unlink_r (struct _reent *r, const char * filename){#ifdef HAS_MMCint i, len;long ptr; // unlink is from some device name, so find that named device. // all devices must start with a name and name is bracketed with '/'. if (filename[0] == '/') { // we might have a valid device name, search the table list. for (i=0; device_table_list [i].item; i++) { len = strlen(device_table_list[i].item->name); if (strncmp (device_table_list [i].item->name, &filename[1], len) == 0) { // ensure trailing '/'. if (filename[len+1] != '/') continue; // found it, now call the unlink. // device is called with device name removed. if (device_table_list[i].item->ioctl) { ptr = ((long)&filename[len+2]); return device_table_list[i].item->ioctl(r, 0, IOCTL_MMC_UNLINK, (long *)&ptr); } } } }#endif // otherwise we get nasty about it.. r->_errno = ENODEV; return -1;}// vi:nowrap:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -