summaryrefslogtreecommitdiff
path: root/src/misc/getopt.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-12-20 19:44:37 -0500
committerRich Felker <dalias@aerifal.cx>2014-12-20 19:44:37 -0500
commit91184c4f16b143107fa9935edebe5d2b20bd70d8 (patch)
tree6f74e3f852498ae639bcc6250e53620f062ad5e4 /src/misc/getopt.c
parentd3357268791f5279b64665a9a5b5629c962c8a15 (diff)
downloadmusl-91184c4f16b143107fa9935edebe5d2b20bd70d8.tar.gz
add error message printing to getopt_long and make related improvements
some related changes are also made to getopt, and the return value of getopt_long in the case of missing arguments is fixed.
Diffstat (limited to 'src/misc/getopt.c')
-rw-r--r--src/misc/getopt.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/misc/getopt.c b/src/misc/getopt.c
index 9db5eaac..92179830 100644
--- a/src/misc/getopt.c
+++ b/src/misc/getopt.c
@@ -12,7 +12,7 @@ int optind=1, opterr=1, optopt, __optpos, __optreset=0;
#define optpos __optpos
weak_alias(__optreset, optreset);
-void __getopt_msg(const char *a, const char *b, const char *c, int l)
+void __getopt_msg(const char *a, const char *b, const char *c, size_t l)
{
FILE *f = stderr;
b = __lctrans_cur(b);
@@ -80,7 +80,7 @@ int getopt(int argc, char * const argv[], const char *optstring)
if (d != c) {
if (optstring[0] != ':' && opterr)
- __getopt_msg(argv[0], ": illegal option: ", optchar, k);
+ __getopt_msg(argv[0], ": unrecognized option: ", optchar, k);
return '?';
}
if (optstring[i] == ':') {