view toys/other/setsid.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 144d5ba7d410
line wrap: on
line source

/* setsid.c - Run program in a new session ID.
 * Copyright 2006 Rob Landley <>


config SETSID
  bool "setsid"
  default y
    usage: setsid [-t] command [args...]

    Run process in a new session.

    -t	Grab tty (become foreground process, receiving keyboard signals)

#include "toys.h"

void setsid_main(void)
  while (setsid()<0) if (vfork()) _exit(0);
  if (toys.optflags) {
    tcsetpgrp(0, getpid());