Re: Segfault with structs and CSTR

2005-11-03 Thread Joshua Isom
I'm on FreeBSD 5.4 so aside from the char array, the rest was correct, which I guess means it's not at all portable. It's working now, now I just need to expand on it. On Nov 3, 2005, at 9:01 AM, Leopold Toetsch wrote: Joshua Isom wrote: I'm trying to use libc to be able to do a directory l

Re: Segfault with structs and CSTR

2005-11-03 Thread Leopold Toetsch
Joshua Isom wrote: I'm trying to use libc to be able to do a directory listing, ... Another tricky part is detecting the NULL pointer after the end, achievable with the get_addr opcode. Here is a directory lister: leo .sub _main @MAIN .local pmc libc .local pmc opendir .loc

Re: Segfault with structs and CSTR

2005-11-03 Thread Leopold Toetsch
Joshua Isom wrote: I'm trying to use libc to be able to do a directory listing, and and if I used the DATATYPE_CSTR I get a segfault, and if I use DATATYPE_STRING, It's neither nor. A DATATYPE_CSTR would be a pointer to a cstring. But when you look at the definition of struct dirent, you see

Re: Segfault with structs and CSTR

2005-11-03 Thread Roger Browne
Joshua Isom wrote: > I'm trying to use libc to be able to do a directory listing, and and if > I used the DATATYPE_CSTR I get a segfault, and if I use > DATATYPE_STRING, I get a "returning unhandled string type in struct" I tried this a while back, and got it working (as a kind of "proof-of-conc

Segfault with structs and CSTR

2005-11-02 Thread Joshua Isom
I'm trying to use libc to be able to do a directory listing, and and if I used the DATATYPE_CSTR I get a segfault, and if I use DATATYPE_STRING, I get a "returning unhandled string type in struct". I don't know if I'm doing the calls wrong or what since the documentation is vague in places. p