Commit Graph

17 Commits

Author SHA1 Message Date
Roberto E. Vargas Caballero d84070398b Check if PRIO_MIN and PRIO_MAX are defined
The majority of the systems define PRIO_MAX and PRIO_MIN,
but there is an obscure system, whose name I am not going
to tell, where they were not defined.
2015-12-15 17:05:21 +00:00
sin 2366164de7 No need for semicolon after ARGEND
This is also the style used in Plan 9.
2015-11-01 10:18:55 +00:00
FRIGN 6f207dac5f Don't return but _exit after failed exec*() and fork()
Quoting POSIX[0]:
"Care should be taken, also, to call _exit() rather than exit() if exec cannot be used, since
exit() flushes and closes standard I/O channels, thereby damaging the parent process' standard
I/O data structures. (Even with fork(), it is wrong to call exit(), since buffered data would
then be flushed twice.)"

[0]: http://pubs.opengroup.org/onlinepubs/009695399/functions/vfork.html
2015-03-09 01:12:59 +01:00
FRIGN c01641c897 Audit nice(1)
1) val is sufficient as "int" (read the standard)
2) BUGFIX: If getpriority fails, it returns -1 and sets errno.
   Previously, it would correctly catch the errno but not take
   care of the fact that by then val has been decremented by 1.
   Only change val if the getpriority-call has been successful.
3) Add LIMIT()-macro from st to increase readability.
4) setpriority returns < 0 on failure
5) Remove bikeshedding-comment. Read the standard if you wonder.
6) return-value trick from env(1)
2015-03-02 16:53:13 +01:00
FRIGN 31572c8b0e Clean up #includes 2015-02-14 21:12:23 +01:00
FRIGN fd562481f3 Convert estrto{l, ul} to estrtonum
Enough with this insanity!
2015-01-30 16:52:44 +01:00
FRIGN 20b5d7c0d4 Add mandoc-manpage for nice(1)
and mark it as finished in README.
2015-01-28 22:40:40 +01:00
sin 166bc3052e Use PRIO_{MIN,MAX} instead of NZERO
Some systems do not define NZERO.  NZERO seems to be an XSI extension
and PRIO_{MIN,MAX} is not specified by POSIX but most relevant systems
define it.
2014-11-17 15:02:51 +00:00
FRIGN eee98ed3a4 Fix coding style
It was about damn time. Consistency is very important in such a
big codebase.
2014-11-13 18:08:43 +00:00
Hiltjo Posthuma 953ebf3573 code style
Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
2014-06-01 18:02:30 +01:00
dwts 575b38391c keep usage definition above main 2014-04-22 13:46:33 +01:00
sin 02d91696b4 Fix char **argv to char *argv[] 2014-04-18 11:54:44 +01:00
sin 795ffe490d Use the more portable NZERO instead of PRIO_*
We assume the valid range is [-NZERO, NZERO-1].
2014-02-27 14:24:21 +00:00
sin 203b52c38a Use getpriority()/setpriority() instead of deprecated nice()
This is now similar to how renice(1) is implemented.
2014-01-28 17:20:20 +00:00
sin f349dd5987 Use arg.h as much as possible and add usage() where missing
Rename eusage() to usage() as well.
2013-10-07 17:13:01 +01:00
Lorenzo Cogotti 75c97de593 Various fixes, add renice command.
This commit adds the renice command and its man page,
it also introduces some fixes:
* Makes nice command more solid, it also makes it respect POSIX return values.
* Fixes estrtol, which produced a misleading error on out of range errors.
* Fixes chgrp.1 NAME section.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
2013-06-14 19:01:04 +02:00
Christoph Lohmann b0898c605d Adding the new C files too. 2013-06-09 15:20:55 +02:00