From e9a910b33c7837b4b868e3abda18eb4810df7f02 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Sat, 4 Oct 2025 09:14:33 +0100 Subject: config/git: import suckless sbase 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 --- util/sbase/xargs.1 | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 util/sbase/xargs.1 (limited to 'util/sbase/xargs.1') diff --git a/util/sbase/xargs.1 b/util/sbase/xargs.1 new file mode 100644 index 00000000..e988278d --- /dev/null +++ b/util/sbase/xargs.1 @@ -0,0 +1,121 @@ +.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. -- cgit v1.2.1