[DGD] #define peculiarity?

Michael McKiel crashnbrn71 at yahoo.ca
Sat Feb 28 17:35:32 CET 2004


 --- "Felix A. Croes" <felix at dworkin.nl> wrote: 
> Michael McKiel <crashnbrn71 at yahoo.ca> 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
> 
> I don't see how a sscanf can cause "Bad argument 1 for kfun call_other"
> either.  Doing your own debugging is another of the responsibilities
> you assume on writing  or modifying a kernel lib. :)

Perhaps I wasn't clear. So far all I've changed are to insert #defines where
sscanf's were originally used to check string path's for whether it was
'kernel' or '/lib' etc.

The point is: THAT #define causes a Bad argument 1 for kfun call_other
If I change it back to: #define USERD "/k/system/userd"
Then all is fine and well, I can login, no problem -- 
so the body of the define with '+' in them aren't being resolved at the point
the define is created, is what it would seem. Otherwise, changing 
USERD to KERNEL_DIR+SYSTEM_DIR+"userd" shouldn't cause an 

As well I *have* tested this on an unmodified Kernel Lib. 
In /include/kernel/user.h -->
#define KERNEL_DIR "/kernel"
#define USERD KERNEL_DIR+"/sys/userd"
which causes the exact same Bad argument error :P

Thus my question was, why is this the case, or is there a way to concatenate
a string in a #define, I seem to recall some trick done for a #define'd exit
wrapper in C, but I don't recall how to do so, nor if it would even work in
LPC.

Thanks.


______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list