Re: NEWBIE: new crashes, have info...

From: Trey T. Morita (tmorita@texas.net)
Date: 05/13/96


On Mon, 13 May 1996 zero@baker.cnw.com wrote:

> I got a couple errors i did not recognize when it compiled but they were 
> only warnings so i ignored them:
> 
> act.informative.c: In function `do_who':
> act.informative.c:1000: warning: format argument is not a pointer (arg 3)
> act.informative.c:1000: warning: int format, pointer arg (arg 8)
> act.informative.c:1000: warning: too few arguments for format
> 
> the code near those lines is as follows:
> 
> 994 } else {
> 995   num_can_see++;
> 996   sprintf(buf, "%s[%2d %2d %2d %2d %2d] %s %s",
> 997         GET_LEVELX(tch, CLASS_MAGIC_USER), GET_LEVELX(tch, CLASS_CLERIC),
> 998         GET_LEVELX(tch, CLASS_THIEF), GET_LEVELX(tch, CLASS_WARRIOR),
> 999         GET_LEVELX(tch, CLASS_BARD), GET_NAME(tch), 
> 1000        GET_TITLE(tch));   
> 1001  
> 1002  if (GET_INVIS_LEV(tch))
> 
Count the number of %'s - 8. Count the number of values you send - 7.
I suspect that you inadvertedly(sp?) removed the original 3rd argument to 
the sprintf call, buf. So it should look like this :

                     /-------------------------------\
                     v                               v (add buf here)
996   sprintf(buf, "%s[%2d %2d %2d %2d %2d] %s %s", buf,
997           GET_LEVELX(tch, CLASS_MAGIC_USER), GET_LEVELX(tch, CLASS_CLERIC),
998           GET_LEVELX(tch, CLASS_THIEF), GET_LEVELX(tch, CLASS_WARRIOR),
999           GET_LEVELX(tch, CLASS_BARD), GET_NAME(tch),
1000          GET_TITLE(tch));

"only warnings" can be pretty important . . .

Trey



This archive was generated by hypermail 2b30 : 12/18/00 PST