Commit Graph

3377 Commits

Author SHA1 Message Date
kre 7c80fcca6b PR bin/14578
Add a reference to editline(7) so we document the "-o vi" and "-o emacs"
bindings (defaults, and what can be set.)
2017-03-23 12:10:53 +00:00
joerg cfe7161816 Add includes guards since we can include the header twice and typedef
redefinitions are a C11 feature.
2017-03-21 10:52:46 +00:00
kre 996a70951c At the suggestion of Matthew Sporleder (on current-users@) reword some
of the description of arithmetic expressions to make it a bit more
human friendly.

While here fix a few other minor errors, and bump date.
2017-03-20 22:17:56 +00:00
kre ae3f786bf5 That will teach me to commit from the version I've actually
been testing, rather than the "other version" ...
2017-03-20 13:12:35 +00:00
kre bda1f28d90 PR bin/52090 - fix expansion of unquoted $* 2017-03-20 11:48:01 +00:00
kre 4d6f79f52d Alternative way of writing (part of) the arithmetic lexical analyzer
- committed separately to make it easier to swap back if desired.

This version avoids open coding is_name() and isdigit() - measurements
show it is perhaps fractionally faster (though the difference is so small
as to probably be statistically insignifigant - if I were a statician
I might understand that) and just a little larger than the previous version.
2017-03-20 11:31:00 +00:00
kre cc8e58edf3 Finish support for all required $(( )) (shell arithmetic) operators,
closing PR bin/50958

That meant adding the assignment operators ('=', and all of the +=, *= ...)
Currently, ++, --, and ',' are not implemented (none of those are required
by posix) but support for them (most likely ',' first) might be added later.

To do this, I removed the yacc/lex arithmetic parser completely, and
replaced it with a hand written recursive descent parser, that I obtained
from FreeBSD, who earlier had obtained it from dash (Herbert Xu).

While doing the import, I cleaned up the sources (changed some file names
to avoid requiring a clean build, or signifigant surgery to the obj
directories if "build.sh -u" was to be used - "build.sh -u" should work
fine as it is now) removed some dashisms, applied some KNF, ...
2017-03-20 11:26:07 +00:00
kre 9d15d213f4 Undo local changes not intended to be committed (and certainly not
with that commit message) in the previous update.   This stuff works,
and will probably appear sometime, but not right now.
2017-03-16 13:21:59 +00:00
kre d58ec7fc4b Have "make clean" remove sh.html1 and adapt it to clean trace files
the way they have been generated the past 20 years or so...
2017-03-16 13:09:06 +00:00
kre df029fcc1b Fix for the "${unset-var#$(cmd1)}$(cmd2)" runs the wrong command bug.
... From FreeBSD
2017-03-12 04:19:29 +00:00
rin 1eca2a869b white space 2017-02-06 21:06:04 +00:00
wiz 7754e6dee9 Remove trailing space. 2017-02-04 23:35:15 +00:00
kre 0ff2aa1043 Fiddle the (new) fdflags implementation:
Remove some unnecessary cuteness that limited error reporting.
Permit just one -s arg to fdflags
Be deterministic in the case of fdflags -s +cloexec,-cloexec 0
	(and similar) - use the last specified, always.
Allow:
	FD_0_FLAGS=$( fdflags -v 0 )
	# do stuff, manipulating the flags
	fdflags -s "FD_0_FLAGS" 0
to save/restore flags for a fd.
Correctly mask result of fcntl(fd, F_GETFD) with FD_CLOEXEC as the
specs require before deciding close on exec is set.

Improve portability as a tool, don't assume strtoi(), nor __arraycount()
and avoid needlessly requiring recent C versions (ie: there's no need to
sprinkle declarations in the middle of the code, it just makes them hard
to find, and benefits nothing.)

Still to do:  As currently implemented, both user, and shell internal fds
are reported, and can be manipulated.  Allowing users to touch the shell's
internal fds is bogus, and providing this easy way to allow users to
discover which values they have is poor.   Fixing this means getting rid
of the use of fcntl(F_MAXFD) and replacing it with a shell maintained
memory of what fds the user (script) has allocated.   The shell's fd
manipulation really still needs major work (including properly fixing
bin/48875)
2017-02-03 23:16:38 +00:00
christos 168f1d4a50 Add fdflags builtin. Discussed with Chet and he has implemented it for
bash too.
2017-02-02 20:00:40 +00:00
christos afa63a6672 Who Ride Wit Us? 2017-02-02 19:26:37 +00:00
christos 9666b979fc Don't let set cloexec for "exec n>&1" like ksh does (but not bash). Unit
tests pass... If we don't like that, we should add some unittests that fail.
2017-01-21 23:03:36 +00:00
maya f959afb267 reorganize the code so we test if open fails at the open call.
this doesn't actually make a functional difference as ftruncate can
handle it, but it's a bit clearer and appeases static analyzers.

