📄 open_r.c
字号:
#include <reent.h>#include <errno.h>#include <devices.h>#include <string.h>#include <sysdefs.h>int _open_r ( struct _reent *ptr, const char *file, int flags, int mode){#ifdef HAS_MMCint i, len; // all devices must start with a name and name is bracketed with '/'. if (file[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, &file[1], len) == 0) { // ensure trailing '/'. if (file[len+1] != '/') continue; // found it, now call the open. // device is called with device name removed. if (device_table_list[i].item->open) { // a function address appears to be there... return device_table_list [i].item->open( ptr, &file[len+2], flags, mode); } } } }#endif // otherwise we get nasty about it.. ptr->_errno = ENODEV; return -1;}// vi:nowrap
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -