MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _module_name

Function _module_name

bsp/simulator/drivers/module_win32.c:207–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205#include <sys/statfs.h>
206extern char * dfs_win32_dirdup(char * path);
207static char* _module_name(const char *path)
208{
209 const char *first, *end, *ptr;
210 char *name;
211 int size;
212
213 ptr = (char *)path;
214 first = ptr;
215 end = path + rt_strlen(path);
216
217 while (*ptr != '\0')
218 {
219 if (*ptr == '/')
220 first = ptr + 1;
221 if (*ptr == '.')
222 end = ptr - 1;
223
224 ptr ++;
225 }
226
227 size = end - first + 1;
228 name = rt_malloc(size);
229 rt_strncpy(name, first, size);
230 name[size] = '\0';
231
232 return name;
233}
234
235typedef int (*appentry_t)(void);
236/**

Callers 2

rt_module_openFunction · 0.85
rt_module_exec_cmdFunction · 0.85

Calls 3

rt_strlenFunction · 0.85
rt_mallocFunction · 0.85
rt_strncpyFunction · 0.85

Tested by

no test coverage detected