summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rtprio/rtprio.c
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-10-13 11:24:01 +0000
committercharnier <charnier@FreeBSD.org>1997-10-13 11:24:01 +0000
commitff717fa4f43a204e67d5cd044379c8803e74cf10 (patch)
treefdd5b5ce4bde3271e74d89cb1a3eb5da35c1ffed /usr.sbin/rtprio/rtprio.c
parent8459f389a168bc4c5109f83e755a73813f58b8bb (diff)
downloadFreeBSD-src-ff717fa4f43a204e67d5cd044379c8803e74cf10.zip
FreeBSD-src-ff717fa4f43a204e67d5cd044379c8803e74cf10.tar.gz
Use err(3). Sync usage string and man page.
Diffstat (limited to 'usr.sbin/rtprio/rtprio.c')
-rw-r--r--usr.sbin/rtprio/rtprio.c48
1 files changed, 23 insertions, 25 deletions
diff --git a/usr.sbin/rtprio/rtprio.c b/usr.sbin/rtprio/rtprio.c
index ab4d085..0088b40 100644
--- a/usr.sbin/rtprio/rtprio.c
+++ b/usr.sbin/rtprio/rtprio.c
@@ -30,18 +30,22 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $Id$
*/
+#ifndef lint
+static const char rcsid[] =
+ "$Id$";
+#endif /* not lint */
+
#include <sys/param.h>
#include <sys/rtprio.h>
#include <sys/errno.h>
+#include <ctype.h>
+#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <unistd.h>
static void usage();
@@ -72,10 +76,8 @@ main(argc, argv)
* arg! */
/* FALLTHROUGH */
case 1:
- if (rtprio(RTP_LOOKUP, proc, &rtp) != 0) {
- perror(argv[0]);
- exit (1);
- }
+ if (rtprio(RTP_LOOKUP, proc, &rtp) != 0)
+ err(1, "%s", argv[0]);
printf("%s: ", p);
switch (rtp.type) {
case RTP_PRIO_REALTIME:
@@ -99,44 +101,40 @@ main(argc, argv)
rtp.type = RTP_PRIO_NORMAL;
rtp.prio = 0;
} else {
- usage(p);
+ usage();
break;
}
} else {
rtp.prio = atoi(argv[1]);
}
} else {
- usage(p);
+ usage();
break;
}
if (argv[2][0] == '-')
proc = -atoi(argv[2]);
- if (rtprio(RTP_SET, proc, &rtp) != 0) {
- perror(argv[0]);
- exit (1);
- }
+ if (rtprio(RTP_SET, proc, &rtp) != 0)
+ err(1, "%s", argv[0]);
if (proc == 0) {
execvp(argv[2], &argv[2]);
- perror(argv[0]);
- exit (1);
+ err(1, "%s", argv[0]);
}
}
exit (1);
}
static void
-usage(basename)
- char *basename;
+usage()
{
- (void) fprintf(stderr, "usage: %s\n", basename);
- (void) fprintf(stderr, "usage: %s [-]pid\n", basename);
- (void) fprintf(stderr, "usage: %s priority command [ args ] \n", basename);
- (void) fprintf(stderr, "usage: %s priority -pid \n", basename);
- (void) fprintf(stderr, "usage: %s -t command [ args ] \n", basename);
- (void) fprintf(stderr, "usage: %s -t -pid \n", basename);
-
- exit(-1);
+ (void) fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n",
+ "usage: [id|rt]prio",
+ " [id|rt]prio [-]pid",
+ " [id|rt]prio priority command [args]",
+ " [id|rt]prio priority -pid",
+ " [id|rt]prio -t command [args]",
+ " [id|rt]prio -t -pid");
+ exit(1);
}
OpenPOWER on IntegriCloud