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

From: Jörgen (di4sig@cse.hks.se)
Date: 05/13/96


> 
> 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))

I assume that you want to concaternate the [XX YY ZZ AA BB] Name Title into a
big string and then just page it. 

try this instead of line 996 -> 1000

996   sprintf(buf, "%s[%2d %2d %2d %2d %2d] %s %s\r\n", 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)); 

If you take a close look you will see that sprintf wants a pointer to a string
as the first argument. Your first argument is an integer => coredump.
 
// Zigg of Bluemage spock.cse.hks.se 4000



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