aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-08-05 13:53:19 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2016-08-05 13:53:19 +0300
commitedd1a92f6743a5f5c31fa1468fdb511c097e75ad (patch)
tree92453e83b14a43923e845228313447c2f310fa64
parent95b9dbb21aa2a7721c091aa79c680b4531fa804b (diff)
downloadgrecs-edd1a92f6743a5f5c31fa1468fdb511c097e75ad.tar.gz
grecs-edd1a92f6743a5f5c31fa1468fdb511c097e75ad.tar.bz2
New operator to stop option processing
* build-aux/getopt.m4 (LASTOPT): New macro. Stops further option processing.
-rw-r--r--build-aux/getopt.m45
1 files changed, 5 insertions, 0 deletions
diff --git a/build-aux/getopt.m4 b/build-aux/getopt.m4
index cf375ca..d424088 100644
--- a/build-aux/getopt.m4
+++ b/build-aux/getopt.m4
@@ -259,12 +259,16 @@ define([<OPTNODE>],[<do {
cmdline_tree = node;
else
grecs_node_bind(cmdline_tree, node, 0);
} while(0)
>])
+dnl LASTOPT()
+dnl Stop option processing (as if "--" has been encountered
+define([<LASTOPT>],[<goto lastoptlab>])
+
dnl GETOPT(argc, argv, [long_index], [onerr])
dnl Emit option parsing code. Arguments:
dnl
dnl argc Name of the 1st argument to getopt_long.
dnl argv Name of the 2nd argument to getopt_long.
dnl long_index 5th argument to getopt_long. If not given,
@@ -288,12 +292,13 @@ define([<GETOPT>],[<
default:
ifelse([<$4>],,,[<$4;>])dnl
exit(EX_USAGE);
undivert(4)
}
}
+lastoptlab:
ifelse([<$3>],,[<
if (optind < argc) {
fprintf(stderr, "%s: unexpected arguments\n", $2[0]);
exit(EX_USAGE);
}
>],[<$3 = optind;>])

Return to:

Send suggestions and report system problems to the System administrator.