[fpc-devel] getopts patch for returned longind (for long options)

Bram Kuijvenhoven kuifwaremailinglists at xs4all.nl
Fri May 5 15:57:55 CEST 2006


Hi!

I found that getlongopts from the getopts unit does not work properly on Mac OS X / PowerPC. The Longind : Longint returned is not valid.

The problem is a cast to a pinteger of a pointer that is in fact a plongint, which seems to break on powerpc, and possibly on other platforms or architectures as well. The attached patch fixes this :)

Note that the getopts unit does not have mode OBJFPC set, nor ANSISTRINGS (well at least not in the unit's source). This limits the use of getopts to options of 255 bytes. getopts also resides in rtl/inc/, so this is no big surprise. Is it possible to move the unit to OBJFPC, such that it supports ansistrings?

Regards,

Bram
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: getopts_pinteger_to_plongint.patch
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20060505/94222b2a/attachment.ksh>


More information about the fpc-devel mailing list