diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-02-11 03:12:21 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-02-11 03:12:21 +0000 |
commit | 774654ad56fc9304e4a064232760835c7a2a6c13 (patch) | |
tree | 3f539521073866497ff0370d8a6464c9356cadb4 /src/skaembutils/s6-nice.c | |
parent | 790c8681d3451b61a536871dad234fc294796fd8 (diff) | |
download | s6-portable-utils-774654ad56fc9304e4a064232760835c7a2a6c13.tar.xz |
Add multicall configuration
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/skaembutils/s6-nice.c')
-rw-r--r-- | src/skaembutils/s6-nice.c | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/skaembutils/s6-nice.c b/src/skaembutils/s6-nice.c deleted file mode 100644 index 38017f6..0000000 --- a/src/skaembutils/s6-nice.c +++ /dev/null @@ -1,45 +0,0 @@ -/* ISC license. */ - -#include <unistd.h> -#include <errno.h> - -#include <skalibs/sgetopt.h> -#include <skalibs/types.h> -#include <skalibs/strerr.h> -#include <skalibs/exec.h> - -#define USAGE "s6-nice [ -I | -i ] [ -n value ] prog..." - -int main (int argc, char const *const *argv) -{ - int incr = 10 ; - int strict = 0 ; - PROG = "s6-nice" ; - { - subgetopt l = SUBGETOPT_ZERO ; - for (;;) - { - int opt = subgetopt_r(argc, argv, "Iin:", &l) ; - if (opt == -1) break ; - switch (opt) - { - case 'I' : strict = 0 ; break ; - case 'i' : strict = 1 ; break ; - case 'n': if (!int_scan(l.arg, &incr)) strerr_dieusage(100, USAGE) ; break ; - default : strerr_dieusage(100, USAGE) ; - } - } - argc -= l.ind ; argv += l.ind ; - } - if (!argc) strerr_dieusage(100, USAGE) ; - - errno = 0 ; - if ((nice(incr) < 0) && errno) - { - char fmt[1+UINT_FMT] ; - fmt[int_fmt(fmt, incr)] = 0 ; - if (strict) strerr_diefu2sys(111, "nice to ", fmt) ; - else strerr_warnwu2sys("nice to ", fmt) ; - } - xexec(argv) ; -} |