aboutsummaryrefslogtreecommitdiff
path: root/.repos/tabbed/xembed.c
diff options
context:
space:
mode:
Diffstat (limited to '.repos/tabbed/xembed.c')
-rw-r--r--.repos/tabbed/xembed.c45
1 files changed, 0 insertions, 45 deletions
diff --git a/.repos/tabbed/xembed.c b/.repos/tabbed/xembed.c
deleted file mode 100644
index cbb0e97..0000000
--- a/.repos/tabbed/xembed.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * See LICENSE file for copyright and license details.
- */
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-int
-main(int argc, char *argv[])
-{
- char *xembed;
- int tty;
- pid_t pgrp, tcpgrp;
-
- if (argc < 3) {
- fprintf(stderr, "usage: %s flag cmd ...\n", argv[0]);
- return 2;
- }
-
- if (!(xembed = getenv("XEMBED")))
- goto noembed;
-
- if ((tty = open("/dev/tty", O_RDONLY)) < 0)
- goto noembed;
-
- pgrp = getpgrp();
- tcpgrp = tcgetpgrp(tty);
-
- close(tty);
-
- if (pgrp == tcpgrp) { /* in foreground of tty */
- argv[0] = argv[2];
- argv[2] = xembed;
- } else {
-noembed:
- argv += 2;
- }
-
- execvp(argv[0], argv);
-
- perror(argv[0]); /* failed to execute */
- return 1;
-}