Peter Eisentraut <[EMAIL PROTECTED]> writes:
> How about copying the entire argv[] array to a new location before the
> very first call to getopt().  Then you can use getopt() without hackery
> and can do anything you want to the "real" argv area.  That should be a
> lot safer.  (We don't know yet what other platforms might play
> optimization tricks in getopt().)

Well, mumble --- strictly speaking, there is *NO* way to use getopt
over multiple cycles "without hackery".  The standard for getopt
(http://www.opengroup.org/onlinepubs/7908799/xsh/getopt.html)
doesn't say you're allowed to scribble on optind in the first place.
But you're probably right that having a read-only copy of the argv
vector will make things safer.  Will do it that way.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to