Commit Graph

3666 Commits

Author SHA1 Message Date
uwe
f46f1cb2a2 Tweak "ulimit" synopsis. 2018-03-17 01:40:28 +00:00
uwe
8b4ce5dc95 Cleanup markup in the "Command Line Editing" section. 2018-03-17 01:32:42 +00:00
uwe
252ed5cb12 Cleanup markup in the "Job Control" section. 2018-03-17 01:03:08 +00:00
uwe
e2342ea669 Use .Dv, not .Ev, to refer to LINENO, it's not an environment variable. 2018-03-17 00:03:25 +00:00
uwe
1a2e30dffb Default values of PS1 and friends have only single space. Use .Li to
typeset them to make that space more visible in PostScript output.
2018-03-16 23:56:13 +00:00
uwe
455a88217c Use .Bd -literal for code example. 2018-03-16 23:36:13 +00:00
kre
1b14ecae60 Markup fixes (partly from uwe@) and change some tabs to spaces, they
seem to work better...
2018-03-16 12:06:18 +00:00
kre
f993985a6e Restore some (*roff) comments deleted in previous (partially unshave
the yak) for which the purpose was misunderstood.   But trim one more hair.
2018-03-16 11:53:57 +00:00
kre
f1861a8088 Give the yak a quick trim and shave, and make one or two minor
wording changes (which are, hopefully, improvements).
2018-03-16 11:19:24 +00:00
uwe
613a287d51 Start adding more gaudy markup. Use .Li or .Dv when referring to
parameters.  Use more .Ic and .Ar when defining syntax.

