summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2011-01-04 08:48:25 (GMT)
committer John Mark Bell <jmb@netsurf-browser.org>2011-01-04 08:48:25 (GMT)
commitf3245d2f6197b89b9c78f2f785148d11666be0c8 (patch)
treeac2fd12a1a15cde9e29f7a2c32bed6a23976aa40
parent16e7d93be959cc49c2bc8cd8a667504a06bc02c9 (diff)
downloadiconv-f3245d2f6197b89b9c78f2f785148d11666be0c8.tar.gz
iconv-f3245d2f6197b89b9c78f2f785148d11666be0c8.tar.bz2
Obtain Aliases file from the Unicode resource -- testrunner no longer passes it to us
svn path=/trunk/iconv/; revision=11191
-rw-r--r--test/iconv.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/test/iconv.c b/test/iconv.c
index 0732040..cd0bfa3 100644
--- a/test/iconv.c
+++ b/test/iconv.c
@@ -1,17 +1,45 @@
#include <stdio.h>
+#include <string.h>
#include <iconv-internal/iconv.h>
#include "testutils.h"
+#ifdef __riscos__
+#define ALIASES_FILE "Files.Aliases"
+#else
+#define ALIASES_FILE "Files/Aliases"
+#endif
+
int main(int argc, char **argv)
{
- if (argc != 2) {
- printf("Usage: %s <aliases_file>\n", argv[0]);
- return 1;
+ const char *ucpath;
+ int alen;
+ char aliases[4096];
+
+ UNUSED(argc);
+ UNUSED(argv);
+
+#ifdef __riscos__
+ ucpath = "Unicode:";
+#else
+ ucpath = getenv("UNICODE_DIR");
+#endif
+
+ assert(ucpath != NULL);
+
+ strncpy(aliases, ucpath, sizeof(aliases));
+ alen = strlen(aliases);
+#ifndef __riscos__
+ if (aliases[alen - 1] != '/') {
+ strncat(aliases, "/", sizeof(aliases) - alen - 1);
+ alen += 1;
}
+#endif
+ strncat(aliases, ALIASES_FILE, sizeof(aliases) - alen - 1);
+ aliases[sizeof(aliases) - 1] = '\0';
- assert(iconv_initialise(argv[1]) == 1);
+ assert(iconv_initialise(aliases) == 1);
iconv_finalise();