summaryrefslogtreecommitdiff
path: root/bin
AgeCommit message (Collapse)Author
2023-10-07Simplify the display() function by getting rid of a useless bufferIngo Schwarze
on the stack. No functional change, +8 -15 LOC. Suggested by and OK millert@.
2023-10-07Improve horizontal alignment in long format when printing minorIngo Schwarze
device numbers greater than 999 by measuring the two widths needed for device numbers just like it is already done for other numbers. In the output, this only changes whitespace, but not the text. Ugly formatting reported by Crystal Kolipe <kolipe dot c at exoticsilicon dot com>. OK millert. Also tested by Crystal Kolipe.
2023-09-14sh(1), ksh(1): reimplement p_tv() with p_ts()Scott Soule Cheloha
p_tv() is identical to p_ts(). Better to not have two copies: in p_tv(), convert the timeval to a timespec and pass it to p_ts(). With input from tb@ and millert@. Thread: https://marc.info/?l=openbsd-tech&m=169448818503541&w=2 ok tb@ millert@
2023-09-04Zap #ifndef SMALL around pax format read supportJeremie Courreges-Anglas
-DSMALL has never been used to build the ramdisks, thus the support for reading pax format archives has always been there. This is misleading, so just zap the ifdef since we want to keep read support. Went through a make release Just In Case(tm). Spotted by caspar@, ok millert@ sthen@ caspar@
2023-08-19Copy entire st_*tim structs at once, rather than copyingPhilip Guenther
the st_*time and (obsolete) st_*timensec members separately. ok millert@
2023-08-18use imperative tense consistently; OK jmcKlemens Nanni
2023-08-08Replace use of the old BSD st_*timensec members in struct stat withPhilip Guenther
the POSIX-standard st_*tim.tv_nsec members. ok millert@
2023-08-03add extract example and reorder flags on other examplesaisha
comments sthen@ and Peter J. Philipp <pjp AT delphinusdns DOT org> ok jmc@
2023-07-23avoid MAIL* environment variables to save a few bytes in install mediaKlemens Nanni
ksh(1) MAIL, MAILCHECK, MAILPATH mbox handling is useless in the installer. OK miod deraadt
2023-07-10Don't open files that will be skippedJeremy Evans
Previously, when creating an archive file with pax(1), pax will attempt to open a file even if the file will be skipped due to an -s replacement with the empty string. With this change, pax will not attempt to open files that it knows will be skipped. When doing direct copies to a directory (-rw), pax already skips the file before attempting to open it. So this makes the behavior more consistent. This can measurably speed up pax when skipping a large number of files. OK tb@
2023-07-06Document PS_CHROOT, and upcoming PS_NOBTCFI flagsTheo de Raadt
2023-07-05It isn't portable to use stderr (or std{in,out}) in file-scopePhilip Guenther
initializers as they are not required to be compile-time constants. So, intialize these global variables at the top of main(). ok miod@ deraadt@ yasuoka@ millert@
2023-06-26pax: truncate times to MAX_TIME_T, not INT_MAXTodd C. Miller
If the mtime in the file header is larger than MAX_TIME_T, trucate it to MAX_TIME_T, not INT_MAX. OK otto@
2023-06-26pax: use safe_print() to display messages which may include file names.Todd C. Miller
Reported by David Leadbeater. OK op@
2023-06-26fix grammar of the comment describing pat_chk(); ok millert@Omar Polo
2023-06-21ksh: escape control chars when displaying file name completions.Todd C. Miller
If there are multiple matches when using autocomplete, the list of matching file names was output as-is. However, for a single match, control characters are escaped before the file name is displayed. This makes the behavior more consistent by escaping control chars in the list of matches too. Discussed with deraadt@, OK op@
2023-06-10ksh: remove broken special handling of test -tOmar Polo
Drop the vestiges of the pre-POSIX support of `test -t' defaulting to fd 1. It doesn't work and it always succeed since "-t" is treated as a string by default when no argument (fd) is specified. diff by Lucas (lucas [at] sexy [dot] is) with minor change by me. ok millert@
2023-06-10test: fix description of -t: it has no defaultOmar Polo
-t always requires the fd number as argument, there's no default. With only one argument -t is equivalent to `test -n -t' and so banally always true. diff from Lucas (lucas [at] sexy [dot] is) ok millert@
2023-05-24ksh: make $(< filename) error output include the errno string.Todd C. Miller
This is more consistent with how bash, zsh and ksh93 behave and makes $(< filename) more of a drop-in replacment for $(cat filename). OK kn@ florian@
2023-05-13add /usr/local/sbin to PATH;Jason McIntyre
confirmed/ok kn
2023-03-30escape "An" in a %T call, so groff does not flag it as an error;Jason McIntyre
2023-03-30adjust markup of one of the builtin kill usageOmar Polo
The Op on its own line becomes part of the item body instead of the list item itself. OK millert@
2023-03-08Fix alignment of command column. print_comm_name() returns an updatedTobias Heider
length value, not the length difference. ok deraadt@ millert@ guenther@
2023-03-08Delete obsolete /* ARGSUSED */ lint comments.Philip Guenther
ok miod@ millert@
2023-02-08Omit version in SMALL ksh buildsKlemens Nanni
No need for KSH_VERSION and its PS1 esacape sequences in installer shells. Save some bits and clean up what(1) output on ramdisk kernels. OK deraadt
2023-01-17pax: Switch a function definition from K&R to ANSI.Theo Buehler
2023-01-07Add {get,set}thrname(2) for putting thread names in the kernel andPhilip Guenther
exposed in a new field returned by sysctl(KERN_PROC). Update pthread_{get,set}_name_np(3) to use the syscalls. Show them, when set, in ps -H and top -H output. libc and libpthread minor bumps ok mpi@, mvs@, deraadt@
2023-01-01Round up fractional percentages, as per POSIX.Todd C. Miller
From nabijaczleweli, OK deraadt@
2022-12-31Document that -P disables BLOCKSIZE support.Todd C. Miller
With input from and OK jmc@
2022-12-26reformat some multiline markup, which had been causing an unwantedJason McIntyre
space (specifically in the "alias", "readonly" and "typeset" commands); from josiah frentsos
2022-12-22Denote multiple arguments with 'arg ...' not 'args'Klemens Nanni
A few programs used the plural in their synopsis which doesn't read as clear as the obvious triple-dot notation. mdoc(7) .Ar defaults to "file ..." if no arguments are given and consistent use of 'arg ...' matches that behaviour. Cleanup a few markups of the same argument so the text keeps reading naturally; omit unhelpful parts like 'if optional arguments are given, they are passed along' for tools like time(1) and timeout(1) that obviously execute commands with whatever arguments where given -- just like doas(1) which doesn't mention arguments in its DESCRIPTION in the first place. For expr(1) the difference between 'expressions' and 'expression ...' is crucial, as arguments must be passed as individual words. Feedback millert jmc schwarze deraadt OK jmc
2022-12-19Remove array reference from sh(1) because sh doesn't have arrays.Stefan Hagen
Reported with diff from Ross L Richardson Agreed kn, OK jmc
2022-12-04userspace: remove vestigial '?' cases from top-level getopt(3) loopsScott Soule Cheloha
getopt(3) returns '?' when it encounters a flag not present in the in the optstring or if a flag is missing its option argument. We can handle this case with the "default" failure case with no loss of legibility. Hence, remove all the redundant "case '?':" lines. Prompted by dlg@. With help from dlg@ and millert@. Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2 ok naddy@ millert@ dlg@
2022-11-18Write number of bytes read/written and "?" prompt to stdout, not stderr.Todd C. Miller
This matches both historical behavior and the POSIX specification. From Soeren Tempel.
2022-10-13controm terminql -> controlling terminal;Jason McIntyre
2022-10-11correct t_lex_type() return typeJonathan Gray
ok miod@
2022-10-11remove unused varJonathan Gray
2022-10-10Trigger ERR trap on permanent I/O redirection failureKlemens Nanni
The following three cases behave identical in bash(1), but our ksh (ksh93 also) fails to run the trap in the last case: (non-zero exit code is trigger, no redirection) $ ksh -c 'trap "echo ERR" ERR ; false' ERR (failed redirection is trigger, 'echo' was not executed) $ ksh -c 'trap "echo ERR" ERR ; echo >/' ksh: cannot create /: Is a directory ERR (failed redirection, no execution, trap was NOT triggered) $ ksh -c 'trap "echo ERR" ERR ; exec >/' ksh: cannot create /: Is a directory bash(1) prints "ERR" in all three cases, as expected. ksh93 behaves like our ksh(1). In ksh `exec' is a builtin (CSHELL), but also special (SPEC_BI): $ type alias alias is a shell builtin $ type exec exec is a special shell builtin Without command and redirection alone, `exec' permanently redirects I/O for the shell itself, not executing anything; it is the only (special) builtin with such a special use-case, implemented as c_sh.c:c_exec(). This corner-case is overlooked in exec.c:execute() which handles iosetup() failure for all commands, incl. builtins. Exclude c_exec() from the rest of special builtins to ensure it runs the ERR trap as expected: $ ./obj/ksh -c 'trap "echo ERR" ERR ; exec >/' ksh: cannot create /: Is a directory ERR Also add three new regress cases covering this; rest keep passing. OK millert
2022-09-23Since tzset(3) ignores arbitrary files, we no longer need rpathFlorian Obser
and can depend on the /usr/share/zoneinfo bypass. OK mestre, millert, deraadt
2022-09-20Fix line length trimming in -f modeJob Snijders
Reported by Christian Weisgerber OK kn@
2022-09-19When setting time, date(1) pledges "wpath" for logwtmp(3). RestrictFlorian Obser
this using unveil(2), but ignore errors if /var/log doesn't exist. We want to be able to set the time if the system is damanged or /var is not mounted yet. We also need to unveil everything for reading since we still allow arbitrary locations of zone info files. Hopefully that will go away soon. OK deraadt
2022-09-13== in [[ does pattern matching as wellKlemens Nanni
OK millert
2022-09-03- rework the -f text to read better; ok jobJason McIntyre
- while here, wrap a long line
2022-09-01Add forest (-f) modeJob Snijders
In -f mode group & display parent/child process relationships using ASCII art. Borrows heavily from Brian Somers' work on FreeBSD ps(1). With input from deraadt@ and tb@ OK benno@ claudio@
2022-08-31use the posix phrasing to improve the description of "shift";Jason McIntyre
nudge from luka krmpotic
2022-08-16-v option should only act based upon syscall success. test case isTheo de Raadt
"rm -rfv nonexistent". problem spotted by Alfred Morgan ok millert
2022-08-04change some 4.4BSD references to earlier releasesJonathan Gray
ok schwarze@
2022-07-30rewrite was in TahoeJonathan Gray
ok cheloha@
2022-07-30sleep.1: miscellaneous rewrites, cleanupScott Soule Cheloha
Description - "for a minimum of" is better said "for at least". - The seconds argument can be zero, so say "non-negative". - Specify that the number (the whole thing) is decimal to exclude e.g. hex numbers. It then follows that the optional fraction must also be decimal. - No need to inspire the reader to use sleep(1) in any particular way. It is probably sufficient to demonstrate these patterns in the Examples section later. Asynchronous Events - Note that SIGALRM wakes sleep(1) up "early". Examples - Simplify the first example. Parenthetically pointing the reader to at(1) muddies what is otherwise a trivial example. We can still point the reader to at(1) in the See Also section later. - Shorten the interval in the first example. A half hour is not interactive. - Get rid of the entire csh(1) example. It's extremely complex and the bulk of the text is spent explaining things that aren't about sleep(1) at all. - Tweak the third example to show the reader that you can sleep for a fraction of a second, as mentioned in the Description. Standards - Prefer active voice. "The handling of fractional arguments" is better said "Support for fractional seconds". Shorten "is provided as" to "is". History - Not merely "appeared": "first appeared". - Note that sleep(1) was reimplemented for 4.4BSD. Thread: https://marc.info/?l=openbsd-tech&m=165888826603953&w=2 Lots of nice tweaks from jmc@. Typo spotted by Crystal Kolipe. ok jmc@
2022-07-05Remove old poll/select wakeup mechanism.Visa Hankala
Also remove unneeded seltrue() and selfalse(). OK mpi@ jsg@