The manual is still rather inconsistent e.g. when referring to
parameters where it randomly uses both $0 and 0 or $@ and @ - but I'm
not shaving that yak at least for now.
2018-03-15 01:20:43 +00:00
uwe
abdb117cdc Compute tag width for the list of options in Argument List Processing,
mandoc *is* up to that.  Remove the part of the comment before the
list that was wondering about that.
2018-03-14 10:38:52 +00:00
uwe
db273842a9 Small markup tweaks in Argument List Processing 2018-03-14 10:30:40 +00:00
uwe
7a8dcc3884 Instead of .Oo/.Oc use .Op directly where possible. 2018-03-14 09:46:45 +00:00
uwe
484f53204c Revert previous. Fix the real problem properly. 2018-03-14 09:42:37 +00:00
wiz
b30e74889c Remove Ic macro without effect. 2018-03-14 07:53:14 +00:00
uwe
caedaa46ad Try to improve markup in the Built-ins section.
Mostly sprinkle missing .Ic and .Ar
2018-03-13 23:03:21 +00:00
uwe
f81efe159b Try to improve markup in the Parameter Expansion section. 2018-03-13 21:49:15 +00:00
uwe
0054fb0db8 Try to improve markup of the redirections definitions. 2018-03-13 21:04:57 +00:00
uwe
08ffbb4888 Fix horrendous markup abuse in the here-document example.
Consistently spell "here-document" in full.
2018-03-13 20:48:00 +00:00
uwe
121a1034cd Spell "here-document" with a hyphen, don't mark it up as a command. 2018-03-13 20:40:52 +00:00
uwe
9453809f25 Mark up "in" (of the "for" command) appropriately. 2018-03-13 20:39:25 +00:00
uwe
194117b0aa Use \(or not \*(Ba when discussing case patterns. 2018-03-13 20:29:13 +00:00
uwe
0bbb85ef5e Use \(em for em-dash 2018-03-13 20:18:16 +00:00
uwe
882c5e3aae Standalone | means \[ba] while we want \[or] so add \& protection to
the few places where it was missing.
2018-03-13 20:08:11 +00:00
uwe
4243789c21 .Dl is a a single line .Bd -literal -offset indent so don't abuse
multiple consecutive .Dl and use proper .Bd instead.
2018-03-13 19:43:52 +00:00
uwe
e0885dda62 .Bd expects the display type to come first, so move -compact to the end. 2018-03-13 19:35:46 +00:00
uwe
5e8101b3eb Add missing word. 2018-03-13 19:18:53 +00:00
dholland
32cded6cc9 Typos. 2018-02-08 09:05:16 +00:00
mrg
6d188dd0d7 convert HAVE_GCC handling to modern GCC release numbering:
- HAVE_GCC=5 is now the default (vs. HAVE_GCC=53 we've been using for
  GCC 5.4 and GCC 5.5.)
- remove some more GCC 4.8 code.  we don't support GCC 4 here.
- adjust set lists to gcc=5 from gcc=53.

add some basic HAVE_GCC=6 handling (totally unused so far.)
2018-02-02 01:02:39 +00:00
wiz
e793fb4654 Remove trailing whitespace and Tn macro. 2018-01-27 18:59:38 +00:00
christos
a61f9804b8 sync with tzcode-2018c 2018-01-25 18:07:17 +00:00
kamil
081e832953 ksh: Rename a local function tsearch to mytsearch
This removes a clash with well-known libc function tsearch(3) from POSIX.

This allows to build ksh against MSan.

The new name might not be perfect, but long term ksh should be switched to
the libc version.

Sponsored by <The NetBSD Foundation>
2018-01-24 09:53:20 +00:00
kamil
6d8c9dfa44 ksh: Rename a local function tdelete to mytdelete
This removes a clash with well-known libc function tdelete(3) from POSIX.

This allows to build ksh against MSan.

The new name might not be perfect, but long term ksh should be switched to
the libc version.

Sponsored by <The NetBSD Foundation>
2018-01-24 09:21:20 +00:00
sevan
7a75668892 drop main() prototype 2018-01-23 22:12:52 +00:00
maya
ee3bb8535b Use 0600 as the mode for histfile here too.
pointed out by John D. Baker in PR bin/52480
2018-01-17 00:29:22 +00:00
kre
d4d1419421 Paul Goyette suggested improvements to parts of the description of
LINENO ... this is what resulted (with thanks for the grammar lessons,
and sundry references provided!)

No date (Dd) bump - there is no change of substance here, just (hopefully)
a clearer way of saying the same thing.
2018-01-15 11:27:39 +00:00
kamil
0e68b604ab Fix an unitialized memory read bug in ps(1)
rawcpu of type int, is declared inside main(){} and it can be passed as
uninitialized to setpinfo().
The setpinfo() function has a switch checking the value of rawcpu:

  if (!rawcpu)
    pi[i].pcpu /= 1.0 - exp(ki[i].p_swtime * log_ccpu);

rawcpu is set to 1 with the command line argument "-C".

   -C           Change the way the CPU percentage is calculated by using a
                "raw" CPU calculation that ignores "resident" time (this
                normally has no effect).

Bug reproducible with an invocation: "ps u". It hides with "ps uC".

Initialize rawcpu by default to 0, before the getopt(3) machinery.

Detected with MSan running on NetBSD/amd64.

Sponsored by <The NetBSD Foundation>
2018-01-12 23:01:14 +00:00
kre
13689a6c8a In addition to previous the which fixed a (harmless) MSAN detected ref
of uninit'd field also fix a couple more (still harmless) related
technical C usage bugs.

Explaining why these issues were harmless would take too long to include here.
2017-12-30 23:24:19 +00:00
christos
d27db487e5 initialize just used and prev_job 2017-12-30 20:42:28 +00:00
christos
e11969ea5d initialize the jobtab; it is easier than putting checks for used everywhere. 2017-12-30 01:21:25 +00:00
kre
84c609adca Do a better job of reporting invalid numeric constants in arithmetic exprs.
For example, given $(( 08 + 1 )) (or similar) instead of reporting
"expecting end of expression"  - the generic error for parse failed,
which happened as this was parsed as $(( 0 8 + 1 )) because the 8
could not be a part of an octal constant, and that expr makes no sense -
instead say "unexpected '8' (out of range) in numeric constant: 08"
which makes the cause of the error more obvious.

NFC for valid expressions, just the error message (and the way the
error is detected).
2017-12-17 04:06:03 +00:00
kamil
b42c7b02bc ps: Rename local routine name from uname to usrname
This removes symbol name routine clash with libc's uname(3).
This allows to build ps(1) against LLVM Sanitizers.

Sponsored by <The NetBSD Foundation>
2017-12-09 14:56:54 +00:00
kre
ae40879b6d Remove the -X option from SMALL shells (as used on boot floppies,
some other install media, mini-roots, etc.)   It is unlikely that
such a shell will be used for much script debugging (and the old -x
still exists of course) and it adds a little bloat, so, zap...

The ancient unused (unrelated) xioctl() function is gone as well
(from all shells).
2017-11-21 03:42:39 +00:00
kre
ffc64c6374 Implement the -X option - an apparent variant of -x which sends all trace
output to the stderr which existed when the -X option was (last) enabled.
It also enables tracing by enabling -x (and when reset, +X, also resets
the 'x' flag (+x)).  Note that it is still -x/+x which actually
enables/disables the trace output.   Hence "apparent variant" - what -X
actually does (aside from setting -x) is just to lock the trace output,
rather than having it follow wherever stderr is later redirected.
2017-11-19 03:23:01 +00:00
kre
bfa0b331f0 Rearrange "struct output" to be slightly more friendly (I think)
to I32 P64 systems - keep nextc first, as that's used in macros,
and nleft next, as that's used (and both are updated) in the same macro,
which is used frequently, this increases the chance they're in the
same cache line (unchanged from before).   Beyond that it matters less,
so just shuffle a bit to avoid internal padding when pointers are 64 bits.
Note that there are just 3 of these structs (currently), even if there was
to be a memory saving (there probably won't be, trailing padding will eat it)
it would be of the order of 12 or 24 bytes total, so all this really
just panders to my sense of rightness....

Note to anyone who might be tempted, please don't update the struct
initializers to use newer C forms - eventually sh is planned to become
a host tool, and a separable package, so it wants to remain able to be
compiled using older (though at least ansi) compilers that implement only
older C variants.
2017-11-19 03:22:55 +00:00
kre
f5deb3ba25 Improve quoting in xtrace (-x) output ... if a string ("word") to be
output includes a single quote (') then see if using double-quotes
to quote it is reasonable (if no chars that are magic in " also appear).
If so, and if the string is not entirely the ' character, then
use " quoting.  This avoids some ugly looking results (occasionally).

Also, fix a bug introduced about 20 months ago where null strings
in xtrace output are dropped, instead of made explicit ('').
To observe this, before you get the fix: set -x; echo ''   (or similar.)

Move a comment from the wrong place to the right place.
2017-11-16 19:41:02 +00:00
kre
b86d4a7424 DEBUG mode only change. Add some tracing. NFC (without DEBUG). 2017-11-15 09:21:48 +00:00
kre
20c8eb69ec Sort options with long names that differ only by char case in
the same order that option flags with a similar property are sorted.
This corresponds with the change made to the sort order of the short
names made in the previous update (1.4).

Right now, this change makes no difference at all, as there are no
long option names that differ only in char case (yet.)
2017-11-15 09:21:19 +00:00
kre
e965a70935 Correct a typo: s/ at / an / 2017-11-15 08:50:07 +00:00
kre
d1b3ee239b PR bin/52715
Correct a (relatively harmless) use after free in prompt expansion
processing [detected by asan.]

Relatively harmless: as (while incorrect) the way the data is (was)
used more or less guaranteed that the buffer contents would be
unaltered until well after they are (were) no longer wanted (this
is the expanded prompt string, it is just output (or copied into
libedit internal storage) and forgotten.

This should make no visible difference to anyone (not using asan or
similar.)

XXX pullup -8
2017-11-10 17:31:12 +00:00