summaryrefslogtreecommitdiff
path: root/nasmlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'nasmlib.c')
-rw-r--r--nasmlib.c21
1 files changed, 21 insertions, 0 deletions
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;