On Mon, May 27, 2013 at 05:43:13AM +0700, Erich Dollansky wrote: > ... > > piewm's twm.c declares main as: > > > > int > > main(int argc, char **argv, char **environ) > > { > > I use this concept since decades but with different names. Could it be > a problem of overlapping names? > ...
It was pointed out to me that -- other than assigning "Environ = environ" -- the code in piewm's twm.c didn't actually use the values of environ or Environ. [Thanks, Stefan!] Elsewhere, there is a putenv() implementation for environments that lack it, and the code uses getenv(), as well. Doing a few more comparisons with twm.c from tvtwm and from twm itself; I have a few more observations: * tvtwm's twm.c is more recent than that of piewm: - * $XConsortium: twm.c,v 1.124 91/05/08 11:01:54 dave Exp $ + * $XConsortium: twm.c,v 1.111 90/03/23 13:23:34 jim Exp $ * twm's twm.c has a copyright block dated 2005 from Hitachi, Ltd. * Merely inserting the "#include <stdlib.h>" in piewm's twm.c appears to be a minimal effective change: Once that's done, the SIGSEGV goes away. * Neither tvtwm's nor twm's twm.c has the "#include <stdlib.h>" (and neither gets a SIGSEGV). * As Stefan pointed out, I was able to completely remove the references to both "environ" and "Environ" from piewm's twm.c; the result builds and runs without problem. * tvtwm's twm.c has these environ and Environ variables (and, as above, lacks the "#include <stdlib.h>" and doesn't get the SIGSEGV). * twm's twm.c lacks the environ and Environ variables (and main() is defined as a function that takes but 2 arguments). I suspect that I'm failing to understand at least part of what's causing the actual problem in piewm. Peace, david -- David H. Wolfskill da...@catwhisker.org Taliban: Evil men with guns afraid of truth from a 14-year old girl. See http://www.catwhisker.org/~david/publickey.gpg for my public key.
pgpL72zaFfMln.pgp
Description: PGP signature