summaryrefslogtreecommitdiff
path: root/legacy/evil/src/lib/evil_langinfo.c
diff options
context:
space:
mode:
authorVincent Torri <vincent.torri@gmail.com>2008-09-15 06:56:14 +0000
committerVincent Torri <vincent.torri@gmail.com>2008-09-15 06:56:14 +0000
commita7f00b51bcf19c8a5b040e6fc47398b689caa63f (patch)
tree75e34ba81140b77e14921744f28e1f98cd2fa43f /legacy/evil/src/lib/evil_langinfo.c
parentbae73a2b6079992df4b24a003229940e318f42af (diff)
* Makefile.am:
add autogen.sh in archive distribution * configure.ac: remove useless defines first support of mingw32msvc compiler * src/lib/Evil.h: move some macro definitions * src/lib/Makefile.am: add evil_(fcntl/langinfo).(c/h) and install pwd.h * src/lib/dlfcn/dlfcn.h: remove useless ifdef * src/lib/evil.c: comment all code for now. It will be deleted later * src/lib/evil_fcntl.c: * src/lib/evil_fcntl.h: * src/lib/evil_langinfo.c: * src/lib/evil_langinfo.h: move fcntl and langinfo related code to their own files * src/lib/evil_mman.c: remove useless inclusion * src/lib/evil_pwd.c: pw var is not needed with cegcc * src/lib/evil_stdlib.c: fix bugs, formatting * src/lib/evil_unistd.c: add missing declarations and fix header files * src/lib/evil_unistd.h: move pid_t typedef to Evil.h * src/lib/evil_util.c: additional include and fix a bug in output * src/lib/pwd.h: use EAPI from Evil.h, define struct passwd when not using cegcc * src/lib/sys/mman.h: use EAPI from Evil.h * win32/common/fnmatch.c: * win32/common/fnmatch.h: * win32/common/fnmatch_list_of_states.c: * win32/vs8/evil.sln: fix and cleanup with vc++ compilation Based on patch by Dmitriy Mazovka SVN revision: 35993
Diffstat (limited to 'legacy/evil/src/lib/evil_langinfo.c')
-rw-r--r--legacy/evil/src/lib/evil_langinfo.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/legacy/evil/src/lib/evil_langinfo.c b/legacy/evil/src/lib/evil_langinfo.c
new file mode 100644
index 0000000000..d478b0d028
--- /dev/null
+++ b/legacy/evil/src/lib/evil_langinfo.c
@@ -0,0 +1,50 @@
1
2#ifdef HAVE_CONFIG_H
3# include "config.h"
4#endif /* HAVE_CONFIG_H */
5
6#include "Evil.h"
7
8
9#ifndef __CEGCC__
10
11static char *
12replace(char *prev, char *value)
13{
14 if (value == NULL)
15 return prev;
16
17 if (prev)
18 free (prev);
19 return strdup (value);
20}
21
22char *
23nl_langinfo(nl_item index)
24{
25 static char *result = NULL;
26 static char *nothing = "";
27
28 switch (index)
29 {
30 case CODESET:
31 {
32 char *p;
33 result = replace(result, setlocale(LC_CTYPE, NULL));
34 if ((p = strrchr(result, '.' )) == NULL)
35 return nothing;
36
37 if ((++p - result) > 2)
38 strcpy(result, "cp");
39 else
40 *result = '\0';
41 strcat(result, p);
42
43 return result;
44 }
45 }
46
47 return nothing;
48}
49
50#endif /* ! __CEGCC__ */