summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-03-19 00:46:36 +0000
committerMiles Bader <miles@gnu.org>1996-03-19 00:46:36 +0000
commita9079b20c02aac0ec112e9186ebd9bd11c295056 (patch)
tree585425013b9ae3e2223672131d25b8872711c951 /utils
parent45bc25a5fa8f68f909d403ee71dc8eefb8dce9c6 (diff)
(main): Pass new arg to argp_parse. Also use argp_usage correctly.
Diffstat (limited to 'utils')
-rw-r--r--utils/portinfo.c5
-rw-r--r--utils/settrans.c13
2 files changed, 11 insertions, 7 deletions
diff --git a/utils/portinfo.c b/utils/portinfo.c
index cef93861..50910333 100644
--- a/utils/portinfo.c
+++ b/utils/portinfo.c
@@ -467,7 +467,8 @@ main (int argc, char **argv)
break;
case ARGP_KEY_NO_ARGS:
- argp_error (state->argp, "No process specified");
+ argp_error (state, "No process specified");
+ return ED; /* Some non-EINVAL error. */
case ARGP_KEY_ARG:
if (state->arg_num == 0)
@@ -523,7 +524,7 @@ main (int argc, char **argv)
const struct argp argp = { options, parse_opt, args_doc, doc };
/* Parse our arguments. */
- argp_parse (&argp, argc, argv, 0, 0);
+ argp_parse (&argp, argc, argv, 0, 0, 0);
exit (0);
}
diff --git a/utils/settrans.c b/utils/settrans.c
index a4276f19..9c55d2f1 100644
--- a/utils/settrans.c
+++ b/utils/settrans.c
@@ -57,8 +57,8 @@ static struct argp_option options[] =
{0, 0}
};
static char *args_doc = "NODE [TRANSLATOR ARG...]";
-static char *doc = "By default, the passive translator is set, and any \
-active translator told to just go away.";
+static char *doc = "When setting a translator, the passive translator is set"
+" by defualt, and when clearing, the active.";
/* ---------------------------------------------------------------- */
@@ -107,7 +107,8 @@ main(int argc, char *argv[])
break;
case ARGP_KEY_NO_ARGS:
- argp_usage (state->argp); /* exits */
+ argp_usage (state);
+ return EINVAL;
case 'a': active = 1; break;
case 'p': passive = 1; break;
@@ -133,10 +134,12 @@ main(int argc, char *argv[])
}
struct argp argp = {options, parse_opt, args_doc, doc};
- argp_parse (&argp, argc, argv, ARGP_IN_ORDER, 0);
+ argp_parse (&argp, argc, argv, ARGP_IN_ORDER, 0, 0);
if (!active && !passive)
- passive = 1;
+ /* When not otherwise specified, defaults are: active when clearing,
+ passive when setting. */
+ (argz_len == 0 ? active : passive) = 1;
if (active && argz_len > 0)
{