Add (#ifdef'ed by STARTUP_LOCALE) following line to crt0.c
(void) setlocale(LC_ALL, ""); It will be easiest way now to make national chars available for all ctype-oriented programs at once by simple: setenv LANG Your_National_Charset Default case (without "LANG" environment variable) will be fully ANSI compatible (got "C" locale). If "LANG" variable present, extention becomes active. Effect of this extention is great: in one time all ctype oriented programs can accept/print national characters without any touching source/binary code, it is big win, IMHO. This method is fully compatible with ISO8859-* and russian koi8-r too (in general -- with all 8-bit character sets). I think it is very useful. I got this idea from Xenix locale implementation. This extention is even never compiled in, unless you set setenv STARTUP_LOCALE before rebuilding crt0.c or corresponding variable in /etc/make.conf
This commit is contained in:
parent
66415998d0
commit
f32a347542
@ -1,7 +1,10 @@
|
|||||||
# from: @(#)Makefile 5.6 (Berkeley) 5/22/91
|
# from: @(#)Makefile 5.6 (Berkeley) 5/22/91
|
||||||
# $Id: Makefile,v 1.9 1994/03/09 17:12:57 nate Exp $
|
# $Id: Makefile,v 1.10 1994/08/22 15:13:41 bde Exp $
|
||||||
|
|
||||||
CFLAGS+= -DLIBC_SCCS -DDYNAMIC
|
CFLAGS+= -DLIBC_SCCS -DDYNAMIC
|
||||||
|
.if defined(STARTUP_LOCALE)
|
||||||
|
CFLAGS+= -DSTARTUP_LOCALE
|
||||||
|
.endif
|
||||||
OBJS= crt0.o gcrt0.o c++rt0.o
|
OBJS= crt0.o gcrt0.o c++rt0.o
|
||||||
CLEANFILES+= a.out
|
CLEANFILES+= a.out
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: crt0.c,v 1.8 1994/02/13 20:53:11 jkh Exp $
|
* $Id: crt0.c,v 1.11 1994/08/05 17:53:07 wollman Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -39,6 +39,9 @@ extern void exit();
|
|||||||
int _callmain();
|
int _callmain();
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#ifdef STARTUP_LOCALE
|
||||||
|
#include <locale.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DYNAMIC
|
#ifdef DYNAMIC
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -173,7 +176,10 @@ asm("eprol:");
|
|||||||
#ifdef MCRT0
|
#ifdef MCRT0
|
||||||
atexit(_mcleanup);
|
atexit(_mcleanup);
|
||||||
monstartup(&eprol, &etext);
|
monstartup(&eprol, &etext);
|
||||||
#endif MCRT0
|
#endif /* MCRT0 */
|
||||||
|
#ifdef STARTUP_LOCALE
|
||||||
|
(void) setlocale(LC_ALL, "");
|
||||||
|
#endif
|
||||||
|
|
||||||
asm ("__callmain:"); /* Defined for the benefit of debuggers */
|
asm ("__callmain:"); /* Defined for the benefit of debuggers */
|
||||||
exit(main(kfp->kargc, argv, environ));
|
exit(main(kfp->kargc, argv, environ));
|
||||||
|
Loading…
Reference in New Issue
Block a user