summaryrefslogtreecommitdiff
path: root/src/nice.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-10-12 01:52:24 +0000
committerJim Meyering <jim@meyering.net>1993-10-12 01:52:24 +0000
commit87fa23e6417d7d1938b72e872d779ae7225a5aa4 (patch)
tree0fcc68f9cdf7315d09d5836df0f261e3d6b8c13a /src/nice.c
parentf12b53b2ce8f0bb0dd28a290f9b27490ef4599a9 (diff)
downloadcoreutils-87fa23e6417d7d1938b72e872d779ae7225a5aa4.tar.xz
merge with 1.8.1b
Diffstat (limited to 'src/nice.c')
-rw-r--r--src/nice.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/nice.c b/src/nice.c
index 51218d8e7..28e68d9f5 100644
--- a/src/nice.c
+++ b/src/nice.c
@@ -28,6 +28,12 @@
#include "version.h"
#include "system.h"
+#ifdef NICE_PRIORITY
+#define GET_PRIORITY() nice (0)
+#else
+#define GET_PRIORITY() getpriority (PRIO_PROCESS, 0)
+#endif
+
void error ();
static int isinteger ();
@@ -39,7 +45,7 @@ char *program_name;
/* If non-zero, display usage information and exit. */
static int show_help;
-/* If non-zero, print the version on standard error. */
+/* If non-zero, print the version on standard output and exit. */
static int show_version;
static struct option const longopts[] =
@@ -111,27 +117,18 @@ main (argc, argv)
usage ();
/* No command given; print the priority. */
errno = 0;
-#ifndef NICE_PRIORITY
- current_priority = getpriority (PRIO_PROCESS, 0);
-#else
- current_priority = nice (0);
-#endif
+ current_priority = GET_PRIORITY ();
if (current_priority == -1 && errno != 0)
error (1, errno, "cannot get priority");
printf ("%d\n", current_priority);
exit (0);
}
- errno = 0;
#ifndef NICE_PRIORITY
- current_priority = getpriority (PRIO_PROCESS, 0);
-#else
- current_priority = nice (0);
-#endif
+ errno = 0;
+ current_priority = GET_PRIORITY ();
if (current_priority == -1 && errno != 0)
error (1, errno, "cannot get priority");
-
-#ifndef NICE_PRIORITY
if (setpriority (PRIO_PROCESS, 0, current_priority + adjustment))
#else
if (nice (adjustment) == -1)