Commit Graph

3676 Commits

Author SHA1 Message Date
kre e76b58b2db In uses like $(( var )) (un-dollared vars in arithmetic) we allow
leading whitespace in the value of var (because strtoimax() does)
but did not allow trailing whitespace.   The effect is that some
cases where $(( ${var:-0} )) would work do not work without the $
expansion.

Fix that - allow trailing whitespace.   However, continue to insist
upon at least one digit (a non-null var that contains nothing but
whitespace is still an error).

Note: posix is not helpful here, it simply requires that the variable
contain "a value that forms a valid integer constant" (with an optional
+ or - sign).
2018-04-21 23:01:29 +00:00
kre d6d059edc2 PR bin/53201
Don't synerr on
	${var-anything
	more}

The newline in the middle of the var expansion is permitted.

Bug reported by Martijn Dekker from his modernish tests.

XXX pullup-8
2018-04-21 21:32:14 +00:00
christos ea7b28924d kvm_geterr() already contains errno, use errx. 2018-04-11 18:52:29 +00:00
christos b02b35c97e use EXIT_FAILURE instead of 1 2018-04-11 18:52:05 +00:00
wiz 883cee82b3 Sort option descripts, fix markups, fix typos. 2018-04-09 06:57:01 +00:00
wiz 051f873718 New sentence, new line. Sort SEE ALSO. Remove Xr to non-existing man page. 2018-04-09 06:54:47 +00:00
snj 107d499d1f fix date 2018-04-08 06:01:04 +00:00
christos c02518ebec add -S to disable ! commands. 2018-04-05 18:44:57 +00:00
msaitoh f96d27e840 s/copy copy/copy/ in comment. 2018-03-19 03:11:39 +00:00
uwe c23d0de35c Drop "show or set the limit on" legalese from the description of each
and every option to ulimit built-in.  The show-or-set text is already
supplied *both* before and after the list.  Pedantically repeating it
for each option just adds a lot of visual clutter that gets in the way
of actually using this fragment of the manual page as a quick
reference.
2018-03-17 01:53:06 +00:00
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