RE: [AD] 3.9.34 release date?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> Also, under unix shells, when you write something like "ls *", the
> metacharacter * get's expanded before being passed to the program, so if
> you do "ls *" in a big directory (over one thousand files), you will get
> one thousand entries for argv. It works with standard programs, but it
> would fail with Allegro programs if you limit it.

Here's a patch for wsystem.c that allocates the memory dynamically. The
command line's length is tested properly, and the array of argv pointers is
realloced whenever necessary (64 at a time). If any of the mallocs fails,
WinMain returns -1. I don't know whether this is the right thing to do; feel
free to change it if necessary.

Since I don't know Windows that well, I could messed up in some way. Does
realloc ensure that the data are preserved, for example? I know it does in
DJGPP libc. And are malloc, realloc and free declared in stdlib.h or
somewhere else?

Anyway, I hope the patch helps; but if it doesn't, I won't be upset :-)

Ben Davis

Attachment: wsystem.c.diff
Description: Binary data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/