|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1980 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: */ ! 6: ! 7: #ifndef lint ! 8: char copyright[] = ! 9: "@(#) Copyright (c) 1980 Regents of the University of California.\n\ ! 10: All rights reserved.\n"; ! 11: #endif not lint ! 12: ! 13: #ifndef lint ! 14: static char sccsid[] = "@(#)nice.c 5.2 (Berkeley) 1/12/86"; ! 15: #endif not lint ! 16: ! 17: #include <stdio.h> ! 18: ! 19: #include <sys/time.h> ! 20: #include <sys/resource.h> ! 21: ! 22: main(argc, argv) ! 23: int argc; ! 24: char *argv[]; ! 25: { ! 26: int nicarg = 10; ! 27: ! 28: if (argc > 1 && argv[1][0] == '-') { ! 29: nicarg = atoi(&argv[1][1]); ! 30: argc--, argv++; ! 31: } ! 32: if (argc < 2) { ! 33: fputs("usage: nice [ -n ] command\n", stderr); ! 34: exit(1); ! 35: } ! 36: if (setpriority(PRIO_PROCESS, 0, ! 37: getpriority(PRIO_PROCESS, 0) + nicarg) < 0) { ! 38: perror("setpriority"); ! 39: exit(1); ! 40: } ! 41: execvp(argv[1], &argv[1]); ! 42: perror(argv[1]); ! 43: exit(1); ! 44: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.