Commit Graph

13740 Commits

Author SHA1 Message Date
Eitan Adler
da446b10ed top(1): permit sending signal with any case 2018-06-10 06:21:45 +00:00
Michael Dexter
c1192502cb Add myself to calendar.freebsd
Approved by:	bcr (mentor)
2018-06-10 05:48:03 +00:00
Eitan Adler
468910cd7a top(1): permit sub-second delay times
This removes the getuid check for delay==0. It didn't prevent users from
writing similar programs in the general case. In theory, if top(1) is
among one of the few restricted programs you're allowed to run, it may
have helped a little, but there are better ways of handling that case.
2018-06-10 00:02:56 +00:00
Eitan Adler
6e0632db3d top(1): correctly reset per-cpu counters
I had changed this from a for loop to a memset during an earlier
cleanup. This change was incorrect so revert it.

While here, clean up

Reported by:	flo
2018-06-09 23:24:08 +00:00
Eitan Adler
ef436ca6a6 top(1): handle specific pids better
When told to watch a specific pid, don't filter idle, system, or self
processes. The summary at the top will still flip correctly though.
2018-06-09 23:08:02 +00:00
Eitan Adler
d73bfd43b2 top(1): implement additional missing long options 2018-06-09 22:30:10 +00:00
Eitan Adler
9d6cce02a7 top(1): initial pass to freebsdize the man page
The previous man page used many conventions not typical in FreeBSD.
Since we've forked top completely, convert the man page too.
2018-06-09 21:40:33 +00:00
Eitan Adler
c388909b8d top(1): Implement long options
This also documents some reserved or differing options from top's
original upstream.
2018-06-09 21:40:24 +00:00
Baptiste Daroussin
e620f7fb56 diff: Import fixes from OpenBSD
original commit log by miller@OpenBSD  r1.46:
Fix exit value when diffing directories with missing files and the -N
or -P options are not used.  From Ibrahim Khalifa
2018-06-09 21:09:24 +00:00
Guangyuan Yang
2b77102934 Add myself to the calendar
Requested by:	mckusick
Reviewed by:	emaste
2018-06-09 21:05:25 +00:00
Baptiste Daroussin
6fa5bf0832 Isolate the pr(1) related code in its own source files
This keeps diffreg.c closer to what it is supposed to do:
diffing regular files.

It also allows my code to get a proper license
2018-06-09 20:24:17 +00:00
Eitan Adler
dd0bdd6b45 top(1): allow starting with -T flag 2018-06-09 20:06:06 +00:00
Kyle Evans
be13c0f967 bsdgrep(1): Some more int -> bool conversions and name changes
Again motivated by upcoming work to rewrite a bunch of this- single-letter
variable names and slightly misleading variable names ("lastmatches" to
indicate that the last matched) are not helpful.
2018-06-09 18:11:46 +00:00
Eitan Adler
7fe961ff48 ncal: correct history section
originally reported Todd C. Miller[0]
Additional data see [1][2].

While here, pet igor.

Closes #152 (github pr)
Sbmitted by:	Raf Czlonka

[0]
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/cal/cal.1?rev=1.28&content-type=text/x-cvsweb-markup
[1] https://www.bell-labs.com/usr/dmr/www/1stEdman.html
[2] https://www.bell-labs.com/usr/dmr/www/man61.pdf
2018-06-09 04:40:17 +00:00
Eitan Adler
e3225dcf12 top(1): correct header, align it.
THR is always 6 digits or longer. Now that the PID/THR change is
separated, use correct headers.

PR:		228823
Reported by:	Trond.Endrestol@ximalas.info
2018-06-09 02:47:02 +00:00
Eitan Adler
4e08f2f53c top(1): actually make change for tid vs pid 2018-06-09 02:18:15 +00:00
Eitan Adler
fc36f5a7cb top(1): use a different command to toggle tid vs pid
- By popular demand, implement a different switch ("T") for toggling
between thread id and process id.
- Add an assert that the size of command chars is as expected.
- Also clean up some messiness I found when implementing this.
- Further document the new flag.

