[DGD] #define peculiarity?

Kris Van Hees aedil at alchar.org
Sat Feb 28 17:34:41 CET 2004


The sscanf() has nothing to do with this.  Your define will expand in
code where it is used as object target for a call like this:

	"/k"+"/system/"+"userd"->somefunction(...)

Which is interpreted as a call to "userd"->somefunction(...), and the result
of that call needs to then be concatenated to "/k"+"/system/".  Your mudlib
is not able to resolve the string "userd" into an object, and thus kf_call_other
reports a bad arg 1 to call_other.

The better way to do this is to change the define to be:

	#define USERD	(KERNEL_DIR+SYSTEM_DIR+"userd")

	Kris

On Sat, Feb 28, 2004 at 11:02:57AM -0500, Michael McKiel wrote:
> I was wondering why something like:
> 
> # define KERNEL_DIR    "/k"
> # define SYSTEM_DIR    "/system/"
> /* AND */
> # define USERD         KERNEL_DIR+SYSTEM_DIR+"userd"
> 
> is legal for a sscanf:
>     sscanf(somepath, KERNEL_DIR+SYSTEM_DIR+"%*s")
> 
> but causes this (on telnet login attempts, after typing in a name):
> ------------------------------------------------------------------
> Feb 28 10:55:33 ** Bad argument 1 for kfun call_other
>   46 receive_message   /k/object/telnet (#23)
>  193 receive_message   /k/inherit/connection (/k/object/telnet#23)
>   66 login             /k/object/user (#24)
>   61 login             /k/inherit/user (/k/object/user#24)
> ------------------------------------------------------------------
> 
> Shouldn't the #define have gotten resolved into:
> USERD being -> "/k/system/userd"   ??
> 
> 
> 
> ______________________________________________________________________ 
> Post your free ad now! http://personals.yahoo.ca
> _________________________________________________________________
> List config page:  http://list.imaginary.com/mailman/listinfo/dgd

-- 
Never underestimate a Mage with:
 - the Intelligence to cast Magic Missile,
 - the Constitution to survive the first hit, and
 - the Dexterity to run fast enough to avoid being hit a second time.
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list