(DLR)
findnextfile()
- Simplify the uses of tail(). (DLR)
+ striponedir()
+ - Since all the strings passed to this are dynamically
+ allocated, use null_at() to strip the directory from the
+ string. (DLR)
- doc/syntax/c.nanorc:
- Since .i and .ii are preprocessed C and C++ output, colorize
them here. (Mike Frysinger)
"..") == 0) {
prev_dir = mallocstrcpy(NULL, filelist[selected]);
striponedir(prev_dir);
- align(&prev_dir);
}
dir = opendir(filelist[selected]);
selected = filelist_len - 1;
}
-/* Strip one directory from the end of path. */
+/* Strip one directory from the end of path, which should be
+ * dynamically allocated. */
void striponedir(char *path)
{
char *tmp;
tmp = strrchr(path, '/');
if (tmp != NULL)
- *tmp = '\0';
+ null_at(&path, tmp - path);
}
#endif /* !DISABLE_BROWSER */