version 1.20, 2004/09/14 23:53:07 |
version 1.21, 2004/10/10 03:59:04 |
|
|
*/ |
*/ |
|
|
#ifndef lint |
#ifndef lint |
static char copyright[] = |
static const char copyright[] = |
"@(#) Copyright (c) 1980, 1992, 1993\n\ |
"@(#) Copyright (c) 1980, 1992, 1993\n\ |
The Regents of the University of California. All rights reserved.\n"; |
The Regents of the University of California. All rights reserved.\n"; |
#endif /* not lint */ |
#endif /* not lint */ |
|
|
#ifndef lint |
#ifndef lint |
#if 0 |
#if 0 |
static char sccsid[] = "@(#)script.c 8.1 (Berkeley) 6/6/93"; |
static const char sccsid[] = "@(#)script.c 8.1 (Berkeley) 6/6/93"; |
#endif |
#endif |
static char rcsid[] = "$OpenBSD$"; |
static const char rcsid[] = "$OpenBSD$"; |
#endif /* not lint */ |
#endif /* not lint */ |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
|
int |
int |
main(int argc, char *argv[]) |
main(int argc, char *argv[]) |
{ |
{ |
|
extern char *__progname; |
struct sigaction sa; |
struct sigaction sa; |
struct termios rtt; |
struct termios rtt; |
struct winsize win; |
struct winsize win; |
|
|
aflg = 1; |
aflg = 1; |
break; |
break; |
default: |
default: |
(void)fprintf(stderr, "usage: script [-a] [file]\n"); |
fprintf(stderr, "usage: %s [-a] [file]\n", __progname); |
exit(1); |
exit(1); |
} |
} |
argc -= optind; |
argc -= optind; |
|
|
|
|
child = fork(); |
child = fork(); |
if (child < 0) { |
if (child < 0) { |
perror("fork"); |
warn("fork"); |
fail(); |
fail(); |
} |
} |
if (child == 0) { |
if (child == 0) { |
subchild = child = fork(); |
subchild = child = fork(); |
if (child < 0) { |
if (child < 0) { |
perror("fork"); |
warn("fork"); |
fail(); |
fail(); |
} |
} |
if (child) |
if (child) |
|
|
(void)fclose(fscript); |
(void)fclose(fscript); |
login_tty(slave); |
login_tty(slave); |
execl(shell, shell, "-i", (char *)NULL); |
execl(shell, shell, "-i", (char *)NULL); |
perror(shell); |
warn("%s", shell); |
fail(); |
fail(); |
} |
} |
|
|