+ char *result = _nc_basename(path);
+#if !MIXEDCASE_FILENAMES || defined(PROG_EXT)
+ static char *temp;
+ char *s;
+
+ temp = strdup(result);
+ result = temp;
+#if !MIXEDCASE_FILENAMES
+ for (s = result; *s != '\0'; ++s) {
+ *s = (char) LOWERCASE(*s);
+ }
+#endif
+#if defined(PROG_EXT)
+ if ((s = strrchr(result, '.')) != 0) {
+ if (!strcmp(s, PROG_EXT))
+ *s = '\0';
+ }
+#endif
+#endif
+ return result;
+}
+
+/*
+ * Check if a string appears to be an absolute pathname.
+ */
+NCURSES_EXPORT(bool)
+_nc_is_abs_path(const char *path)
+{
+#if defined(__EMX__) || defined(__DJGPP__)
+#define is_pathname(s) ((((s) != 0) && ((s)[0] == '/')) \
+ || (((s)[0] != 0) && ((s)[1] == ':')))
+#else
+#define is_pathname(s) ((s) != 0 && (s)[0] == '/')
+#endif
+ return is_pathname(path);
+}
+
+/*
+ * Return index of the basename
+ */
+NCURSES_EXPORT(unsigned)
+_nc_pathlast(const char *path)
+{
+ const char *test = strrchr(path, '/');