fix for Bourne shell export or readonly without arguments

David Trueman david at utzoo.UUCP
Tue Apr 17 08:44:27 AEST 1984


In System 5 manual page for the shell (sh(1)), the BUGS section
mentions that readonly without arguments produces the same output
as export without arguments.  I'm not sure why no one fixed this
before (the bug is also in V7 and 4.1bsd), because the fix is
quite simple. 

In the file name.c , in the function "printflg", change:

	IF n->namflg&N_EXPORT
	THEN	prs(export); blank();
	FI
	IF n->namflg&N_RDONLY
	THEN	prs(readonly); blank();
	FI
	IF n->namflg&(N_EXPORT|N_RDONLY)
	THEN	prs(n->namid); newline();
	FI

to:

	/* exitval is set in xec.c to N_EXPORT or N_RDONLY */
	IF exitval&n->namflg&N_EXPORT
	THEN	prs(export); blank();
	FI
	IF exitval&n->namflg&N_RDONLY
	THEN	prs(readonly); blank();
	FI
	IF n->namflg&exitval
	THEN	prs(n->namid); newline();
	FI

With these changes, readonly lists only those variables that *are*
readonly and likewise for export.
-- 
				David Trueman @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!david



More information about the Net.bugs.v7 mailing list