Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 May 1997 00:41:51 +0700
From:      "Artem Koutchine" <matrix@norilsk.ru>
To:        <questions@freebsd.org>
Subject:   Custom Shell question
Message-ID:  <199705100747.AAA06111@omni.norilsk.ru>

next in thread | raw e-mail | index | archive | help
Hello!

	I am writing a menu shell for my users (we
a little provider and want to simplify life for our users and
at the same time take full control of them). Here is a sample
code (just a skeleton from the memory):

void main (int argc, char **argv, char **evp)
{
	/* are we running as a login shell ??? */
	if (*argv[0] != '-')
	{
		/* code for usual calls.. just passed to csh */
		execve("/bin/csh",argv,evp);
		die("Can't call csh");
	}
	else
	{
		/* init code.. prints menu does init stuff*/
		i=domenu();
		switch(i)
		{
			case 1:
				startppp();
			case 2:
				/* user chose to enter shell*/
				i=execve("/bin/csh",argv,vpe);
				if (i==-1) die ("cannot execute shell");
			case 3:
				changepass();
			default:
				dir("menu error");
		}
	}
}

It work find for almost everything. The only thing ,so far, which
does not work is the following line in .login

tset -Q ?$TERM

when i use CSH as a shell it just asks for the terminal and then
does the termcap initialization and stuff, but with my shell it
print all of those init command on the screen. For everything
else it works just fine. Programs have no clue that it is not
a csh. As i undertsand
they must be printed into the stderror (that's why i don't see
them with csh), but somehow with my shell stderr is redirected
to stdout. On the other hand i could be wrong.

Please, if you have any thoughts, share them with me!

Regards,
Artem Koutchine
matrix@norilsk.ru



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705100747.AAA06111>