Module Name: src Committed By: mrg Date: Tue Dec 7 07:39:15 UTC 2010
Modified Files: src/usr.bin/pkill: pkill.1 pkill.c Log Message: add -l support to prenice, as noted by enami. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/usr.bin/pkill/pkill.1 cvs rdiff -u -r1.26 -r1.27 src/usr.bin/pkill/pkill.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/pkill/pkill.1 diff -u src/usr.bin/pkill/pkill.1:1.20 src/usr.bin/pkill/pkill.1:1.21 --- src/usr.bin/pkill/pkill.1:1.20 Mon Dec 6 08:34:28 2010 +++ src/usr.bin/pkill/pkill.1 Tue Dec 7 07:39:15 2010 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkill.1,v 1.20 2010/12/06 08:34:28 wiz Exp $ +.\" $NetBSD: pkill.1,v 1.21 2010/12/07 07:39:15 mrg Exp $ .\" .\" Copyright (c) 2002 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -57,6 +57,7 @@ .Op Fl u Ar euid .Op Ar pattern ... .Nm prenice +.Op Fl l .Op Ar priority .Op Ar pattern ... .Sh DESCRIPTION @@ -79,7 +80,9 @@ The following options are available for .Nm pkill and -.Nm pgrep : +.Nm pgrep , +and some are available for +.Nm prenice : .Bl -tag -width xxxxxxxx .It Fl d Ar delim Specify a delimiter to be printed between each process ID. Index: src/usr.bin/pkill/pkill.c diff -u src/usr.bin/pkill/pkill.c:1.26 src/usr.bin/pkill/pkill.c:1.27 --- src/usr.bin/pkill/pkill.c:1.26 Mon Dec 6 04:00:11 2010 +++ src/usr.bin/pkill/pkill.c Tue Dec 7 07:39:15 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: pkill.c,v 1.26 2010/12/06 04:00:11 mrg Exp $ */ +/* $NetBSD: pkill.c,v 1.27 2010/12/07 07:39:15 mrg Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: pkill.c,v 1.26 2010/12/06 04:00:11 mrg Exp $"); +__RCSID("$NetBSD: pkill.c,v 1.27 2010/12/07 07:39:15 mrg Exp $"); #endif /* !lint */ #include <sys/types.h> @@ -129,18 +129,7 @@ pgrep = 1; } else if (strcmp(getprogname(), "prenice") == 0) { prenice = 1; - if (argc < 2) - usage(); - action = reniceact; - p = argv[1]; - i = (int)strtol(p, &q, 10); - if (*q == '\0') { - nicenum = i; - argv++; - argc--; - } else - usage(); } else { action = killact; p = argv[1]; @@ -169,7 +158,30 @@ criteria = 0; - if (!prenice) { + if (prenice) { + if (argc < 2) + usage(); + + if (strcmp(argv[1], "-l") == 0) { + longfmt = 1; + argv++; + argc--; + } + + if (argc < 2) + usage(); + + action = reniceact; + p = argv[1]; + + i = (int)strtol(p, &q, 10); + if (*q == '\0') { + nicenum = i; + argv++; + argc--; + } else + usage(); + } else { while ((ch = getopt(argc, argv, "G:P:U:d:fg:ilns:t:u:vx")) != -1) switch (ch) { case 'G': @@ -228,10 +240,10 @@ usage(); /* NOTREACHED */ } + argc -= optind; + argv += optind; } - argc -= optind; - argv += optind; if (argc != 0) criteria = 1; if (!criteria) @@ -427,7 +439,7 @@ const char *ustr; if (prenice) - fprintf(stderr, "Usage: %s priority pattern ...\n", + fprintf(stderr, "Usage: %s [-l] priority pattern ...\n", getprogname()); else { if (pgrep)