dnl This file is part of GNU Anubis.
dnl Copyright (C) 2007-2014 The Anubis Team.
dnl
dnl GNU Anubis is free software; you can redistribute it and/or modify it
dnl under the terms of the GNU General Public License as published by the
dnl Free Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl GNU Anubis is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License along
dnl with GNU Anubis. If not, see .
dnl
divert(-1)
changequote([<,>])
changecom(/*,*/)
dnl upcase(ARGS...)
dnl Concatenate and convert ARGS to upper case.
dnl
define([], [], [], [])>])
dnl concat(ARGS...)
dnl Concatenate arguments, inserting ", " between each of pair of them.
dnl
define([],[],1,[<$1>],[<$1, concat(shift($@))>])>])
dnl flushleft(ARGS...)
dnl Concatenate ARGS and remove any leading whitespace
dnl
define([],
[], [<^[ ]+>])>])
dnl chop(ARGS...)
dnl Concatenate ARGS and remove any trailing whitespace
dnl
define([],
[], [<[ ]+$>])>])
dnl escape(ARGS...)
dnl Concatenate ARGS and escape any occurrences of double-quotes with
dnl backslashes.
dnl
define([],
[],[<[\"]>],[<\\\&>])>])
dnl prep(ARG)
dnl Prepare ARG for including in C strings: replace newlines with any amount
dnl of preceding and following whitespace by a single space character, remove
dnl leading whitespace, and escape double-quotes.
dnl
define([],
[],[<[ ]*
+[ ]*>],[< >])))>])
define([],
[],[<\\n>],[<\n>])>])
define([],[])
dnl SHORT_OPTS
dnl Accumulator for the 3rd argument of getopt_long
dnl
define([],[<>])
dnl GROUP(STRING)
dnl Begin a named group of options
dnl
define([],[])") },
divert(-1)>])
define([<__GATHER_OPTIONS>],[<
define([],ifelse([<$2>],,[]upcase(patsubst($1,-,_)),'$2'))
ifelse([<$2>],,[<
divert(1)
KEY,
divert(-1)
>])
define([],ifdef([],SELECTOR) case KEY:)
ifelse([<$1>],,,[<
divert(2)
{ "$1", ARGTYPE, 0, KEY },
divert(-1)>])
dnl
define([],SHORT_OPTS[<>]dnl
ifelse([<$2>],,,$2[<>]ifelse(ARGTYPE,[],,ARGTYPE,[],:,ARGTYPE,[],::)))
dnl
ifelse([<$1>],,,dnl
[],ifelse(LONG_TAG,,[<--$1>],[]))>])
ifelse([<$2>],,,dnl
[],ifelse(SHORT_TAG,,[<-$2>],[]))>])
>])
dnl OPTION(long-opt, short-opt, [arg], [descr])
dnl Introduce a command line option. Arguments:
dnl long-opt Long option.
dnl short-opt Short option (a single char)
dnl (At least one of long-opt or short-opt must be present)
dnl
dnl Optional arguments:
dnl arg Option argument.
dnl descr Option description
dnl
dnl If arg is absent, the option does not take any arguments. If arg is
dnl enclosed in square brackets, the option takes an optional argument.
dnl Otherwise, the argument is required.
dnl
dnl If descr is not given the option will not appear in the --help and
dnl --usage outputs.
dnl
define([