diff options
author | Keith Kanios <keith@kanios.net> | 2011-06-05 04:11:01 -0500 |
---|---|---|
committer | Keith Kanios <keith@kanios.net> | 2011-06-05 04:11:01 -0500 |
commit | 622a7e2f1dc7c53e5fdc73ba6a6bf59808ef701c (patch) | |
tree | 789dfbedb8b41a7c60b5e81602a79d734b883ead /nasmlib.c | |
parent | 20306b2b8ccff6eb9c175086d4d8f430edfc0463 (diff) | |
download | nasm-path.tar.gz |
Add __PATH__ supportpath
Diffstat (limited to 'nasmlib.c')
-rw-r--r-- | nasmlib.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -649,6 +649,27 @@ int src_get(int32_t *xline, char **xname) return 0; } +int src_get_path(char **xname) +{ + const char *path = NULL; + + if (!file_name) { + return -1; + } + + path = strrchr(file_name, '/'); +#if defined(__DOS__) || defined(__WINDOWS__) + if (!path) + path = strrchr(file_name, '\\'); +#endif + + if (path != NULL) { + *xname = nasm_strndup(file_name, (path - file_name + 1)); + } + + return 0; +} + char *nasm_strcat(const char *one, const char *two) { char *rslt; |