FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
drv_intl_getmonthname.c
Go to the documentation of this file.
1
/* get localized month name */
2
3
#include "../fb.h"
4
#include <langinfo.h>
5
6
FBSTRING
*
fb_DrvIntlGetMonthName
(
int
month,
int
short_names )
7
{
8
const
char
*pszName;
9
FBSTRING
*result;
10
size_t
name_len;
11
nl_item index;
12
13
if
( month < 1 || month > 12 )
14
return
NULL
;
15
16
if
( short_names ) {
17
index = (nl_item) (ABMON_1 + month - 1);
18
}
else
{
19
index = (nl_item) (MON_1 + month - 1);
20
}
21
22
FB_LOCK
();
23
24
pszName = nl_langinfo( index );
25
if
( pszName==
NULL
) {
26
FB_UNLOCK
();
27
return
NULL
;
28
}
29
30
name_len = strlen( pszName );
31
32
result =
fb_hStrAllocTemp
(
NULL
, name_len );
33
if
( result!=
NULL
) {
34
FB_MEMCPY
( result->
data
, pszName, name_len + 1 );
35
}
36
37
FB_UNLOCK
();
38
39
return
result;
40
}
rtlib
unix
drv_intl_getmonthname.c
Generated on Thu Jan 23 2014 19:40:08 for FreeBASIC by
1.8.4