summaryrefslogtreecommitdiff
path: root/nasmlib.c
diff options
context:
space:
mode:
authorKeith Kanios <keith@kanios.net>2011-06-05 04:11:01 -0500
committerKeith Kanios <keith@kanios.net>2011-06-05 04:11:01 -0500
commit622a7e2f1dc7c53e5fdc73ba6a6bf59808ef701c (patch)
tree789dfbedb8b41a7c60b5e81602a79d734b883ead /nasmlib.c
parent20306b2b8ccff6eb9c175086d4d8f430edfc0463 (diff)
downloadnasm-path.tar.gz
Add __PATH__ supportpath
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;