void-packages/srcpkgs/sudoku/patches/musl-file.patch
Đoàn Trần Công Danh 4b97cd2fb4 srcpkgs/s*: 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

48 lines
1.5 KiB
Diff

--- a/sudoku.c 2015-03-13 16:20:28.000000000 +0100
+++ b/sudoku.c 2017-12-22 19:44:59.484598329 +0100
@@ -369,7 +369,8 @@
static int opt_solve = 0;
static int opt_restrict = 0;
-static FILE default_template_file; /* We will use only the address of it. */
+/* We will use only the address of it. */
+static FILE* default_template_file = (FILE *)0x000000001;
static int default_template_siz = 0;
static int default_template_pos = 0;
@@ -384,7 +385,7 @@
&& strcmp(mode, "r") == 0) {
stream = fopen(filename, "r");
if (0 == stream && strcmp(TEMPLATE_FALLBACK, filename) == 0) {
- stream = &default_template_file;
+ stream = default_template_file;
default_template_siz = sizeof(default_template) * 4;
default_template_pos = 0;
}
@@ -397,7 +398,7 @@
tclose (FILE * stream)
{
int ret = -1;
- if (stream == &default_template_file) {
+ if (stream == default_template_file) {
default_template_siz = 0;
default_template_pos = 0;
ret = 0;
@@ -414,7 +415,7 @@
int origin)
{
int ret = -1;
- if (stream != &default_template_file) {
+ if (stream != default_template_file) {
ret = fseek(stream,
offset,
origin);
@@ -454,7 +455,7 @@
FILE * stream)
{
char * ret = 0;
- if (stream == &default_template_file) {
+ if (stream == default_template_file) {
int i = 0;
if (str != 0
&& n > 0