From df85cc01656c2a234642047ea22b44b5f6a65683 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Wed, 6 May 1998 20:24:10 +0000 Subject: [PATCH] POSIX states that getopt returns -1 when it is done parsing options, not EOF. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10550 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/sample/sserver/ChangeLog | 5 +++++ src/appl/sample/sserver/sserver.c | 2 +- src/appl/simple/client/ChangeLog | 5 +++++ src/appl/simple/client/sim_client.c | 2 +- src/appl/simple/server/ChangeLog | 5 +++++ src/appl/simple/server/sim_server.c | 2 +- src/appl/telnet/libtelnet/ChangeLog | 5 +++++ src/appl/telnet/libtelnet/getopt.c | 6 +++--- src/clients/kdestroy/ChangeLog | 5 +++++ src/clients/kdestroy/kdestroy.c | 2 +- src/clients/kinit/ChangeLog | 5 +++++ src/clients/kinit/kinit.c | 2 +- src/clients/ksu/ChangeLog | 5 +++++ src/clients/ksu/main.c | 2 +- src/kadmin.v4/server/ChangeLog | 5 +++++ src/kadmin.v4/server/admin_server.c | 2 +- src/kadmin/dbutil/ChangeLog | 7 +++++++ src/kadmin/dbutil/kdb5_create.c | 2 +- src/kadmin/dbutil/kdb5_destroy.c | 2 +- src/kadmin/dbutil/kdb5_stash.c | 2 +- src/kadmin/v5passwdd/ChangeLog | 5 +++++ src/kadmin/v5passwdd/kpasswd.c | 2 +- src/kdc/ChangeLog | 5 +++++ src/kdc/main.c | 2 +- src/krb524/ChangeLog | 5 +++++ src/krb524/k524init.c | 2 +- src/lib/kadm/ChangeLog | 6 ++++++ src/lib/kadm/t_dbentry.c | 2 +- src/lib/kadm/t_ktentry.c | 2 +- src/lib/kdb/ChangeLog | 5 +++++ src/lib/kdb/t_kdb.c | 2 +- src/lib/krb5/os/ChangeLog | 5 +++++ src/lib/krb5/os/t_std_conf.c | 2 +- src/prototype/ChangeLog | 5 +++++ src/prototype/getopt.c | 2 +- src/tests/asn.1/ChangeLog | 5 +++++ src/tests/asn.1/krb5_encode_test.c | 2 +- src/tests/create/ChangeLog | 5 +++++ src/tests/create/kdb5_mkdums.c | 2 +- src/tests/hammer/ChangeLog | 5 +++++ src/tests/hammer/kdc5_hammer.c | 2 +- src/tests/verify/ChangeLog | 5 +++++ src/tests/verify/kdb5_verify.c | 2 +- src/util/db2/test/ChangeLog | 5 +++++ src/util/db2/test/btree.tests/ChangeLog | 4 ++++ src/util/db2/test/btree.tests/main.c | 2 +- src/util/db2/test/dbtest.c | 2 +- src/util/windows/ChangeLog | 4 ++++ src/util/windows/getopt.c | 6 +++--- 49 files changed, 146 insertions(+), 30 deletions(-) create mode 100644 src/prototype/ChangeLog create mode 100644 src/util/db2/test/ChangeLog create mode 100644 src/util/db2/test/btree.tests/ChangeLog diff --git a/src/appl/sample/sserver/ChangeLog b/src/appl/sample/sserver/ChangeLog index 36513524c..9973d04d6 100644 --- a/src/appl/sample/sserver/ChangeLog +++ b/src/appl/sample/sserver/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * sserver.c (main): POSIX states that getopt returns -1 when it + is done parsing options, not EOF. + Wed Feb 18 15:33:15 1998 Tom Yu * Makefile.in: Remove trailing slash from thisconfigdir. Fix up diff --git a/src/appl/sample/sserver/sserver.c b/src/appl/sample/sserver/sserver.c index 78b291d36..e3b08962c 100644 --- a/src/appl/sample/sserver/sserver.c +++ b/src/appl/sample/sserver/sserver.c @@ -103,7 +103,7 @@ main(argc, argv) * */ opterr = 0; - while ((ch = getopt(argc, argv, "p:S:s:")) != EOF) + while ((ch = getopt(argc, argv, "p:S:s:")) != -1) switch (ch) { case 'p': port = atoi(optarg); diff --git a/src/appl/simple/client/ChangeLog b/src/appl/simple/client/ChangeLog index 04d4e43f5..3065caa8a 100644 --- a/src/appl/simple/client/ChangeLog +++ b/src/appl/simple/client/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * sim_client.c (main): POSIX states that getopt returns -1 when it + is done parsing options, not EOF. + Wed Feb 18 15:34:52 1998 Tom Yu * Makefile.in: Remove trailing slash from thisconfigdir. Fix up diff --git a/src/appl/simple/client/sim_client.c b/src/appl/simple/client/sim_client.c index ec88a76b8..0838757c4 100644 --- a/src/appl/simple/client/sim_client.c +++ b/src/appl/simple/client/sim_client.c @@ -108,7 +108,7 @@ main(argc, argv) * */ opterr = 0; - while ((ch = getopt(argc, argv, "p:m:h:s:")) != EOF) + while ((ch = getopt(argc, argv, "p:m:h:s:")) != -1) switch (ch) { case 'p': port = atoi(optarg); diff --git a/src/appl/simple/server/ChangeLog b/src/appl/simple/server/ChangeLog index 3381a5b77..68e9d4bae 100644 --- a/src/appl/simple/server/ChangeLog +++ b/src/appl/simple/server/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * sim_server.c (argv): POSIX states that getopt returns -1 when it + is done parsing options, not EOF. + Wed Feb 18 15:35:38 1998 Tom Yu * Makefile.in: Remove trailing slash from thisconfigdir. Fix up diff --git a/src/appl/simple/server/sim_server.c b/src/appl/simple/server/sim_server.c index f57ec8911..7f1a824e4 100644 --- a/src/appl/simple/server/sim_server.c +++ b/src/appl/simple/server/sim_server.c @@ -98,7 +98,7 @@ char *argv[]; * */ opterr = 0; - while ((ch = getopt(argc, argv, "p:s:S:")) != EOF) + while ((ch = getopt(argc, argv, "p:s:S:")) != -1) switch (ch) { case 'p': port = atoi(optarg); diff --git a/src/appl/telnet/libtelnet/ChangeLog b/src/appl/telnet/libtelnet/ChangeLog index dd3448241..1a50bd4f0 100644 --- a/src/appl/telnet/libtelnet/ChangeLog +++ b/src/appl/telnet/libtelnet/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * getopt.c (getopt): POSIX states that getopt returns -1 when it + is done parsing options, not EOF. + Wed Feb 18 15:37:20 1998 Tom Yu * Makefile.in: Remove trailing slash from thisconfigdir. Fix up diff --git a/src/appl/telnet/libtelnet/getopt.c b/src/appl/telnet/libtelnet/getopt.c index a4a735684..d61cc3c1f 100644 --- a/src/appl/telnet/libtelnet/getopt.c +++ b/src/appl/telnet/libtelnet/getopt.c @@ -67,12 +67,12 @@ getopt(nargc, nargv, ostr) optreset = 0; if (optind >= nargc || *(place = nargv[optind]) != '-') { place = EMSG; - return(EOF); + return(-1); } if (place[1] && *++place == '-') { /* found "--" */ ++optind; place = EMSG; - return(EOF); + return(-1); } } /* option letter okay? */ if ((optopt = (int)*place++) == (int)':' || @@ -82,7 +82,7 @@ getopt(nargc, nargv, ostr) * assume it means EOF. */ if (optopt == (int)'-') - return(EOF); + return(-1); if (!*place) ++optind; if (opterr && *ostr != ':') { diff --git a/src/clients/kdestroy/ChangeLog b/src/clients/kdestroy/ChangeLog index 15b38506d..428f1d3fa 100644 --- a/src/clients/kdestroy/ChangeLog +++ b/src/clients/kdestroy/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * kdestroy.c (main): POSIX states that getopt returns -1 when it + is done parsing options, not EOF. + Wed Feb 18 15:40:31 1998 Tom Yu * Makefile.in: Remove trailing slash from thisconfigdir. Fix up diff --git a/src/clients/kdestroy/kdestroy.c b/src/clients/kdestroy/kdestroy.c index 97869a316..b52ccb246 100644 --- a/src/clients/kdestroy/kdestroy.c +++ b/src/clients/kdestroy/kdestroy.c @@ -55,7 +55,7 @@ main(argc, argv) if (strrchr(argv[0], '/')) argv[0] = strrchr(argv[0], '/')+1; - while ((c = getopt(argc, argv, "qc:")) != EOF) { + while ((c = getopt(argc, argv, "qc:")) != -1) { switch (c) { case 'q': quiet = 1; diff --git a/src/clients/kinit/ChangeLog b/src/clients/kinit/ChangeLog index 3fadd99fa..65bcc031e 100644 --- a/src/clients/kinit/ChangeLog +++ b/src/clients/kinit/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * kinit.c (main): POSIX states that getopt returns -1 when it + is done parsing options, not EOF. + Wed Feb 18 15:42:14 1998 Tom Yu * Makefile.in: Remove trailing slash from thisconfigdir. Fix up diff --git a/src/clients/kinit/kinit.c b/src/clients/kinit/kinit.c index 6c3f037e6..6f7b840c9 100644 --- a/src/clients/kinit/kinit.c +++ b/src/clients/kinit/kinit.c @@ -105,7 +105,7 @@ main(argc, argv) if (strrchr(argv[0], '/')) argv[0] = strrchr(argv[0], '/')+1; - while ((option = getopt(argc, argv, "r:Rfpl:s:c:kt:vS:")) != EOF) { + while ((option = getopt(argc, argv, "r:Rfpl:s:c:kt:vS:")) != -1) { switch (option) { case 'r': options |= KDC_OPT_RENEWABLE; diff --git a/src/clients/ksu/ChangeLog b/src/clients/ksu/ChangeLog index 0f8d4b13a..a7f563ac2 100644 --- a/src/clients/ksu/ChangeLog +++ b/src/clients/ksu/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * main.c (main): POSIX states that getopt returns -1 when it + is done parsing options, not EOF. + Wed Feb 18 15:44:15 1998 Tom Yu * Makefile.in: Remove trailing slash from thisconfigdir. Fix up diff --git a/src/clients/ksu/main.c b/src/clients/ksu/main.c index c5daf939a..31a255cf3 100644 --- a/src/clients/ksu/main.c +++ b/src/clients/ksu/main.c @@ -172,7 +172,7 @@ char * dir_of_cc_source; } - while(!done && ((option = getopt(pargc, pargv,"n:c:C:r:a:zZDfpkql:e:")) != EOF)){ + while(!done && ((option = getopt(pargc, pargv,"n:c:C:r:a:zZDfpkql:e:")) != -1)){ switch (option) { case 'r': options.opt |= KDC_OPT_RENEWABLE; diff --git a/src/kadmin.v4/server/ChangeLog b/src/kadmin.v4/server/ChangeLog index 431055f30..ba7dd7646 100644 --- a/src/kadmin.v4/server/ChangeLog +++ b/src/kadmin.v4/server/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * admin_server.c (argv): POSIX states that getopt returns -1 when + it is done parsing options, not EOF. + Wed Feb 18 16:03:53 1998 Tom Yu * Makefile.in: Remove trailing slash from thisconfigdir. Fix up diff --git a/src/kadmin.v4/server/admin_server.c b/src/kadmin.v4/server/admin_server.c index ac4032b38..a1fd60c5c 100644 --- a/src/kadmin.v4/server/admin_server.c +++ b/src/kadmin.v4/server/admin_server.c @@ -102,7 +102,7 @@ char *argv[]; memset(krbrlm, 0, sizeof(krbrlm)); fascist_cpw = 1; /* by default, enable fascist mode */ - while ((c = getopt(argc, argv, "f:hnd:a:r:FN")) != EOF) + while ((c = getopt(argc, argv, "f:hnd:a:r:FN")) != -1) switch(c) { case 'f': /* Syslog file name change */ prm.sysfile = optarg; diff --git a/src/kadmin/dbutil/ChangeLog b/src/kadmin/dbutil/ChangeLog index 4f89fdd17..3ab92e90e 100644 --- a/src/kadmin/dbutil/ChangeLog +++ b/src/kadmin/dbutil/ChangeLog @@ -1,3 +1,10 @@ +1998-05-06 Theodore Ts'o + + * kdb5_stash.c (argv): + * kdb5_destroy.c (kdb5_destroy): + * kdb5_create.c (kdb5_create): POSIX states that getopt returns -1 + when it is done parsing options, not EOF. + Fri Feb 27 23:32:38 1998 Theodore Ts'o * Makefile.in: Changed thisconfigdir to point at the kadmin diff --git a/src/kadmin/dbutil/kdb5_create.c b/src/kadmin/dbutil/kdb5_create.c index c599228b4..2e2c5f912 100644 --- a/src/kadmin/dbutil/kdb5_create.c +++ b/src/kadmin/dbutil/kdb5_create.c @@ -138,7 +138,7 @@ void kdb5_create(argc, argv) if (strrchr(argv[0], '/')) argv[0] = strrchr(argv[0], '/')+1; - while ((optchar = getopt(argc, argv, "s")) != EOF) { + while ((optchar = getopt(argc, argv, "s")) != -1) { switch(optchar) { case 's': do_stash++; diff --git a/src/kadmin/dbutil/kdb5_destroy.c b/src/kadmin/dbutil/kdb5_destroy.c index a0567c8b9..c5f47ca2f 100644 --- a/src/kadmin/dbutil/kdb5_destroy.c +++ b/src/kadmin/dbutil/kdb5_destroy.c @@ -63,7 +63,7 @@ kdb5_destroy(argc, argv) dbname = global_params.dbname; optind = 1; - while ((optchar = getopt(argc, argv, "f")) != EOF) { + while ((optchar = getopt(argc, argv, "f")) != -1) { switch(optchar) { case 'f': force++; diff --git a/src/kadmin/dbutil/kdb5_stash.c b/src/kadmin/dbutil/kdb5_stash.c index 9502c0952..40084e2bb 100644 --- a/src/kadmin/dbutil/kdb5_stash.c +++ b/src/kadmin/dbutil/kdb5_stash.c @@ -71,7 +71,7 @@ char *argv[]; keyfile = global_params.stash_file; optind = 1; - while ((optchar = getopt(argc, argv, "f:")) != EOF) { + while ((optchar = getopt(argc, argv, "f:")) != -1) { switch(optchar) { case 'f': keyfile = optarg; diff --git a/src/kadmin/v5passwdd/ChangeLog b/src/kadmin/v5passwdd/ChangeLog index 548e75e87..90a19a8a2 100644 --- a/src/kadmin/v5passwdd/ChangeLog +++ b/src/kadmin/v5passwdd/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * kpasswd.c (main): POSIX states that getopt returns -1 + when it is done parsing options, not EOF. + Fri Feb 27 23:32:38 1998 Theodore Ts'o * Makefile.in: Changed thisconfigdir to point at the kadmin diff --git a/src/kadmin/v5passwdd/kpasswd.c b/src/kadmin/v5passwdd/kpasswd.c index 1a7d1c49b..e9785858b 100644 --- a/src/kadmin/v5passwdd/kpasswd.c +++ b/src/kadmin/v5passwdd/kpasswd.c @@ -200,7 +200,7 @@ main(argc, argv) * Usage is: * kpasswd [-u user] [-l language] */ - while ((option = getopt(argc, argv, kpwd_getoptstring)) != EOF) { + while ((option = getopt(argc, argv, kpwd_getoptstring)) != -1) { switch (option) { case 'u': if ((name = (char *) malloc(strlen(optarg)+1)) == NULL) { diff --git a/src/kdc/ChangeLog b/src/kdc/ChangeLog index ce3fc0f27..614a095a4 100644 --- a/src/kdc/ChangeLog +++ b/src/kdc/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * main.c (initialize_realms): POSIX states that getopt returns -1 + when it is done parsing options, not EOF. + Fri Mar 20 17:13:46 1998 Tom Yu * kdc_util.c (add_to_transited): Check lengths, fix up comma diff --git a/src/kdc/main.c b/src/kdc/main.c index 786312b9c..d58ebc80e 100644 --- a/src/kdc/main.c +++ b/src/kdc/main.c @@ -627,7 +627,7 @@ initialize_realms(kcontext, argc, argv) * Loop through the option list. Each time we encounter a realm name, * use the previously scanned options to fill in for defaults. */ - while ((c = getopt(argc, argv, "r:d:mM:k:R:e:p:s:n4:")) != EOF) { + while ((c = getopt(argc, argv, "r:d:mM:k:R:e:p:s:n4:")) != -1) { switch(c) { case 'r': /* realm name for db */ if (!find_realm_data(optarg, (krb5_ui_4) strlen(optarg))) { diff --git a/src/krb524/ChangeLog b/src/krb524/ChangeLog index c492ab3d8..675070c2c 100644 --- a/src/krb524/ChangeLog +++ b/src/krb524/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * k524init.c (main): POSIX states that getopt returns -1 + when it is done parsing options, not EOF. + Wed Feb 18 16:04:44 1998 Tom Yu * Makefile.in (thisconfigdir): Remove trailing slash. diff --git a/src/krb524/k524init.c b/src/krb524/k524init.c index 3c355a29b..680991c44 100644 --- a/src/krb524/k524init.c +++ b/src/krb524/k524init.c @@ -59,7 +59,7 @@ int main(argc, argv) exit(1); } - while(((option = getopt(argc, argv, "p:n")) != EOF)) { + while(((option = getopt(argc, argv, "p:n")) != -1)) { switch(option) { case 'p': princ = optarg; diff --git a/src/lib/kadm/ChangeLog b/src/lib/kadm/ChangeLog index d35cd3a1a..0973153ac 100644 --- a/src/lib/kadm/ChangeLog +++ b/src/lib/kadm/ChangeLog @@ -1,3 +1,9 @@ +1998-05-06 Theodore Ts'o + + * t_ktentry.c (main): + * t_dbentry.c (main): POSIX states that getopt returns -1 + when it is done parsing options, not EOF. + Wed Feb 18 16:13:15 1998 Tom Yu * Makefile.in: Remove trailing slash from thisconfigdir. Fix up diff --git a/src/lib/kadm/t_dbentry.c b/src/lib/kadm/t_dbentry.c index 7fa578019..461c8e7ef 100644 --- a/src/lib/kadm/t_dbentry.c +++ b/src/lib/kadm/t_dbentry.c @@ -928,7 +928,7 @@ main(argc, argv) now = time((time_t *) NULL); SRAND((RAND_TYPE) now); - while ((option = getopt(argc, argv, "r:v")) != EOF) { + while ((option = getopt(argc, argv, "r:v")) != -1) { switch (option) { case 'r': if (sscanf(optarg, "%d", &randompasses) != 1) { diff --git a/src/lib/kadm/t_ktentry.c b/src/lib/kadm/t_ktentry.c index 8242699d0..c59319cc6 100644 --- a/src/lib/kadm/t_ktentry.c +++ b/src/lib/kadm/t_ktentry.c @@ -366,7 +366,7 @@ main(argc, argv) now = time((time_t *) NULL); SRAND((RAND_TYPE) now); - while ((option = getopt(argc, argv, "r:v")) != EOF) { + while ((option = getopt(argc, argv, "r:v")) != -1) { switch (option) { case 'r': if (sscanf(optarg, "%d", &randompasses) != 1) { diff --git a/src/lib/kdb/ChangeLog b/src/lib/kdb/ChangeLog index 6c692d1d1..ec0b38457 100644 --- a/src/lib/kdb/ChangeLog +++ b/src/lib/kdb/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * t_kdb.c (main): POSIX states that getopt returns -1 + when it is done parsing options, not EOF. + Wed Apr 15 18:06:34 1998 Tom Yu * Makefile.in (SHLIB_EXPDEPS): diff --git a/src/lib/kdb/t_kdb.c b/src/lib/kdb/t_kdb.c index 75c0a373d..b14152602 100644 --- a/src/lib/kdb/t_kdb.c +++ b/src/lib/kdb/t_kdb.c @@ -1015,7 +1015,7 @@ main(argc, argv) hash = 0; /* Parse argument list */ - while ((option = getopt(argc, argv, "cd:n:prstvDh")) != EOF) { + while ((option = getopt(argc, argv, "cd:n:prstvDh")) != -1) { switch (option) { case 'c': check_cont = 1; diff --git a/src/lib/krb5/os/ChangeLog b/src/lib/krb5/os/ChangeLog index 12619dd5d..c9b7ece1f 100644 --- a/src/lib/krb5/os/ChangeLog +++ b/src/lib/krb5/os/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * t_std_conf.c (main): POSIX states that getopt returns -1 + when it is done parsing options, not EOF. + Fri Feb 27 18:03:33 1998 Theodore Ts'o * Makefile.in: Changed thisconfigdir to point at the lib/krb5 diff --git a/src/lib/krb5/os/t_std_conf.c b/src/lib/krb5/os/t_std_conf.c index 63a4bd727..5e615102e 100644 --- a/src/lib/krb5/os/t_std_conf.c +++ b/src/lib/krb5/os/t_std_conf.c @@ -173,7 +173,7 @@ main(argc, argv) exit(1); } - while ((c = getopt(argc, argv, "dk:r:D:l:s:")) != EOF) { + while ((c = getopt(argc, argv, "dk:r:D:l:s:")) != -1) { switch (c) { case 'd': /* Get default realm */ test_get_default_realm(ctx); diff --git a/src/prototype/ChangeLog b/src/prototype/ChangeLog new file mode 100644 index 000000000..e0f924c46 --- /dev/null +++ b/src/prototype/ChangeLog @@ -0,0 +1,5 @@ +1998-05-06 Theodore Ts'o + + * getopt.c (main): POSIX states that getopt returns -1 + when it is done parsing options, not EOF. + diff --git a/src/prototype/getopt.c b/src/prototype/getopt.c index 66cbad5d4..935f0bf5f 100644 --- a/src/prototype/getopt.c +++ b/src/prototype/getopt.c @@ -10,7 +10,7 @@ main(argc, argv) <<>>; - while ((c = getopt(argc, argv, "<<<>>>")) != EOF) { + while ((c = getopt(argc, argv, "<<<>>>")) != -1) { switch (c) { <<>>; case '?': diff --git a/src/tests/asn.1/ChangeLog b/src/tests/asn.1/ChangeLog index 1e0a00736..83d6ca304 100644 --- a/src/tests/asn.1/ChangeLog +++ b/src/tests/asn.1/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * krb5_encode_test.c (PRS): POSIX states that getopt returns -1 + when it is done parsing options, not EOF. + Mon Mar 30 13:51:58 1998 Ezra Peisach * ktest_equal.h: Add prototypes for ktest_equal_sam_challenge and diff --git a/src/tests/asn.1/krb5_encode_test.c b/src/tests/asn.1/krb5_encode_test.c index 95bdab630..68fd44104 100644 --- a/src/tests/asn.1/krb5_encode_test.c +++ b/src/tests/asn.1/krb5_encode_test.c @@ -59,7 +59,7 @@ void PRS(argc, argv) print_constructed_length, print_skip_context, print_skip_tagnum, print_context_shortcut; - while ((optchar = getopt(argc, argv, "tp:")) != EOF) { + while ((optchar = getopt(argc, argv, "tp:")) != -1) { switch(optchar) { case 't': do_trval = 1; diff --git a/src/tests/create/ChangeLog b/src/tests/create/ChangeLog index 402ad04bb..64e0b2801 100644 --- a/src/tests/create/ChangeLog +++ b/src/tests/create/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * kdb5_mkdums.c (argv): POSIX states that getopt returns -1 + when it is done parsing options, not EOF. + Mon Mar 30 16:57:43 1998 Ezra Peisach * kdb5_mkdums.c: Add parenthesis about assignements in conditionals. diff --git a/src/tests/create/kdb5_mkdums.c b/src/tests/create/kdb5_mkdums.c index ca17b6815..18ee9e8ac 100644 --- a/src/tests/create/kdb5_mkdums.c +++ b/src/tests/create/kdb5_mkdums.c @@ -119,7 +119,7 @@ char *argv[]; num_to_create = 0; depth = 1; - while ((optchar = getopt(argc, argv, "D:P:p:n:d:r:k:M:e:m")) != EOF) { + while ((optchar = getopt(argc, argv, "D:P:p:n:d:r:k:M:e:m")) != -1) { switch(optchar) { case 'D': depth = atoi(optarg); /* how deep to go */ diff --git a/src/tests/hammer/ChangeLog b/src/tests/hammer/ChangeLog index 8d652e76e..59c5767eb 100644 --- a/src/tests/hammer/ChangeLog +++ b/src/tests/hammer/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * kdc5_hammer.c (main): POSIX states that getopt returns -1 + when it is done parsing options, not EOF. + Mon Mar 30 16:48:17 1998 Ezra Peisach * kdc5_hammer.c (usage): Change usage to refelect reality diff --git a/src/tests/hammer/kdc5_hammer.c b/src/tests/hammer/kdc5_hammer.c index 9769f0541..54d567c43 100644 --- a/src/tests/hammer/kdc5_hammer.c +++ b/src/tests/hammer/kdc5_hammer.c @@ -145,7 +145,7 @@ main(argc, argv) errors = 0; enctypedone = 0; - while ((option = getopt(argc, argv, "D:p:n:c:R:k:P:e:bvr:t")) != EOF) { + while ((option = getopt(argc, argv, "D:p:n:c:R:k:P:e:bvr:t")) != -1) { switch (option) { case 't': do_timer = 1; diff --git a/src/tests/verify/ChangeLog b/src/tests/verify/ChangeLog index bb9397a44..12fb1f93b 100644 --- a/src/tests/verify/ChangeLog +++ b/src/tests/verify/ChangeLog @@ -1,3 +1,8 @@ +1998-05-06 Theodore Ts'o + + * kdb5_verify.c (argv): POSIX states that getopt returns -1 + when it is done parsing options, not EOF. + Mon Mar 30 16:46:20 1998 Ezra Peisach * kdb5_verify.c: Declare main() as int instead of void. diff --git a/src/tests/verify/kdb5_verify.c b/src/tests/verify/kdb5_verify.c index 5ef38d6d6..8a95d7125 100644 --- a/src/tests/verify/kdb5_verify.c +++ b/src/tests/verify/kdb5_verify.c @@ -119,7 +119,7 @@ char *argv[]; num_to_check = 0; depth = 1; - while ((optchar = getopt(argc, argv, "D:P:p:n:d:r:R:k:M:e:m")) != EOF) { + while ((optchar = getopt(argc, argv, "D:P:p:n:d:r:R:k:M:e:m")) != -1) { switch(optchar) { case 'D': depth = atoi(optarg); /* how deep to go */ diff --git a/src/util/db2/test/ChangeLog b/src/util/db2/test/ChangeLog new file mode 100644 index 000000000..4e147d746 --- /dev/null +++ b/src/util/db2/test/ChangeLog @@ -0,0 +1,5 @@ +1998-05-06 Theodore Ts'o + + * dbtest.c (main): POSIX states that getopt returns -1 + when it is done parsing options, not EOF. + diff --git a/src/util/db2/test/btree.tests/ChangeLog b/src/util/db2/test/btree.tests/ChangeLog new file mode 100644 index 000000000..cfd0b18a2 --- /dev/null +++ b/src/util/db2/test/btree.tests/ChangeLog @@ -0,0 +1,4 @@ +1998-05-06 Theodore Ts'o + + * main.c (main): POSIX states that getopt returns -1 + when it is done parsing options, not EOF. diff --git a/src/util/db2/test/btree.tests/main.c b/src/util/db2/test/btree.tests/main.c index 61c9731cc..bbf1fcfac 100644 --- a/src/util/db2/test/btree.tests/main.c +++ b/src/util/db2/test/btree.tests/main.c @@ -135,7 +135,7 @@ main(argc, argv) b.prefix = NULL; b.lorder = 0; - while ((c = getopt(argc, argv, "bc:di:lp:ru")) != EOF) { + while ((c = getopt(argc, argv, "bc:di:lp:ru")) != -1) { switch (c) { case 'b': b.lorder = BIG_ENDIAN; diff --git a/src/util/db2/test/dbtest.c b/src/util/db2/test/dbtest.c index 170a0ea0f..f499047ae 100644 --- a/src/util/db2/test/dbtest.c +++ b/src/util/db2/test/dbtest.c @@ -101,7 +101,7 @@ main(argc, argv) fname = NULL; oflags = O_CREAT | O_RDWR | O_BINARY; sflag = 0; - while ((ch = getopt(argc, argv, "f:i:lo:s")) != EOF) + while ((ch = getopt(argc, argv, "f:i:lo:s")) != -1) switch (ch) { case 'f': fname = optarg; diff --git a/src/util/windows/ChangeLog b/src/util/windows/ChangeLog index e69de29bb..0484dd08a 100644 --- a/src/util/windows/ChangeLog +++ b/src/util/windows/ChangeLog @@ -0,0 +1,4 @@ +1998-05-06 Theodore Ts'o + + * getopt.c (getopt): POSIX states that getopt returns -1 + when it is done parsing options, not EOF. diff --git a/src/util/windows/getopt.c b/src/util/windows/getopt.c index ee38e72ab..081520f55 100644 --- a/src/util/windows/getopt.c +++ b/src/util/windows/getopt.c @@ -67,12 +67,12 @@ getopt(nargc, nargv, ostr) optreset = 0; if (optind >= nargc || *(place = nargv[optind]) != '-') { place = EMSG; - return(EOF); + return(-1); } if (place[1] && *++place == '-') { /* found "--" */ ++optind; place = EMSG; - return(EOF); + return(-1); } } /* option letter okay? */ if ((optopt = (int)*place++) == (int)':' || @@ -82,7 +82,7 @@ getopt(nargc, nargv, ostr) * assume it means EOF. */ if (optopt == (int)'-') - return(EOF); + return(-1); if (!*place) ++optind; if (opterr && *ostr != ':') { -- 2.26.2