Official patch for script: Please apply

The Beach Bum jfh at rpp386.Dallas.TX.US
Sat Oct 29 00:44:03 AEST 1988


There was a bug report of script prompting for the commands in a users
.profile or the system-wide /etc/profile.  This is caused by the shell
being executed as a login shell.

I have added an option to script.c to not execute the shell as a login
shell, and a flag to the Makefile to select this option.

- John.
--
*** Makefile.old
--- Makefile
**************
*** 4,9
  BINDIR=/usr/local/bin
  # Your favorite MAN directory ...
  MANDIR=/usr/man/man1
  
  all:	install
  
--- 4,11 -----
  BINDIR=/usr/local/bin
  # Your favorite MAN directory ...
  MANDIR=/usr/man/man1
+ # If your shell doesn't prompt for .profile commands while running script ...
+ # FLAGS=-DLOGIN_SHELL
  
  CFLAGS=-O $(FLAGS)
  
**************
*** 5,11
  # Your favorite MAN directory ...
  MANDIR=/usr/man/man1
  
! all:	install
  
  script:	script.c
  	cc -o script -s -O script.c
--- 7,13 -----
  # If your shell doesn't prompt for .profile commands while running script ...
  # FLAGS=-DLOGIN_SHELL
  
! CFLAGS=-O $(FLAGS)
  
  all:	install
  
**************
*** 7,12
  
  all:	install
  
  script:	script.c
  	cc -o script -s -O script.c
  
--- 9,16 -----
  
  CFLAGS=-O $(FLAGS)
  
+ all:	install
+ 
  script:	script.c
  	cc -o script -s $(CFLAGS) script.c
  
**************
*** 8,14
  all:	install
  
  script:	script.c
! 	cc -o script -s -O script.c
  
  install: script.1 script
  	cp script.1 $(MANDIR)
--- 12,18 -----
  all:	install
  
  script:	script.c
! 	cc -o script -s $(CFLAGS) script.c
  
  install: script.1 script
  	cp script.1 $(MANDIR)
*** script.c.old
--- script.c
**************
*** 192,198
  	close (2);
  	dup (1);
  
! 	execl (shell, "-h", "-i", (char *) 0);
  	perror ("can't exec shell");
  	_exit (127);
  }
--- 192,202 -----
  	close (2);
  	dup (1);
  
! #ifdef	LOGIN_SHELL
! 	execl (shell, "-sh", "-i", (char *) 0);
! #else
! 	execl (shell, "sh", "-i", (char *) 0);
! #endif
  	perror ("can't exec shell");
  	_exit (127);
  }
-- 
John F. Haugh II                        +----Make believe quote of the week----
VoiceNet: (214) 250-3311   Data: -6272  | Nancy Reagan on Richard Stallman:
InterNet: jfh at rpp386.Dallas.TX.US       |          "Just say `Gno'"
UucpNet : <backbone>!killer!rpp386!jfh  +--------------------------------------



More information about the Comp.sources.bugs mailing list