Module Name:    src
Committed By:   rillig
Date:           Sun Mar  7 10:42:49 UTC 2021

Modified Files:
        src/usr.bin/indent: args.c indent.c indent.h io.c lexi.c parse.c
            pr_comment.c

Log Message:
indent: use all headers in all files

This is a prerequisite for converting the token types to an enum instead
of a preprocessor define, since the return type of lexi will become
token_type.  Having the enum will make debugging easier.

There was a single naming collision, which forced the variable in
scan_profile to be renamed.  All other token names are used nowhere
else.

No change to the resulting binary.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.bin/indent/args.c
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.21 -r1.22 src/usr.bin/indent/io.c
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/indent/parse.c \
    src/usr.bin/indent/pr_comment.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/indent/args.c
diff -u src/usr.bin/indent/args.c:1.14 src/usr.bin/indent/args.c:1.15
--- src/usr.bin/indent/args.c:1.14	Thu Apr  4 15:22:13 2019
+++ src/usr.bin/indent/args.c	Sun Mar  7 10:42:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.14 2019/04/04 15:22:13 kamil Exp $	*/
+/*	$NetBSD: args.c,v 1.15 2021/03/07 10:42:48 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@ static char sccsid[] = "@(#)args.c	8.1 (
 #include <sys/cdefs.h>
 #ifndef lint
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.14 2019/04/04 15:22:13 kamil Exp $");
+__RCSID("$NetBSD: args.c,v 1.15 2021/03/07 10:42:48 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
 #endif
@@ -63,7 +63,7 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "indent_globs.h"
+
 #include "indent.h"
 
 #define INDENT_VERSION	"2.0"
@@ -209,22 +209,22 @@ set_profile(const char *profile_name)
 static void
 scan_profile(FILE *f)
 {
-    int		comment, i;
+    int		comment_index, i;
     char	*p;
     char        buf[BUFSIZ];
 
     while (1) {
 	p = buf;
-	comment = 0;
+	comment_index = 0;
 	while ((i = getc(f)) != EOF) {
-	    if (i == '*' && !comment && p > buf && p[-1] == '/') {
-		comment = p - buf;
+	    if (i == '*' && !comment_index && p > buf && p[-1] == '/') {
+		comment_index = p - buf;
 		*p++ = i;
-	    } else if (i == '/' && comment && p > buf && p[-1] == '*') {
-		p = buf + comment - 1;
-		comment = 0;
+	    } else if (i == '/' && comment_index && p > buf && p[-1] == '*') {
+		p = buf + comment_index - 1;
+		comment_index = 0;
 	    } else if (isspace((unsigned char)i)) {
-		if (p > buf && !comment)
+		if (p > buf && !comment_index)
 		    break;
 	    } else {
 		*p++ = i;

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.28 src/usr.bin/indent/indent.c:1.29
--- src/usr.bin/indent/indent.c:1.28	Sat Mar  6 20:30:06 2021
+++ src/usr.bin/indent/indent.c	Sun Mar  7 10:42:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.28 2021/03/06 20:30:06 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.29 2021/03/07 10:42:48 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@ static char sccsid[] = "@(#)indent.c	5.1
 #include <sys/cdefs.h>
 #ifndef lint
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.28 2021/03/06 20:30:06 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.29 2021/03/07 10:42:48 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -65,8 +65,7 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
-#include "indent_globs.h"
-#include "indent_codes.h"
+
 #include "indent.h"
 
 struct options opt;

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.2 src/usr.bin/indent/indent.h:1.3
--- src/usr.bin/indent/indent.h:1.2	Sat Oct 19 15:44:31 2019
+++ src/usr.bin/indent/indent.h	Sun Mar  7 10:42:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.2 2019/10/19 15:44:31 christos Exp $	*/
+/*	$NetBSD: indent.h,v 1.3 2021/03/07 10:42:48 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -30,12 +30,15 @@
 
 #if 0
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.h,v 1.2 2019/10/19 15:44:31 christos Exp $");
+__RCSID("$NetBSD: indent.h,v 1.3 2021/03/07 10:42:48 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.h 336333 2018-07-16 05:46:50Z pstef $");
 #endif
 #endif
 
+#include "indent_codes.h"
+#include "indent_globs.h"
+
 #ifndef nitems
 #define nitems(array) (sizeof (array) / sizeof (array[0]))
 #endif

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.21 src/usr.bin/indent/io.c:1.22
--- src/usr.bin/indent/io.c:1.21	Sat Mar  6 20:30:06 2021
+++ src/usr.bin/indent/io.c	Sun Mar  7 10:42:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.21 2021/03/06 20:30:06 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.22 2021/03/07 10:42:48 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@ static char sccsid[] = "@(#)io.c	8.1 (Be
 #include <sys/cdefs.h>
 #ifndef lint
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: io.c,v 1.21 2021/03/06 20:30:06 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.22 2021/03/07 10:42:48 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -58,7 +58,7 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/
 #include <stdlib.h>
 #include <string.h>
 #include <stdarg.h>
-#include "indent_globs.h"
+
 #include "indent.h"
 
 int         comment_open;

Index: src/usr.bin/indent/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.17 src/usr.bin/indent/lexi.c:1.18
--- src/usr.bin/indent/lexi.c:1.17	Sat Oct 19 15:44:31 2019
+++ src/usr.bin/indent/lexi.c	Sun Mar  7 10:42:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lexi.c,v 1.17 2019/10/19 15:44:31 christos Exp $	*/
+/*	$NetBSD: lexi.c,v 1.18 2021/03/07 10:42:48 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@ static char sccsid[] = "@(#)lexi.c	8.1 (
 #include <sys/cdefs.h>
 #ifndef lint
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.17 2019/10/19 15:44:31 christos Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.18 2021/03/07 10:42:48 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -65,8 +65,6 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/
 #include <string.h>
 #include <sys/param.h>
 
-#include "indent_globs.h"
-#include "indent_codes.h"
 #include "indent.h"
 
 struct templ {

Index: src/usr.bin/indent/parse.c
diff -u src/usr.bin/indent/parse.c:1.11 src/usr.bin/indent/parse.c:1.12
--- src/usr.bin/indent/parse.c:1.11	Sat Mar  6 20:30:06 2021
+++ src/usr.bin/indent/parse.c	Sun Mar  7 10:42:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.11 2021/03/06 20:30:06 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.12 2021/03/07 10:42:48 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -54,8 +54,7 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/
 
 #include <err.h>
 #include <stdio.h>
-#include "indent_globs.h"
-#include "indent_codes.h"
+
 #include "indent.h"
 
 static void reduce(void);
Index: src/usr.bin/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.11 src/usr.bin/indent/pr_comment.c:1.12
--- src/usr.bin/indent/pr_comment.c:1.11	Thu Apr  4 15:22:13 2019
+++ src/usr.bin/indent/pr_comment.c	Sun Mar  7 10:42:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pr_comment.c,v 1.11 2019/04/04 15:22:13 kamil Exp $	*/
+/*	$NetBSD: pr_comment.c,v 1.12 2021/03/07 10:42:48 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@ static char sccsid[] = "@(#)pr_comment.c
 #include <sys/cdefs.h>
 #ifndef lint
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.11 2019/04/04 15:22:13 kamil Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.12 2021/03/07 10:42:48 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -56,9 +56,9 @@ __FBSDID("$FreeBSD: head/usr.bin/indent/
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "indent_globs.h"
-#include "indent_codes.h"
+
 #include "indent.h"
+
 /*
  * NAME:
  *	pr_comment

Reply via email to