summaryrefslogtreecommitdiffstats
path: root/test/regex/tst-regexloc.c
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2009-01-22 16:04:28 +0000
committerCarmelo Amoroso <carmelo.amoroso@st.com>2009-01-22 16:04:28 +0000
commit91772298b0377ab805e19085f60a7808fe62d157 (patch)
tree520a9015fd8ce7aebbd503814b5758dfe9b07cba /test/regex/tst-regexloc.c
parent2f22f00640b79531879bf21afc9727483934ac65 (diff)
downloaduClibc-alpine-91772298b0377ab805e19085f60a7808fe62d157.tar.bz2
uClibc-alpine-91772298b0377ab805e19085f60a7808fe62d157.tar.xz
Synch with trunk: miscellaneous changes, mostly cleanup,
code styling, comments. No object-code changes. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'test/regex/tst-regexloc.c')
-rw-r--r--test/regex/tst-regexloc.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/test/regex/tst-regexloc.c b/test/regex/tst-regexloc.c
index 88ab58116..4bc65f660 100644
--- a/test/regex/tst-regexloc.c
+++ b/test/regex/tst-regexloc.c
@@ -24,10 +24,12 @@
int
main (int argc, char *argv[])
{
-#ifdef __UCLIBC_HAS_XLOCALE__
+/* If uclibc has extended locale, or if it's a host build
+ * (assuming host libc always has locale): */
+#if defined __UCLIBC_HAS_XLOCALE__ || !defined __UCLIBC__
regex_t re;
regmatch_t mat[1];
- int res = 1;
+ int exitcode = 1;
if (setlocale (LC_ALL, "de_DE.ISO-8859-1") == NULL)
puts ("cannot set locale");
@@ -37,11 +39,14 @@ main (int argc, char *argv[])
puts ("no match");
else
{
- printf ("match from %d to %d\n", mat[0].rm_so, mat[0].rm_eo);
- res = mat[0].rm_so != 0 || mat[0].rm_eo != 6;
+ exitcode = mat[0].rm_so != 0 || mat[0].rm_eo != 6;
+ printf ("match from %d to %d - %s\n",
+ mat[0].rm_so, mat[0].rm_eo,
+ exitcode ? "WRONG!" : "ok"
+ );
}
- return res;
+ return exitcode;
#else
puts("Test requires locale; skipping");
return 0;