/* nice - be nice to others	Author: Kai-Uwe Bloem	  */
/* (Based on time.c, by Andy Tanenbaum & Michiel Huisjes) */

#include <sys/types.h>
/* #include <limits.h> */
#include <signal.h>

char **args;
char *name;

main(argc, argv)
int argc;
char *argv[];
{
  int status, pid, incr;

  if (argc == 1) exit(0);

  /* See if there is a numeric option */
  if (*argv[1] == '-') {
	incr = atoi(argv[1]+1);
	name = argv[2];
	args = &argv[2];
  } else {	/* default is nice(10) */
	incr = 10;
	name = argv[1];
	args = &argv[1];
  }

  /* lower (or raise) priority */
  if (nice(incr) != 0) {
	perror(argv[0]);
	exit(1);
  }

  execvp(name, args);
  std_err("Cannot execute ");
  std_err(name);
  std_err("\n");
  exit(-1);
}
