diff options
author | Carlos Santos | 2017-06-29 12:55:42 +0200 |
---|---|---|
committer | Karel Zak | 2017-06-29 13:03:43 +0200 |
commit | ccedd0d7b12df2382dc223d3325fe52a2981bb59 (patch) | |
tree | 6ca6339e8d5fc17cf2a37a2f66a609e22b335a8e /text-utils/column.c | |
parent | libmount: use _exit() in <type> handlers (diff) | |
download | kernel-qcow2-util-linux-ccedd0d7b12df2382dc223d3325fe52a2981bb59.tar.gz kernel-qcow2-util-linux-ccedd0d7b12df2382dc223d3325fe52a2981bb59.tar.xz kernel-qcow2-util-linux-ccedd0d7b12df2382dc223d3325fe52a2981bb59.zip |
column: fix compilation when libc lacks wide-character support
Commit 4762ae9d removed mtsafe_strtok() but left behind calls to wcstok
and wcspbrk. This leads to build failures when libc does not have the
wide-character functions, like some uClibc builds.
Solve the problem by using strtok_r and strpbrk when HAVE_WIDECHAR is
not defined.
Fixes:
http://autobuild.buildroot.net/results/fd8a1a8e0cef3aeed9588540e8e663664f6b43aa
http://autobuild.buildroot.net/results/5ad73ea8b471321988c50d80a5e50d4504151dd6
http://autobuild.buildroot.net/results/04411b7280dc51ecd51236967981a42352bbeb3e
Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
Diffstat (limited to 'text-utils/column.c')
-rw-r--r-- | text-utils/column.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/text-utils/column.c b/text-utils/column.c index be99f94fa..fb57b4748 100644 --- a/text-utils/column.c +++ b/text-utils/column.c @@ -160,14 +160,22 @@ static wchar_t *local_wcstok(wchar_t *p, const wchar_t *separator, int greedy, w wchar_t *result = NULL; if (greedy) +#ifdef HAVE_WIDECHAR return wcstok(p, separator, state); +#else + return strtok_r(p, separator, state); +#endif if (!p) { if (!*state || !**state) return NULL; p = *state; } result = p; +#ifdef HAVE_WIDECHAR p = wcspbrk(result, separator); +#else + p = strpbrk(result, separator); +#endif if (!p) *state = NULL; else { |