Requested by:	flo, ronald-lists@klop.ws, bapt
PR:		139389 (for the record)
X-MFC-With:	r334474
2018-06-09 02:14:33 +00:00
Kyle Evans
d1a920b48f bsdgrep(1): Evict character sequence that moved in
Reported by:	trasz
2018-06-08 12:58:55 +00:00
Eitan Adler
4fb80c7008 top(1): remove some unneeded indirection 2018-06-08 02:03:51 +00:00
Eitan Adler
d408c8f742 top(1): fix several style & const related issues
- use parens for return
- put function names on newline
- sprinkle const where possible
2018-06-08 01:55:47 +00:00
Kyle Evans
bd60b9b499 bsdgrep(1): Slooowly peel away the chunky onion
(or peel off the band-aid, whatever floats your boat)

This addresses two separate issues:

1.) Nothing within bsdgrep actually knew whether it cared about line numbers
  or not.

2.) The file layer knew nothing about the context in which it was being
  called.

#1 is only important when we're *not* processing line-by-line. #2 is
debatably a good idea; the parsing context is only handy because that's
where we store current offset information and, as of this commit, whether or
not it needs to be line-aware.
2018-06-08 01:25:07 +00:00
Kyle Evans
66f780aee0 bsdgrep(1): Don't initialize fts_flags twice
Admittedly, this is a clang-scan complaint... but it wasn't wrong. fts_flags
is initialized by all cases in the switch(), which should be fairly obvious.
Annotate this anyways.
2018-06-07 18:38:48 +00:00
Kyle Evans
40f0e0b100 bsdgrep(1): whoops, garbage collect the now write-only variable 2018-06-07 18:36:12 +00:00
Kyle Evans
cbfff13fa2 bsdgrep(1): Do some less dirty things with return types
Neither procfile nor grep_tree return anything meaningful to their callers.
None of the callers actually care about how many lines were matched in all
of the files they processed; it's all about "did anything match?"

This is generally just a light refactoring to remind me of what actually
matters as I'm rewriting these bits to care less about 'stuff'.
2018-06-07 18:27:58 +00:00
Baptiste Daroussin
30dc95029e Remove NLS support from BSD grep
GNU grep as in actually in base does not have any translations support
compiled in, so no functionnality loss.

We do support 193 locales in base, we will never catch up on that number of
translation with bsd grep.

Removing NLS support make bsd grep consistent with the other binaries in base
which are not translated, and also reduce a little bit the code.

Reviewed by:	kevans
Approved by:	kevans
Discussed with:	kevans @BSDCan
Differential Revision:	https://reviews.freebsd.org/D15682
2018-06-06 23:12:35 +00:00
Eitan Adler
59c8d5dc27 top(1): fix err again
I am amazed at my ability to get a one-line error reporting line wrong
thrice.
2018-06-06 07:13:27 +00:00
Eitan Adler
bca1b45bb1 top(1): make error message happy
We don't use a "size" variable, so just don't report it.

Reported by:	bapt
2018-06-06 06:42:12 +00:00
Piotr Pawel Stefaniak
0929b3d971 indent(1): fix buildworld after r334632
Fix
error: comparison of integers of different signs: 'int' and 'unsigned long'
by casting nitems() to int.

Reported by:	mjg
2018-06-04 21:21:55 +00:00
Piotr Pawel Stefaniak
d0f86f663f indent(1): add --version option
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.
2018-06-04 21:05:56 +00:00
Piotr Pawel Stefaniak
88b24a62d1 indent(1): remove the STACKSIZE macro and all of its use
It conflicts with a system-provided macro of the same name on another OS.
2018-06-04 20:39:58 +00:00
Piotr Pawel Stefaniak
4d0c622816 indent(1): remove static const char copyright[]
It repeats what is already said in the heading comment and it's optimized out
so serves no purpose.
2018-06-04 20:24:31 +00:00
Piotr Pawel Stefaniak
03e6aeef3a indent(1): replace BSD bcopy() with C memmove() 2018-06-04 19:47:24 +00:00
Eitan Adler
cda7a5d5ed top(1): some nitpicks
- prefer fully spelled names to "u_long"
- fix speeling
2018-06-04 05:27:00 +00:00
Eitan Adler
8d0d26767b top(1): include what you use
- Change headers to more closely match what we use
- use more standard functions instead of bzero, bcmp, bcopy
- Add myself to authors.

