Commit graph

52 commits

Author SHA1 Message Date
Warner Losh bdcbfde31e usr.bin: Remove ancient SCCS tags.
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
2023-11-26 22:23:30 -07:00
Warner Losh b2c76c41be Remove $FreeBSD$: one-line nroff pattern
Remove /^\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:15 -06:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Simon J. Gerraty d9a4274795 Update/fix Makefile.depend for userland 2023-04-18 17:14:23 -07:00
John Baldwin 7ad9aa0b93 rs: Test actual output in the tests.
Previously the tests just verified if command line arguments raised an
error or not, they did not test how command line arguments affected
the output.  This adds some sample (if simple) input and output to
each flag test as well as adding a few additional trivial tests.

Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D36835
2022-11-15 21:20:18 -08:00
John Baldwin afb4998dd4 rs: Use getopt() and strtol() instead of mannual parsing.
This uses the "::" extension to getopt() to handle options which take
an optional argument.

The updated flag tests were all wrong before and only passed because
the manual parser failed to raise errors when a required argument was
missing.  The invalid argument test now gets a better error message.

Reviewed by:	brooks, imp, emaste
Differential Revision:	https://reviews.freebsd.org/D36834
2022-11-15 21:19:35 -08:00
John Baldwin 42d10b1b56 rs: Convert to C++ to convert elem to a std::vector<char *>.
This also updates various indices and counters from int to size_t to
pacify resulting -Wsign-compare warnings.

Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D36833
2022-11-15 21:03:12 -08:00
John Baldwin ba86cffb28 rs: Fix some pointer arith UB.
If the next column was blank, then the length of the following entry
was computed as the end of the following entry minus a global variable
"blank" which is not in the same string or allocation.  Instead, save
the start value of 'p' explicitly instead of abusing '*ep'.  Possibly
we should just increment p before saving it in sp in the 'blank' case,
but at worst that would just mean maxlen might be one char too large
which should be harmless.

Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D36832
2022-10-05 16:48:05 -07:00
John Baldwin e5f2d5b35e rs: Fix a use after free.
Using a pointer passed to realloc() after realloc() even for pointer
arithmetic is UB.  It also breaks in practice on CHERI systems as
the updated value of 'sp' in this case would have had the bounds from
the old allocation.

This would be much cleaner if elem were a std::vector<char *>.

Reviewed by:	brooks, emaste
Reported by:	GCC -Wuse-after-free
Differential Revision:	https://reviews.freebsd.org/D36831
2022-10-05 16:47:40 -07:00
John Baldwin bb31e1bbf2 rs: Fix various harmless warnings.
- Add /* FALLTHROUGH */ comments for intentional fall throughs in
  getargs().

- Remove id strings to quiet -Wunused-const-variable warnings from
  GCC.

- While here, remove __FBSDID.

Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D36830
2022-10-05 16:47:21 -07:00
Alan Somers 013953eb5f Add basic tests for ctfconvert(1), fold(1) and rs(1)
Add basic command line parsing test coverage for these utilities.  The tests
were automatically generated based on their man pages.  These tests can be
expanded by hand for more thorough coverage.  The aim is to generate very
basic amount of test coverage for all the utilities in the base system.

Tests generated via: https://github.com/shivansh/smoketestsuite/

Submitted by:	shivansh
Reviewed by:	asomers
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D12424
2017-11-27 20:01:58 +00:00
Pedro F. Giffuni 8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Bryan Drewery ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Warner Losh fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Baptiste Daroussin 68dd67a27b Rename getline with get_line to avoid collision with getline(3)
When getline(3) in 2009 was added a _WITH_GETLINE guard has also been added.
This rename is made in preparation for the removal of this guard
2016-05-10 11:17:36 +00:00
Simon J. Gerraty ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty 44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty 98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Allan Jude 212236608c Fix missing AUTHOR section for jot(1), rs(1), and lam(1)
PR:		196786
Differential Revision:	https://reviews.freebsd.org/D2115
Submitted by:	John A. Kunze (Author)
Approved by:	wblock (mentor)
MFC after:	1 week
Sponsored by:	ScaleEngine Inc.
2015-04-07 15:56:08 +00:00
Simon J. Gerraty fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty 76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty 7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Marcel Moolenaar 7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Ed Schouten 43420d1cad Add missing static keywords to rs(1) 2011-11-06 08:16:35 +00:00
Jaakko Heinonen c23211e97e Document the input line length limit.
Submitted by:	Dominic Fandrey (original version)
2011-02-25 19:10:19 +00:00
Jaakko Heinonen 96a7586b7d - Use LINE_MAX from limits.h as the maximum line length instead of
BUFSIZ. Use LINE_MAX * 2 as the buffer size (BSIZE).
- Error out if we encounter a line longer than LINE_MAX. The previous
  behavior was to silently split long lines and produce corrupted
  output.

