Subject: Re: pcvt and TIOCCONS
To: Gordon W. Ross <gwr@mc.com>
From: Ty Sarna <tsarna@endicor.com>
List: current-users
Date: 04/19/1996 13:28:20
Gordon W. Ross wrote:
> 
> It looks a little hairy to me.  Maybe Ty would like to offer an
> outline of the tty_relatives() function he proposes.

I don't think it's hairy. Just set a couple more variables, switch to
glob matching instead of strcmp(), and match on the action field as
well.

Here's a outline based on your earlier one. I don't see that it's that
much more complex:

	Open filepath
	do {
		read line (and maybe continuations)
		if line glob-matches ttyname && line glob-matches action {
			fork; parent waits;
			child does {
				putenv("USER", username);
				putenv("GROUP", groupname);
				putenv("ACTION", action);
				putenv("TTY", ttyname);
				putenv("PATH", "/bin:/sbin:/usr/bin:/usr/sbin");
				/* anything else that should be in PATH? */
				system(command_line);
				exit(0);
			}
		}
	} while (not end of file)