csh prompt setting within a c-program

$Keith Blackwell kwb at hpmtlx.HP.COM
Sat Jan 28 08:30:51 AEST 1989


|	strcpy(ps1,"PS1=new prompt: ");
|	if (putenv(ps1))
|	  fprintf(stderr,"%s: Environment not set up correctly.\n",pgmname);
|	system(shell);
Csh doesn't use an environment variable for the prompt, so theoretically,
there's no way to do it.  Of course, you could always try to find a way
to use .cshrc --- but probably no luck there either for your application.

Actually, I tried doing the following from sh (to see if you could use
this command in your "system" call instead of just "csh -f" or whatever):
   (echo 'set prompt="new prompt: "' ; cat - ) | exec csh
Needless to say, it didn't work.  The prompt was set alright, but csh
didn't think it was interactive and didn't bother printing the prompt out!
Maybe someone knows a way to convince csh that it *is* interactive?
It would be a shame to have to use pseuto-tty's.
--
Keith Blackwell
NOTE: email to most posters doesn't work from here. Anyway, its interesting...



More information about the Comp.unix.questions mailing list