summaryrefslogtreecommitdiffstats
path: root/usr.bin/indent/args.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/indent/args.c')
-rw-r--r--usr.bin/indent/args.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/usr.bin/indent/args.c b/usr.bin/indent/args.c
index 09df243..00456e1 100644
--- a/usr.bin/indent/args.c
+++ b/usr.bin/indent/args.c
@@ -1,4 +1,4 @@
-/*
+/*-
* SPDX-License-Identifier: BSD-4-Clause
*
* Copyright (c) 1985 Sun Microsystems, Inc.
@@ -93,6 +93,7 @@ struct pro {
} pro[] = {
{"T", PRO_SPECIAL, 0, KEY, 0},
+ {"P", PRO_SPECIAL, 0, IGN, 0},
{"bacc", PRO_BOOL, false, ON, &blanklines_around_conditional_compilation},
{"badp", PRO_BOOL, false, ON, &blanklines_after_declarations_at_proctop},
{"bad", PRO_BOOL, false, ON, &blanklines_after_declarations},
@@ -225,17 +226,14 @@ scan_profile(FILE *f)
}
}
-const char *param_start;
-
-static int
+static const char *
eqin(const char *s1, const char *s2)
{
while (*s1) {
if (*s1++ != *s2++)
- return (false);
+ return (NULL);
}
- param_start = s2;
- return (true);
+ return (s2);
}
/*
@@ -259,11 +257,12 @@ set_defaults(void)
void
set_option(char *arg)
{
- struct pro *p;
+ struct pro *p;
+ const char *param_start;
arg++; /* ignore leading "-" */
for (p = pro; p->p_name; p++)
- if (*p->p_name == *arg && eqin(p->p_name, arg))
+ if (*p->p_name == *arg && (param_start = eqin(p->p_name, arg)) != NULL)
goto found;
errx(1, "%s: unknown parameter \"%s\"", option_source, arg - 1);
found:
@@ -282,9 +281,9 @@ found:
break;
case STDIN:
- if (input == 0)
+ if (input == NULL)
input = stdin;
- if (output == 0)
+ if (output == NULL)
output = stdout;
break;
OpenPOWER on IntegriCloud