Create doshell() that will be needed by --interactive. --- term-utils/script.c | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/term-utils/script.c b/term-utils/script.c index 02ba596..14a44e1 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -90,6 +90,7 @@ void getmaster(void); void getslave(void); void doinput(void); void dooutput(void); +void doexec(void); void doshell(void); char *shell; @@ -508,9 +509,32 @@ dooutput(void) { } void -doshell(void) { +doexec(void) { char *shname; + shname = strrchr(shell, '/'); + if (shname) + shname++; + else + shname = shell; + + if (access(shell, X_OK) == 0) { + if (cflg) + execl(shell, shname, "-c", cflg, NULL); + else + execl(shell, shname, "-i", NULL); + } else { + if (cflg) + execlp(shname, "-c", cflg, NULL); + else + execlp(shname, "-i", NULL); + } + warn(_("failed to execute %s"), shell); + fail(); +} + +void +doshell(void) { getslave(); /* close things irrelevant for this process */ @@ -528,12 +552,6 @@ doshell(void) { master = -1; - shname = strrchr(shell, '/'); - if (shname) - shname++; - else - shname = shell; - /* * When invoked from within /etc/csh.login, script spawns a csh shell * that spawns programs that cannot be killed with a SIGTERM. This is @@ -544,19 +562,7 @@ doshell(void) { */ signal(SIGTERM, SIG_DFL); - if (access(shell, X_OK) == 0) { - if (cflg) - execl(shell, shname, "-c", cflg, NULL); - else - execl(shell, shname, "-i", NULL); - } else { - if (cflg) - execlp(shname, "-c", cflg, NULL); - else - execlp(shname, "-i", NULL); - } - warn(_("failed to execute %s"), shell); - fail(); + doexec(); } void -- 2.2.2 -- Best Regards / S pozdravem, Stanislav Brabec software developer --------------------------------------------------------------------- SUSE LINUX, s. r. o. e-mail: sbrabec@xxxxxxx Lihovarská 1060/12 tel: +49 911 7405384547 190 00 Praha 9 fax: +420 284 084 001 Czech Republic http://www.suse.cz/ PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html