mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
Add LC_TIME to the supported locale variables (#257)
The current version of 93u+m does not have proper support for the
LC_TIME variable. Setting LC_TIME has no effect on printf %T, and
if the locale is invalid no error message is shown:
$ LC_TIME=ja_JP.UTF-8
$ printf '%T\n' now
Wed Apr 7 15:18:13 PDT 2021
$ LC_TIME=invalid.locale
$ # No error message
src/cmd/ksh93/data/variables.c,
src/cmd/ksh93/include/variables.h,
src/cmd/ksh93/sh/init.c:
- Add support for the $LC_TIME variable. ksh93v- attempted to add
support for LC_TIME, but the patch from that version was extended
because the variable still didn't function correctly.
src/cmd/ksh93/tests/variables.sh:
- Add LC_TIME to the regression tests for LC_* variables.
This commit is contained in:
parent
3667aa4f71
commit
b2a7ec032f
6 changed files with 43 additions and 29 deletions
|
|
@ -194,6 +194,7 @@ typedef struct _init_
|
|||
Namfun_t SH_MATH_init;
|
||||
#ifdef _hdr_locale
|
||||
Namfun_t LC_TYPE_init;
|
||||
Namfun_t LC_TIME_init;
|
||||
Namfun_t LC_NUM_init;
|
||||
Namfun_t LC_COLL_init;
|
||||
Namfun_t LC_MSG_init;
|
||||
|
|
@ -438,6 +439,8 @@ static void put_cdpath(register Namval_t* np,const char *val,int flags,Namfun_t
|
|||
type = LC_COLLATE;
|
||||
else if(name==(LCNUMNOD)->nvname)
|
||||
type = LC_NUMERIC;
|
||||
else if(name==(LCTIMENOD)->nvname)
|
||||
type = LC_TIME;
|
||||
#ifdef LC_LANG
|
||||
else if(name==(LANGNOD)->nvname)
|
||||
type = LC_LANG;
|
||||
|
|
@ -1598,7 +1601,7 @@ Namfun_t *nv_cover(register Namval_t *np)
|
|||
if(np==IFSNOD || np==PATHNOD || np==SHELLNOD || np==FPATHNOD || np==CDPNOD || np==SECONDS || np==ENVNOD || np==LINENO)
|
||||
return(np->nvfun);
|
||||
#ifdef _hdr_locale
|
||||
if(np==LCALLNOD || np==LCTYPENOD || np==LCMSGNOD || np==LCCOLLNOD || np==LCNUMNOD || np==LANGNOD)
|
||||
if(np==LCALLNOD || np==LCTYPENOD || np==LCMSGNOD || np==LCCOLLNOD || np==LCNUMNOD || np==LCTIMENOD || np==LANGNOD)
|
||||
return(np->nvfun);
|
||||
#endif
|
||||
return(0);
|
||||
|
|
@ -1765,6 +1768,8 @@ static Init_t *nv_init(Shell_t *shp)
|
|||
#ifdef _hdr_locale
|
||||
ip->LC_TYPE_init.disc = &LC_disc;
|
||||
ip->LC_TYPE_init.nofree = 1;
|
||||
ip->LC_TIME_init.disc = &LC_disc;
|
||||
ip->LC_TIME_init.nofree = 1;
|
||||
ip->LC_NUM_init.disc = &LC_disc;
|
||||
ip->LC_NUM_init.nofree = 1;
|
||||
ip->LC_COLL_init.disc = &LC_disc;
|
||||
|
|
@ -1807,6 +1812,7 @@ static Init_t *nv_init(Shell_t *shp)
|
|||
nv_stack(LCMSGNOD, &ip->LC_MSG_init);
|
||||
nv_stack(LCCOLLNOD, &ip->LC_COLL_init);
|
||||
nv_stack(LCNUMNOD, &ip->LC_NUM_init);
|
||||
nv_stack(LCTIMENOD, &ip->LC_TIME_init);
|
||||
nv_stack(LANGNOD, &ip->LANG_init);
|
||||
#endif /* _hdr_locale */
|
||||
(PPIDNOD)->nvalue.pidp = (&shp->gd->ppid);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue