getopt(3) returns -1, not EOF when out of args.
This commit is contained in:
parent
4881bd38e2
commit
cf67f3127e
@ -380,7 +380,7 @@ main(int argc, char *argv[])
|
||||
bzero(args, sizeof(args));
|
||||
|
||||
what = LO_NONE;
|
||||
while ((opt = getopt(argc, argv, "h")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, "h")) != -1) {
|
||||
switch (opt) {
|
||||
case 'h': case '?':
|
||||
help();
|
||||
|
@ -69,7 +69,7 @@ static void
|
||||
login(int argc, char *argv[], struct ncp_conn_loginfo *li) {
|
||||
int error = 0, connid, opt, setprimary = 0;
|
||||
|
||||
while ((opt = getopt(argc, argv, STDPARAM_OPT"D")) != EOF){
|
||||
while ((opt = getopt(argc, argv, STDPARAM_OPT"D")) != -1) {
|
||||
switch(opt){
|
||||
case STDPARAM_ARGS:
|
||||
if (ncp_li_arg(li, opt, optarg))
|
||||
|
@ -650,7 +650,7 @@ main(int ac, char* av[])
|
||||
char *prog;
|
||||
int logopt = LOG_NDELAY | LOG_PID;
|
||||
|
||||
while ((ch = getopt(ac, av, "df:sv")) != EOF) {
|
||||
while ((ch = getopt(ac, av, "df:sv")) != -1) {
|
||||
switch (ch) {
|
||||
case 'd':
|
||||
daemonize = 0;
|
||||
|
@ -36,7 +36,7 @@ proc_arg(int ac, char **av)
|
||||
|
||||
tmp_dir = getenv("TMPDIR") ? getenv("TMPDIR") : tmp_dir;
|
||||
|
||||
while ((ch = getopt(ac, av, "ans:")) != EOF) {
|
||||
while ((ch = getopt(ac, av, "ans:")) != -1) {
|
||||
switch (ch) {
|
||||
case 'a':
|
||||
slot_map = ~0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user