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.
This commit is contained in:
parent
e31cf72b5a
commit
3658a7adc6
|
@ -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 (Berkeley) 6/6/93";
|
|||
#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/args.c 336318 2018-07-15 21:04:21Z pstef
|
|||
#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;
|
||||
|
|
|
@ -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.17 (Berkeley) 6/7/93";
|
|||
#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/indent.c 340138 2018-11-04 19:24:49Z osh
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "indent_globs.h"
|
||||
#include "indent_codes.h"
|
||||
|
||||
#include "indent.h"
|
||||
|
||||
struct options opt;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 (Berkeley) 6/6/93";
|
|||
#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/io.c 334927 2018-06-10 16:44:18Z pstef $
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include "indent_globs.h"
|
||||
|
||||
#include "indent.h"
|
||||
|
||||
int comment_open;
|
||||
|
|
|
@ -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 (Berkeley) 6/6/93";
|
|||
#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/lexi.c 337862 2018-08-15 18:19:45Z pstef
|
|||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#include "indent_globs.h"
|
||||
#include "indent_codes.h"
|
||||
#include "indent.h"
|
||||
|
||||
struct templ {
|
||||
|
|
|
@ -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/parse.c 337651 2018-08-11 19:20:06Z pste
|
|||
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include "indent_globs.h"
|
||||
#include "indent_codes.h"
|
||||
|
||||
#include "indent.h"
|
||||
|
||||
static void reduce(void);
|
||||
|
|
|
@ -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 8.1 (Berkeley) 6/6/93";
|
|||
#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/pr_comment.c 334927 2018-06-10 16:44:18Z
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "indent_globs.h"
|
||||
#include "indent_codes.h"
|
||||
|
||||
#include "indent.h"
|
||||
|
||||
/*
|
||||
* NAME:
|
||||
* pr_comment
|
||||
|
|
Loading…
Reference in New Issue