From: H. P. A. <hp...@zy...> - 2016-01-24 09:48:32
|
On January 23, 2016 11:32:49 PM PST, Jim Kukunas <jam...@li...> wrote: >Converts a relative pathname to an absolute pathname. > >Signed-off-by: Jim Kukunas <jam...@li...> >--- > nasmlib.c | 12 ++++++++++++ > nasmlib.h | 7 +++++++ > 2 files changed, 19 insertions(+) > >diff --git a/nasmlib.c b/nasmlib.c >index ecd6d8d..9d57adb 100644 >--- a/nasmlib.c >+++ b/nasmlib.c >@@ -696,6 +696,18 @@ char *nasm_opt_val(char *p, char **val, char >**next) > return p; > } > >+#ifdef _WIN32 >+char *nasm_realpath(const char *rel_path) >+{ >+ return _fullpath(NULL, rel_path, 0); >+} >+#else >+char *nasm_realpath(const char *rel_path) >+{ >+ return realpath(rel_path, NULL); >+} >+#endif >+ > /* > * initialized data bytes length from opcode > */ >diff --git a/nasmlib.h b/nasmlib.h >index a3a8c12..9cd417f 100644 >--- a/nasmlib.h >+++ b/nasmlib.h >@@ -400,6 +400,13 @@ char *nasm_trim_spaces(char *p); > char *nasm_get_word(char *p, char **tail); > char *nasm_opt_val(char *p, char **opt, char **val); > >+/* >+ * Converts a relative pathname rel_path into an absolute path name. >+ * >+ * The buffer returned must be freed by the caller >+ */ >+char *nasm_realpath(const char *rel_path); >+ > const char *prefix_name(int); > > #define ZERO_BUF_SIZE 4096 One minor nit: this should be discovered by autoconf, and the functionality disabled if no such function is available. I can fix that. -- Sent from my Android device with K-9 Mail. Please excuse brevity and formatting. |