File: langinfo.c

package info (click to toggle)
catdoc 0.94.4-1.1
  • links: PTS
  • area: main
  • in suites: jessie-kfreebsd, wheezy
  • size: 2,940 kB
  • sloc: ansic: 4,186; tcl: 262; makefile: 220; sh: 212
file content (25 lines) | stat: -rw-r--r-- 488 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdlib.h>
#include <stdio.h>
#include <dos.h>
#include <langinfo.h>

static char *badParam="";
char* __get_dos_codepage(void) {
	static char codePageName[10];
	union REGS regs;
	regs.x.ax=0x6601;
	intdos(&regs,&regs);
	sprintf(codePageName,"cp%d",(regs.x.bx & 0xFFFF));
	if (regs.x.cflag) {
		return badParam;
	}
	return codePageName;
}	
char *nl_langinfo(nl_item item) {
   if (item == CODESET) {
   		return __get_dos_codepage();
   } else {
	   return badParam;
   }	   
}