Tested with: base clang (amd64), gcc 9 (amd64), base clang (i386), base
gcc (mips)
2018-06-04 04:59:32 +00:00
Eitan Adler
5dc98aeeaa top(1): Prefer memcpy over bcopy 2018-06-04 04:59:24 +00:00
Eitan Adler
a9a99372d9 top(1): Use strsep instead of homegrown alternative
This replaces some complex, and not quite correct logic, with a more
common strsep pattern.

Reviewed by:	mmacy (older version)
2018-06-04 03:16:24 +00:00
Eitan Adler
eae589f1ce top(1): another pass of cleanup
- avoid the need to call a function to get size of known array. I'll
likely re-arrange some of the indirect in a later to avoid the magic
constants.
- use correct type
- add const
- replace caddr_t with void*. This corrects an alignment warning.
- remove duplicated include from immediately prior commit

Under base clang we're now down to:
- 3 warning in top.c, 1 warning in mahcine.c,  4 warning in display.c,
- 1 warning in utils.c

Tested with base clang, gcc7, gcc9, base gcc (mips)
2018-06-03 23:40:54 +00:00
Eitan Adler
9f8096e339 top(1): top warnings and cleanup
- Add const where helpful
- add missing 'static' for file-local functions
- use nitems where possible
- convert manual abort() to assert
- use strndup instead of homegrown version

Tested with clang, gcc7, and gcc9
2018-06-03 22:42:54 +00:00
Piotr Pawel Stefaniak
aac30b753f indent(1): new option -lpl
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
2018-06-03 21:40:38 +00:00
Piotr Pawel Stefaniak
50a2976094 indent(1): revert introduction of -lpl
That was committed with the wrong message. Will be re-added.
2018-06-03 21:34:29 +00:00
Piotr Pawel Stefaniak
971e1c47ec indent(1): new option -lpl (always line up to parenthesis)
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
2018-06-03 20:59:59 +00:00
Piotr Pawel Stefaniak
5834814ee8 indent(1): manual page corretions
Add missing options, synchronize syntax summary with the actual option list,
and other fixes.

Submitted by:	Tom Lane
2018-06-03 20:48:58 +00:00
Piotr Pawel Stefaniak
2364d1a74e indent(1): if an identifier can be either a typedef name or as a struct
member, it is taken as the latter
2018-06-03 19:05:20 +00:00
Piotr Pawel Stefaniak
01a206e63c indent(1): if the token is a "[" then neither of the blocks is relevant 2018-06-03 18:38:03 +00:00
Piotr Pawel Stefaniak
fa7ea0c961 indent(1): don't add a space after a label
It's not needed and it fools pr_comment().
2018-06-03 18:34:36 +00:00
Piotr Pawel Stefaniak
9963ad6fdf indent(1): ignore null characters from input 2018-06-03 18:32:11 +00:00
Piotr Pawel Stefaniak
370d0cf9be indent(1): don't overflow di_stack[] 2018-06-03 18:29:20 +00:00
Piotr Pawel Stefaniak
9de29bfb5a indent(1): improve CHECK_SIZE_ macros
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.
2018-06-03 18:19:41 +00:00
Piotr Pawel Stefaniak
1479f36d8e indent(1): remove troff output support
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.
2018-06-03 17:55:50 +00:00
Piotr Pawel Stefaniak
7c5f6031fe indent(1): avoid resetting last_bl to a bogus value when reallocating
underlying buffer
2018-06-03 17:11:01 +00:00