view toys/lsb/pidof.c @ 694:786841fdb1e0

Reindent to two spaces per level. Remove vi: directives that haven't worked right in years (ubuntu broke its' vim implementation). Remove trailing spaces. Add/remove blank lines. Re-wordwrap in places. Update documentation with new coding style. The actual code should be the same afterward, this is just cosmetic refactoring.
author Rob Landley <>
date Tue, 13 Nov 2012 17:14:08 -0600
parents 6df4ccc0acbe
children 43e6ec52aa29
line wrap: on
line source

/* pidof.c - Print the Process IDs of all processes with the given names.
 * Copyright 2012 Andreas Heck <>


config PIDOF
  bool "pidof"
  default y
    usage: pidof [NAME]...

    Print the PIDs of all processes with the given names.

#include "toys.h"

static void print_pid(pid_t pid)
  xprintf("%s%ld", toys.exitval ? "" : " ", (long)pid);
  toys.exitval = 0;

void pidof_main(void)
  toys.exitval = 1;
  for_each_pid_with_name_in(toys.optargs, print_pid);
  if (!toys.exitval) xputc('\n');