The attached patch corrects some minor bugs and a major one in function bin_getopts() in builtin.c. The minor bugs are: - optbuf is unitialized, but optbuf[1] is checked for ':'. - The check for required arguments is incorrect. - If an optional argument is missing, OPTARG keeps the old value instead of being reset to empty. The major bug, which didn't exist in zsh-3.1.2: If an an empty string is used as an optional argument, getopts returns 1, leaving all remaining options unprocessed. I'm also not sure about the statement starting in line 2537: if (zoptind < 1) ... Actually zoptind is NEVER set to 0 in the sources. I left it, though, because the user might set OPTIND=0 deliberately, although I'm in doubt whether that should be considered legal. Regards, Bernd -- Bernd Eggink Regionales Rechenzentrum der Universitaet Hamburg eggink@rrz.uni-hamburg.de http://www.rrz.uni-hamburg.de/eggink/BEggink.html