Removed typos from pidof manual page and killall5 page.

Closes Debian bugs #815839, #905245 and #890478

Added -f <format> option to pidof program to allow printf
style formating.
Closes Debian bug #571590
Thanks to Philipp Marek for the patch.
This commit is contained in:
Jesse Smith 2018-11-10 21:27:11 -04:00
parent 2ece2c0364
commit aa6873b85b
4 changed files with 37 additions and 17 deletions

View File

@ -42,7 +42,12 @@ sysvinit (2.92) unreleased; urgency=low
Closes Debian bug #402847.
* Updated src/Makefile to make sure we build all the software before
attempting to install.
* Removed typos from pidof manual page and killall5 page.
Closes Debian bugs #815839, #905245 and #890478
* Added -f <format> option to pidof program to allow printf
style formating.
Closes Debian bug #571590
Thanks to Philipp Marek for the patch.
sysvinit (2.91) world; urgency=low

View File

@ -22,9 +22,9 @@ killall5 -- send a signal to all processes.
.B killall5
.RB -signalnumber
.RB [ \-o
.IR omitpid[,omitpid..]]
.IR omitpid[,omitpid...]]
.RB [ \-o
.IR omitpid[,omitpid..].. ]
.IR omitpid[,omitpid...]... ]
.SH DESCRIPTION
.B killall5
is the SystemV killall command. It sends a signal to all processes except

View File

@ -25,11 +25,13 @@ pidof -- find the process ID of a running program.
.RB [ \-n ]
.RB [ \-x ]
.RB [ \-o
.IR omitpid[,omitpid..] ]
.IR omitpid[,omitpid...] ]
.RB [ \-o
.IR omitpid[,omitpid..].. ]
.IR omitpid[,omitpid...]... ]
.RB [ \-f
.IR format ]
.B program
.RB [ program.. ]
.RB [ program... ]
.SH DESCRIPTION
.B Pidof
finds the process id's (PIDs) of the named programs. It prints those
@ -53,7 +55,7 @@ Avoid
system function call on all binaries which are located on network
based file systems like
.BR NFS .
Instead of using this option the the variable
Instead of using this option the variable
.B PIDOF_NETFS
may be set and exported.
.IP \-q
@ -66,6 +68,9 @@ shells running the named scripts.
Tells \fIpidof\fP to omit processes with that process id. The special
pid \fB%PPID\fP can be used to name the parent process of the \fIpidof\fP
program, in other words the calling shell or shell script.
.IP "-f \fIformat\fP"
Tells \fIpidof\fP to format the process ids in the given \fIprintf\fP style.
For example \fB" -p%d"\fP is useful for \fIstrace\fP.
.SH "EXIT STATUS"
.TP
.B 0
@ -80,7 +85,7 @@ the program behaves according to the name under which it is called.
When \fIpidof\fP is invoked with a full pathname to the program it
should find the pid of, it is reasonably safe. Otherwise it is possible
that it returns PIDs of running programs that happen to have the same name
as the program you're after but are actually other programs. Note that
as the program you're after but are actually other programs. Note
that the executable name of running processes is calculated with
.BR readlink (2),
so symbolic links to executables will also match.

View File

@ -945,13 +945,14 @@ void usage(void)
void pidof_usage(void)
{
printf("pidof usage: [options] <program-name>\n\n");
printf(" -c Return PIDs with the same root directory\n");
printf(" -h Display this help text\n");
printf(" -n Avoid using stat system function on network shares\n");
printf(" -o <pid> Omit results with a given PID\n");
printf(" -q Quiet mode. Do not display output\n");
printf(" -s Only return one PID\n");
printf(" -x Return PIDs of shells running scritps with a matchign name\n");
printf(" -c Return PIDs with the same root directory\n");
printf(" -h Display this help text\n");
printf(" -f <format> Display PIDs in a given printf-style format\n");
printf(" -n Avoid using stat system function on network shares\n");
printf(" -o <pid> Omit results with a given PID\n");
printf(" -q Quiet mode. Do not display output\n");
printf(" -s Only return one PID\n");
printf(" -x Return PIDs of shells running scritps with a matchign name\n");
printf("\n");
}
@ -996,6 +997,7 @@ int main_pidof(int argc, char **argv)
int chroot_check = 0;
struct stat st;
char tmp[512];
char *format = NULL;
omit = (OMIT*)0;
nlist = (NFS*)0;
@ -1004,7 +1006,7 @@ int main_pidof(int argc, char **argv)
if ((token = getenv("PIDOF_NETFS")) && (strcmp(token,"no") != 0))
flags |= PIDOF_NETFS;
while ((opt = getopt(argc,argv,"qhco:sxn")) != EOF) switch (opt) {
while ((opt = getopt(argc,argv,"qhcof:sxn")) != EOF) switch (opt) {
case '?':
nsyslog(LOG_ERR,"invalid options on command line!\n");
closelog();
@ -1015,6 +1017,9 @@ int main_pidof(int argc, char **argv)
case 'h':
pidof_usage();
exit(0);
case 'f':
format = optarg;
break;
case 'o':
here = optarg;
while ((token = strsep(&here, ",;:"))) {
@ -1111,9 +1116,14 @@ int main_pidof(int argc, char **argv)
}
if ( ~flags & PIDOF_QUIET ) {
if (!first)
if (format)
printf(format, p->pid);
else
{
if (! first)
printf(" ");
printf("%d", p->pid);
}
}
first = 0;
}