mcpp: fix set_encoding() to understand C.UTF-8

This commit is contained in:
gt7-void 2020-01-13 12:03:49 -03:00 committed by Jürgen Buchmüller
parent 2636c9c5ba
commit 03544d1ce7
2 changed files with 30 additions and 1 deletions

View file

@ -0,0 +1,29 @@
Fix set_encoding() to understand C.UTF-8 and other
locale names with != 5 characters before .
--- src/mbchar.c 2008-03-08 11:06:13.000000000 -0200
+++ src/mbchar.c 2020-01-13 10:02:20.800174591 -0300
@@ -366,6 +366,7 @@
= "Too long encoding name: %s%.0ld%.0s"; /* _E_ */
const char * loc = "";
int alias;
+ char *dot;
char norm[ NAMLEN];
/*
* Normalized name (removed 'xxxxx.', stripped '_', '-', '.'
@@ -380,10 +381,11 @@
mcpp_fputc( '\n', ERR);
}
}
- strcpy( norm, name);
- if (norm[ 5] == '.')
- memmove( norm, norm + 5, strlen( norm + 5) + 1);
- /* Remove initial 'xxxxx.' as 'ja_JP.', 'en_US.' or any other */
+ if ( dot = strchr( name, '.' ) )
+ /* Remove initial 'xxxxx.' as 'ja_JP.', 'en_US.', 'C.' or any other */
+ strcpy( norm, dot+1);
+ else
+ strcpy( norm, name);
conv_case( norm, norm + strlen( norm), LOWER);
strip_bar( norm);

View file

@ -1,7 +1,7 @@
# Template file for 'mcpp'
pkgname=mcpp
version=2.7.2
revision=7
revision=8
build_style=gnu-configure
configure_args="--enable-mcpplib"
short_desc="Portable C preprocessor"