| @@ -1,32 +1,32 @@ | | | @@ -1,32 +1,32 @@ |
1 | /* $NetBSD: ex_mkexrc.c,v 1.3 2014/01/26 21:43:45 christos Exp $ */ | | 1 | /* $NetBSD: ex_mkexrc.c,v 1.3.6.1 2015/04/14 05:18:53 snj Exp $ */ |
2 | /*- | | 2 | /*- |
3 | * Copyright (c) 1992, 1993, 1994 | | 3 | * Copyright (c) 1992, 1993, 1994 |
4 | * The Regents of the University of California. All rights reserved. | | 4 | * The Regents of the University of California. All rights reserved. |
5 | * Copyright (c) 1992, 1993, 1994, 1995, 1996 | | 5 | * Copyright (c) 1992, 1993, 1994, 1995, 1996 |
6 | * Keith Bostic. All rights reserved. | | 6 | * Keith Bostic. All rights reserved. |
7 | * | | 7 | * |
8 | * See the LICENSE file for redistribution information. | | 8 | * See the LICENSE file for redistribution information. |
9 | */ | | 9 | */ |
10 | | | 10 | |
11 | #include "config.h" | | 11 | #include "config.h" |
12 | | | 12 | |
13 | #include <sys/cdefs.h> | | 13 | #include <sys/cdefs.h> |
14 | #if 0 | | 14 | #if 0 |
15 | #ifndef lint | | 15 | #ifndef lint |
16 | static const char sccsid[] = "Id: ex_mkexrc.c,v 10.13 2001/06/25 15:19:17 skimo Exp (Berkeley) Date: 2001/06/25 15:19:17 "; | | 16 | static const char sccsid[] = "Id: ex_mkexrc.c,v 10.13 2001/06/25 15:19:17 skimo Exp (Berkeley) Date: 2001/06/25 15:19:17 "; |
17 | #endif /* not lint */ | | 17 | #endif /* not lint */ |
18 | #else | | 18 | #else |
19 | __RCSID("$NetBSD: ex_mkexrc.c,v 1.3 2014/01/26 21:43:45 christos Exp $"); | | 19 | __RCSID("$NetBSD: ex_mkexrc.c,v 1.3.6.1 2015/04/14 05:18:53 snj Exp $"); |
20 | #endif | | 20 | #endif |
21 | | | 21 | |
22 | #include <sys/types.h> | | 22 | #include <sys/types.h> |
23 | #include <sys/queue.h> | | 23 | #include <sys/queue.h> |
24 | #include <sys/stat.h> | | 24 | #include <sys/stat.h> |
25 | | | 25 | |
26 | #include <bitstring.h> | | 26 | #include <bitstring.h> |
27 | #include <errno.h> | | 27 | #include <errno.h> |
28 | #include <fcntl.h> | | 28 | #include <fcntl.h> |
29 | #include <limits.h> | | 29 | #include <limits.h> |
30 | #include <stdio.h> | | 30 | #include <stdio.h> |
31 | #include <stdlib.h> | | 31 | #include <stdlib.h> |
32 | #include <string.h> | | 32 | #include <string.h> |
| @@ -42,27 +42,27 @@ __RCSID("$NetBSD: ex_mkexrc.c,v 1.3 2014 | | | @@ -42,27 +42,27 @@ __RCSID("$NetBSD: ex_mkexrc.c,v 1.3 2014 |
42 | * | | 42 | * |
43 | * PUBLIC: int ex_mkexrc __P((SCR *, EXCMD *)); | | 43 | * PUBLIC: int ex_mkexrc __P((SCR *, EXCMD *)); |
44 | */ | | 44 | */ |
45 | int | | 45 | int |
46 | ex_mkexrc(SCR *sp, EXCMD *cmdp) | | 46 | ex_mkexrc(SCR *sp, EXCMD *cmdp) |
47 | { | | 47 | { |
48 | struct stat sb; | | 48 | struct stat sb; |
49 | FILE *fp; | | 49 | FILE *fp; |
50 | int fd, sverrno; | | 50 | int fd, sverrno; |
51 | const char *fname; | | 51 | const char *fname; |
52 | size_t flen; | | 52 | size_t flen; |
53 | | | 53 | |
54 | switch (cmdp->argc) { | | 54 | switch (cmdp->argc) { |
55 | case 0: | | 55 | case 1: |
56 | fname = _PATH_EXRC; | | 56 | fname = _PATH_EXRC; |
57 | INT2CHAR(sp, cmdp->argv[0]->bp, cmdp->argv[0]->len + 1, | | 57 | INT2CHAR(sp, cmdp->argv[0]->bp, cmdp->argv[0]->len + 1, |
58 | fname, flen); | | 58 | fname, flen); |
59 | set_alt_name(sp, fname); | | 59 | set_alt_name(sp, fname); |
60 | break; | | 60 | break; |
61 | default: | | 61 | default: |
62 | abort(); | | 62 | abort(); |
63 | } | | 63 | } |
64 | | | 64 | |
65 | if (!FL_ISSET(cmdp->iflags, E_C_FORCE) && !stat(fname, &sb)) { | | 65 | if (!FL_ISSET(cmdp->iflags, E_C_FORCE) && !stat(fname, &sb)) { |
66 | msgq_str(sp, M_ERR, fname, | | 66 | msgq_str(sp, M_ERR, fname, |
67 | "137|%s exists, not written; use ! to override"); | | 67 | "137|%s exists, not written; use ! to override"); |
68 | return (1); | | 68 | return (1); |