*/
char *string_strip(char *s);
+/**
+ * string_truncate_at_pattern - remove pattern and everything after it
+ * @buf: pointer to buffer
+ * @pattern: string to remove
+ */
+void string_truncate_at_pattern(char *buf, const char *pattern);
+
#endif /* __LABWC_STRING_HELPERS_H */
#include "common/dir.h"
#include "common/font.h"
#include "common/log.h"
+#include "common/string-helpers.h"
#include "config/keybind.h"
#include "config/rcxml.h"
/* TODO: Add all places based on Openbox's rc.xml */
};
-static void
-rstrip(char *buf, const char *pattern)
-{
- char *p = strstr(buf, pattern);
- if (!p) {
- return;
- }
- *p = '\0';
-}
-
static void
fill_keybind(char *nodename, char *content)
{
if (!content) {
return;
}
- rstrip(nodename, ".keybind.keyboard");
+ string_truncate_at_pattern(nodename, ".keybind.keyboard");
if (!strcmp(nodename, "key")) {
current_keybind = keybind_create(content);
}
if (!content) {
return;
}
- rstrip(nodename, ".font.theme");
+ string_truncate_at_pattern(nodename, ".font.theme");
/* TODO: implement for all font places */
if (place != FONT_PLACE_ACTIVEWINDOW) {
if (!nodename) {
return;
}
- rstrip(nodename, ".openbox_config");
+ string_truncate_at_pattern(nodename, ".openbox_config");
/* for debugging */
if (write_to_nodename_buffer) {