[gnu.emacs.help] emacs under ksh job control

mb@ttidca.TTI.COM (Michael Bloom) (12/25/90)

In article <1473@beaudin.UUCP> john@beaudin.UUCP (John Beaudin) writes:
	I've been using emacs for several months. It works as advertized
	for my purposes.

	Recently, I started using the korn shell (ksh) full-time.
	My previous shell didn't have job control.
	I decided to re-compile emacs with job control defined.

	However, when in emacs, when I type ^z, I get my ksh prompt and the 
	shell
	acts normal, but when I 'fg' I get stuck in some kind of twilight zone

Your problem may be similar to (or the same as) one experienced in gdb
by one of the people using my "stabs-in-coff" stuff on an SCO system.
Certainly your symptoms sound similar.

SCO uses the POSIX definitions of some of the facilities used for job control,
rather than the BSD definitions.  

The particular calls of interest are the bsd routines setpgrp() and
getpgrp(). SCO's setpgrp() is a superset of the System V routine of
the same name, and is probably implemented using the same (or nearly
the same) code as the POSIX setsid() routine.

Fortunately, posix does define a routine with the semantics you need. It's
called setpgid(), and behaves like the bsd setpgrp(). Similarly, the posix
routine getpgid() routine behaves like the bsd getpgrp().

I suspect that the fix for the problem you are having on SCO (and probably 
any other POSIX system) is to add this to your config file:

/* use setpgid(int pid, int pgrp), not setpgrp(void) on POSIX systems. */
#define setpgrp setpgid
#define getpgrp getpgid