void mutt_buffer_select_file(struct Buffer *f, SelectFileFlags flags, char ***files, int *numfiles);
void mutt_browser_select_dir(const char *f);
void mutt_browser_cleanup(void);
-void mutt_buffer_concat_path(struct Buffer *d, const char *dir, const char *fname);
#endif /* MUTT_BROWSER_H */
return buf->dptr - buf->data;
}
+
+/**
+ * mutt_buffer_concat_path - Join a directory name and a filename
+ * @param buf Buffer to add to
+ * @param dir Directory name
+ * @param fname File name
+ *
+ * If both dir and fname are supplied, they are separated with '/'.
+ * If either is missing, then the other will be copied exactly.
+ */
+void mutt_buffer_concat_path(struct Buffer *buf, const char *dir, const char *fname)
+{
+ const char *fmt = "%s/%s";
+
+ if ((fname[0] == '\0') || ((dir[0] != '\0') && (dir[strlen(dir) - 1] == '/')))
+ fmt = "%s%s";
+
+ mutt_buffer_printf(buf, fmt, dir, fname);
+}
size_t mutt_buffer_addstr_n (struct Buffer *buf, const char *s, size_t len);
int mutt_buffer_add_printf (struct Buffer *buf, const char *fmt, ...);
struct Buffer *mutt_buffer_alloc (size_t size);
+void mutt_buffer_concat_path (struct Buffer *buf, const char *dir, const char *fname);
void mutt_buffer_fix_dptr (struct Buffer *buf);
void mutt_buffer_free (struct Buffer **p);
struct Buffer *mutt_buffer_from (const char *seed);
return 0;
}
-
-/**
- * mutt_buffer_concat_path - Join a directory name and a filename
- * @param d Buffer to add to
- * @param dir Directory name
- * @param fname File name
- *
- * If both dir and fname are supplied, they are separated with '/'.
- * If either is missing, then the other will be copied exactly.
- */
-void mutt_buffer_concat_path(struct Buffer *d, const char *dir, const char *fname)
-{
- const char *fmt = "%s/%s";
-
- if (!*fname || (*dir && dir[strlen(dir) - 1] == '/'))
- fmt = "%s%s";
-
- mutt_buffer_printf(d, fmt, dir, fname);
-}