aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/indent
Commit message (Collapse)AuthorAgeFilesLines
* tests: skip gracefully when the tested binary's own package isn't installedWarner Losh10 days1-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | pkgbase splits programs and their tests into separate packages (e.g. unifdef/yacc/indent/file2c -> toolchain, jail -> jail, etc), while their tests always land in the generic tests package. Installing just the tests package therefore leaves these suites unable to find the binary they exercise, and they fail confusingly instead of skipping. Rather than force all packages to be installed for the tests package, make the tests cope with the missing packages. Add require.progs (or, for TAP/PLAIN-style suites with no atf_set hook: TEST_METADATA required_programs) for the binary under test in: bectl, certctl, ctfconvert, dhclient, file2c, indent, ipfw, jail, lastcomm, mixer, newsyslog, nvmecontrol, pfctl, praudit, sa, syslogd, tunefs, unifdef, yacc, ztest. I skipped adding data for all the binaries in the base runtime package for simplicity. Assisted-by: Claude Code (Sonnet 5) Sponsored by: Netflix Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D58262
* indent: Fix buffer overflowDag-Erling Smørgrav2025-08-072-22/+34
| | | | | | | | | | | | | The function used to create a backup of the input before starting work used a static buffer and did not check that the file name it constructed did not overflow. Switch to using asprintf(), clean up the rest of the function, and update some comments that still referred to an earlier version of the code. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: bnovkov Differential Revision: https://reviews.freebsd.org/D51796
* indent: Simplify test scriptDag-Erling Smørgrav2025-08-071-40/+15
| | | | | | | | | | Much of the test script was concerned with working around RCS tags and dealing with cases which don't apply to indent. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51795
* packages: rename elftoolchain to toolchain, add more thingsLexi Winter2025-05-281-0/+1
| | | | | | | | | | | | | | Rename the existing "elftoolchain" package to "toolchain", and move everything which is gated by MK_TOOLCHAIN (e.g. lex, yacc, ...) to the toolchain package. This means we have one package called "toolchain" which contains all the development-related utilities which are not compilers or already part of some other package (e.g., llvm). Reviewed by: des, emaste Approved by: des (mentor) Differential Revision: https://reviews.freebsd.org/D50286
* Remove residual blank line at start of MakefileWarner Losh2024-07-152-2/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* indent: make the URL of the manpage two characters longer so that the test ↵Wolfram Schneider2023-12-292-2/+2
| | | | is successful
* use long manpage URL (broken in last commit)Wolfram Schneider2023-12-282-2/+2
| | | | Reported by: pstef
* update manpage URLWolfram Schneider2023-12-282-2/+2
|
* usr.bin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-277-22/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* usr.bin: Remove ancient SCCS tags.Warner Losh2023-11-2710-25/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* Remove $FreeBSD$: one-line bare tagWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line nroff patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-165-5/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-167-13/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-1643-43/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-162-2/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* Restore and document -ps / -nps option.Dag-Erling Smørgrav2023-06-298-4/+34
| | | | | | Sponsored by: Klara, Inc. Reviewed by: pauamma_gundo.com, pstef, kevans Differential Revision: https://reviews.freebsd.org/D40788
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-1/+2
|
* Fix a few typos in source code commentsGordon Bergling2021-08-141-1/+1
| | | | | | - s/procesing/processing/ MFC after: 5 days
* Fix a few mandoc issuesGordon Bergling2020-10-091-1/+2
| | | | | | | | | | - skipping paragraph macro: Pp after Sh - sections out of conventional order: Sh EXAMPLES - whitespace at end of input line - normalizing date format Notes: svn path=/head/; revision=366583
* indent(1): add fallthrough markersPiotr Pawel Stefaniak2020-05-212-0/+2
| | | | | | | | | | | This silences -Wimplicit-fallthrough warnings. Submitted by: Michael Paquier Obtained from: postgresql.org MFC after: 3 days Notes: svn path=/head/; revision=361337
* indent: fix the -fno-common buildKyle Evans2020-04-064-46/+88
| | | | | | | | | | | | Spread the globals far and wide, hopefully to the files that make the most sense. -fno-common will become the default in GCC10/LLVM11. MFC after: 3 days Notes: svn path=/head/; revision=359678
* - address missing whitespace for indentJason Helfman2019-08-291-3/+3
| | | | | | | | | | PR: 239727 Submitted by: gbergling@gmail.com Reviewed by: 0mp@ MFC after: 1 week Notes: svn path=/head/; revision=351614
* capsicum: use a new capsicum helpers in toolsMariusz Zaborski2018-11-041-2/+2
| | | | | | | Use caph_{rights,ioctls,fcntls}_limit to simplify the code. Notes: svn path=/head/; revision=340138
* indent(1): bug fix after r336333Piotr Pawel Stefaniak2018-08-153-1/+4
| | | | | | | | | | The bug was that isalnum() is not exactly equivalent to previous code which also allowed characters "$" and "_", so check for those explicitly. Reported by: tuexen@ Notes: svn path=/head/; revision=337862
* indent(1): revert r334640 and r334632Piotr Pawel Stefaniak2018-08-112-6/+6
| | | | | | | | | While STACKSIZE macro is indeed problematic on some systems, the commits were wrong to shrink il[] and cstk[], because they need to be of the same size as p_stack[] as they're accessed with the same index ps.tos. Notes: svn path=/head/; revision=337651
* indent(1): rewrite the integer/floating constant scanning part of lexi.cPiotr Pawel Stefaniak2018-07-165-102/+86
| | | | | | | | | | | | | | | | | Remove procedural code that did the scanning, which was faulty and didn't support complex constants such as 0x1p-61. Replace it with a finite state machine expressed as a transition table. The table was rewritten by hand from lx's output, given parts of grammar expressed as regular expressions. lx is Katherine Flavel's lexer generator, currently available at https://github.com/katef/libfsm and the parts of grammar were taken from http://quut.com/c/ANSI-C-grammar-l-2011.html and extended to support binary integer constants which are a popular GCC extension. Reported by: bde Notes: svn path=/head/; revision=336333
* indent(1): move case_indent from parser state to the options structPiotr Pawel Stefaniak2018-07-153-7/+7
| | | | | | | This was missed in r334927. Notes: svn path=/head/; revision=336318
* Convert `cap_enter() < 0 && errno != ENOSYS` to `caph_enter() < 0`.Mariusz Zaborski2018-06-191-1/+2
| | | | | | | No functional change intended. Notes: svn path=/head/; revision=335395
* indent(1): rename -nsac/-sac ("space after cast") to -ncs/-csPiotr Pawel Stefaniak2018-06-119-17/+17
| | | | | | | | | Also update tests and the manpage. GNU indent had the option earlier as -cs, let's not diverge unnecessarily. Notes: svn path=/head/; revision=334944
* indent(1): group global option variables into an options structurePiotr Pawel Stefaniak2018-06-107-243/+241
| | | | | | | | | It's clearer now when a variable represents a toggable command line option. Many options were stored in the parser's state structure, so fix also that. Notes: svn path=/head/; revision=334927
* indent(1): fix buildworld after r334632Piotr Pawel Stefaniak2018-06-041-1/+1
| | | | | | | | | | | Fix error: comparison of integers of different signs: 'int' and 'unsigned long' by casting nitems() to int. Reported by: mjg Notes: svn path=/head/; revision=334640
* indent(1): add --version optionPiotr Pawel Stefaniak2018-06-042-1/+14
| | | | | | | | | There exist multi-platform programs that check indent's version in order to know what they can expect from it. GNU indent provides that via --version, so implement the same option here. Notes: svn path=/head/; revision=334636
* indent(1): remove the STACKSIZE macro and all of its usePiotr Pawel Stefaniak2018-06-042-6/+6
| | | | | | | It conflicts with a system-provided macro of the same name on another OS. Notes: svn path=/head/; revision=334632
* indent(1): remove static const char copyright[]Piotr Pawel Stefaniak2018-06-041-8/+0
| | | | | | | | It repeats what is already said in the heading comment and it's optimized out so serves no purpose. Notes: svn path=/head/; revision=334630
* indent(1): replace BSD bcopy() with C memmove()Piotr Pawel Stefaniak2018-06-041-1/+1
| | | | Notes: svn path=/head/; revision=334628
* indent(1): new option -lplPiotr Pawel Stefaniak2018-06-035-1/+24
| | | | | | | | | | | | | | | | With -lpl, code surrounded by parentheses in continuation lines is lined up even if it would extend past the right margin. With -nlpl (the default), such a line that would extend past the right margin is moved left to keep it within the margin, if that does not require placing it to the left of the prevailing indentation level. These switches have no effect if -nlp is selected. Submitted by: Tom Lane Notes: svn path=/head/; revision=334590
* indent(1): revert introduction of -lplPiotr Pawel Stefaniak2018-06-035-24/+1
| | | | | | | That was committed with the wrong message. Will be re-added. Notes: svn path=/head/; revision=334589
* indent(1): new option -lpl (always line up to parenthesis)Piotr Pawel Stefaniak2018-06-035-1/+24
| | | | | | | | | | | With -lp, if a line has an opening paren which is not closed on that line, then continuation lines will be lined up to start at the character position just after the opening paren. Submitted by: Tom Lane Notes: svn path=/head/; revision=334588
* indent(1): manual page corretionsPiotr Pawel Stefaniak2018-06-031-11/+12
| | | | | | | | | | Add missing options, synchronize syntax summary with the actual option list, and other fixes. Submitted by: Tom Lane Notes: svn path=/head/; revision=334587
* indent(1): if an identifier can be either a typedef name or as a structPiotr Pawel Stefaniak2018-06-034-1/+11
| | | | | | | member, it is taken as the latter Notes: svn path=/head/; revision=334583
* indent(1): if the token is a "[" then neither of the blocks is relevantPiotr Pawel Stefaniak2018-06-031-2/+4
| | | | Notes: svn path=/head/; revision=334581
* indent(1): don't add a space after a labelPiotr Pawel Stefaniak2018-06-031-1/+0
| | | | | | | It's not needed and it fools pr_comment(). Notes: svn path=/head/; revision=334580
* indent(1): ignore null characters from inputPiotr Pawel Stefaniak2018-06-031-1/+2
| | | | Notes: svn path=/head/; revision=334579
* indent(1): don't overflow di_stack[]Piotr Pawel Stefaniak2018-06-031-1/+6
| | | | Notes: svn path=/head/; revision=334578
* indent(1): improve CHECK_SIZE_ macrosPiotr Pawel Stefaniak2018-06-034-95/+110
| | | | | | | | | | | | | | | | | | | | Rewrite the macros so that they take a parameter. Consumers use it to signal how much room in the buffer they need; this lets them do that once when required space is known instead of doing the check once every loop step. Also take the parameter value into consideration when resizing the buffer; the requested space may be larger than the constant 400 bytes that the previous version used - now it's the sum of those two values. On the consumer side, don't copy strings byte by byte - use memcpy(). Deduplicate code that copied base 2, base 8 and base 16 literals. Don't advance the e_token pointer once the token has been copied into s_token. This allows easy calculation of the token's length. Notes: svn path=/head/; revision=334576
* indent(1): remove troff output supportPiotr Pawel Stefaniak2018-06-038-360/+60
| | | | | | | | | | | | | | | | | | | The troff output in indent was invented at Sun and the online documentation for some post-SunOS operating system includes this: The usual way to get a troffed listing is with the command indent -troff program.c | troff -mindent The indent manual page in FreeBSD 1.0 already lacks that information and troff -mindent complains about not being able to find the macro file. It seems that the file did exist on SunOS and was supposed to be imported into 4.3BSD together with the feature, but that has never happened. Removal of troff output support simplifies a lot of indent's code. vgrind(1) seems to be a promising replacement. Notes: svn path=/head/; revision=334574
* indent(1): avoid resetting last_bl to a bogus value when reallocatingPiotr Pawel Stefaniak2018-06-031-2/+7
| | | | | | | underlying buffer Notes: svn path=/head/; revision=334571
* indent(1): the check for buffer overflow has to be done before copyPiotr Pawel Stefaniak2018-06-031-2/+2
| | | | Notes: svn path=/head/; revision=334570