Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 19 Nov 2014 19:44:50 +0100
From: Felix Janda <>
Subject: Re: More GNU semantics for getopt_long?

Rich Felker wrote:
> I'd like to resume working on getting this integrated, especially
> since one of the main Roadmap goals for 1.1.6 is solving the remaining
> issues Alpine Linux is matching musl for, of which getopt_long is one.

Thanks for coming back to this.

> > I also noticed that 66fcde4ae4a52ae3edb1cf237ce2c22d08d7a062 seems
> > to have broken getopt_long: Even if optstring does not begin with
> > ':', getopt_long will return ':' if a long option is not supplied
> > by its required argument.
> Is this still broken, and if so, could you provide a short testcase I
> could use for checking it and figuring out what's wrong?

Nothing has changed. Below is a testcase.


#include <stdio.h>
#include <getopt.h>

int main(void) {
	struct option opts[2] = {{"opt", 1, NULL, 'o'}, {0, 0, 0, 0}};
	int ret;

	ret = getopt_long(2, (char *[3]){"a", "--opt", 0}, "", opts, NULL);
	if (ret != '?') printf("'%d' != '%d'\n", ret, '?');

	return 0;

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.