summaryrefslogtreecommitdiff
path: root/mysys/mf_fn_ext.c
diff options
context:
space:
mode:
Diffstat (limited to 'mysys/mf_fn_ext.c')
-rw-r--r--mysys/mf_fn_ext.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/mysys/mf_fn_ext.c b/mysys/mf_fn_ext.c
index 47fc67cabbd..cbf0d5dd9e4 100644
--- a/mysys/mf_fn_ext.c
+++ b/mysys/mf_fn_ext.c
@@ -52,3 +52,40 @@ char *fn_ext(const char *name)
pos=strchr(gpos,FN_EXTCHAR);
DBUG_RETURN((char*) (pos ? pos : strend(gpos)));
} /* fn_ext */
+
+
+/*
+ Return a pointer to the extension of the filename.
+
+ SYNOPSIS
+ fn_ext()
+ name Name of file
+
+ DESCRIPTION
+ The extension is defined as everything after the last extension character
+ (normally '.') after the directory name.
+
+ RETURN VALUES
+ Pointer to to the extension character. If there isn't any extension,
+ points at the end ASCII(0) of the filename.
+*/
+
+char *fn_ext2(const char *name)
+{
+ register const char *pos, *gpos;
+ DBUG_ENTER("fn_ext");
+ DBUG_PRINT("mfunkt",("name: '%s'",name));
+
+#if defined(FN_DEVCHAR) || defined(BASKSLASH_MBTAIL)
+ {
+ char buff[FN_REFLEN];
+ size_t res_length;
+ gpos= name+ dirname_part(buff,(char*) name, &res_length);
+ }
+#else
+ if (!(gpos= strrchr(name, FN_LIBCHAR)))
+ gpos= name;
+#endif
+ pos=strrchr(gpos,FN_EXTCHAR);
+ DBUG_RETURN((char*) (pos ? pos : strend(gpos)));
+} /* fn_ext */