ok riastradh
2017-01-14 18:35:43 +00:00
christos bad8f1c071 need <time.h> for time(3) 2017-01-10 20:44:05 +00:00
christos 7792ef1ac5 add missing <sys/stat.h> 2017-01-10 20:43:08 +00:00
abhinav 1bd07c5d11 The range of the SS field is [0,60]
From the POSIX time.h man page:
"The formal definition of UTC does not permit double leap seconds, so all mention of double leap seconds has been removed, and the range shortened from the former [0,61] seconds seen in previous versions of POSIX."
2017-01-03 16:01:05 +00:00
rin f637bb05bd simplify logic; there must be no CPU usage when p_swtime is zero 2016-12-26 20:52:39 +00:00
christos 56b5e39636 Don't trash the logical $PWD if a component is a symlink; no other shell
does this.
2016-12-26 02:27:57 +00:00
christos 6721aabc1e Handle functions that use the offset from either kinfo_proc2/kinfo_lwp properly. 2016-12-12 20:35:36 +00:00
christos 5a6cfab10a provide a tree like display with -d, from FreeBSD 2016-12-02 21:59:03 +00:00
rin cc1877ba3a Calculate CPU usage (pcpu) once per process if it is required. This change
significantly improves performance for slow machines when output is sorted
by pcpu.

ok martin
2016-11-28 08:21:10 +00:00
rin b095bb75a7 for donlist{,_sysctl}:
- obtain log_ccpu = log(ccpu) rather than ccpu itself
- use common default values and warn users appropriately when errors occur
ok martin
2016-11-28 08:19:23 +00:00
rin 078edf9ccc KNF
ok martin
2016-11-28 08:18:27 +00:00
abhinav 056b8cc767 Fix grammar in couple of sentences. 2016-10-25 13:01:59 +00:00
abhinav 602eb66c16 Remove unused variables.
Fixes the sh(1) build when DEBUG is enabled.
2016-10-23 08:24:27 +00:00
dholland f7f12e2d7d PR 49595 William Ahern: The exit status of "unset NOTSET" should be 0, not 1.
(like 48312 but for ksh)
2016-10-11 06:31:07 +00:00
joerg acfe9a7761 Add explicit char cast to show that the value change is intended. 2016-10-04 15:09:03 +00:00
abhinav 40e3a09c63 kill(1) is a utility, not a function. 2016-10-02 21:00:54 +00:00
sevan 51fe790c4c Drop main() prototype. 2016-09-05 01:00:07 +00:00
sevan 50517541f0 Move the description of CHANGER variable to ENVIRONMENT section
Bump date.
From OpenBSD src/bin/chio/chio.1 r1.23
2016-08-25 18:16:10 +00:00
sevan 90a4f225ec Remove redundant main() prototype which survived a K&R to ANSI transition. 2016-08-23 21:07:40 +00:00
sevan 03fb25d442 Mark email addresses as mailto links, heads up by Sascha Wildner.
Move email addresses to same line as author name.
Do not split the third author entry on to a new line.
Public domain is not licensed by definition, heads up by Robert Elz.
2016-08-23 20:34:23 +00:00
sevan 9e84015020 Instruction to not split the line needs to be stated separately. 2016-08-23 03:21:16 +00:00
sevan 0f2a09011f Add HISTORY section
Credit author of initial implementation in AUTHORS section
Bump date
Remove contraction highlighted by textproc/igor
2016-08-23 02:58:45 +00:00
sevan b61c439d62 bump date 2016-08-18 22:43:49 +00:00
sevan 6e78a5b106 dd first appeared in V5, not V1
Heads up by Ingo Schwarze
http://www.tuhs.org/cgi-bin/utree.pl?file=V5/usr/source/s1/dd.c
2016-08-18 22:42:28 +00:00
sevan ee4aa55280 While the v2 source and man pages are incomplete, TUHS has a scanned copy of the
printed version of the 2nd edition manual. stty is featured in this copy, in the
table of contents listed as meaning "set typewriter modes" and on the actual manual page
headed correctly as "set teletype options"
http://www.tuhs.org/Archive/PDP-11/Distributions/research/1972_stuff/unix_2nd_edition_manual.pdf
Ammend HISTORY and bump date.
2016-08-14 23:29:43 +00:00
sevan 2881adbdf2 While the v2 source and man pages are incomplete, TUHS has a scanned copy of the
printed version of the 2nd edition manual. echo is featured in this copy.
http://www.tuhs.org/Archive/PDP-11/Distributions/research/1972_stuff/unix_2nd_edition_manual.pdf
Ammend HISTORY and bump date.
2016-08-14 22:59:22 +00:00
sevan 7346e185f5 Document the version test first appeared.
Bump date.
2016-08-12 03:17:41 +00:00
sevan ca8106df5f sync was there from v4.
Confirmed from the TUHS hosted copies of man pages.
2016-08-12 02:59:23 +00:00
sevan 5dee078da5 Document the version stty first appeared.
Bump date.
2016-08-12 02:49:18 +00:00
sevan 0995d1e872 Document the version sleep first appeared.
Bump date.
2016-08-12 02:36:38 +00:00
sevan a59caebcc3 Document the version rmdir first appeared.
Bump date.
2016-08-12 02:30:37 +00:00
sevan 15dc5a009b Document the version rm first appeared.
Bump date.
2016-08-12 02:26:42 +00:00
sevan 5ca5543cb0 Document the version pwd first appeared.
Bump date.
2016-08-12 02:03:26 +00:00
sevan 324ed4887a Document the version pax first appeared.
Bump date.
2016-08-12 01:52:22 +00:00