[comp.windows.x] Fix for a bug in xstring.

andre@rodan.caltech.edu (Andre Burgoyne) (02/01/89)

I found a bug in xstring.c in contrib/clients/xstring for R3.
I don't know if this fix has been posted already, so here it is.
It also fixes the Imakefile to compile under R3.

---cut here---
*** O.xstring.c	Wed Jul 13 16:32:09 1988
--- xstring.c	Tue Jan 31 21:57:02 1989
***************
*** 51,56
  	for(len = 0, i = 1, cp = &argv[1]; i < argc; i++, cp++)
  		len += strlen(*cp) + 1;
  	string = XtMalloc(len + 1);
  	for(i = 1, cp = &argv[1]; i < argc; i++, cp++) {
  		(void) strcat(string, *cp);
  		(void) strcat(string, " ");

--- 51,57 -----
  	for(len = 0, i = 1, cp = &argv[1]; i < argc; i++, cp++)
  		len += strlen(*cp) + 1;
  	string = XtMalloc(len + 1);
+ 	*string = '\0';
  	for(i = 1, cp = &argv[1]; i < argc; i++, cp++) {
  		(void) strcat(string, *cp);
  		(void) strcat(string, " ");
*** O.Imakefile	Sat Apr 23 05:14:30 1988
--- Imakefile	Tue Nov  1 06:28:30 1988
***************
*** 1,3
! LOCAL_LIBRARIES = $(XAWLIB) $(XTOOLLIB) $(XLIB)
  
  SimpleProgramTarget(xstring)

--- 1,3 -----
! LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
  
  SimpleProgramTarget(xstring)
---cut here---

Andre' "nine clubs with someone else" Burgoyne
andre@csvax.caltech.edu