Wed May 26 07:57:05 2021 UTC ()
correct indentation. spotted by Roland.


(cjep)
diff -r1.27 -r1.28 src/usr.bin/patch/inp.c

cvs diff -r1.27 -r1.28 src/usr.bin/patch/inp.c (expand / switch to unified diff)

--- src/usr.bin/patch/inp.c 2021/05/25 11:25:59 1.27
+++ src/usr.bin/patch/inp.c 2021/05/26 07:57:05 1.28
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1/* 1/*
2 * $OpenBSD: inp.c,v 1.34 2006/03/11 19:41:30 otto Exp $ 2 * $OpenBSD: inp.c,v 1.34 2006/03/11 19:41:30 otto Exp $
3 * $DragonFly: src/usr.bin/patch/inp.c,v 1.6 2007/09/29 23:11:10 swildner Exp $ 3 * $DragonFly: src/usr.bin/patch/inp.c,v 1.6 2007/09/29 23:11:10 swildner Exp $
4 * $NetBSD: inp.c,v 1.27 2021/05/25 11:25:59 cjep Exp $ 4 * $NetBSD: inp.c,v 1.28 2021/05/26 07:57:05 cjep Exp $
5 */ 5 */
6 6
7/* 7/*
8 * patch - a program to apply diffs to original files 8 * patch - a program to apply diffs to original files
9 *  9 *
10 * Copyright 1986, Larry Wall 10 * Copyright 1986, Larry Wall
11 *  11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following condition is met: 13 * modification, are permitted provided that the following condition is met:
14 * 1. Redistributions of source code must retain the above copyright notice, 14 * 1. Redistributions of source code must retain the above copyright notice,
15 * this condition and the following disclaimer. 15 * this condition and the following disclaimer.
16 *  16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE. 27 * SUCH DAMAGE.
28 *  28 *
29 * -C option added in 1998, original code by Marc Espie, based on FreeBSD 29 * -C option added in 1998, original code by Marc Espie, based on FreeBSD
30 * behaviour 30 * behaviour
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__RCSID("$NetBSD: inp.c,v 1.27 2021/05/25 11:25:59 cjep Exp $"); 34__RCSID("$NetBSD: inp.c,v 1.28 2021/05/26 07:57:05 cjep Exp $");
35 35
36#include <sys/types.h> 36#include <sys/types.h>
37#include <sys/file.h> 37#include <sys/file.h>
38#include <sys/stat.h> 38#include <sys/stat.h>
39#include <sys/mman.h> 39#include <sys/mman.h>
40#include <sys/wait.h> 40#include <sys/wait.h>
41 41
42#include <ctype.h> 42#include <ctype.h>
43#include <errno.h> 43#include <errno.h>
44#include <fcntl.h> 44#include <fcntl.h>
45#include <libgen.h> 45#include <libgen.h>
46#include <limits.h> 46#include <limits.h>
47#include <stddef.h> 47#include <stddef.h>
@@ -184,30 +184,30 @@ plan_a(const char *filename) @@ -184,30 +184,30 @@ plan_a(const char *filename)
184 ((filestat.st_mode & 0022) == 0 && filestat.st_uid != getuid())) { 184 ((filestat.st_mode & 0022) == 0 && filestat.st_uid != getuid())) {
185 char *filebase, *filedir; 185 char *filebase, *filedir;
186 struct stat cstat; 186 struct stat cstat;
187 char *tmp_filename1, *tmp_filename2; 187 char *tmp_filename1, *tmp_filename2;
188 188
189 tmp_filename1 = strdup(filename); 189 tmp_filename1 = strdup(filename);
190 tmp_filename2 = strdup(filename); 190 tmp_filename2 = strdup(filename);
191 if (tmp_filename1 == NULL || tmp_filename2 == NULL) 191 if (tmp_filename1 == NULL || tmp_filename2 == NULL)
192 fatal("strdupping filename"); 192 fatal("strdupping filename");
193  193
194 filebase = basename(tmp_filename1); 194 filebase = basename(tmp_filename1);
195 filedir = dirname(tmp_filename2); 195 filedir = dirname(tmp_filename2);
196 196
197 lbufsz = INITLINELEN; 197 lbufsz = INITLINELEN;
198 if ((lbuf = malloc(bufsz)) == NULL) 198 if ((lbuf = malloc(bufsz)) == NULL)
199 pfatal("allocating line buffer"); 199 pfatal("allocating line buffer");
200 lbuf[0] = '\0'; 200 lbuf[0] = '\0';
201  201
202#define try(f, a1, a2, a3) \ 202#define try(f, a1, a2, a3) \
203 (snprintf(lbuf, lbufsz, f, a1, a2, a3), stat(lbuf, &cstat) == 0) 203 (snprintf(lbuf, lbufsz, f, a1, a2, a3), stat(lbuf, &cstat) == 0)
204 204
205 /* 205 /*
206 * else we can't write to it but it's not under a version 206 * else we can't write to it but it's not under a version
207 * control system, so just proceed. 207 * control system, so just proceed.
208 */ 208 */
209 if (try("%s/RCS/%s%s", filedir, filebase, RCSSUFFIX) || 209 if (try("%s/RCS/%s%s", filedir, filebase, RCSSUFFIX) ||
210 try("%s/RCS/%s%s", filedir, filebase, "") || 210 try("%s/RCS/%s%s", filedir, filebase, "") ||
211 try("%s/%s%s", filedir, filebase, RCSSUFFIX)) { 211 try("%s/%s%s", filedir, filebase, RCSSUFFIX)) {
212 if (!statfailed) { 212 if (!statfailed) {
213 if ((filestat.st_mode & 0222) != 0) 213 if ((filestat.st_mode & 0222) != 0)