# New Ticket Created by Steve Clark # Please include the string: [perl #23832] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=23832 >
Attached is a patch to tidyup a couple of things in longopt.c - there were a couple of instances of a hard-coded buffer length being used rather than sizeof(...) - a couple of line-wraps have been split onto two lines. Steve -- attachment 1 ------------------------------------------------------ url: http://rt.perl.org/rt2/attach/64654/47362/6ec271/longopt.patch
Index: longopt.c =================================================================== RCS file: /cvs/public/parrot/longopt.c,v retrieving revision 1.6 diff -u -r1.6 longopt.c --- longopt.c 21 Jul 2003 18:00:24 -0000 1.6 +++ longopt.c 17 Sep 2003 15:00:18 -0000 @@ -96,7 +96,8 @@ * not expecting one, it is just ignored. Bad. */ if (argv[dex][optlen] == '=') { - if (dptr->opt_flags & (OPTION_required_FLAG | OPTION_optional_FLAG)) { + if (dptr->opt_flags & + (OPTION_required_FLAG | OPTION_optional_FLAG)) { info_buf->opt_arg = &argv[dex][optlen+1]; } else { @@ -124,7 +125,8 @@ } } else if (dptr->opt_flags & OPTION_optional_FLAG) { - if (dex+1 < argc && argv[dex+1][0] && argv[dex+1][0] != '-') { + if (dex+1 < argc && argv[dex+1][0] && + argv[dex+1][0] != '-') { info_buf->opt_arg = argv[dex+1]; ++info_buf->opt_index; } @@ -138,7 +140,8 @@ /* Couldn't find it. */ info_buf->opt_id = -1; - Parrot_snprintf(interp, longopt_error_buffer, 512, + Parrot_snprintf(interp, longopt_error_buffer, + sizeof(longopt_error_buffer), "Option %s not known", argv[dex]); info_buf->opt_error = longopt_error_buffer; return -1; @@ -194,7 +197,8 @@ if (*(pos + 1)) { info_buf->opt_arg = pos + 1; } - else if (dex+2 < argc && argv[dex+1][0] && argv[dex+1][0] != '-') { + else if (dex+2 < argc && argv[dex+1][0] && + argv[dex+1][0] != '-') { info_buf->opt_arg = argv[dex+1]; ++info_buf->opt_index; } @@ -217,7 +221,8 @@ /* Couldn't find it in the table */ info_buf->opt_id = -1; - Parrot_snprintf(interp, longopt_error_buffer, 512, + Parrot_snprintf(interp, longopt_error_buffer, + sizeof(longopt_error_buffer), "Option -%c not known", *pos); info_buf->opt_error = longopt_error_buffer; return -1;