mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-03-25 13:29:03 +02:00
i currently use the output of sha512sum in several places of xbmk, which is a bit unreliable in case output changes. other cases where i use util outputs in variables are probably reliable, because i'm using mostly posix utilities in those. to mitigate this, i now import suckless sbase, which has a reasonable sha512sum implementation. *every* binary it builds is being placed in build.list, because i'll probably start using more of them. for example, i may start modifying the "date" implementation, adding the GNU-specific options that i need as mentioned on init.sh i'm importing it in util/ because the sha512sum util is needed for verifying project sources, so if sbase itself is a "project source", that means we can into a chicken and egg bootstrapping problem. this is sbase at revision: 055cc1ae1b3a13c3d8f25af0a4a3316590efcd48 Signed-off-by: Leah Rowe <leah@libreboot.org>
122 lines
2.8 KiB
Groff
122 lines
2.8 KiB
Groff
.Dd July 30, 2025
|
|
.Dt XARGS 1
|
|
.Os sbase
|
|
.Sh NAME
|
|
.Nm xargs
|
|
.Nd construct argument lists and execute command
|
|
.Sh SYNOPSIS
|
|
.Nm
|
|
.Op Fl 0prtx
|
|
.Op Fl E Ar eofstr
|
|
.Op Fl I Ar replstr
|
|
.Op Fl n Ar num
|
|
.Op Fl P Ar maxprocs
|
|
.Op Fl s Ar num
|
|
.Op Ar cmd Op Ar arg ...
|
|
.Sh DESCRIPTION
|
|
.Nm
|
|
reads space, tab, newline and EOF delimited strings from stdin
|
|
and executes the specified
|
|
.Ar cmd
|
|
with the strings as
|
|
.Ar arguments .
|
|
.Pp
|
|
Any arguments specified on the command line are given to the command upon
|
|
each invocation, followed by some number of the arguments read from
|
|
stdin.
|
|
The command is repeatedly executed one or more times until stdin is exhausted.
|
|
.Pp
|
|
Spaces, tabs and newlines may be embedded in arguments using single (`'')
|
|
or double (`"') quotes or backslashes ('\e').
|
|
Single quotes escape all non-single quote characters, excluding newlines, up
|
|
to the matching single quote.
|
|
Double quotes escape all non-double quote characters, excluding newlines, up
|
|
to the matching double quote.
|
|
Any single character, including newlines, may be escaped by a backslash.
|
|
.Sh OPTIONS
|
|
.Bl -tag -width Ds
|
|
.It Fl 0
|
|
Change
|
|
.Nm
|
|
to expect NUL ('\e0') characters as separators, instead of spaces
|
|
and newlines.
|
|
The quoting mechanisms described above are not performed.
|
|
.It Fl E Ar eofstr
|
|
Use
|
|
.Ar eofstr
|
|
as a logical EOF marker.
|
|
.It Fl I Ar replstr
|
|
Use
|
|
.Ar replstr
|
|
as the placeholder for the argument.
|
|
Sets the arguments count to 1 per command line.
|
|
It also implies the option x.
|
|
.It Fl n Ar num
|
|
Use at most
|
|
.Ar num
|
|
arguments per command line.
|
|
.It Fl p
|
|
Prompt mode: the user is asked whether to execute
|
|
.Ar cmd
|
|
at each invocation.
|
|
Trace mode (-t) is turned on to write the command instance to be executed,
|
|
followed by a prompt to standard error.
|
|
An affirmative response read from
|
|
.Pa /dev/tty
|
|
executes the command, otherwise it is skipped.
|
|
.It Fl P Ar maxprocs
|
|
Parallel mode: run at most maxprocs invocations of
|
|
.Ar cmd
|
|
at once.
|
|
.It Fl r
|
|
Do not run the command if there are no arguments.
|
|
Normally the command is executed at least once even if there are no arguments.
|
|
.It Fl s Ar num
|
|
Use at most
|
|
.Ar num
|
|
bytes per command line.
|
|
.It Fl t
|
|
Enable trace mode.
|
|
Write the command line to stderr before executing it.
|
|
.It Fl x
|
|
Terminate if the command line exceeds the system limit or the number of bytes
|
|
given with the
|
|
.Op Fl s
|
|
flag.
|
|
.El
|
|
.Sh EXIT STATUS
|
|
.Nm
|
|
exits with one of the following values:
|
|
.Bl -tag -width Ds
|
|
.It 0
|
|
All invocations of
|
|
.Ar cmd
|
|
returned a zero exit status.
|
|
.It 123
|
|
One or more invocations of
|
|
.Ar cmd
|
|
returned a nonzero exit status.
|
|
.It 124
|
|
.Ar cmd
|
|
exited with a 255 exit status.
|
|
.It 125
|
|
.Ar cmd
|
|
was killed or stopped by a signal.
|
|
.It 126
|
|
.Ar cmd
|
|
was found but could not be executed.
|
|
.It 127
|
|
.Ar cmd
|
|
could not be found.
|
|
.It 1
|
|
Some other error occurred.
|
|
.El
|
|
.Sh STANDARDS
|
|
POSIX.1-2013.
|
|
.Pp
|
|
The
|
|
.Op Fl r
|
|
and
|
|
.Op Fl P
|
|
flag is an extension to that specification.
|