:
:> no control terminal == no signals == no ^C'ing hung programs during
:> startup (for example, when you need to boot a machine without a working
:> network and sendmail and other programs stop the boot sequence in its
:> tracks trying to do DNS lookups).
:>
:> -Matt
:> Matthew Dillon
:> <[EMAIL PROTECTED]>
:>
:Hmm, good point. So I still need to find a way to start up rc5des, it seems
:that rc5des installs a SIGHUP handler and therefore nohup is useless. I wish
:there were a noctty...
:
:-lq
Your wish is my command ... I needed the same thing for BEST for many
things. I call the program 'notty'. Included below.
-Matt
Matthew Dillon
<[EMAIL PROTECTED]>
/*
* NOTTY.C
*
* NOTTY [-012] <command>
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/wait.h>
main(ac, av)
char *av[];
{
char *opts = "";
int ttyfd;
if (av[1]) {
if (av[1][0] == '-') {
opts = av[1];
++av;
}
}
ttyfd = open("/dev/null", O_RDWR);
if (strchr(opts, '0') == NULL && ttyfd != 0)
dup2(ttyfd, 0);
if (strchr(opts, '1') == NULL && ttyfd != 1)
dup2(ttyfd, 1);
if (strchr(opts, '2') == NULL && ttyfd != 2)
dup2(ttyfd, 2);
if (ttyfd > 2)
close(ttyfd);
{
int fd = open("/dev/tty", O_RDWR);
if (fd >= 0) {
ioctl(fd, TIOCNOTTY, 0);
close(fd);
}
}
/* signal(SIGCHLD, SIG_IGN); */
if (fork() == 0) {
setpgrp();
exit(execvp(av[1], av + 1));
}
exit(0);
}
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message