w3m

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/w3m.git/
Log | Files | Refs | README

islang.c (748B)


      1 /*
      2  * Copyright (c) 2000, NBG01720@nifty.ne.jp
      3  *
      4  * To compile this program:
      5  *      gcc -Zomf -Zcrtdll -O2 -Wall -s islang.c
      6  */
      7 #define INCL_DOSNLS
      8 #include <os2.h>
      9 #include <stdlib.h>
     10 #include <stdio.h>
     11 #include <string.h>
     12 #include <ctype.h>
     13 
     14 int
     15 main(int argc, char **argv)
     16 {
     17     if (argc <= 1)
     18 	return 1;
     19 
     20     if (isdigit((int)*argv[1])) {
     21 	unsigned long CpList[8], CpSize;
     22 	APIRET rc = DosQueryCp(sizeof(CpList), CpList, &CpSize);
     23 	if (rc)
     24 	    return rc;
     25 	while (--argc > 0)
     26 	    if (*CpList == atoi(argv[argc]))
     27 		return 0;
     28     }
     29     else {
     30 	char *lang = getenv("LANG");
     31 	if (!lang || !*lang) {
     32 	    lang = getenv("LANGUAGE");
     33 	    if (!lang || !*lang)
     34 		return 1;
     35 	}
     36 	if (!strnicmp(lang, argv[1], 2))
     37 	    return 0;
     38     }
     39     return 1;
     40 }