summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdlib/getopt.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdlib/getopt.c')
-rw-r--r--newlib/libc/stdlib/getopt.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/newlib/libc/stdlib/getopt.c b/newlib/libc/stdlib/getopt.c
index 2bea694e8..2a4e7d4a2 100644
--- a/newlib/libc/stdlib/getopt.c
+++ b/newlib/libc/stdlib/getopt.c
@@ -269,6 +269,10 @@ getopt_internal (int argc, char *const argv[], const char *shortopts,
break;
}
}
+ /* End of option list? */
+ if (argv[data->optind] == 0)
+ return EOF;
+
/* we've got an option, so parse it */
/* first, is it a long option? */