]> git.ipfire.org Git - thirdparty/util-linux.git/blob - sys-utils/setsid.c
Imported from util-linux-2.9v tarball.
[thirdparty/util-linux.git] / sys-utils / setsid.c
1 /*
2 * setsid.c -- execute a command in a new session
3 * Rick Sladkey <jrs@world.std.com>
4 * In the public domain.
5 *
6 * 1999-02-22 Arkadiusz Mi¶kiewicz <misiek@misiek.eu.org>
7 * - added Native Language Support
8 *
9 */
10
11 #include <stdio.h>
12 #include <unistd.h>
13 #include <stdlib.h>
14 #include "nls.h"
15
16 int main(int argc, char *argv[])
17 {
18 setlocale(LC_ALL, "");
19 bindtextdomain(PACKAGE, LOCALEDIR);
20 textdomain(PACKAGE);
21
22 if (argc < 2) {
23 fprintf(stderr, _("usage: %s program [arg ...]\n"),
24 argv[0]);
25 exit(1);
26 }
27 if (setsid() < 0) {
28 perror("setsid");
29 exit(1);
30 }
31 execvp(argv[1], argv + 1);
32 perror("execvp");
33 exit(1);
34 }