| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: io.c,v 1.28 2021/03/12 19:11:29 rillig Exp $ */ | | 1 | /* $NetBSD: io.c,v 1.29 2021/03/12 19:14:18 rillig Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * SPDX-License-Identifier: BSD-4-Clause | | 4 | * SPDX-License-Identifier: BSD-4-Clause |
5 | * | | 5 | * |
6 | * Copyright (c) 1985 Sun Microsystems, Inc. | | 6 | * Copyright (c) 1985 Sun Microsystems, Inc. |
7 | * Copyright (c) 1980, 1993 | | 7 | * Copyright (c) 1980, 1993 |
8 | * The Regents of the University of California. All rights reserved. | | 8 | * The Regents of the University of California. All rights reserved. |
9 | * All rights reserved. | | 9 | * All rights reserved. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -36,27 +36,27 @@ | | | @@ -36,27 +36,27 @@ |
36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
37 | * SUCH DAMAGE. | | 37 | * SUCH DAMAGE. |
38 | */ | | 38 | */ |
39 | | | 39 | |
40 | #if 0 | | 40 | #if 0 |
41 | #ifndef lint | | 41 | #ifndef lint |
42 | static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93"; | | 42 | static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93"; |
43 | #endif /* not lint */ | | 43 | #endif /* not lint */ |
44 | #endif | | 44 | #endif |
45 | | | 45 | |
46 | #include <sys/cdefs.h> | | 46 | #include <sys/cdefs.h> |
47 | #ifndef lint | | 47 | #ifndef lint |
48 | #if defined(__NetBSD__) | | 48 | #if defined(__NetBSD__) |
49 | __RCSID("$NetBSD: io.c,v 1.28 2021/03/12 19:11:29 rillig Exp $"); | | 49 | __RCSID("$NetBSD: io.c,v 1.29 2021/03/12 19:14:18 rillig Exp $"); |
50 | #elif defined(__FreeBSD__) | | 50 | #elif defined(__FreeBSD__) |
51 | __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $"); | | 51 | __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $"); |
52 | #endif | | 52 | #endif |
53 | #endif | | 53 | #endif |
54 | | | 54 | |
55 | #include <ctype.h> | | 55 | #include <ctype.h> |
56 | #include <err.h> | | 56 | #include <err.h> |
57 | #include <stdio.h> | | 57 | #include <stdio.h> |
58 | #include <stdlib.h> | | 58 | #include <stdlib.h> |
59 | #include <string.h> | | 59 | #include <string.h> |
60 | #include <stdarg.h> | | 60 | #include <stdarg.h> |
61 | | | 61 | |
62 | #include "indent.h" | | 62 | #include "indent.h" |
| @@ -67,27 +67,27 @@ static int pad_output(int current, int t | | | @@ -67,27 +67,27 @@ static int pad_output(int current, int t |
67 | | | 67 | |
68 | static void | | 68 | static void |
69 | output_char(char ch) | | 69 | output_char(char ch) |
70 | { | | 70 | { |
71 | fputc(ch, output); | | 71 | fputc(ch, output); |
72 | } | | 72 | } |
73 | | | 73 | |
74 | static void | | 74 | static void |
75 | output_range(const char *s, const char *e) | | 75 | output_range(const char *s, const char *e) |
76 | { | | 76 | { |
77 | fwrite(s, 1, (size_t)(e - s), output); | | 77 | fwrite(s, 1, (size_t)(e - s), output); |
78 | } | | 78 | } |
79 | | | 79 | |
80 | static void | | 80 | static inline void |
81 | output_string(const char *s) | | 81 | output_string(const char *s) |
82 | { | | 82 | { |
83 | output_range(s, s + strlen(s)); | | 83 | output_range(s, s + strlen(s)); |
84 | } | | 84 | } |
85 | | | 85 | |
86 | static void | | 86 | static void |
87 | output_int(int i) | | 87 | output_int(int i) |
88 | { | | 88 | { |
89 | fprintf(output, "%d", i); | | 89 | fprintf(output, "%d", i); |
90 | } | | 90 | } |
91 | | | 91 | |
92 | /* | | 92 | /* |
93 | * dump_line is the routine that actually effects the printing of the new | | 93 | * dump_line is the routine that actually effects the printing of the new |