Deleted Added
full compact
jobs.c (66612) jobs.c (69793)
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 25 unchanged lines hidden (view full) ---

34 * SUCH DAMAGE.
35 */
36
37#ifndef lint
38#if 0
39static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95";
40#endif
41static const char rcsid[] =
1/*-
2 * Copyright (c) 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Kenneth Almquist.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 25 unchanged lines hidden (view full) ---

34 * SUCH DAMAGE.
35 */
36
37#ifndef lint
38#if 0
39static char sccsid[] = "@(#)jobs.c 8.5 (Berkeley) 5/4/95";
40#endif
41static const char rcsid[] =
42 "$FreeBSD: head/bin/sh/jobs.c 66612 2000-10-03 23:13:14Z brian $";
42 "$FreeBSD: head/bin/sh/jobs.c 69793 2000-12-09 09:35:55Z obrien $";
43#endif /* not lint */
44
45#include <fcntl.h>
46#include <signal.h>
47#include <errno.h>
48#include <unistd.h>
49#include <stdlib.h>
50#include <sys/param.h>
51#ifdef BSD
52#include <sys/wait.h>
53#include <sys/time.h>
54#include <sys/resource.h>
43#endif /* not lint */
44
45#include <fcntl.h>
46#include <signal.h>
47#include <errno.h>
48#include <unistd.h>
49#include <stdlib.h>
50#include <sys/param.h>
51#ifdef BSD
52#include <sys/wait.h>
53#include <sys/time.h>
54#include <sys/resource.h>
55#include <paths.h>
55#endif
56#include <sys/ioctl.h>
57
58#include "shell.h"
59#if JOBS
60#if OLD_TTY_DRIVER
61#include "sgtty.h"
62#else

--- 567 unchanged lines hidden (view full) ---

630 setsignal(SIGTSTP);
631 setsignal(SIGTTOU);
632 } else if (mode == FORK_BG) {
633 ignoresig(SIGINT);
634 ignoresig(SIGQUIT);
635 if ((jp == NULL || jp->nprocs == 0) &&
636 ! fd0_redirected_p ()) {
637 close(0);
56#endif
57#include <sys/ioctl.h>
58
59#include "shell.h"
60#if JOBS
61#if OLD_TTY_DRIVER
62#include "sgtty.h"
63#else

--- 567 unchanged lines hidden (view full) ---

631 setsignal(SIGTSTP);
632 setsignal(SIGTTOU);
633 } else if (mode == FORK_BG) {
634 ignoresig(SIGINT);
635 ignoresig(SIGQUIT);
636 if ((jp == NULL || jp->nprocs == 0) &&
637 ! fd0_redirected_p ()) {
638 close(0);
638 if (open("/dev/null", O_RDONLY) != 0)
639 error("Can't open /dev/null: %s",
640 strerror(errno));
639 if (open(_PATH_DEVNULL, O_RDONLY) != 0)
640 error("Can't open %s: %s",
641 _PATH_DEVNULL, strerror(errno));
641 }
642 }
643#else
644 if (mode == FORK_BG) {
645 ignoresig(SIGINT);
646 ignoresig(SIGQUIT);
647 if ((jp == NULL || jp->nprocs == 0) &&
648 ! fd0_redirected_p ()) {
649 close(0);
642 }
643 }
644#else
645 if (mode == FORK_BG) {
646 ignoresig(SIGINT);
647 ignoresig(SIGQUIT);
648 if ((jp == NULL || jp->nprocs == 0) &&
649 ! fd0_redirected_p ()) {
650 close(0);
650 if (open("/dev/null", O_RDONLY) != 0)
651 error("Can't open /dev/null: %s",
652 strerror(errno));
651 if (open(_PATH_DEVNULL, O_RDONLY) != 0)
652 error("Can't open %s: %s",
653 _PATH_DEVNULL, strerror(errno));
653 }
654 }
655#endif
656 if (wasroot && iflag) {
657 setsignal(SIGINT);
658 setsignal(SIGQUIT);
659 setsignal(SIGTERM);
660 }

--- 496 unchanged lines hidden ---
654 }
655 }
656#endif
657 if (wasroot && iflag) {
658 setsignal(SIGINT);
659 setsignal(SIGQUIT);
660 setsignal(SIGTERM);
661 }

--- 496 unchanged lines hidden ---