void-packages/srcpkgs/mcpp/patches/mbchar.patch
Đoàn Trần Công Danh 765e304c4b srcpkgs/m*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

29 lines
1,011 B
Diff

Fix set_encoding() to understand C.UTF-8 and other
locale names with != 5 characters before .
--- a/src/mbchar.c 2008-03-08 11:06:13.000000000 -0200
+++ b/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);