Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
spectrwm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a53197f
)
Turn this into a function.
author
Tiago Cunha
<tcunha@gmx.com>
Wed, 4 Jul 2012 20:37:20 +0000
(21:37 +0100)
committer
Tiago Cunha
<tcunha@gmx.com>
Wed, 4 Jul 2012 20:37:20 +0000
(21:37 +0100)
spectrwm.c
patch
|
blob
|
history
diff --git
a/spectrwm.c
b/spectrwm.c
index
b4e86a4
..
024c527
100644
(file)
--- a/
spectrwm.c
+++ b/
spectrwm.c
@@
-1539,6
+1539,15
@@
bar_fmt(const char *fmtexp, char *fmtnew, struct swm_region *r, size_t sz)
strlcat(fmtnew, "+4<+A+4<+V", sz);
}
strlcat(fmtnew, "+4<+A+4<+V", sz);
}
+void
+bar_replace_pad(char *tmp, int *limit, size_t sz)
+{
+ /* special case; no limit given, pad one space, instead */
+ if (*limit == sz - 1)
+ *limit = 1;
+ snprintf(tmp, sz, "%*s", *limit, " ");
+}
+
/* replaces the bar format character sequences (like in tmux(1)) */
char *
bar_replace_seq(char *fmt, char *fmtrep, struct swm_region *r, size_t *offrep,
/* replaces the bar format character sequences (like in tmux(1)) */
char *
bar_replace_seq(char *fmt, char *fmtrep, struct swm_region *r, size_t *offrep,
@@
-1575,10
+1584,7
@@
bar_replace_seq(char *fmt, char *fmtrep, struct swm_region *r, size_t *offrep,
switch (*fmt) {
case '<':
switch (*fmt) {
case '<':
- /* special case; no limit given, pad one space, instead */
- if (limit == sizeof tmp - 1)
- limit = 1;
- snprintf(tmp, sizeof tmp, "%*s", limit, " ");
+ bar_replace_pad(tmp, &limit, sizeof tmp);
break;
case 'A':
snprintf(tmp, sizeof tmp, "%s", bar_ext);
break;
case 'A':
snprintf(tmp, sizeof tmp, "%s", bar_ext);