PR:		bin/151384
2011-02-07 18:10:18 +00:00
Jaakko Heinonen a373cd6a6f Handle EOF when skipping lines. 2011-02-07 18:05:56 +00:00
Joel Dahl da52b4caaf Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
Colin Percival 5fe69bb518 Setting a variable to the same value twice doesn't actually make it
more likely to have the right value.  Remove superfluous assignments.

Found by:	LLVM/Clang Static Checker
2008-08-04 06:39:52 +00:00
Colin Percival 04f064d680 Document that jot(1), rs(1), and lam(1) first appeared in 4.2BSD.
MFC after:	1 month
2006-10-20 04:31:01 +00:00
Robert Drehmel 92bc8d4e8e - Set negative row or column argument values to zero.
Negative values would produce undefined behaviour including
   a possible segmentation fault.
 - Explicitly initialize the global row and column variables
   to zero.

PR:		bin/80348
2005-04-28 12:37:15 +00:00
Tim J. Robbins 752448ce84 Document incorrect handling of multibyte characters. 2004-07-30 00:10:52 +00:00
Tim J. Robbins a2b28f9d9a Avoid passing negative values to isdigit() on machines with signed chars. 2004-07-15 10:26:38 +00:00
Philippe Charnier 6a1be1f51b Add section number to .Xr 2003-06-08 13:58:08 +00:00
Tim J. Robbins 8cd4e21f0f Contrary to what the comments said, rs -H did not recycle storage, it just
kept writing past the end of the buffer. Correct the code so that it
actually does recycle storage.
2002-06-07 07:08:06 +00:00
Mark Murray 791e544b6b Use __FBSDID, ANSIfy functions, fix const string. 2002-04-28 11:00:34 +00:00
Philippe Charnier e8937ba009 Use `The .Nm utility' 2002-04-20 12:18:28 +00:00
Warner Losh d3cb5ded92 remove __P 2002-03-22 01:33:25 +00:00
Ruslan Ermilov 1cdc4a5318 Do not overrun entry array when printing output tables.
Cleanup storage allocation for entries.

Obtained from:	NetBSD
2001-09-10 15:09:12 +00:00
Ruslan Ermilov db8b9c344e Fixed SIGFPE (divide by zero) if column's width exceeds display width (-w).
Obtained from:	OpenBSD
2001-09-10 11:56:07 +00:00
Ruslan Ermilov c4c981072b Fixed the -z option handling:
-Wuninitialized if used without -t.

PR:		bin/30467

Null pointer dereference if used with -t.

Maximum column width computation was wrong.
2001-09-10 11:43:40 +00:00
Dima Dorfman f247324df7 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
Ruslan Ermilov f4ddfb3865 Prepare for mdoc(7)NG. 2000-12-27 16:52:31 +00:00
Ruslan Ermilov 9b88faecd3 Prepare for mdoc(7)NG. 2000-12-19 16:00:12 +00:00
Ruslan Ermilov 8fe908ef0c mdoc(7) police: use the new features of the Nm macro. 2000-11-20 19:21:22 +00:00
Peter Wemm c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Nik Clayton 3be5f1f5ce Add $Id$, to make it simpler for members of the translation teams to
track.

The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

     .\"    $Id$
     .\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by:            bde
1999-07-12 20:24:20 +00:00
John Birrell 32744e40cd Add #include <string.h> to get prototypes. 1998-02-20 04:48:37 +00:00
Philippe Charnier e25f6756fb Use err(3). Add usage(). Rewrote man page in mdoc format. 1997-08-07 06:42:37 +00:00