1
0
mirror of https://github.com/skeeto/w64devkit.git synced 2026-10-23 06:08:56 +03:00

Add launchers for cdrop, drop, pdrop, flock, sha384sum, and stty

These applets arrived with busybox-w32 upgrades that never touched the
launcher list, so they were reachable only through busybox or the
shell. Add manual pages for drop (with cdrop and pdrop), flock, and
stty, list sha384sum with md5sum, and drop the notes about missing
launchers. Only [ is left without one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Christopher Wellons
2026-10-22 20:48:38 -04:00
parent 2845baff59
commit 0ca4aa683c
11 changed files with 1038 additions and 55 deletions

View File

@@ -812,15 +812,16 @@ RUN QUILT_PATCHES=$PREFIX/src/busybox quilt push -a \
RUN $ARCH-gcc -Oz -fno-asynchronous-unwind-tables -Wl,--gc-sections -s \
-nostdlib -o alias.exe $PREFIX/src/busybox-alias.c -lkernel32 \
&& printf '%s\n' arch ash awk base32 base64 basename bc bunzip2 bzcat \
bzip2 cal cat chattr chmod cksum clear cmp comm cp cpio crc32 cut date \
dc dd df diff dirname dos2unix du echo ed egrep env expand expr factor \
false fgrep find fold free fsync getopt grep groups hd head hexdump \
httpd iconv id inotifyd install ipcalc jn join kill killall \
lash less ln logname ls lsattr lzcat lzma lzop lzopcat man md5sum mkdir \
mktemp mv nc nl nproc od paste patch pgrep pidof pipe_progress pkill \
printenv printf ps pwd readlink realpath reset rev rm rmdir sed seq sh \
sha1sum sha256sum sha3sum sha512sum shred shuf sleep sort split \
ssl_client stat su sum sync tac tail tar tee test time timeout touch \
bzip2 cal cat cdrop chattr chmod cksum clear cmp comm cp cpio crc32 cut \
date dc dd df diff dirname dos2unix drop du echo ed egrep env expand \
expr factor false fgrep find flock fold free fsync getopt grep groups \
hd head hexdump httpd iconv id inotifyd install ipcalc jn join kill \
killall lash less ln logname ls lsattr lzcat lzma lzop lzopcat man \
md5sum mkdir mktemp mv nc nl nproc od paste patch pdrop pgrep pidof \
pipe_progress pkill printenv printf ps pwd readlink realpath reset rev \
rm rmdir sed seq sh sha1sum sha256sum sha384sum sha3sum sha512sum shred \
shuf sleep sort split ssl_client stat stty su sum sync tac tail tar tee \
test time timeout touch \
tr true truncate ts ttysize uname uncompress unexpand uniq unix2dos \
unlzma unlzop unxz uptime usleep uudecode uuencode watch \
wc wget which whoami whois xargs xz xzcat yes \

View File

@@ -168,7 +168,9 @@ The kit's
.I bin
directory holds
.I busybox.exe
and, for most applets, a launcher named after the applet, such as
and, for every applet except
.BR [ ,
a launcher named after the applet, such as
.IR ls.exe .
A launcher is a small separate program, not a link to
.IR busybox.exe .
@@ -202,20 +204,14 @@ and ask
.B "Terminate batch job (Y/N)?"
on Ctrl+C.
.PP
These applets have no launcher:
.BR [ ,
.BR cdrop ,
.BR drop ,
.BR flock ,
.BR pdrop ,
.BR sha384sum ,
and
.BR stty .
Run them as
.B busybox
.IR applet ,
or by name in the kit's shell, which runs applets without searching
.BR PATH .
.B [
has no launcher, since
.B test
does the same.
In the kit's shell
.B [
is a builtin, and elsewhere it runs as
.BR "busybox [" .
.SS Applets
This build has these applets.
.BR sh ,
@@ -614,14 +610,17 @@ directory that
shows for it.
.RE
.IP
The kit's launchers already provide most applets as commands; see
The kit's launchers already provide every applet except
.B [
as a command; see
.BR Launchers .
Without
.B \-u
or
.IR dir ,
.B \-\-install
therefore adds links only for the applets that have no launcher.
therefore adds only
.IR [.exe .
.TP
\fB\-\-uninstall\fR [\fB\-n\fR] \fIfile\fR
Delete every hard link to
@@ -928,7 +927,7 @@ $ busybox \-\-help sort
.EE
.RE
.PP
Run an applet that has no launcher:
Run an applet through busybox itself, without its launcher:
.PP
.RS 4
.EX
@@ -1151,7 +1150,9 @@ Some applets are left out, and the shell is not available as
see
.BR "Applets left out" .
.IP \(bu 2
Most applets have a launcher in
Every applet except
.B [
has a launcher in
.IR bin ;
see
.BR Launchers .

1
man/man1/cdrop.1 Normal file
View File

@@ -0,0 +1 @@
.so man1/drop.1

363
man/man1/drop.1 Normal file
View File

@@ -0,0 +1,363 @@
.TH DROP 1 2026-10-22 "w64devkit" "w64devkit Manual"
.SH NAME
drop, cdrop, pdrop \- run a command without administrator privileges
.SH SYNOPSIS
.B drop
.RB [[ \-\- ]
.I command
.RI [ argument ...]]
.br
.B drop
.B \-s
.I shell
.br
.B drop
.RB [ \-s
.IR shell ]
.B \-c
.I string
.RB [[ \-\- ]
.IR argument ...]
.br
.B cdrop
.RB [[ \-\- ]
.I command
.RI [ argument ...]]
.br
.B cdrop \-c
.I string
.RB [[ \-\- ]
.IR argument ...]
.br
.B pdrop
.RB [[ \-\- ]
.I command
.RI [ argument ...]]
.br
.B pdrop \-c
.I string
.RB [[ \-\- ]
.IR argument ...]
.SH DESCRIPTION
.BR drop ,
.BR cdrop ,
and
.B pdrop
run a command with the rights of a standard user.
They are meant to be run from an elevated process, one that has
administrator rights through User Account Control (UAC), such as a shell
started by
.BR su (1).
The command runs as the same user, in the same console, with the same
standard input, output, and error, environment, and current directory.
These programs are busybox applets; see
.BR busybox (1).
.PP
Each program builds a new access token for the command from its own
token.
In the new token the Administrators group is disabled, the privileges
are those Windows gives a standard user, and the integrity level is
medium.
This is the Windows "Normal User" software restriction level.
.PP
With a
.I command
operand, all three programs run that command with the remaining operands
as its arguments.
A
.I command
that names a busybox applet runs that applet from the running
.IR busybox.exe ,
even when
.B PATH
has a program of the same name, unless
.B BB_OVERRIDE_APPLETS
says otherwise.
A
.I command
that contains a slash, a backslash, or a drive letter is the path of a
file.
Any other
.I command
is searched for in
.BR PATH .
For a path and in the search, if the name is not an executable file,
the suffixes
.BR .com ,
.BR .exe ,
.BR .sh ,
.BR .bat ,
and
.B .cmd
are tried in that order, unless the name already ends with one of them
or with a period.
.PP
With no
.I command
operand, or with
.BR \-c ,
the programs differ in the shell they run:
.TP
.B drop
runs the kit's
.BR sh (1)
from the running
.IR busybox.exe ,
or the program named by
.BR \-s .
.TP
.B cdrop
runs
.BR cmd.exe ,
found in
.BR PATH .
.TP
.B pdrop
runs Windows PowerShell,
.BR powershell.exe ,
found in
.BR PATH .
.PP
Without
.BR \-c ,
the shell is interactive.
With
.BR \-c ,
the shell runs
.I string
and exits, and the operands follow
.I string
as arguments.
In
.BR sh (1),
the first of them is
.BR $0 .
.PP
Each program waits for the command to exit, and exits with its status.
The program reads no input and writes no output of its own, apart from
error
messages and
.BR \-\-help .
.SH OPTIONS
Options may follow operands unless
.B POSIXLY_CORRECT
is set, so an option meant for the command is taken as an option of the
program.
Put
.B \-\-
before the command to end the options, as in
.BR "drop \-\- ls \-l" .
An unknown option or an option without its argument is a usage error:
the program prints a usage message on standard error and exits with
status 1.
.TP
.BI "\-c " string
Run
.I string
as a command in the shell.
The shell is given
.B \-c
.IR string ,
or
.B /c
.I string
for
.BR cmd.exe .
The operands follow as arguments.
.TP
.BI "\-s " shell
.RB ( drop
only.)
Run
.I shell
instead of
.BR sh (1).
.I shell
is the path of a program, with forward slashes or backslashes.
It is not searched for in
.BR PATH :
a name without a directory is looked for in the current directory, with
the suffixes listed above.
When the last component of
.I shell
is
.B cmd.exe
in any case,
.B \-c
passes
.B /c
instead.
When
.I shell
is not found,
.B drop
exits with status 127.
.B \-s
is ignored when there is a
.I command
operand and no
.BR \-c .
.TP
.B \-\-help
As the first argument, print a usage message on standard output and exit
with status 0.
Any further arguments are ignored.
.SH ENVIRONMENT
.TP
.B PATH
Where
.IR command ,
.BR cmd.exe ,
and
.B powershell.exe
are searched for.
.TP
.B BB_OVERRIDE_APPLETS
Which names run an applet and which run a program from
.BR PATH ;
see
.BR busybox (1).
.TP
.BR USER ", " LOGNAME
Each is set for the command to the name of the user, with spaces
replaced by underscores, when it is unset or is
.BR root .
Otherwise it is passed on unchanged.
.TP
.B POSIXLY_CORRECT
The C library's option parser reads it.
When it is set, even to an empty value, options are recognized only
before the first operand.
.TP
.B BB_GLOBBING
Unless it is
.BR 0 ,
wildcards in the operands are expanded, as needed when run from
.BR cmd.exe .
A busybox process started with it unset sets it to
.B 0
for its children.
.SH EXIT STATUS
.TP
.B 1
A usage error, a failure to build the new token, or a failure to read
the status of the command.
Also a status of 1 from the command.
.TP
.B 126
The command was found but could not be started.
.TP
.B 127
The command, the
.B \-s
shell,
.BR cmd.exe ,
or
.B powershell.exe
was not found.
.PP
Otherwise the exit status is that of the command, any value from 0 to
255.
A command that ended as if by a signal has status 128 plus the signal
number, such as 139 for an access violation and 130 for Ctrl+C.
Otherwise the status is the low byte of the Windows exit code, or 255
for a code that is a nonzero multiple of 256.
Such a code above 255 is also reported on standard error as
.PP
.RS 4
.EX
drop: \fImessage\fR Error 0x\fIcode\fR
.EE
.RE
.PP
with the code in hexadecimal, after the Windows description of it when
there is one.
The other errors are reported as
.PP
.RS 4
.EX
drop: can\(aqt find \(aq\fIname\fR\(aq
drop: can\(aqt execute \(aq\fIpath\fR\(aq
.EE
.RE
.PP
with the name of the program in place of
.BR drop .
A failure to build the new token has no message.
.SH EXAMPLES
From an elevated shell, open a shell without administrator rights in the
same console:
.PP
.RS 4
.EX
$ drop
.EE
.RE
.PP
Build a project without administrator rights.
The
.B \-\-
keeps
.B \-j4
away from
.BR drop :
.PP
.RS 4
.EX
$ drop \-\- make \-j4
.EE
.RE
.PP
Run a shell command, passing a file name as
.BR $0 :
.PP
.RS 4
.EX
$ drop \-c \(aqls \-l "$0"\(aq notes.txt
.EE
.RE
.PP
Open a
.B cmd.exe
prompt without administrator rights:
.PP
.RS 4
.EX
$ cdrop
.EE
.RE
.SH NOTES
Windows still reports the dropped process as elevated.
To tell the difference, busybox tests whether the Administrators group
is enabled, so in a dropped process
.BR id (1)
does not print
.BR root ,
and
.BR su (1)
refuses to run from a dropped process, because it cannot raise the
privilege again.
.PP
When the program is not elevated it works the same way.
The command then runs with no more rights than the program has, at
medium integrity.
If Windows refuses to build the new token or to set its integrity
level, the program exits with status 1 without a message.
Integrity levels exist only on Windows Vista and later, so on Windows XP
the programs always fail this way.
.PP
On Ctrl+C or Ctrl+Break, a command that shares the console handles the
event itself.
A command that does not, such as a GUI program, is terminated.
The program itself keeps waiting for the command to exit.
.PP
Each argument is quoted by the rules of the Microsoft C runtime.
.B cmd.exe
and PowerShell parse their command lines by their own rules, so a
.I string
that contains double quotes may reach them changed.
.SH SEE ALSO
.BR busybox (1),
.BR id (1),
.BR sh (1),
.BR su (1)

371
man/man1/flock.1 Normal file
View File

@@ -0,0 +1,371 @@
.TH FLOCK 1 2026-10-22 "w64devkit" "w64devkit Manual"
.SH NAME
flock \- run a program while holding a lock on a file
.SH SYNOPSIS
.B flock
.RB [ \-sxn ]
.I file
.I prog
.RI [ arg ...]
.br
.B flock
.RB [ \-sxn ]
.I file
.B \-c
.I command
.br
.B flock
.RB [ \-sxun ]
.I fd
.SH DESCRIPTION
.B flock
opens
.IR file ,
locks it, runs
.I prog
with the arguments
.IR arg ...,
waits for it, and exits with its exit status.
The lock is released when
.B flock
exits.
Two
.B flock
commands that lock the same file therefore run their programs one at a
time, which serializes jobs that must not overlap.
If
.I file
does not exist,
.B flock
creates it as an empty file; see
.B Lock range
below.
.I file
is opened for reading only, and
.B flock
never writes to it.
This
.B flock
is a busybox applet; see
.BR busybox (1).
.PP
A lock is exclusive or shared.
An exclusive lock, the default, conflicts with every other lock on the
file.
A shared lock, taken with
.BR \-s ,
conflicts only with exclusive locks, so several shared locks may be
held at once.
When the lock conflicts with one held by another process,
.B flock
waits until it is released, or with
.B \-n
fails at once.
.PP
With
.BR \-c ,
.B flock
runs
.I command
with the shell, as
.I shell
.B \-c
.IR command ,
where
.I shell
is the value of
.B SHELL
or, when that is unset or empty,
.IR /bin/sh ,
which is the kit's
.BR sh (1).
.PP
With a single operand, a file descriptor number
.IR fd ,
.B flock
locks or unlocks the file already open on that descriptor and exits.
On Windows this form cannot hold a lock beyond the life of
.B flock
itself; see
.BR NOTES .
.PP
.I prog
is started as the kit's shell starts an external command: an applet of
that name runs as a new busybox process, or inside the
.B flock
process for the few applets that busybox runs that way, such as
.BR echo ,
and any other name without a directory part is looked up in
.BR PATH ;
see
.B Running commands
in
.BR busybox (1).
.I prog
shares the standard input, output, and error of
.BR flock ,
which writes nothing itself except error messages on standard error.
.SS Lock range
.B flock
locks the bytes of
.I file
that exist when the lock is taken, from offset 0 up to the size of the
file at that moment.
Bytes appended later are not covered.
A lock on an empty file covers no bytes, and Windows does not let a lock
of zero bytes conflict with any other lock.
A lock on an empty file therefore excludes nothing, and two
.B flock
commands on it run their programs at the same time.
Write at least one byte to a lock file before using it, as in
.BR EXAMPLES .
.PP
Windows locks are mandatory, not advisory.
While
.B flock
holds an exclusive lock, no other process, including
.IR prog ,
can read or write the locked bytes of
.IR file .
While it holds a shared lock, no process can write them.
Such a read or write fails with a permission error.
Use a separate file as the lock, not the data that
.I prog
works on.
.SH OPTIONS
Options are recognized only before
.I file
or
.IR fd ,
and may be grouped, as in
.BR \-sn .
Everything after
.I file
belongs to
.IR prog ,
except a
.B \-c
or
.B \-\-command
immediately after
.IR file .
.B \-\-
ends the options.
.TP
.BR \-s ", " \-\-shared
Take a shared lock.
Incompatible with
.B \-x
and
.BR \-u .
.TP
.BR \-x ", " \-\-exclusive
Take an exclusive lock.
This is the default.
Incompatible with
.B \-s
and
.BR \-u .
.TP
.BR \-u ", " \-\-unlock
Release a lock instead of taking one.
A lock belongs to the process that took it, and a new
.B flock
process holds none, so
.B \-u
always fails with status 1, and
.I prog
does not run.
.TP
.BR \-n ", " \-\-nonblock
Do not wait for a conflicting lock to be released.
Exit at once with status 1 and an error message instead.
.TP
\fB\-c\fR, \fB\-\-command\fR \fIcommand\fR
Run
.I command
with the shell, as described above.
It must follow
.I file
directly, and
.I command
must be a single argument.
.TP
.B \-\-help
Print a usage message on standard output and exit with status 0.
.SH ENVIRONMENT
.TP
.B SHELL
The shell that runs
.I command
for
.BR \-c ,
when set and not empty.
.TP
.B PATH
Where
.I prog
is looked up when it is not an applet and has no directory part.
.TP
.B BB_OVERRIDE_APPLETS
Applets that are not run when named as
.IR prog ,
so that a program in
.B PATH
runs instead; see
.BR busybox (1).
.TP
.B BB_GLOBBING
Unless it is
.BR 0 ,
wildcards in the arguments of
.B flock
are expanded when it starts, as needed when run from
.BR cmd.exe .
That includes the arguments of
.IR prog .
A busybox process started with it unset sets it to
.B 0
for its children.
.PP
Variables that affect every busybox applet, such as
.B BB_TERMINAL_MODE
for console output, are described in
.BR busybox (1).
.SH EXIT STATUS
.TP
.I n
.I prog
ran and exited with status
.IR n .
A
.I prog
that ended as if by a signal gives 128 plus the signal number.
.TP
.B 0
In the
.I fd
form, the lock was taken.
.TP
.B 1
A usage error, a
.I file
that could not be opened, a lock that could not be taken or released,
or, with
.BR \-n ,
a conflicting lock.
.I prog
does not run.
.TP
.B 255
.I prog
could not be started.
.PP
Errors are reported on standard error as
.PP
.RS 4
.EX
flock: can\(aqt open \(aq\fIfile\fR\(aq: \fIreason\fR
flock: : \fIreason\fR
flock: invalid number \(aq\fIfd\fR\(aq
flock: \-c takes only one argument
flock: \fIprog\fR: \fIreason\fR
.EE
.RE
.PP
The second form, with an empty field before the reason, reports a
failure to lock or unlock, such as
.B Permission denied
for a conflicting lock with
.BR \-n ,
.B Invalid argument
for
.B \-s
with
.BR \-x ,
or
.B Bad file descriptor
for an
.I fd
that is not open.
.SH EXAMPLES
Create a lock file of one line, then run a build that no other build
using the same lock file can overlap:
.PP
.RS 4
.EX
$ echo lock >build.lock
$ flock build.lock make
.EE
.RE
.PP
Skip the build when another one holds the lock:
.PP
.RS 4
.EX
$ flock \-n build.lock make || echo busy
.EE
.RE
.PP
Run a shell command under a shared lock:
.PP
.RS 4
.EX
$ flock \-s build.lock \-c \(aqcp out/app.exe /c/dist/\(aq
.EE
.RE
.SH NOTES
Differences from
.B flock
on Unix:
.IP \(bu 2
On Unix a lock belongs to an open file and outlives the process that
took it while the file stays open elsewhere, so
.B "flock 9"
can lock a file that a shell opened with
.B "exec 9>file"
and hold the lock for the rest of the script.
On Windows a lock belongs to the process that took it and is released
when that process exits.
In the
.I fd
form
.B flock
takes the lock and releases it as it exits, so the shell never holds
it.
The only use of this form is to wait until no other process holds a
conflicting lock.
.IP \(bu 2
.B \-u
always fails, as described under
.BR OPTIONS .
.IP \(bu 2
Locks are mandatory, and a lock on an empty file excludes nothing; see
.BR "Lock range" .
.IP \(bu 2
With
.BR \-n ,
a conflicting lock gives an error message as well as status 1.
.IP \(bu 2
A directory cannot be opened, so it cannot be locked.
.B flock
exits with status 1 and
.BR "Permission denied" .
.IP \(bu 2
There are no
.BR \-o ,
.BR \-w ,
.BR \-E ,
or
.B \-F
options, and no timeout.
.PP
Windows does not let another process delete or rename
.I file
while
.B flock
has it open.
.SH SEE ALSO
.BR busybox (1),
.BR sh (1),
.BR timeout (1)

View File

@@ -1,6 +1,7 @@
.TH MD5SUM 1 2026-10-19 "w64devkit" "w64devkit Manual"
.TH MD5SUM 1 2026-10-22 "w64devkit" "w64devkit Manual"
.SH NAME
md5sum, sha1sum, sha256sum, sha3sum, sha512sum \- print or check digests
md5sum, sha1sum, sha256sum, sha384sum, sha3sum, sha512sum \-
print or check digests
.SH SYNOPSIS
.B md5sum
.RB [ \-b " | " \-t ]
@@ -38,6 +39,9 @@ SHA-1, 160 bits.
.B sha256sum
SHA-256, 256 bits.
.TP
.B sha384sum
SHA-384, 384 bits.
.TP
.B sha512sum
SHA-512, 512 bits.
.TP
@@ -48,6 +52,7 @@ chooses another size.
.PP
.BR sha1sum ,
.BR sha256sum ,
.BR sha384sum ,
and
.B sha512sum
take the same options and operands as
@@ -398,20 +403,6 @@ When standard output is a console, names are converted for display from
the ANSI code page to the console's output code page.
.PP
MD5 and SHA-1 detect accidental damage only, not deliberate tampering.
.PP
busybox also has
.BR sha384sum ,
which takes the same options as
.BR md5sum .
The kit installs no
.I sha384sum.exe
for it.
The kit's shell, and busybox commands such as
.BR find ,
run it by name, but elsewhere, such as from
.BR cmd.exe ,
run it as
.BR "busybox sha384sum" .
.SH SEE ALSO
.BR busybox (1),
.BR cksum (1),

1
man/man1/pdrop.1 Normal file
View File

@@ -0,0 +1 @@
.so man1/drop.1

1
man/man1/sha384sum.1 Normal file
View File

@@ -0,0 +1 @@
.so man1/md5sum.1

254
man/man1/stty.1 Normal file
View File

@@ -0,0 +1,254 @@
.TH STTY 1 2026-10-22 "w64devkit" "w64devkit Manual"
.SH NAME
stty \- print or change console input settings
.SH SYNOPSIS
.B stty
.RB [ \-a ]
.br
.B stty
.IR setting ...
.SH DESCRIPTION
.B stty
prints or changes the input mode of the console attached to standard
input, and prints the size of the console window.
On Unix it controls a terminal device.
Windows consoles have no such device, so this build recognizes only the
settings listed below, and every other Unix setting is an invalid
argument.
.PP
Standard input must be a console.
When it is a file or a pipe,
.B stty
prints an error and exits with status 1, even when the only argument is
.BR size .
.PP
With no arguments,
.B stty
prints the settings that differ from those set by
.BR sane .
The only setting it can report is echo, so it prints
.B \-echo
when echo is off and nothing at all when echo is on.
With
.BR \-a ,
it prints the window size and the echo setting on two lines:
.PP
.RS 4
.EX
rows 30; columns 120;
echo
.EE
.RE
.PP
Neither form reports whether the console is in raw mode.
.PP
With one or more settings,
.B stty
first checks every argument, and changes nothing if any is invalid.
It then applies the settings in order, so a later setting overrides an
earlier one, and writes the resulting mode to the console once.
.B size
is the only setting that prints anything.
.SS Settings
These change the console's input mode, a set of flags that Windows
keeps for the console.
The change stays in effect after
.B stty
exits, for every program that reads from the same console, until a
program changes the mode again.
Flags that no setting names, such as quick edit mode and virtual
terminal input, are left as they are.
.TP
.B echo
Display typed characters as the console reads a line.
.TP
.B \-echo
Read lines without displaying them.
.TP
.BR cooked ", " \-raw
Turn on line input and processed input.
With line input, a read returns only when Enter is pressed, and the
console provides line editing.
With processed input, Ctrl+C interrupts the program instead of being
read as a character.
.TP
.BR raw ", " \-cooked
Turn off line input and processed input, so that a read returns each
key as it is typed and Ctrl+C is read as an ordinary character.
Echo is not changed.
Windows allows echo only with line input, so use
.B raw
together with
.BR \-echo .
.TP
.B sane
Turn on echo, line input, and processed input.
.TP
.B size
Print the height and then the width of the console window, in character
cells, as two decimal numbers separated by a space.
This is the size of the visible window, not of the screen buffer behind
it.
It does not change the console.
.PP
The size comes from the console attached to standard output or, when
that is not a console, to standard error.
The console on standard input is not asked, though standard input must
still be a console.
When neither standard output nor standard error is a console,
.B size
prints an error message instead of the size, and
.B \-a
leaves out the size line.
The variables
.B LINES
and
.B COLUMNS
override the size; see
.BR ENVIRONMENT .
.PP
The settings
.BR rows ,
.BR cols ,
and
.BR columns ,
which resize the window on Unix, are recognized but always fail:
a number after one of them is reported as an invalid argument.
.SH OPTIONS
.TP
.B \-a
Print the window size and the echo setting.
.B \-a
cannot be combined with a setting.
Letters after the dash may repeat, as in
.BR \-aa ,
but any letter other than
.B a
makes the argument invalid.
.TP
.B \-\-help
When it is the first argument, print a usage message on standard output
and exit with status 0.
In any other position it is an invalid argument.
.PP
There are no
.B \-F
and
.B \-g
options, and
.B \-\-
is an invalid argument.
An argument that is a single
.B \-
is ignored.
.SH ENVIRONMENT
.TP
.B LINES
When set, replaces the height reported by
.B size
and
.BR \-a ,
even when a console is present.
.TP
.B COLUMNS
When set, replaces the width in the same way.
.PP
A value that is not a number from 2 to 29999 counts as 24 for
.B LINES
and 80 for
.BR COLUMNS .
When either variable is set and there is no console to ask, the other
dimension is reported as 24 or 80 rather than as an error.
.PP
The startup code shared by all applets reads
.BR BB_CRITICAL_ERROR_DIALOGS ,
.BR BB_GLOBBING ,
and
.BR BB_UMASK ;
see
.BR busybox (1).
.SH EXIT STATUS
.TP
.B 0
Success.
This includes a
.B size
or
.B \-a
that could not find the window size.
.TP
.B 1
An argument was invalid,
.B \-a
was combined with a setting, standard input is not a console, or the
console rejected the new mode.
.SH EXAMPLES
Print the height and width of the console:
.PP
.RS 4
.EX
$ stty size
.EE
.RE
.PP
Save the height and width in shell variables:
.PP
.RS 4
.EX
$ set \-\- $(stty size)
$ rows=$1 cols=$2
.EE
.RE
.PP
Restore the usual input mode after a program left the console in raw
mode:
.PP
.RS 4
.EX
$ stty sane
.EE
.RE
.PP
Turn off line input and echo, and later turn them back on:
.PP
.RS 4
.EX
$ stty raw \-echo
$ stty sane
.EE
.RE
.SH NOTES
The settings affect programs that read the console with ordinary reads.
The kit's shell reads keys directly, both for its command line and for
its
.B read
builtin, so it echoes and edits input whatever the console mode is.
In particular,
.B stty \-echo
does not hide input to
.BR read ;
use
.B read \-s
instead.
.PP
There is no way to save the current mode and restore it later, because
.B \-g
is not supported.
.PP
When
.BR rows ,
.BR cols ,
or
.B columns
is the last argument, with no number after it,
.B stty
crashes instead of reporting an error.
.PP
.BR ttysize (1)
also prints the console size, prints the width first by default, and
does not require standard input to be a console.
.SH SEE ALSO
.BR busybox (1),
.BR reset (1),
.BR sh (1),
.BR ttysize (1)

View File

@@ -1,4 +1,4 @@
.TH SU 1 2026-10-19 "w64devkit" "w64devkit Manual"
.TH SU 1 2026-10-22 "w64devkit" "w64devkit Manual"
.SH NAME
su \- run a shell with elevated privileges
.SH SYNOPSIS
@@ -391,9 +391,9 @@ The privilege of a process can be dropped by the busybox applets
.BR drop ,
.BR cdrop ,
or
.BR pdrop ,
which have no launchers; see
.BR busybox (1).
.BR pdrop ;
see
.BR drop (1).
Windows still reports such a process as elevated, so it would start the
shell without raising the privilege, and
.B su
@@ -402,5 +402,6 @@ gives up with status 2.
skips this test.
.SH SEE ALSO
.BR busybox (1),
.BR drop (1),
.BR id (1),
.BR sh (1)

View File

@@ -1,4 +1,4 @@
.TH TTYSIZE 1 2026-10-19 "w64devkit" "w64devkit Manual"
.TH TTYSIZE 1 2026-10-22 "w64devkit" "w64devkit Manual"
.SH NAME
ttysize \- print the width and height of the console
.SH SYNOPSIS
@@ -125,11 +125,8 @@ $ cat size.txt
.SH NOTES
.B stty size
prints the height first, not the width, and fails with an error when
standard input is not a console.
.B stty
has no launcher in the kit, so run it as
.B busybox stty
or from the kit's shell.
standard input is not a console; see
.BR stty (1).
.PP
The usage message says the size is that of the stdin tty, but on Windows
this build asks only standard output, then standard error.
@@ -151,4 +148,5 @@ The default size cannot be told from a real 80 by 24 console.
The output ends in LF, not CRLF.
.SH SEE ALSO
.BR busybox (1),
.BR sh (1)
.BR sh (1),
.BR stty (1)