aboutsummaryrefslogtreecommitdiffstats
path: root/islang.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:18:09 +0000
committerTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:18:09 +0000
commit5f8e0f8ef9a422691dd72e8a953a42a41478fcb4 (patch)
tree4b2df4796a534793648b3c4fc532fc36bd0cd525 /islang.c
parentReleasing debian version 0.3-2.4 (diff)
downloadw3m-debian/0.5.1-1.tar.gz
w3m-debian/0.5.1-1.zip
Releasing debian version 0.5.1-1debian/0.5.1-1
Diffstat (limited to '')
-rw-r--r--islang.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/islang.c b/islang.c
new file mode 100644
index 0000000..bcf9688
--- /dev/null
+++ b/islang.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2000, NBG01720@nifty.ne.jp
+ *
+ * To compile this program:
+ * gcc -Zomf -Zcrtdll -O2 -Wall -s islang.c
+ */
+#define INCL_DOSNLS
+#include <os2.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+int
+main(int argc, char **argv)
+{
+ if (argc <= 1)
+ return 1;
+
+ if (isdigit((int)*argv[1])) {
+ ULONG CpList[8], CpSize;
+ APIRET rc = DosQueryCp(sizeof(CpList), CpList, &CpSize);
+ if (rc)
+ return rc;
+ while (--argc > 0)
+ if (*CpList == atoi(argv[argc]))
+ return 0;
+ }
+ else {
+ char *lang = getenv("LANG");
+ if (!lang || !*lang) {
+ lang = getenv("LANGUAGE");
+ if (!lang || !*lang)
+ return 1;
+ }
+ if (!strnicmp(lang, argv[1], 2))
+ return 0;
+ }
+ return 1;
+}