From 622a7e2f1dc7c53e5fdc73ba6a6bf59808ef701c Mon Sep 17 00:00:00 2001 From: Keith Kanios Date: Sun, 5 Jun 2011 04:11:01 -0500 Subject: Add __PATH__ support --- nasmlib.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'nasmlib.c') diff --git a/nasmlib.c b/nasmlib.c index d70f6c24..04672efb 100644 --- a/nasmlib.c +++ b/nasmlib.c @@ -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; -- cgit v1.2.1