pidof: Fix separator option

Short separator option used 's' instead of 'S' which
meant it pidof would use the single-shot option when you
meant separator.

Added alias for -S using -d to give some sysvinit pidof
compatibility.

References:
    commit 73492b182d
    procps-ng/procps#141
This commit is contained in:
Craig Small
2019-09-21 16:17:05 +10:00
parent bdce977a4e
commit c660dbae1b
2 changed files with 6 additions and 3 deletions

View File

@ -289,13 +289,13 @@ int main (int argc, char **argv)
int first_pid = 1;
const char *separator = " ";
const char *opts = "scnxmo:S:?Vh";
const char *opts = "scdnxmo:S:?Vh";
static const struct option longopts[] = {
{"check-root", no_argument, NULL, 'c'},
{"single-shot", no_argument, NULL, 's'},
{"omit-pid", required_argument, NULL, 'o'},
{"separator", required_argument, NULL, 's'},
{"separator", required_argument, NULL, 'S'},
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, 'V'},
{NULL, 0, NULL, 0}
@ -328,6 +328,7 @@ int main (int argc, char **argv)
pidof_root = pid_link(getpid(), "root");
}
break;
case 'd': /* sysv pidof uses this for S */
case 'S':
separator = optarg;
break;