├── .gitignore ├── .travis.yml ├── GNUmakefile ├── LICENCE ├── Makefile.am ├── README.md ├── configure.ac ├── info ├── Makefile.am └── author.h2m ├── m4 ├── clitoris.m4 ├── sxe-compiler.m4 └── yuck.m4 ├── snap └── snapcraft.yaml ├── src ├── Makefile.am ├── version.c.in ├── version.h ├── yuck-coru.c.m4 ├── yuck-coru.h.m4 ├── yuck-custom.example.m4 ├── yuck-scmver.c ├── yuck-scmver.h ├── yuck-scmver.m4 ├── yuck.am ├── yuck.c ├── yuck.m4 ├── yuck.man.m4 ├── yuck.mk └── yuck.yuck ├── test ├── Makefile.am ├── auto-dashdash.c ├── auto-dashdash.yuck ├── auto-dashdash_01.clit ├── auto-dashdash_02.clit ├── brack_01.clit ├── brack_01.yuck ├── brack_02.clit ├── brack_02.yuck ├── clitoris.am ├── clitoris.c ├── clitoris.yuck ├── dashdesc_01.clit ├── dashdesc_01.yuck ├── escape_01.clit ├── escape_01.yuck ├── escape_02.clit ├── escape_03.clit ├── escape_03.yuck ├── escape_04.clit ├── generic-mularg_01.clit ├── generic-mularg_02.clit ├── generic-mularg_03.clit ├── generic-mularg_04.clit ├── generic-muloptarg_01.clit ├── generic-muloptarg_02.clit ├── generic-muloptarg_03.clit ├── generic-muloptarg_04.clit ├── generic-optarg_01.clit ├── generic-optarg_02.clit ├── generic-optarg_03.clit ├── generic-optarg_04.clit ├── generic-option_01.clit ├── generic-option_02.clit ├── generic-option_03.clit ├── generic-option_04.clit ├── generic-option_05.clit ├── generic-option_06.clit ├── generic-option_07.clit ├── generic-option_08.clit ├── generic-plain_05.clit ├── generic-plain_06.clit ├── generic.c ├── lastarg_01.clit ├── lastarg_01.yuck ├── lastarg_02.clit ├── lastarg_02.yuck ├── lone-cmd_01.clit ├── lone-cmd_01.yuck ├── lone-cmd_02.clit ├── lone-cmd_02.yuck ├── man-01.clit ├── man-01.yuck ├── mularg_01.clit ├── mularg_01.yuck ├── mularg_02.clit ├── mularg_02.yuck ├── mularg_03.clit ├── mularg_03.yuck ├── mularg_04.clit ├── mularg_04.yuck ├── muloptarg_01.clit ├── muloptarg_01.yuck ├── muloptarg_02.clit ├── muloptarg_02.yuck ├── muloptarg_03.clit ├── muloptarg_03.yuck ├── muloptarg_04.clit ├── muloptarg_04.yuck ├── noauto_01.clit ├── noauto_01.yuck ├── noauto_02.clit ├── optarg_01.clit ├── optarg_01.yuck ├── optarg_02.clit ├── optarg_02.yuck ├── optarg_03.clit ├── optarg_03.yuck ├── optarg_04.clit ├── optarg_04.yuck ├── option_01.clit ├── option_01.yuck ├── option_02.clit ├── option_02.yuck ├── option_03.clit ├── option_03.yuck ├── option_04.clit ├── option_04.yuck ├── option_05.clit ├── option_05.yuck ├── option_06.clit ├── option_06.yuck ├── option_07.clit ├── option_07.yuck ├── option_08.clit ├── option_08.yuck ├── option_09.clit ├── option_09.yuck ├── option_10.clit ├── option_10.yuck ├── option_11.clit ├── option_12.clit ├── outfn_01.clit ├── outfn_02.clit ├── outfn_03.clit ├── paren_01.clit ├── paren_01.yuck ├── paren_02.clit ├── paren_02.yuck ├── plain_01.clit ├── plain_01.yuck ├── plain_02.clit ├── plain_02.yuck ├── plain_03.clit ├── plain_03.yuck ├── plain_04.clit ├── plain_04.yuck ├── plain_05.clit ├── plain_05.yuck ├── plain_06.clit ├── plain_06.yuck ├── post-hook.c ├── post-hook_01.clit ├── post-hook_02.clit ├── rudi_01.version ├── rudi_02.version ├── rudi_03.version ├── rudi_04.version ├── rudi_05.version ├── rudi_06.version ├── rudi_07.version ├── rudi_08.version ├── rudi_09.version ├── rudi_10.version ├── rudi_11.version ├── rudi_12.version ├── rudi_13.version ├── rudi_14.version ├── rudi_15.version ├── rudi_16.version ├── scmver_01.clit ├── scmver_02.clit ├── scmver_02.tmpl ├── scmver_03.clit ├── scmver_04.clit ├── scmver_04.ver ├── scmver_05.clit ├── scmver_05.ver ├── scmver_06.clit ├── scmver_06.ver ├── scmver_07.clit ├── scmver_07.ver ├── scmver_08.clit ├── scmver_09.clit ├── scmver_11.clit ├── scmver_12.clit ├── scmver_13.clit ├── scmver_14.clit ├── scmver_15.clit ├── scmver_16.clit ├── scmver_17.clit ├── scmver_18.clit ├── scmver_21.clit ├── scmver_22.clit ├── scmver_23.clit ├── scmver_24.clit ├── scmver_25.clit ├── scmver_26.clit ├── scmver_27.clit ├── scmver_28.clit ├── subcmd_01.clit ├── subcmd_01.yuck ├── subcmd_02.clit ├── subcmd_02.yuck ├── subcmd_03.clit ├── subcmd_03.yuck ├── subcmd_04.clit ├── subcmd_04.yuck ├── underq_01.clit ├── underq_01.yuck ├── underq_02.clit ├── underq_02.yuck ├── underq_03.clit ├── underq_03.yuck ├── underq_04.clit ├── underq_04.yuck ├── underq_05.clit ├── underq_05.yuck ├── underq_06.clit ├── underq_06.yuck ├── xmpl-01.clit ├── xmpl-02.clit ├── xmpl-03.clit ├── xmpl-04.clit ├── xmpl-command-01.clit ├── xmpl-command.c ├── xmpl-command.yuck ├── xmpl-posarg-with-angles-01.clit ├── xmpl-posarg-with-angles.c ├── xmpl-posarg-with-angles.yuck ├── xmpl-subcommands-01.clit ├── xmpl-subcommands-02.clit ├── xmpl-subcommands-03.clit ├── xmpl-subcommands-04.clit ├── xmpl-subcommands.c ├── xmpl-subcommands.yuck ├── xmpl.c ├── xmpl.yuck ├── xtraarg_01.clit └── xtraarg_01.yuck └── version.mk.in /.gitignore: -------------------------------------------------------------------------------- 1 | aclocal.m4 2 | autom4te.cache 3 | configure 4 | ltmain.sh 5 | m4/libtool.m4 6 | m4/lt*.m4 7 | Makefile.in 8 | config.guess 9 | config.sub 10 | install-sh 11 | missing 12 | src/config.h.in 13 | *~ 14 | =build* 15 | build* 16 | depcomp 17 | ++* 18 | Makefile 19 | .version 20 | version.mk 21 | config.log 22 | config.status 23 | libtool 24 | *.o 25 | config.h 26 | stamp-h1 27 | .deps 28 | .libs 29 | test-driver 30 | 31 | ##binaries and shite 32 | yuck 33 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | 3 | os: 4 | - linux 5 | - osx 6 | 7 | compiler: 8 | - gcc 9 | - clang 10 | 11 | env: 12 | - CHECK="normal" 13 | 14 | matrix: 15 | include: 16 | ## distcheck 17 | - os: linux 18 | compiler: gcc 19 | env: CHECK="distcheck" 20 | 21 | before_script: 22 | - autoreconf -vfi 23 | - MAKE="make -j2" 24 | 25 | script: 26 | - ./configure || { cat config.log; false; } 27 | - if [ "$CHECK" = "normal" ]; then 28 | $MAKE clean && $MAKE check; 29 | fi 30 | - if [ "$CHECK" = "distcheck" ]; then 31 | $MAKE all && $MAKE distcheck; 32 | fi 33 | 34 | after_script: 35 | # find test log from check as well as from distcheck 36 | - log=$(find . -name test-suite.log) && test -f "$log" && cat "$log" || true 37 | 38 | ## whitelist 39 | branches: 40 | only: 41 | - master 42 | - next 43 | - /^travis.*/ 44 | - /^tmp.*/ 45 | 46 | notifications: 47 | email: 48 | - devel@fresse.org 49 | -------------------------------------------------------------------------------- /GNUmakefile: -------------------------------------------------------------------------------- 1 | # This GNUmakefile is used only if you run GNU Make. 2 | 3 | # If the user runs GNU make but has not yet run ./configure, 4 | # give them a diagnostic. 5 | _gl-Makefile := $(wildcard [M]akefile) 6 | ifneq ($(_gl-Makefile),) 7 | 8 | _dist-target_p ?= $(filter dist%,$(MAKECMDGOALS)) 9 | 10 | include Makefile 11 | 12 | # update the included makefile snippet which sets VERSION variables 13 | .PHONY: version.mk 14 | version.mk: .version version.mk.in 15 | -$(AM_V_GEN) \ 16 | if test "$(MAKECMDGOALS)" != "am--refresh"; then \ 17 | $(MAKE) -C "$(top_builddir)/src" $(MAKECMDGOALS); \ 18 | PATH="$(top_builddir)/src:$${PATH}" \ 19 | yuck scmver --ignore-noscm -o $@ --reference $^; \ 20 | if test $$? -eq 3 -a -n "$(_dist-target_p)"; then \ 21 | exec $(MAKE) $(MAKECMDGOALS); \ 22 | fi; \ 23 | fi 24 | 25 | else 26 | 27 | .DEFAULT_GOAL := abort-due-to-no-makefile 28 | $(MAKECMDGOALS): abort-due-to-no-makefile 29 | 30 | abort-due-to-no-makefile: 31 | @echo There seems to be no Makefile in this directory. 1>&2 32 | @echo "You must run ./configure before running 'make'." 1>&2 33 | exit 1 34 | 35 | endif 36 | 37 | .PHONY: FORCE 38 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without 2 | modification, are permitted provided that the following conditions 3 | are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright 6 | notice, this list of conditions and the following disclaimer. 7 | 8 | 2. Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | 12 | 3. Neither the name of the author nor the names of any contributors 13 | may be used to endorse or promote products derived from this 14 | software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR 17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 | OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_builddir)/version.mk 2 | 3 | LANG = C 4 | LC_ALL = C 5 | 6 | ACLOCAL_AMFLAGS = -I m4 7 | aclocaldir = $(datadir)/aclocal 8 | 9 | SUBDIRS = 10 | EXTRA_DIST = $(DISTCLEANFILES) 11 | DISTCLEANFILES = 12 | CLEANFILES = 13 | 14 | SUBDIRS += src 15 | SUBDIRS += info 16 | SUBDIRS += test 17 | 18 | DISTCLEANFILES += version.mk 19 | DISTCLEANFILES += .version 20 | EXTRA_DIST += version.mk.in 21 | 22 | aclocal_DATA = m4/yuck.m4 23 | 24 | doc_DATA = README.md LICENCE 25 | EXTRA_DIST += $(doc_DATA) 26 | 27 | ## make sure .version is read-only in the dist 28 | dist-hook: 29 | chmod ugo-w $(distdir)/.version 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | yuck 2 | ==== 3 | 4 | [![Build Status](https://secure.travis-ci.org/hroptatyr/yuck.png?branch=master)](http://travis-ci.org/hroptatyr/yuck) 5 | [![Licence](http://img.shields.io/badge/licence-BSD3c-brightgreen.svg)](http://opensource.org/licenses/BSD-3-Clause) 6 | 7 | + project homepage: http://www.fresse.org/yuck/ 8 | + github page: https://github.com/hroptatyr/yuck 9 | + downloads: https://github.com/hroptatyr/yuck/releases 10 | + issues: https://github.com/hroptatyr/yuck/issues 11 | 12 | ### Your Umbrella Command Kit 13 | 14 | yuck is a bog-standard command line option parser for C that works with 15 | only household ingredients (a C compiler and the m4 macro processor) and 16 | comes with all the knickknackery and whatnots: 17 | 18 | + GNU-style long options (`--blah`) 19 | + condensable short options (`-xab` for `-x -a -b`) 20 | + optional arguments to long and short options (--foo[=BAR]) 21 | + multiple occurrence of options (-vvv) 22 | + does *not* depend on libc's getopt() nor getopt_long() 23 | + licensed under [BSD 3-clause licence][4] 24 | 25 | And getting started is as easy as *munching* cake -- let yuck do the 26 | actual baking for you: Just feed it the `--help` output you'd like to 27 | see and yuck will happily try and generate a parser from it. 28 | 29 | To build yuck from the git sources: 30 | 31 | $ autoreconf -fi 32 | $ ./configure 33 | $ make 34 | $ make install 35 | 36 | For tarball builds omit the `autoreconf -fi` line. 37 | 38 | 39 | That all? I need more highlights 40 | -------------------------------- 41 | 42 | yuck can also generate parsers for umbrella tools, i.e. tools that take 43 | a command as argument (think git(1), ip(8), etc.). 44 | 45 | yuck has no exotic build time or run time dependencies, a C99 compiler and 46 | the m4 macro processor is enough. 47 | 48 | yuck can be used in other projects by copying 4 files and setting up 49 | a simple Makefile rule. 50 | 51 | yuck can generate man pages based on the definition files (the --help 52 | output), much like [help2man](http://www.gnu.org/s/help2man/). 53 | 54 | yuck can automatically determine (and make use of) version numbers in 55 | git controlled projects. 56 | 57 | 58 | But why? 59 | -------- 60 | There's [AutoOpts](http://autogen.sourceforge.net/autoopts.html), 61 | there's [gengetopt](http://www.gnu.org/software/gengetopt/), lately even 62 | glibc takes on arg parsing (see their argp section in the manual); makes 63 | you wonder how we dare create yet another thing for something as simple 64 | as command line argument parsing. 65 | 66 | Well, the killer feature, as we see it, is yuck's approach to specifying 67 | the parser in question. You expect your users to grasp your `--help` 68 | output? Well, there you go, if your users can understand it so can you! 69 | Just type up what you'd like to see in your `--help` output and yuck 70 | will generate a parser that does exactly that. 71 | 72 | 73 | No, the other why? 74 | ------------------ 75 | yuck has been crafted by a heavy gengetopt user, so both the procedure 76 | and the handling is quite similar to the ggo workflow. 77 | 78 | While gengetopt does a great job most of the time, it becomes annoying 79 | in some corner cases, is largely undermaintained, counts on libc for the 80 | actual getopt()'ing, is GPL licensed but first and foremost it is 81 | certainly not the right tool for the job if the job is parsing options 82 | for umbrella programs. 83 | 84 | 85 | And what about docopt? 86 | ---------------------- 87 | While [docopt](http://docopt.org/) is based on essentially the same idea 88 | as yuck, its grammar is formal and doesn't allow for descriptive texts. 89 | Also, docopt's C parser (yuck's primary target) is not fully functional. 90 | 91 | However, if you're currently using docopt and you feel comfortable with 92 | it, there's no need to switch to yuck. 93 | 94 | 95 | Got an example? 96 | --------------- 97 | Consider the following .yuck file: 98 | 99 | Usage: xmpl 100 | Shows off yuck. 101 | 102 | -x, --extra Produce some extra bling. 103 | -o, --output=FILE Output bling to file. 104 | 105 | Process with: 106 | 107 | $ yuck gen xmpl.yuck > xmpl.yucc 108 | 109 | Then include in your `xmpl.c`: 110 | 111 | #include 112 | #include "xmpl.yucc" 113 | 114 | int main(int argc, char *argv[]) 115 | { 116 | yuck_t argp[1]; 117 | 118 | yuck_parse(argp, argc, argv); 119 | 120 | if (argp->extra_flag) { 121 | puts("BLING BLING!"); 122 | } 123 | 124 | yuck_free(argp); 125 | return 0; 126 | } 127 | 128 | And that's it. Some example calls: 129 | 130 | $ xmpl --help 131 | Usage: xmpl [OPTION]... 132 | 133 | Shows off yuck. 134 | 135 | -h, --help display this help and exit 136 | -V, --version output version information and exit 137 | -x, --extra Produce some extra bling. 138 | -o, --output=FILE Output bling to file. 139 | 140 | $ xmpl -x 141 | BLING BLING! 142 | $ 143 | 144 | More details, please 145 | -------------------- 146 | The example above results in an auxiliary struct: 147 | 148 | struct yuck_s { 149 | enum yuck_cmds_e cmd; 150 | 151 | /* left-over arguments, the command string is never a part of this */ 152 | size_t nargs; 153 | char *const *args; 154 | 155 | /* slots common to all commands */ 156 | 157 | /* help is handled automatically */ 158 | /* version is handled automatically */ 159 | unsigned int extra_flag; 160 | const char *output_arg; 161 | }; 162 | 163 | which is filled in when `yuck_parse()` is run. As there are no 164 | subcommands defined this struct will directly be typedef'd to `yuck_t` 165 | and the `cmd` slot at the top will always hold `YUCK_NOCMD`. 166 | 167 | Every occurrence of `-x` or `--extra` on the command line will increase 168 | the count in `extra_flag`, yuck does not distinguish between optional 169 | flags (to occur at most once), flags to occur exactly once, or flags 170 | that can occur multiple times. 171 | 172 | Same goes for every occurrence of `-o` or `--output`, however, the 173 | pointer in `output_arg` will point to the last occurrence on the 174 | commandline. 175 | 176 | Left-over positional arguments will be counted in `nargs` and collected 177 | into `args`. It is never an error to pass in positional arguments. It 178 | is up to the caller of `yuck_parse()` to check the yuck_t representation 179 | of the command line for integrity. 180 | 181 | In a similar fashion, yuck's only types are options with arguments 182 | (which are mapped to const char* or const char** in case of multi-args) 183 | and flags (mapped to unsigned int, representing the number of occurrences 184 | on the command line). Again, it is up to the postprocessing code to 185 | interpret arguments suitably, e.g. convert integer strings to integers, 186 | or constrain a HOSTNAME argument to its legal characters, etc. 187 | 188 | All const char* objects point straight to members of `argv`, i.e. they 189 | are not `strdup()`ed. Changing strings in argv will therefore change 190 | the strings in the yuck_t representation also, and vice versa (after 191 | by-passing the const qualifier). 192 | 193 | 194 | So what about subcommands? 195 | -------------------------- 196 | yuck's command-line interface is generated by yuck itself, so for an 197 | hands-on example have a look there. 198 | 199 | Subcommands are specified through extra usage clauses: 200 | 201 | Usage: xmpl 202 | Shows off yuck. 203 | 204 | -x, --extra Produce some extra bling. 205 | -o, --output=FILE Output bling to file. 206 | 207 | Usage: xmpl turbo [FILE]... 208 | Run xmpl in turbo mode 209 | 210 | -x, --extra-turbo Use more turbos than normal. 211 | 212 | Again, generate a C parser: 213 | 214 | $ yuck gen xmpl-subcommands.yuck 215 | 216 | The auxiliaries generated will now look like: 217 | 218 | typedef union yuck_u yuck_t; 219 | 220 | /* convenience structure for `turbo' */ 221 | struct yuck_cmd_turbo_s { 222 | enum yuck_cmds_e cmd; 223 | 224 | /* left-over arguments, the command string is never a part of this */ 225 | size_t nargs; 226 | char *const *args; 227 | 228 | /* help is handled automatically */ 229 | /* version is handled automatically */ 230 | unsigned int extra_flag; 231 | const char *output_arg; 232 | 233 | unsigned int extra_turbo_flag; 234 | }; 235 | 236 | union yuck_u { 237 | /* generic struct */ 238 | struct { 239 | enum yuck_cmds_e cmd; 240 | 241 | /* left-over arguments, 242 | * the command string is never a part of this */ 243 | size_t nargs; 244 | char *const *args; 245 | 246 | /* slots common to all commands */ 247 | /* help is handled automatically */ 248 | /* version is handled automatically */ 249 | unsigned int extra_flag; 250 | const char *output_arg; 251 | }; 252 | 253 | /* depending on CMD at most one of the following structs is filled in 254 | * if CMD is YUCK_NONE no slots of this union must be accessed */ 255 | struct yuck_cmd_turbo_s turbo; 256 | }; 257 | 258 | and when `yuck_parse()` is run, provided the `turbo` command is given, 259 | the struct yuck_cmd_turbo_s object will be filled in, `cmd` will be set 260 | to `XMPL_CMD_TURBO` in such case. If no command is given the generic 261 | struct at the top of the union will be filled in and `cmd` is set to 262 | `XMPL_CMD_NONE`. 263 | 264 | The structs are carefully generated in a way that allows you to simple 265 | cast a `yuck_t*` to a `struct yuck_cmd_turbo_s*`. 266 | 267 | 268 | And now handing the `--help` output over to help2man again?! 269 | ------------------------------------------------------------ 270 | Nope. Of course not. If we can create something as formal and 271 | definitive as a command-line option parser, we sure as hell can create 272 | something sloppy and informal as a man page (that is, no offence, for 273 | human eyes only anyway). 274 | 275 | yuck comes with a template `yuck.man.m4` for that purpose which is 276 | materialised through the `genman` command: 277 | 278 | $ yuck genman xmpl-subcommands.yuck 279 | 280 | would produce [xmpl-subcommands.man](xmpl-subcommands.html) (which here 281 | for obvious reasons has been run through man2html first). 282 | 283 | 284 | This is all superfluous and utter rubbish because ... 285 | ----------------------------------------------------- 286 | Don't let me stop you there. I'm all ears for feature requests, patches, 287 | criticism and insults, oh, and death threats, of course. 288 | 289 | Best to use the [bug tracker][1], or drop me an [email][2], or just put 290 | a huuuge graffiti [on my house][3]. 291 | 292 | [1]: https://github.com/hroptatyr/yuck/issues 293 | [2]: mailto:devel+yuck@fresse.org 294 | [3]: http://www.fresse.org/yuck/my-house.jpg 295 | [4]: http://opensource.org/licenses/BSD-3-Clause 296 | 297 | 304 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | dnl ------------------------------------------------------------------------- 2 | dnl Autoconf startup. 3 | dnl ------------------------------------------------------------------------- 4 | 5 | AC_PREREQ([2.63]) 6 | AC_INIT([yuck], [0.2.6.GIT], [https://github.com/hroptatyr/yuck]) 7 | AC_CONFIG_AUX_DIR([build-aux]) 8 | AC_CONFIG_HEADERS([src/config.h]) 9 | AC_CONFIG_MACRO_DIR([m4]) 10 | 11 | dnl ------------------------------------------------------------------------- 12 | dnl Local copyright notices. 13 | dnl ------------------------------------------------------------------------- 14 | 15 | AC_COPYRIGHT([dnl 16 | #### Configuration script for yuck 17 | #### Copyright (C) 2013-2024 Sebastian Freundt 18 | 19 | ### Don't edit this script! 20 | ### This script was automatically generated by the `autoconf' program 21 | ### from the file `./configure.ac'. 22 | ### To rebuild it, execute the command 23 | ### autoreconf 24 | ]) 25 | 26 | AM_INIT_AUTOMAKE([foreign parallel-tests dist-xz color-tests]) 27 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 28 | 29 | ## the build chain 30 | AC_PROG_CC([icc gcc cc]) 31 | SXE_CHECK_CC([c11 c1x gnu99 c99]) 32 | SXE_CHECK_CFLAGS 33 | AC_CHECK_TOOLS([AR], [xiar ar], [false]) 34 | AC_C_BIGENDIAN 35 | AC_PROG_RANLIB 36 | 37 | 38 | AX_YUCK_SCMVER([version.mk]) 39 | AC_CONFIG_LINKS([GNUmakefile:GNUmakefile]) 40 | 41 | 42 | AC_CHECK_HEADERS([strings.h]) 43 | 44 | AC_CHECK_FUNCS([getline]) 45 | AC_CHECK_FUNCS([fgetln]) 46 | 47 | ## check for yuck helper 48 | AX_CHECK_YUCK([with_included_yuck="yes"]) 49 | 50 | AX_CHECK_CLITORIS 51 | 52 | 53 | AC_CONFIG_FILES([Makefile]) 54 | AC_CONFIG_FILES([src/Makefile]) 55 | AC_CONFIG_FILES([info/Makefile]) 56 | AC_CONFIG_FILES([test/Makefile]) 57 | AC_OUTPUT 58 | 59 | echo 60 | echo 61 | echo "Build summary" 62 | echo "=============" 63 | echo 64 | echo "[[x]] yuck" 65 | echo 66 | 67 | dnl configure.ac ends here 68 | -------------------------------------------------------------------------------- /info/Makefile.am: -------------------------------------------------------------------------------- 1 | # Help the Developers and yourself. Just use the C locale and settings 2 | # for the compilation. They can still be overriden by make LANG= 3 | # but that is general a not very good idea 4 | LANG=C 5 | LC_ALL=C 6 | 7 | BUILT_SOURCES = 8 | BUILT_MANS = 9 | EXTRA_DIST = $(BUILT_SOURCES) $(BUILT_MANS) 10 | 11 | man1_MANS = 12 | man1_MANS += $(BUILT_MANS) 13 | 14 | BUILT_MANS += yuck.man 15 | 16 | VPATH += $(builddir):$(srcdir):$(top_builddir)/src:$(top_srcdir)/src 17 | EXTRA_DIST += author.h2m 18 | 19 | ## help2man helpers 20 | SUFFIXES = .yuck 21 | SUFFIXES += .man 22 | yuck.man: $(top_builddir)/.version 23 | .yuck.man: 24 | $(AM_V_GEN) YUCK_TEMPLATE_PATH="$(abs_top_srcdir)/src" \ 25 | $(top_builddir)/src/yuck genman \ 26 | -i "$(srcdir)/author.h2m" \ 27 | -o $@ --version-file $(top_builddir)/.version $< 28 | 29 | ## Makefile.am ends here 30 | -------------------------------------------------------------------------------- /info/author.h2m: -------------------------------------------------------------------------------- 1 | [Author] 2 | Written by Sebastian Freundt 3 | 4 | [Reporting bugs] 5 | Report bugs to: https://github.com/hroptatyr/yuck/issues 6 | -------------------------------------------------------------------------------- /m4/clitoris.m4: -------------------------------------------------------------------------------- 1 | dnl clitoris.m4 --- checks necessary for the clitoris test harness 2 | dnl 3 | dnl Copyright (C) 2013-2016 Sebastian Freundt 4 | dnl 5 | dnl Author: Sebastian Freundt 6 | dnl 7 | dnl Redistribution and use in source and binary forms, with or without 8 | dnl modification, are permitted provided that the following conditions 9 | dnl are met: 10 | dnl 11 | dnl 1. Redistributions of source code must retain the above copyright 12 | dnl notice, this list of conditions and the following disclaimer. 13 | dnl 14 | dnl 2. Redistributions in binary form must reproduce the above copyright 15 | dnl notice, this list of conditions and the following disclaimer in the 16 | dnl documentation and/or other materials provided with the distribution. 17 | dnl 18 | dnl 3. Neither the name of the author nor the names of any contributors 19 | dnl may be used to endorse or promote products derived from this 20 | dnl software without specific prior written permission. 21 | dnl 22 | dnl THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR 23 | dnl IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | dnl DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 | dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | dnl CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | dnl SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | dnl BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | dnl WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 31 | dnl OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | dnl IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | dnl 34 | dnl This file is part of clitoris. 35 | 36 | AC_DEFUN([AX_CHECK_CLITORIS], [dnl 37 | ## check for pseudo-tty support 38 | AC_CHECK_HEADERS([pty.h]) 39 | AM_CONDITIONAL([HAVE_PTY_H], [test "${ac_cv_header_pty_h}" = "yes"]) 40 | 41 | ## we might want to use splice(2) 42 | AC_CHECK_FUNCS([splice]) 43 | ])dnl AX_CHECK_CLITORIS 44 | 45 | dnl clitoris.m4 ends here 46 | -------------------------------------------------------------------------------- /m4/sxe-compiler.m4: -------------------------------------------------------------------------------- 1 | dnl compiler.m4 --- compiler magic 2 | dnl 3 | dnl Copyright (C) 2005-2016 Sebastian Freundt 4 | dnl Copyright (c) 2005 Steven G. Johnson 5 | dnl Copyright (c) 2005 Matteo Frigo 6 | dnl 7 | dnl Author: Sebastian Freundt 8 | dnl 9 | dnl Redistribution and use in source and binary forms, with or without 10 | dnl modification, are permitted provided that the following conditions 11 | dnl are met: 12 | dnl 13 | dnl 1. Redistributions of source code must retain the above copyright 14 | dnl notice, this list of conditions and the following disclaimer. 15 | dnl 16 | dnl 2. Redistributions in binary form must reproduce the above copyright 17 | dnl notice, this list of conditions and the following disclaimer in the 18 | dnl documentation and/or other materials provided with the distribution. 19 | dnl 20 | dnl 3. Neither the name of the author nor the names of any contributors 21 | dnl may be used to endorse or promote products derived from this 22 | dnl software without specific prior written permission. 23 | dnl 24 | dnl THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR 25 | dnl IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | dnl DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 | dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 | dnl CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 | dnl SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 31 | dnl BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 32 | dnl WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 33 | dnl OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | dnl IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | dnl 36 | dnl This file is part of SXEmacs. 37 | 38 | ##### http://autoconf-archive.cryp.to/ax_check_compiler_flags.html 39 | ## renamed the prefix to SXE_ 40 | AC_DEFUN([SXE_CHECK_COMPILER_FLAG], [dnl 41 | dnl SXE_CHECK_COMPILER_FLAG([flag], [action-if-accepted], [action-if-not-accepted]) 42 | AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1]) 43 | 44 | ## store werror status, then turn -Werror on 45 | save_ac_[]_AC_LANG_ABBREV[]_werror_flag="${ac_[]_AC_LANG_ABBREV[]_werror_flag}" 46 | AC_LANG_WERROR 47 | 48 | AC_CACHE_VAL(AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flag_$1), [dnl 49 | sxe_save_FLAGS="${[]_AC_LANG_PREFIX[]FLAGS}" 50 | _AC_LANG_PREFIX[]FLAGS="$1" 51 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM($4)], 52 | eval AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flag_$1)="yes", 53 | eval AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flag_$1)="no") 54 | _AC_LANG_PREFIX[]FLAGS="${sxe_save_FLAGS}" 55 | ]) 56 | eval sxe_check_flag=$AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flag_$1) 57 | ac_[]_AC_LANG_ABBREV[]_werror_flag="${save_ac_[]_AC_LANG_ABBREV[]_werror_flag}" 58 | 59 | AC_MSG_RESULT([${sxe_check_flag}]) 60 | if test "${sxe_check_flag}" = "yes"; then 61 | : 62 | $2 63 | else 64 | : 65 | $3 66 | fi 67 | ])dnl SXE_CHECK_COMPILER_FLAG 68 | 69 | AC_DEFUN([SXE_CHECK_PREPROC_FLAG], [dnl 70 | dnl SXE_CHECK_CPP_FLAG([flag], [action-if-found], [action-if-not-found]) 71 | AC_MSG_CHECKING([whether _AC_LANG preprocessor accepts $1]) 72 | 73 | ## store werror status, then turn -Werror on 74 | save_ac_[]_AC_LANG_ABBREV[]_werror_flag="${ac_[]_AC_LANG_ABBREV[]_werror_flag}" 75 | AC_LANG_WERROR 76 | 77 | AC_CACHE_VAL(AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]pp_flag_$1), [dnl 78 | sxe_save_FLAGS="${[]_AC_LANG_PREFIX[]PPFLAGS}" 79 | _AC_LANG_PREFIX[]PPFLAGS="$1" 80 | AC_PREPROC_IFELSE([AC_LANG_PROGRAM()], 81 | eval AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]pp_flag_$1)="yes", 82 | eval AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]pp_flag_$1)="no") 83 | _AC_LANG_PREFIX[]PPFLAGS=$sxe_save_FLAGS 84 | ]) 85 | eval sxe_check_flag=$AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]pp_flag_$1) 86 | ac_[]_AC_LANG_ABBREV[]_werror_flag="${save_ac_[]_AC_LANG_ABBREV[]_werror_flag}" 87 | 88 | AC_MSG_RESULT([${sxe_check_flag}]) 89 | if test "${sxe_check_flag}" = "yes"; then 90 | : 91 | $2 92 | else 93 | : 94 | $3 95 | fi 96 | ])dnl SXE_CHECK_PREPROC_FLAG 97 | 98 | AC_DEFUN([SXE_CHECK_CCLD_FLAG], [dnl 99 | dnl SXE_CHECK_CCLD_FLAG([flag], [action-if-accepted], [action-if-not-accepted]) 100 | AC_MSG_CHECKING([whether _AC_LANG linker accepts $1]) 101 | 102 | ## store werror status, then turn -Werror on 103 | save_ac_[]_AC_LANG_ABBREV[]_werror_flag="${ac_[]_AC_LANG_ABBREV[]_werror_flag}" 104 | AC_LANG_WERROR 105 | 106 | AC_CACHE_VAL(AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flag_$1), [dnl 107 | sxe_save_FLAGS="${[]_AC_LANG_PREFIX[]FLAGS}" 108 | _AC_LANG_PREFIX[]FLAGS="$1" 109 | AC_LINK_IFELSE([AC_LANG_PROGRAM()], 110 | eval AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flag_$1)="yes", 111 | eval AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flag_$1)="no") 112 | _AC_LANG_PREFIX[]FLAGS="${sxe_save_FLAGS}" 113 | ]) 114 | eval sxe_check_flag=$AS_TR_SH(sxe_cv_[]_AC_LANG_ABBREV[]_flag_$1) 115 | ac_[]_AC_LANG_ABBREV[]_werror_flag="${save_ac_[]_AC_LANG_ABBREV[]_werror_flag}" 116 | 117 | AC_MSG_RESULT([${sxe_check_flag}]) 118 | if test "${sxe_check_flag}" = "yes"; then 119 | : 120 | $2 121 | else 122 | : 123 | $3 124 | fi 125 | ])dnl SXE_CHECK_CCLD_FLAG 126 | 127 | 128 | AC_DEFUN([SXE_DEBUGFLAGS], [dnl 129 | ## distinguish between different compilers, no? 130 | SXE_CHECK_COMPILER_FLAG([-g]) 131 | SXE_CHECK_COMPILER_FLAG([-g3]) 132 | 133 | AC_PATH_PROG([DBX], [dbx]) 134 | if test -n "$ac_cv_path_DBX"; then 135 | SXE_CHECK_COMPILER_FLAG([-gstabs]) 136 | SXE_CHECK_COMPILER_FLAG([-gstabs3]) 137 | SXE_CHECK_COMPILER_FLAG([-gxcoff]) 138 | SXE_CHECK_COMPILER_FLAG([-gxcoff3]) 139 | fi 140 | 141 | AC_PATH_PROG([GDB], [gdb]) 142 | if test -n "$ac_cv_path_GDB"; then 143 | SXE_CHECK_COMPILER_FLAG([-ggdb]) 144 | SXE_CHECK_COMPILER_FLAG([-ggdb3]) 145 | fi 146 | 147 | AC_PATH_PROG([SDB], [sdb]) 148 | if test -n "$ac_cv_path_SDB"; then 149 | SXE_CHECK_COMPILER_FLAG([-gcoff]) 150 | SXE_CHECK_COMPILER_FLAG([-gcoff3]) 151 | fi 152 | 153 | ## final evaluation 154 | debugflags="" 155 | ## gdb 156 | if test "$sxe_cv_c_flag__ggdb3" = "yes"; then 157 | debugflags="$debugflags -ggdb3" 158 | elif test "$sxe_cv_c_flag__ggdb" = "yes"; then 159 | debugflags="$debugflags -ggdb" 160 | fi 161 | ## stabs 162 | if test "$sxe_cv_c_flag__gstabs3" = "yes"; then 163 | debugflags="$debugflags -gstabs3" 164 | elif test "$sxe_cv_c_flag__gstabs" = "yes"; then 165 | debugflags="$debugflags -gstabs" 166 | fi 167 | ## coff 168 | if test "$sxe_cv_c_flag__gcoff3" = "yes"; then 169 | debugflags="$debugflags -gcoff3" 170 | elif test "$sxe_cv_c_flag__gcoff" = "yes"; then 171 | debugflags="$debugflags -gcoff" 172 | fi 173 | ## xcoff 174 | if test "$sxe_cv_c_flag__gxcoff3" = "yes"; then 175 | debugflags="$debugflags -gxcoff3" 176 | elif test "$sxe_cv_c_flag__gxcoff" = "yes"; then 177 | debugflags="$debugflags -gxcoff" 178 | fi 179 | 180 | if test -z "debugflags" -a \ 181 | "$sxe_cv_c_flag__g" = "yes"; then 182 | debugflags="$debugflags -g" 183 | fi 184 | 185 | SXE_CHECK_COMPILER_FLAG([-ftime-report]) 186 | SXE_CHECK_COMPILER_FLAG([-fmem-report]) 187 | SXE_CHECK_COMPILER_FLAG([-fvar-tracking]) 188 | SXE_CHECK_COMPILER_FLAG([-save-temps]) 189 | 190 | #if test "$sxe_cv_c_flag__ggdb3" = "yes" -a \ 191 | # "$sxe_cv_c_flag__fvar_tracking" = "yes"; then 192 | # debugflags="$debugflags -fvar-tracking" 193 | #fi 194 | 195 | AC_MSG_CHECKING([for preferred debugging flags]) 196 | AC_MSG_RESULT([${debugflags}]) 197 | ])dnl SXE_DEBUGFLAGS 198 | 199 | AC_DEFUN([SXE_WARNFLAGS], [dnl 200 | ## Calculate warning flags. We separate the flags for warnings from 201 | ## the other flags because we want to force the warnings to be seen 202 | ## by everyone who doesn't specifically override them. 203 | 204 | ## by default we want the -Wall level 205 | SXE_CHECK_COMPILER_FLAG([-Wall], [warnflags="-Wall"]) 206 | 207 | SXE_CHECK_COMPILER_FLAG([-qinfo], [ 208 | warnflags="${warnflags} -qinfo"]) 209 | 210 | SXE_CHECK_COMPILER_FLAG([-Wextra], [ 211 | warnflags="${warnflags} -Wextra"]) 212 | 213 | ## Yuck, bad compares have been worth at 214 | ## least 3 crashes! 215 | ## Warnings about char subscripts are pretty 216 | ## pointless, though, 217 | ## and we use them in various places. 218 | SXE_CHECK_COMPILER_FLAG([-Wsign-compare], [ 219 | warnflags="$warnflags -Wsign-compare"]) 220 | SXE_CHECK_COMPILER_FLAG([-Wno-char-subscripts], [ 221 | warnflags="$warnflags -Wno-char-subscripts"]) 222 | SXE_CHECK_COMPILER_FLAG([-Wundef], [ 223 | warnflags="$warnflags -Wundef"]) 224 | 225 | ## too much at the moment, we rarely define protos 226 | #warnflags="$warnflags -Wmissing-prototypes -Wstrict-prototypes" 227 | 228 | ## somehow clang seems to think -Wpacked is to inform me 229 | ## about how unnecessary the packed attr is, so conditionalise ... 230 | SXE_CHECK_COMPILER_FLAG([-Wpacked], [ 231 | warnflags="$warnflags -Wpacked"], [:], [[ 232 | #if defined __clang__ 233 | # error 234 | #endif /* __clang__ */ 235 | ]]) 236 | 237 | ## glibc is intentionally not `-Wpointer-arith'-clean. 238 | ## Ulrich Drepper has rejected patches to fix 239 | ## the glibc header files. 240 | ## we don't care 241 | SXE_CHECK_COMPILER_FLAG([-Wpointer-arith], [ 242 | warnflags="$warnflags -Wpointer-arith"]) 243 | 244 | SXE_CHECK_COMPILER_FLAG([-Wshadow], [ 245 | warnflags="$warnflags -Wshadow"]) 246 | 247 | ## our code lacks declarations almost all the time 248 | SXE_CHECK_COMPILER_FLAG([-Wmissing-declarations], [ 249 | warnflags="$warnflags -Wmissing-declarations"]) 250 | SXE_CHECK_COMPILER_FLAG([-Wmissing-prototypes], [ 251 | warnflags="$warnflags -Wmissing-prototypes"]) 252 | 253 | ## gcc can't practically inline anything, so exclude this 254 | case "${CC}" in 255 | dnl ( 256 | *"gcc"*) 257 | ;; 258 | dnl ( 259 | *) 260 | SXE_CHECK_COMPILER_FLAG([-Winline], [ 261 | warnflags="$warnflags -Winline"]) 262 | ;; 263 | esac 264 | 265 | SXE_CHECK_COMPILER_FLAG([-Wbad-function-cast], [ 266 | warnflags="$warnflags -Wbad-function-cast"]) 267 | SXE_CHECK_COMPILER_FLAG([-Wcast-qual], [ 268 | warnflags="$warnflags -Wcast-qual"]) 269 | SXE_CHECK_COMPILER_FLAG([-Wcast-align], [ 270 | warnflags="$warnflags -Wcast-align"]) 271 | 272 | ## warn about incomplete switches 273 | ## for gcc, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50422 274 | ## we used to have -Wswitch-default and -Wswitch-enum but that 275 | ## set gcc off quite badly in the nested switch case 276 | SXE_CHECK_COMPILER_FLAG([-Wno-switch], [ 277 | warnflags="$warnflags -Wno-switch"]) 278 | 279 | SXE_CHECK_COMPILER_FLAG([-Wunused-function], [ 280 | warnflags="$warnflags -Wunused-function"]) 281 | SXE_CHECK_COMPILER_FLAG([-Wunused-variable], [ 282 | warnflags="$warnflags -Wunused-variable"]) 283 | SXE_CHECK_COMPILER_FLAG([-Wunused-parameter], [ 284 | warnflags="$warnflags -Wunused-parameter"]) 285 | SXE_CHECK_COMPILER_FLAG([-Wunused-value], [ 286 | warnflags="$warnflags -Wunused-value"]) 287 | SXE_CHECK_COMPILER_FLAG([-Wunused], [ 288 | warnflags="$warnflags -Wunused"]) 289 | SXE_CHECK_COMPILER_FLAG([-Wmaybe-uninitialized], [ 290 | warnflags="${warnflags} -Wmaybe-uninitialized"]) 291 | 292 | SXE_CHECK_COMPILER_FLAG([-Wnopragma], [ 293 | warnflags="$warnflags -Wnopragma"]) 294 | 295 | SXE_CHECK_COMPILER_FLAG([-fdiagnostics-show-option], [ 296 | warnflags="${warnflags} -fdiagnostics-show-option"]) 297 | 298 | SXE_CHECK_COMPILER_FLAG([-Wunknown-pragmas], [ 299 | warnflags="$warnflags -Wunknown-pragmas"]) 300 | SXE_CHECK_COMPILER_FLAG([-Wuninitialized], [ 301 | warnflags="$warnflags -Wuninitialized"]) 302 | SXE_CHECK_COMPILER_FLAG([-Wreorder], [ 303 | warnflags="$warnflags -Wreorder"]) 304 | SXE_CHECK_COMPILER_FLAG([-Wdeprecated], [ 305 | warnflags="$warnflags -Wdeprecated"]) 306 | 307 | SXE_CHECK_COMPILER_FLAG([-Wno-parentheses], [ 308 | warnflags="${warnflags} -Wno-parentheses"]) 309 | 310 | ## icc specific 311 | SXE_CHECK_COMPILER_FLAG([-Wcheck], [ 312 | warnflags="$warnflags -Wcheck"]) 313 | 314 | dnl SXE_CHECK_COMPILER_FLAG([-Wp64], [ 315 | dnl warnflags="$warnflags -Wp64"]) 316 | 317 | SXE_CHECK_COMPILER_FLAG([-Wstrict-aliasing], [ 318 | warnflags="$warnflags -Wstrict-aliasing"]) 319 | 320 | SXE_CHECK_COMPILER_FLAG([-w3], [ 321 | warnflags="$warnflags -w3"]) 322 | 323 | SXE_CHECK_COMPILER_FLAG([-diag-disable 10237], [dnl 324 | warnflags="${warnflags} -diag-disable 10237"], [ 325 | SXE_CHECK_COMPILER_FLAG([-wd 10237], [dnl 326 | warnflags="${warnflags} -wd 10237"])]) 327 | 328 | SXE_CHECK_COMPILER_FLAG([-diag-disable 2102], [dnl 329 | warnflags="${warnflags} -diag-disable 2102"], [ 330 | SXE_CHECK_COMPILER_FLAG([-wd 2102], [dnl 331 | warnflags="${warnflags} -wd 2102"])]) 332 | 333 | SXE_CHECK_COMPILER_FLAG([-debug inline-debug-info], [ 334 | warnflags="${warnflags} -debug inline-debug-info"]) 335 | 336 | SXE_CHECK_COMPILER_FLAG([-diag-enable remark,vec,par], [ 337 | warnflags="${warnflags} -diag-enable remark,vec,par"]) 338 | 339 | ## for dfp754 340 | SXE_CHECK_COMPILER_FLAG([-Wunsuffixed-float-constants], [ 341 | warnflags="$warnflags -Wunsuffixed-float-constants"]) 342 | 343 | AC_MSG_CHECKING([for preferred warning flags]) 344 | AC_MSG_RESULT([${warnflags}]) 345 | ])dnl SXE_WARNFLAGS 346 | 347 | AC_DEFUN([SXE_OPTIFLAGS], [dnl 348 | AC_REQUIRE([SXE_USER_CFLAGS]) 349 | AC_REQUIRE([SXE_WARNFLAGS]) 350 | 351 | case " ${CFLAGS} ${EXTRA_CFLAGS} " in 352 | (*" -O"[[0-9]]" "*) 353 | ;; 354 | (*" -Os "*) 355 | ;; 356 | (*" -Og "*) 357 | ;; 358 | (*" -Ofast "*) 359 | ;; 360 | (*" -O "*) 361 | ;; 362 | (*) 363 | SXE_CHECK_COMPILER_FLAG([-O3], [ 364 | optiflags="${optiflags} -O3"]) 365 | ;; 366 | esac 367 | 368 | SXE_CHECK_COMPILER_FLAG([-ipo], [ 369 | optiflags="${optiflags} -ipo" 370 | 371 | AC_CHECK_TOOLS([AR], [xiar ar], [false]) 372 | AC_CHECK_TOOLS([LD], [xild ld], [false]) 373 | 374 | ## fiddle with xiar and xild params, kick ansi aliasing warnings 375 | if test "${ac_cv_prog_ac_ct_AR}" = "xiar"; then 376 | AR="${AR} -qdiag-disable=2102" 377 | fi 378 | if test "${ac_cv_prog_ac_ct_LD}" = "xild"; then 379 | LD="${LD} -qdiag-disable=2102" 380 | fi 381 | ]) 382 | 383 | SXE_CHECK_COMPILER_FLAG([-no-prec-div], [ 384 | optiflags="${optiflags} -no-prec-div"]) 385 | ])dnl SXE_OPTIFLAGS 386 | 387 | AC_DEFUN([SXE_CC_NATIVE], [dnl 388 | dnl Usage: SXE_CC_NATIVE([yes|no]) 389 | AC_ARG_ENABLE([native], [dnl 390 | AS_HELP_STRING(m4_case([$1], [yes], [--disable-native], [--enable-native]), [ 391 | Use code native to the build machine.])], 392 | [enable_native="${enableval}"], [enable_native="$1"]) 393 | 394 | ## -fast implies -static which is a dream but 395 | ## packager prefer dynamic binaries 396 | dnl SXE_CHECK_COMPILER_FLAG([-fast], [ 397 | dnl optiflags="${optiflags} -fast"]) 398 | 399 | ## auto-vectorisation 400 | dnl SXE_CHECK_COMPILER_FLAG([-axMIC-AVX512,CORE-AVX2,CORE-AVX-I,AVX,SSSE3], [ 401 | dnl optiflags="${optiflags} -axMIC-AVX512,CORE-AVX2,CORE-AVX-I,AVX,SSSE3"]) 402 | 403 | if test "${enable_native}" = "yes"; then 404 | case " ${CFLAGS} ${EXTRA_CFLAGS}" in 405 | (*" -mtune"*) 406 | ## don't tune 407 | ;; 408 | (*" -march"*) 409 | ## don't set march 410 | ;; 411 | (*" -m32 "*) 412 | ## don't bother 413 | ;; 414 | (*" -m64 "*) 415 | ## don't bother 416 | ;; 417 | (*) 418 | SXE_CHECK_COMPILER_FLAG([-xHost], [ 419 | optiflags="${optiflags} -xHost"], [ 420 | ## non-icc 421 | SXE_CHECK_COMPILER_FLAG([-mtune=native -march=native], [ 422 | optiflags="${optiflags} -mtune=native -march=native"]) 423 | ]) 424 | ;; 425 | esac 426 | fi 427 | ])dnl SXE_CC_NATIVE 428 | 429 | AC_DEFUN([SXE_FEATFLAGS], [dnl 430 | ## default flags for needed features 431 | AC_REQUIRE([SXE_CHECK_COMPILER_XFLAG]) 432 | XCCFLAG="${XFLAG}" 433 | 434 | ## recent gentoos went ballistic again, they compile PIE gcc's 435 | ## but there's no way to turn that misconduct off ... 436 | ## however I've got one report about a working PIE build 437 | ## we'll just check for -nopie here, if it works, we turn it on 438 | ## (and hence PIE off) and hope bug 16 remains fixed 439 | SXE_CHECK_COMPILER_FLAG([-nopie], 440 | [featflags="$featflags -nopie"]) 441 | 442 | ## icc and gcc related 443 | ## check if some stuff can be staticalised 444 | ## actually requires SXE_WARNFLAGS so warnings would be disabled 445 | ## that affect the outcome of the following tests 446 | SXE_CHECK_COMPILER_FLAG([-static-intel], [ 447 | featflags="${featflags} -static-intel" 448 | XCCLDFLAGS="${XCCLDFLAGS} \${XCCFLAG} -static-intel"], [:]) 449 | SXE_CHECK_COMPILER_FLAG([-static-libgcc], [ 450 | featflags="${featflags} -static-libgcc" 451 | XCCLDFLAGS="${XCCLDFLAGS} \${XCCFLAG} -static-libgcc"], [:]) 452 | 453 | SXE_CHECK_COMPILER_FLAG([-intel-extensions], [dnl 454 | featflags="${featflags} -intel-extensions"]) 455 | 456 | ## also pass on some diags to the linker 457 | if test "${sxe_cv_c_flag__diag_disable_10237}" = "yes"; then 458 | XCCLDFLAGS="${XCCLDFLAGS} \${XCCFLAG} -diag-disable=10237" 459 | fi 460 | if test "${sxe_cv_c_flag__diag_disable_2102}" = "yes"; then 461 | XCCLDFLAGS="${XCCLDFLAGS} \${XCCFLAG} -diag-disable=2102" 462 | fi 463 | 464 | AC_SUBST([XCCLDFLAGS]) 465 | AC_SUBST([XCCFLAG]) 466 | ])dnl SXE_FEATFLAGS 467 | 468 | AC_DEFUN([SXE_CHECK_COMPILER_XFLAG], [dnl 469 | if test "${XFLAG}" = ""; then 470 | SXE_CHECK_CCLD_FLAG([-XCClinker -foo], [XFLAG="-XCClinker"]) 471 | fi 472 | if test "${XFLAG}" = ""; then 473 | SXE_CHECK_CCLD_FLAG([-Xlinker -foo], [XFLAG="-Xlinker"]) 474 | fi 475 | 476 | AC_SUBST([XFLAG]) 477 | ])dnl SXE_CHECK_COMPILER_XFLAG 478 | 479 | AC_DEFUN([SXE_USER_CFLAGS], [dnl 480 | AC_MSG_CHECKING([for user provided CFLAGS/EXTRA_CFLAGS]) 481 | 482 | CFLAGS="${ac_cv_env_CFLAGS_value}" 483 | AC_MSG_RESULT([${CFLAGS} ${EXTRA_CFLAGS}]) 484 | ])dnl SXE_USER_CFLAGS 485 | 486 | 487 | AC_DEFUN([SXE_CHECK_CFLAGS], [dnl 488 | dnl Usage: SXE_CHECK_CFLAGS([option ...]) 489 | dnl valid options include: 490 | dnl + native[=yes|no] Emit the --enable-native flag 491 | 492 | ## those are passed on to our determined CFLAGS 493 | AC_ARG_VAR([EXTRA_CFLAGS], [C compiler flags to be APPENDED.]) 494 | 495 | ## check for user provided flags 496 | AC_REQUIRE([SXE_USER_CFLAGS]) 497 | ## Use either command line flag, environment var, or autodetection 498 | SXE_DEBUGFLAGS 499 | SXE_WARNFLAGS 500 | SXE_OPTIFLAGS 501 | m4_foreach_w([opt], [$1], [dnl 502 | m4_case(opt, 503 | [native], [SXE_CC_NATIVE], 504 | [native=yes], [SXE_CC_NATIVE([yes])], 505 | [native=no], [SXE_CC_NATIVE([no])]) 506 | ]) 507 | SXE_CFLAGS="${SXE_CFLAGS} ${debugflags} ${optiflags} ${warnflags}" 508 | 509 | SXE_FEATFLAGS 510 | SXE_CFLAGS="${SXE_CFLAGS} ${featflags}" 511 | 512 | save_ac_c_werror_flag="${ac_c_werror_flag}" 513 | 514 | CFLAGS="${CFLAGS} ${SXE_CFLAGS} ${EXTRA_CFLAGS}" 515 | AC_MSG_CHECKING([for preferred CFLAGS]) 516 | AC_MSG_RESULT([${CFLAGS}]) 517 | 518 | AC_MSG_NOTICE([ 519 | If you wish to APPEND your own flags you want to stop here and rerun the 520 | configure script like so: 521 | configure EXTRA_CFLAGS= 522 | 523 | If you wish to OVERRIDE these flags you want to stop here too and rerun 524 | the configure script like this: 525 | configure CFLAGS= 526 | 527 | You can always override the determined CFLAGS, partially or totally, 528 | using 529 | make -C CFLAGS= [target] 530 | or 531 | make CFLAGS= [target] 532 | respectively 533 | ]) 534 | 535 | ac_c_werror_flag="${save_ac_c_werror_flag}" 536 | ])dnl SXE_CHECK_CFLAGS 537 | 538 | AC_DEFUN([SXE_CHECK_CC], [dnl 539 | dnl SXE_CHECK_CC([STANDARDS]) 540 | dnl standards are flavours supported by the compiler chosen with AC_PROG_CC 541 | pushdef([stds], m4_default([$1], [gnu11 c11 gnu99 c99])) 542 | 543 | AC_REQUIRE([AC_CANONICAL_HOST]) 544 | AC_REQUIRE([AC_CANONICAL_BUILD]) 545 | AC_REQUIRE([AC_PROG_CPP]) 546 | AC_REQUIRE([AC_PROG_CC]) 547 | 548 | AC_HEADER_STDC 549 | 550 | case "${CC}" in dnl ( 551 | *"-std="*) 552 | ## user specified a std value already 553 | ;; 554 | dnl ( 555 | *) 556 | for i in []stds[]; do 557 | SXE_CHECK_COMPILER_FLAG([-std="${i}"], [ 558 | std="-std=${i}" 559 | save_CC="${CC}" 560 | CC="${CC} ${std}" 561 | SXE_CHECK_ANON_STRUCTS_DECL 562 | CC="${save_CC}" 563 | if test "${sxe_cv_have_anon_structs_decl}" \ 564 | = "yes"; then 565 | break 566 | fi 567 | ]) 568 | done 569 | 570 | AC_MSG_CHECKING([for preferred CC std]) 571 | AC_MSG_RESULT([${std}]) 572 | CC="${CC} ${std}" 573 | 574 | ## while we're at it, check for anon initialising too 575 | SXE_CHECK_ANON_STRUCTS_INIT 576 | ## oh and sloppy sloppy init 577 | SXE_CHECK_SLOPPY_STRUCTS_INIT 578 | ;; 579 | esac 580 | 581 | popdef([stds]) 582 | ])dnl SXE_CHECK_CC 583 | 584 | AC_DEFUN([SXE_CHECK_ANON_STRUCTS_INIT], [ 585 | AC_MSG_CHECKING([dnl 586 | whether C compiler can initialise anonymous structs and unions]) 587 | AC_LANG_PUSH([C]) 588 | 589 | ## backup our CFLAGS and unset it 590 | save_CFLAGS="${CFLAGS}" 591 | CFLAGS="" 592 | 593 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 594 | union __test_u { 595 | int i; 596 | struct { 597 | char c; 598 | char padc; 599 | short int pads; 600 | }; 601 | }; 602 | ]], [[ 603 | union __test_u tmp = {.c = '4'}; 604 | ]])], [ 605 | sxe_cv_have_anon_structs_init="yes" 606 | ], [ 607 | sxe_cv_have_anon_structs_init="no" 608 | ]) 609 | AC_MSG_RESULT([${sxe_cv_have_anon_structs_init}]) 610 | 611 | ## restore CFLAGS 612 | CFLAGS="${save_CFLAGS}" 613 | 614 | if test "${sxe_cv_have_anon_structs_init}" = "yes"; then 615 | AC_DEFINE([HAVE_ANON_STRUCTS_INIT], [1], [dnl 616 | Whether c11 anon struct initialising works]) 617 | $1 618 | : 619 | else 620 | $2 621 | : 622 | fi 623 | AC_LANG_POP() 624 | ])dnl SXE_CHECK_ANON_STRUCTS_INIT 625 | 626 | AC_DEFUN([SXE_CHECK_ANON_STRUCTS_DECL], [ 627 | AC_MSG_CHECKING([dnl 628 | whether C compiler can understand anonymous structs and unions]) 629 | AC_LANG_PUSH([C]) 630 | 631 | ## backup our CFLAGS and unset it 632 | save_CFLAGS="${CFLAGS}" 633 | CFLAGS="" 634 | 635 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 636 | union __test_u { 637 | int i; 638 | struct { 639 | char c; 640 | char padc; 641 | short int pads; 642 | }; 643 | }; 644 | ]], [[ 645 | /* nothing to do really*/ 646 | union __test_u foo; 647 | foo.c = 0; 648 | ]])], [ 649 | sxe_cv_have_anon_structs_decl="yes" 650 | ], [ 651 | sxe_cv_have_anon_structs_decl="no" 652 | ]) 653 | AC_MSG_RESULT([${sxe_cv_have_anon_structs_decl}]) 654 | 655 | ## restore CFLAGS 656 | CFLAGS="${save_CFLAGS}" 657 | 658 | if test "${sxe_cv_have_anon_structs_decl}" = "yes"; then 659 | AC_DEFINE([HAVE_ANON_STRUCTS_DECL], [1], [dnl 660 | Whether c11 anon structs declaring works]) 661 | $1 662 | : 663 | else 664 | $2 665 | : 666 | fi 667 | AC_LANG_POP() 668 | ])dnl SXE_CHECK_ANON_STRUCTS_DECL 669 | 670 | AC_DEFUN([SXE_CHECK_SLOPPY_STRUCTS_INIT], [ 671 | AC_LANG_PUSH([C]) 672 | 673 | ## backup our CFLAGS and unset it 674 | save_CFLAGS="${CFLAGS}" 675 | CFLAGS="-Werror" 676 | 677 | SXE_CHECK_COMPILER_FLAG([-Wmissing-field-initializers], [ 678 | CFLAGS="${CFLAGS} -Wmissing-field-initializers"]) 679 | 680 | AC_MSG_CHECKING([dnl 681 | whether C compiler can initialise structs and unions in a sloppy way]) 682 | 683 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 684 | struct __test_s { 685 | int i; 686 | int j; 687 | }; 688 | ]], [[ 689 | struct __test_s tmp = {}; 690 | ]])], [ 691 | sxe_cv_have_sloppy_structs_init="yes" 692 | ], [ 693 | sxe_cv_have_sloppy_structs_init="no" 694 | ]) 695 | AC_MSG_RESULT([${sxe_cv_have_sloppy_structs_init}]) 696 | 697 | ## restore CFLAGS 698 | CFLAGS="${save_CFLAGS}" 699 | 700 | if test "${sxe_cv_have_sloppy_structs_init}" = "yes"; then 701 | AC_DEFINE([HAVE_SLOPPY_STRUCTS_INIT], [1], [dnl 702 | Whether sloppy struct initialising works]) 703 | $1 704 | : 705 | else 706 | $2 707 | : 708 | fi 709 | AC_LANG_POP() 710 | ])dnl SXE_CHECK_SLOPPY_STRUCTS_INIT 711 | 712 | AC_DEFUN([SXE_CHECK_INTRINS], [dnl 713 | AC_CHECK_HEADERS([immintrin.h]) 714 | AC_CHECK_HEADERS([x86intrin.h]) 715 | AC_CHECK_HEADERS([ia32intrin.h]) 716 | AC_CHECK_HEADERS([popcntintrin.h]) 717 | AC_CHECK_TYPES([__m128i], [], [], [[ 718 | #if defined HAVE_X86INTRIN_H 719 | # include 720 | #elif defined HAVE_IMMINTRIN_H 721 | # include 722 | #endif 723 | ]]) 724 | AC_CHECK_TYPES([__m256i], [], [], [[ 725 | #if defined HAVE_X86INTRIN_H 726 | # include 727 | #elif defined HAVE_IMMINTRIN_H 728 | # include 729 | #endif 730 | ]]) 731 | AC_CHECK_TYPES([__m512i], [], [], [[ 732 | #if defined HAVE_X86INTRIN_H 733 | # include 734 | #elif defined HAVE_IMMINTRIN_H 735 | # include 736 | #endif 737 | ]]) 738 | AC_CHECK_TYPES([__mmask64], [], [], [[ 739 | #if defined HAVE_X86INTRIN_H 740 | # include 741 | #elif defined HAVE_IMMINTRIN_H 742 | # include 743 | #endif 744 | ]]) 745 | ])dnl SXE_CHECK_INTRINS 746 | 747 | AC_DEFUN([SXE_CHECK_SIMD], [dnl 748 | dnl Usage: SXE_CHECK_SIMD([INTRIN], [[SNIPPET], [IF-FOUND], [IF-NOT-FOUND]]) 749 | AC_REQUIRE([SXE_CHECK_INTRINS]) 750 | 751 | AC_MSG_CHECKING([for SIMD routine $1]) 752 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ 753 | #if defined HAVE_IA32INTRIN_H 754 | # include 755 | #endif 756 | #if defined HAVE_X86INTRIN_H 757 | # include 758 | #endif 759 | #if defined HAVE_IMMINTRIN_H 760 | # include 761 | #endif 762 | #if defined HAVE_POPCNTINTRIN_H 763 | # include 764 | #endif 765 | ]], [ifelse([$2],[],[$1(0U)],[$2]);])], [ 766 | eval AS_TR_SH(ac_cv_func_$1)="yes" 767 | AC_DEFINE(AS_TR_CPP([HAVE_$1]), [1], [dnl 768 | Define to 1 if you have the `$1' simd routine]) 769 | $3 770 | ], [ 771 | eval AS_TR_SH(ac_cv_func_$1)="no" 772 | $4 773 | ]) 774 | AC_MSG_RESULT([${ac_cv_func_$1}]) 775 | ])dnl SXE_CHECK_SIMD 776 | 777 | AC_DEFUN([SXE_CHECK_CILK], [dnl 778 | dnl Usage: SXE_CHECK_CILK([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) 779 | dnl defines sxe_cv_feat_cilk to "yes" if applicable, "no" otherwise 780 | dnl also AC_DEFINEs HAVE_CILK 781 | AC_CHECK_HEADERS([cilk/cilk.h]) 782 | 783 | save_CFLAGS="${CFLAGS}" 784 | SXE_CHECK_COMPILER_FLAG([-fcilkplus], [CFLAGS="${CFLAGS} -fcilkplus"]) 785 | 786 | AC_MSG_CHECKING([whether Cilk+ keywords work]) 787 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ 788 | #include 789 | #if defined HAVE_CILK_CILK_H 790 | # include 791 | #else /* !HAVE_CILK_CILK_H */ 792 | # define cilk_spawn _Cilk_spawn 793 | # define cilk_sync _Cilk_sync 794 | # define cilk_for _Cilk_for 795 | #endif /* HAVE_CILK_CILK_H */ 796 | 797 | static char *trick; 798 | 799 | static int pcmp(const void *x, const void *y) 800 | { 801 | return (const char*)x - (const char*)y; 802 | } 803 | ]], [ 804 | int x = 0; 805 | int j; 806 | 807 | cilk_spawn qsort(trick, 1, 2, pcmp); 808 | qsort(trick + 4, 1, 2, pcmp); 809 | cilk_sync; 810 | 811 | cilk_for(j = 0; j < 8; j++) { 812 | x++; 813 | } 814 | ])], [ 815 | AC_DEFINE([HAVE_CILK], [1], [define when compiler supports Cilk+ keywords]) 816 | sxe_cv_feat_cilk="yes" 817 | $1 818 | ], [ 819 | CFLAGS="${save_CFLAGS}" 820 | sxe_cv_feat_cilk="no" 821 | $2 822 | ]) 823 | AC_MSG_RESULT([${sxe_cv_feat_cilk}]) 824 | ])dnl SXE_CHECK_CILK 825 | 826 | dnl sxe-compiler.m4 ends here 827 | -------------------------------------------------------------------------------- /m4/yuck.m4: -------------------------------------------------------------------------------- 1 | dnl yuck.m4 --- yuck goodies 2 | dnl 3 | dnl Copyright (C) 2013-2016 Sebastian Freundt 4 | dnl 5 | dnl Author: Sebastian Freundt 6 | dnl 7 | dnl Redistribution and use in source and binary forms, with or without 8 | dnl modification, are permitted provided that the following conditions 9 | dnl are met: 10 | dnl 11 | dnl 1. Redistributions of source code must retain the above copyright 12 | dnl notice, this list of conditions and the following disclaimer. 13 | dnl 14 | dnl 2. Redistributions in binary form must reproduce the above copyright 15 | dnl notice, this list of conditions and the following disclaimer in the 16 | dnl documentation and/or other materials provided with the distribution. 17 | dnl 18 | dnl 3. Neither the name of the author nor the names of any contributors 19 | dnl may be used to endorse or promote products derived from this 20 | dnl software without specific prior written permission. 21 | dnl 22 | dnl THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR 23 | dnl IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | dnl DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 | dnl FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | dnl CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 28 | dnl SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | dnl BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30 | dnl WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 31 | dnl OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 32 | dnl IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | dnl 34 | dnl This file is part of yuck. 35 | 36 | AC_DEFUN([AX_CHECK_M4_BUFFERS], [dnl 37 | AC_MSG_CHECKING([for m4 with sufficient capabilities]) 38 | 39 | AC_ARG_VAR([M4], [full path to the m4 tool]) 40 | probe_M4="${M4-m4}" 41 | if ${probe_M4} >/dev/null 2>&1 \ 42 | -Dx='y y y y y y y y y y y y y y y y' \ 43 | -Dy='z z z z z z z z z z z z z z z z' \ 44 | -Dz='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0' <<'EOF' 45 | [define(`foo', x)] 46 | EOF 47 | then 48 | ## ah well done 49 | AC_MSG_RESULT([${probe_M4}]) 50 | M4="${probe_M4}" 51 | else 52 | ## check if a little buffer massage solves the problem 53 | probe_M4="${M4-m4} -B16384" 54 | if ${probe_M4} >/dev/null 2>&1 \ 55 | -Dx='y y y y y y y y y y y y y y y y' \ 56 | -Dy='z z z z z z z z z z z z z z z z' \ 57 | -Dz='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0' <<'EOF' 58 | [define(`foo', x)] 59 | EOF 60 | then 61 | ## very well then, let's use -B 62 | AC_MSG_RESULT([${probe_M4}]) 63 | M4="${probe_M4}" 64 | else 65 | AC_MSG_WARN([m4 on this machine might suffer from big buffers.]) 66 | M4="${M4-m4}" 67 | fi 68 | fi 69 | 70 | AC_DEFINE_UNQUOTED([YUCK_M4], ["${M4}"], [m4 value used for yuck build]) 71 | ])dnl AX_CHECK_M4_BUFFERS 72 | 73 | AC_DEFUN([AX_CHECK_YUCK], [dnl 74 | AC_ARG_WITH([included-yuck], [dnl 75 | AS_HELP_STRING([--with-included-yuck], [ 76 | Use included copy of the yuck command line parser generator 77 | instead of the system-wide one.])], [with_included_yuck="${withval}"], [with_included_yuck="$1"]) 78 | 79 | AC_REQUIRE([AX_CHECK_M4_BUFFERS]) 80 | if test "${with_included_yuck}" = "no"; then 81 | AC_PATH_PROG([YUCK], [yuck]) 82 | AC_ARG_VAR([YUCK], [full path to the yuck tool]) 83 | 84 | if test -n "${YUCK}"; then 85 | ## see what m4 they used back then 86 | YUCK_M4=`${YUCK} config --m4 2>/dev/null` 87 | M4="${YUCK_M4-$M4}" 88 | else 89 | YUCK="yuck" 90 | fi 91 | else 92 | AC_MSG_CHECKING([for yuck]) 93 | AC_MSG_RESULT([using included]) 94 | YUCK="${YUCK-yuck}" 95 | fi 96 | AM_CONDITIONAL([HAVE_YUCK], [test "${with_included_yuck}" = "no"]) 97 | 98 | ## further requirement is either getline() or fgetln() 99 | AC_CHECK_FUNCS([getline]) 100 | AC_CHECK_FUNCS([fgetln]) 101 | ])dnl AX_CHECK_YUCK 102 | 103 | AC_DEFUN([AX_YUCK_SCMVER], [dnl 104 | ## initially generate version.mk and yuck.version here 105 | ## because only GNU make can do this at make time 106 | pushdef([vfile], [$1]) 107 | 108 | AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) 109 | AC_LANG_PUSH([C]) 110 | AC_PROG_CC_C99 111 | ## use our yuck-scmver tool 112 | AC_MSG_CHECKING([for stipulated version files]) 113 | save_CPPFLAGS="${CPPFLAGS}" 114 | CPPFLAGS="-I${srcdir}/src -I${ac_aux_dir} ${CPPFLAGS}" 115 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ 116 | #define CONFIGURE 117 | #define _XOPEN_SOURCE 600 118 | #define VERSION_FILE "${srcdir}/.version" 119 | #include "yuck-scmver.c" 120 | ]])], [STIP_VERSION=`./conftest$EXEEXT`], [AC_MSG_RESULT([none])], [dnl 121 | AC_MSG_RESULT([impossible, cross-compiling]) 122 | if test -f "[]vfile[]" -o \ 123 | -f "${srcdir}/[]vfile[]" -o \ 124 | -f "${srcdir}/.version"; then 125 | AC_MSG_NOTICE([ 126 | Files that (possibly) mandate versions have been detected. 127 | These are `]vfile[' or `${srcdir}/]vfile[' or `${srcdir}/.version'. 128 | However, their contents cannot be automatically checked for integrity 129 | due to building for a platform other than the current one 130 | (cross-compiling). 131 | 132 | I will proceed with the most conservative guess for the stipulated 133 | version, which is `${VERSION}'. 134 | 135 | If that appears to be wrong, or needs overriding, please edit the 136 | aforementioned files manually. 137 | 138 | Also note, even though this project comes with all the tools to 139 | perform a successful bootstrap for any of the files above, should 140 | they go out of date or be deleted, they don't support cross-builds. 141 | ]) 142 | fi 143 | ]) 144 | CPPFLAGS="${save_CPPFLAGS}" 145 | AC_LANG_POP([C]) 146 | 147 | if test -n "${STIP_VERSION}"; then 148 | VERSION="${STIP_VERSION}" 149 | fi 150 | ## also massage version.mk file 151 | if test -f "[]vfile[]" -a ! -w "[]vfile[]"; then 152 | : 153 | elif test -f "${srcdir}/[]vfile[]"; then 154 | ## make sure it's in the builddir as well 155 | cp -p "${srcdir}/[]vfile[]" "[]vfile[]" 2>/dev/null 156 | elif test -f "${srcdir}/[]vfile[].in"; then 157 | ${M4-m4} -DYUCK_SCMVER_VERSION="${VERSION}" \ 158 | "${srcdir}/[]vfile[].in" > "[]vfile[]" 159 | else 160 | echo "VERSION = ${VERSION}" > "[]vfile[]" 161 | fi 162 | ## make sure .version is generated (for version.mk target in GNUmakefile) 163 | if test -f "${srcdir}/.version"; then 164 | cp -p "${srcdir}/.version" ".version" 2>/dev/null 165 | else 166 | echo "v${VERSION}" > ".version" 2>/dev/null 167 | fi 168 | 169 | popdef([vfile]) 170 | ])dnl AX_YUCK_SCMVER 171 | 172 | dnl yuck.m4 ends here 173 | -------------------------------------------------------------------------------- /snap/snapcraft.yaml: -------------------------------------------------------------------------------- 1 | name: yuck 2 | version: '0.2.4-GIT' 3 | summary: Command line option parser for C. 4 | description: | 5 | A command line option parser generator for C that works with 6 | only household ingredients (a C compiler and the m4 macro 7 | processor) and supports: 8 | + GNU-style long options (--blah) 9 | + condensable short options (-xab for -x -a -b) 10 | + optional arguments to long and short options (--foo[=BAR]) 11 | + multiple occurrence of options (-vvv) 12 | + does not depend on libc's getopt() nor getopt_long() 13 | grade: stable 14 | confinement: strict 15 | 16 | apps: 17 | yuck: 18 | command: bin/yuck 19 | 20 | parts: 21 | yuck: 22 | plugin: autotools 23 | source: https://github.com/hroptatyr/yuck.git 24 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | # Help the Developers and yourself. Just use the C locale and settings 2 | # for the compilation. They can still be overriden by make LANG= 3 | # but that is general a not very good idea 4 | 5 | LANG = C 6 | LC_ALL = C 7 | 8 | AM_CFLAGS = $(EXTRA_CFLAGS) 9 | 10 | bin_PROGRAMS = 11 | noinst_PROGRAMS = 12 | pkglib_LIBRARIES = 13 | pkgdata_DATA = 14 | noinst_LIBRARIES = 15 | BUILT_SOURCES = 16 | EXTRA_DIST = $(BUILT_SOURCES) 17 | DISTCLEANFILES = 18 | 19 | include $(srcdir)/yuck.am 20 | 21 | noinst_PROGRAMS += yuck-scmver 22 | yuck_scmver_SOURCES = yuck-scmver.c yuck-scmver.h 23 | yuck_scmver_CPPFLAGS = $(yuck_CPPFLAGS) 24 | yuck_scmver_CPPFLAGS += -DBOOTSTRAP 25 | 26 | ## fiddle with yuck_CPPFLAGS 27 | yuck_CPPFLAGS += -DHAVE_VERSION_H 28 | ## include version info 29 | yuck_SOURCES += version.c version.h version.c.in 30 | ## and make it an installed thing 31 | bin_PROGRAMS += yuck 32 | 33 | DISTCLEANFILES += version.c 34 | 35 | pkgdata_DATA += yuck.m4 36 | pkgdata_DATA += yuck-scmver.m4 37 | pkgdata_DATA += yuck-coru.c.m4 38 | pkgdata_DATA += yuck-coru.h.m4 39 | pkgdata_DATA += yuck.man.m4 40 | pkgdata_DATA += yuck.mk 41 | pkgdata_DATA += yuck.am 42 | EXTRA_DIST += $(pkgdata_DATA) 43 | 44 | ## version rules 45 | version.c: $(top_builddir)/.version version.c.in 46 | $(AM_V_GEN) \ 47 | if test "$(MAKECMDGOALS)" != "am--refresh"; then \ 48 | $(MAKE) -C $(builddir) yuck-scmver$(EXEEXT); \ 49 | $(builddir)/yuck-scmver$(EXEEXT) \ 50 | $(srcdir)/version.c.in $< | \ 51 | $(M4) - $(srcdir)/version.c.in > $@; \ 52 | fi 53 | 54 | ## for dist or dist check we need binaries, so help2man can work 55 | dist-hook: $(bin_PROGRAMS) 56 | 57 | ## Create preprocessor output (debugging purposes only) 58 | .c.i: 59 | $(COMPILE) -E -o $@ $< 60 | 61 | ## Create assembler output (debugging purposes only) 62 | .c.s: 63 | $(COMPILE) -S -c $(AM_CFLAGS) $< 64 | 65 | ## Makefile.am ends here 66 | -------------------------------------------------------------------------------- /src/version.c.in: -------------------------------------------------------------------------------- 1 | /* -*- c -*- */ 2 | #include "version.h" 3 | 4 | const char yuck_version_string[] = "yuck YUCK_SCMVER_VERSION"; 5 | -------------------------------------------------------------------------------- /src/version.h: -------------------------------------------------------------------------------- 1 | #ifndef INCLUDED_version_h_ 2 | #define INCLUDED_version_h_ 3 | 4 | extern const char yuck_version_string[]; 5 | #define package_string yuck_version_string 6 | 7 | #endif /* INCLUDED_version_h_ */ 8 | -------------------------------------------------------------------------------- /src/yuck-coru.c.m4: -------------------------------------------------------------------------------- 1 | /* -*- c -*- */ 2 | changequote`'changequote([,])dnl 3 | changecom([#])dnl 4 | #if defined HAVE_CONFIG_H 5 | # include "config.h" 6 | #endif /* HAVE_CONFIG_H */ 7 | #if defined HAVE_VERSION_H 8 | # include "version.h" 9 | #endif /* HAVE_VERSION_H */ 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | changecom([])dnl 16 | ifdef([YUCK_HEADER], [dnl 17 | #include "YUCK_HEADER" 18 | ])dnl 19 | changecom([#])dnl 20 | 21 | #if defined __INTEL_COMPILER 22 | # pragma warning (push) 23 | # pragma warning (disable:177) 24 | # pragma warning (disable:111) 25 | # pragma warning (disable:3280) 26 | #elif defined __GNUC__ 27 | # if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 6 28 | # pragma GCC diagnostic push 29 | # endif /* GCC version */ 30 | # pragma GCC diagnostic ignored "-Wunused-label" 31 | # pragma GCC diagnostic ignored "-Wunused-variable" 32 | # pragma GCC diagnostic ignored "-Wunused-function" 33 | # pragma GCC diagnostic ignored "-Wshadow" 34 | #endif /* __INTEL_COMPILER */ 35 | pushdef([DEFUN], ifdef([YUCK_HEADER], [], [static]))[]dnl 36 | 37 | 38 | static inline bool 39 | yuck_streqp(const char *s1, const char *s2) 40 | { 41 | return !strcmp(s1, s2); 42 | } 43 | 44 | /* for multi-args */ 45 | static inline char** 46 | yuck_append(char **array, size_t n, char *val) 47 | { 48 | if (!(n % 16U)) { 49 | /* resize */ 50 | void *tmp = realloc(array, (n + 16U) * sizeof(*array)); 51 | if (tmp == NULL) { 52 | free(array); 53 | return NULL; 54 | } 55 | /* otherwise make it persistent */ 56 | array = tmp; 57 | } 58 | array[[n]] = val; 59 | return array; 60 | } 61 | 62 | static enum yuck_cmds_e yuck_parse_cmd(const char *cmd) 63 | { 64 | if (0) { 65 | ; 66 | }foreachq([__CMD], yuck_cmds(), [ else if (yuck_streqp(cmd, "yuck_cmd_string(defn([__CMD]))")) { 67 | return yuck_cmd(defn([__CMD])); 68 | }]) else { 69 | /* error here? */ 70 | fprintf(stderr, "YUCK_UMB_STR: invalid command `%s'\n\ 71 | Try `--help' for a list of commands.\n", cmd); 72 | } 73 | return (enum yuck_cmds_e)-1; 74 | } 75 | 76 | 77 | DEFUN int yuck_parse(yuck_t tgt[[static 1U]], int argc, char *argv[[]]) 78 | { 79 | char *op; 80 | int i; 81 | 82 | /* we'll have at most this many args */ 83 | memset(tgt, 0, sizeof(*tgt)); 84 | if ((tgt->args = calloc(argc, sizeof(*tgt->args))) == NULL) { 85 | return -1; 86 | } 87 | ifdef([YUCK_MAX_POSARGS], [], [define([YUCK_MAX_POSARGS], [(size_t)-1])])dnl 88 | for (i = 1; i < argc && tgt->nargs < YUCK_MAX_POSARGS; i++) { 89 | op = argv[[i]]; 90 | 91 | switch (*op) { 92 | case '-': 93 | /* could be an option */ 94 | switch (*++op) { 95 | default: 96 | /* could be glued into one */ 97 | for (; *op; op++) { 98 | yield(shortopt, *op); 99 | } 100 | break; 101 | case '-': 102 | if (*++op == '\0') { 103 | i++; 104 | yield(dashdash); 105 | break; 106 | } 107 | yield(longopt, op); 108 | break; 109 | case '\0': 110 | goto plain_dash; 111 | } 112 | break; 113 | default: 114 | plain_dash: 115 | yield(arg, op); 116 | break; 117 | } 118 | } 119 | if (i < argc) { 120 | op = argv[[i]]; 121 | 122 | if (*op++ == '-' && *op++ == '-' && !*op) { 123 | /* another dashdash, filter out */ 124 | i++; 125 | } 126 | } 127 | /* has to be here as the max_pargs condition might drive us here */ 128 | coroutine(dashdash) 129 | { 130 | /* dashdash loop, pile everything on tgt->args 131 | * don't check for subcommands either, this is in accordance to 132 | * the git tool which won't accept commands after -- */ 133 | for (; i < argc; i++) { 134 | tgt->args[[tgt->nargs++]] = argv[[i]]; 135 | } 136 | } 137 | return 0; 138 | 139 | coroutine(longopt) 140 | { 141 | /* split into option and arg part */ 142 | char *arg; 143 | 144 | if ((arg = strchr(op, '=')) != NULL) { 145 | /* \nul this one out */ 146 | *arg++ = '\0'; 147 | } 148 | 149 | switch (tgt->cmd) { 150 | default: 151 | yield(yuck_cmd()[_longopt]); 152 | break; 153 | foreachq([__CMD], yuck_cmds(), [case yuck_cmd(defn([__CMD])): 154 | yield(yuck_cmd(defn([__CMD]))[_longopt]); 155 | break; 156 | ])} 157 | resume; 158 | 159 | dnl TYPE actions 160 | pushdef([yuck_flag_action], [tgt->yuck_slot([$1], [$2])++; ifdef([YOPT_ALLOW_UNKNOWN_DASHDASH], [], [goto xtra_chk])])dnl 161 | pushdef([yuck_arg_action], [tgt->yuck_slot([$1], [$2]) = arg ?: argv[[++i]]])dnl 162 | pushdef([yuck_arg_opt_action], [tgt->yuck_slot([$1], [$2]) = arg ?: YUCK_OPTARG_NONE])dnl 163 | pushdef([yuck_arg_mul_action], [tgt->yuck_slot([$1], [$2]) = 164 | yuck_append( 165 | tgt->yuck_slot([$1], [$2]), tgt->yuck_cnt_slot([$1], [$2])++, 166 | arg ?: argv[[++i]]); 167 | if (tgt->yuck_slot([$1], [$2]) == NULL) { 168 | return -1; 169 | }])dnl 170 | pushdef([yuck_arg_mul_opt_action], [tgt->yuck_slot([$1], [$2]) = 171 | yuck_append( 172 | tgt->yuck_slot([$1], [$2]), tgt->yuck_cnt_slot([$1], [$2])++, 173 | arg ?: YUCK_OPTARG_NONE); 174 | if (tgt->yuck_slot([$1], [$2]) == NULL) { 175 | return -1; 176 | }])dnl 177 | pushdef([yuck_auto_action], [/* invoke auto action and exit */ 178 | yuck_auto_[]yuck_canon([$1], [$2])(tgt); 179 | resume_at(success)])dnl 180 | 181 | foreachq([__CMD], yuck_umbcmds(), [coroutine(yuck_cmd(defn([__CMD]))[_longopt]) 182 | { 183 | if (0) { 184 | ; 185 | }dnl 186 | foreachq([__IDN], yuck_idents(defn([__CMD])), [ dnl 187 | pushdef([long], yuck_long(defn([__IDN]), defn([__CMD])))[]dnl 188 | ifelse(defn([long]), [], [divert(-1)])dnl 189 | else if (yuck_streqp(op, "defn([long])")) { 190 | popdef([long])[]dnl 191 | dnl now simply expand yuck_foo_action: 192 | yuck_option_action(defn([__IDN]), defn([__CMD])); 193 | }dnl 194 | divert[]dnl 195 | ]) else { 196 | ifelse(defn([__CMD]), [], [dnl 197 | ifdef([YOPT_ALLOW_UNKNOWN_DASHDASH], [dnl 198 | /* just treat it as argument then */ 199 | resume_at(arg); 200 | ], [dnl 201 | /* grml */ 202 | fprintf(stderr, "YUCK_UMB_STR: unrecognized option `--%s'\n", op); 203 | resume_at(failure); 204 | xtra_chk: 205 | if (arg != NULL) { 206 | fprintf(stderr, "YUCK_UMB_STR: option `--%s' doesn't allow an argument\n", op); 207 | resume_at(failure); 208 | } 209 | ])dnl 210 | ], [dnl 211 | resume_at(yuck_cmd()[_longopt]); 212 | ])dnl 213 | } 214 | if (i >= argc) { 215 | fprintf(stderr, "YUCK_UMB_STR: option `--%s' requires an argument\n", op); 216 | resume_at(failure); 217 | } 218 | resume; 219 | } 220 | ]) 221 | popdef([yuck_flag_action])dnl 222 | popdef([yuck_arg_action])dnl 223 | popdef([yuck_arg_mul_action])dnl 224 | popdef([yuck_arg_opt_action])dnl 225 | popdef([yuck_arg_mul_opt_action])dnl 226 | popdef([yuck_auto_action])dnl 227 | } 228 | 229 | coroutine(shortopt) 230 | { 231 | char *arg = op + 1U; 232 | 233 | switch (tgt->cmd) { 234 | default: 235 | yield(yuck_cmd()[_shortopt]); 236 | break; 237 | foreachq([__CMD], yuck_cmds(), [case yuck_cmd(defn([__CMD])): 238 | yield(yuck_cmd(defn([__CMD]))[_shortopt]); 239 | break; 240 | ])} 241 | resume; 242 | 243 | dnl TYPE actions 244 | pushdef([yuck_flag_action], [tgt->yuck_slot([$1], [$2])++])dnl 245 | pushdef([yuck_arg_action], [tgt->yuck_slot([$1], [$2]) = *arg 246 | ? (op += strlen(arg), arg) 247 | : argv[[++i]]])dnl 248 | pushdef([yuck_arg_opt_action], [tgt->yuck_slot([$1], [$2]) = *arg 249 | ? (op += strlen(arg), arg) 250 | : YUCK_OPTARG_NONE])dnl 251 | pushdef([yuck_arg_mul_action], [tgt->yuck_slot([$1], [$2]) = 252 | yuck_append( 253 | tgt->yuck_slot([$1], [$2]), 254 | tgt->yuck_cnt_slot([$1], [$2])++, 255 | *arg ? (op += strlen(arg), arg) : argv[[++i]]); 256 | if (tgt->yuck_slot([$1], [$2]) == NULL) { 257 | return -1; 258 | }])dnl 259 | pushdef([yuck_arg_mul_opt_action], [tgt->yuck_slot([$1], [$2]) = 260 | yuck_append( 261 | tgt->yuck_slot([$1], [$2]), 262 | tgt->yuck_cnt_slot([$1], [$2])++, 263 | *arg ? (op += strlen(arg), arg) : YUCK_OPTARG_NONE); 264 | if (tgt->yuck_slot([$1], [$2]) == NULL) { 265 | return -1; 266 | }])dnl 267 | pushdef([yuck_auto_action], [/* invoke auto action and exit */ 268 | yuck_auto_[]yuck_canon([$1], [$2])(tgt); 269 | resume_at(success)])dnl 270 | 271 | foreachq([__CMD], yuck_umbcmds(), [coroutine(yuck_cmd(defn([__CMD]))[_shortopt]) 272 | { 273 | switch (*op) { 274 | default: 275 | /* again for clarity */ 276 | switch (*op) { 277 | case '0': 278 | case '1': 279 | case '2': 280 | case '3': 281 | case '4': 282 | case '5': 283 | case '6': 284 | case '7': 285 | case '8': 286 | case '9': 287 | if (op[[-1]] == '-') { 288 | /* literal treatment of numeral */ 289 | resume_at(arg); 290 | } 291 | /* fallthrough */ 292 | default: 293 | break; 294 | } 295 | divert(1); 296 | ifdef([YOPT_ALLOW_UNKNOWN_DASH], [dnl 297 | resume_at(arg); 298 | ], [dnl 299 | fprintf(stderr, "YUCK_UMB_STR: unrecognized option -%c\n", *op); 300 | resume_at(failure); 301 | ])dnl 302 | 303 | ifdef([YUCK_SHORTS_HAVE_NUMERALS], [ 304 | /* [yuck_shorts()] (= yuck_shorts()) 305 | * has numerals as shortopts 306 | * don't allow literal treatment of numerals */divert(-1)]) 307 | 308 | divert(2); 309 | resume_at(yuck_cmd()[_shortopt]); 310 | 311 | divert(0); 312 | ifelse(defn([__CMD]), [], [select_divert(1)], [select_divert(2)])dnl 313 | divert[]dnl 314 | 315 | foreachq([__IDN], yuck_idents(defn([__CMD])), [dnl 316 | pushdef([short], yuck_short(defn([__IDN]), defn([__CMD])))dnl 317 | ifelse(defn([short]), [], [divert(-1)])dnl 318 | case 'defn([short])': 319 | popdef([short])dnl 320 | dnl 321 | dnl now simply expand yuck_foo_action: 322 | yuck_option_action(defn([__IDN]), defn([__CMD])); 323 | break; 324 | divert[]dnl 325 | ])dnl 326 | } 327 | if (i >= argc) { 328 | fprintf(stderr, "YUCK_UMB_STR: option `--%s' requires an argument\n", op); 329 | resume_at(failure); 330 | } 331 | resume; 332 | } 333 | ]) 334 | popdef([yuck_flag_action])dnl 335 | popdef([yuck_arg_action])dnl 336 | popdef([yuck_arg_opt_action])dnl 337 | popdef([yuck_arg_mul_action])dnl 338 | popdef([yuck_arg_mul_opt_action])dnl 339 | popdef([yuck_auto_action])dnl 340 | } 341 | 342 | coroutine(arg) 343 | { 344 | if (tgt->cmd || YUCK_NCMDS == 0U) { 345 | tgt->args[[tgt->nargs++]] = argv[[i]]; 346 | } else { 347 | /* ah, might be an arg then */ 348 | if ((tgt->cmd = yuck_parse_cmd(op)) > YUCK_NCMDS) { 349 | return -1; 350 | } 351 | } 352 | resume; 353 | } 354 | 355 | coroutine(failure) 356 | { 357 | exit(EXIT_FAILURE); 358 | } 359 | 360 | coroutine(success) 361 | { 362 | exit(EXIT_SUCCESS); 363 | } 364 | } 365 | 366 | DEFUN void yuck_free(yuck_t tgt[[static 1U]]) 367 | { 368 | if (tgt->args != NULL) { 369 | /* free despite const qualifier */ 370 | free(tgt->args); 371 | } 372 | /* free mulargs */ 373 | switch (tgt->cmd) { 374 | void *ptr; 375 | default: 376 | break; 377 | pushdef([action], [dnl 378 | ptr = tgt->yuck_slot([$1], [$2]); 379 | if (ptr != NULL) { 380 | free(ptr); 381 | } 382 | ])dnl 383 | dnl TYPE actions 384 | pushdef([yuck_flag_action], [])dnl 385 | pushdef([yuck_arg_action], [])dnl 386 | pushdef([yuck_arg_opt_action], [])dnl 387 | pushdef([yuck_arg_mul_action], defn([action]))dnl 388 | pushdef([yuck_arg_mul_opt_action], defn([action]))dnl 389 | pushdef([yuck_auto_action], [])dnl 390 | foreachq([__CMD], yuck_umbcmds(), [dnl 391 | case yuck_cmd(defn([__CMD])): 392 | foreachq([__IDN], yuck_idents(defn([__CMD])), [dnl 393 | yuck_option_action(defn([__IDN]), defn([__CMD])); 394 | ])[]dnl 395 | break; 396 | ])[]dnl 397 | popdef([action])dnl 398 | popdef([yuck_flag_action])dnl 399 | popdef([yuck_arg_action])dnl 400 | popdef([yuck_arg_opt_action])dnl 401 | popdef([yuck_arg_mul_action])dnl 402 | popdef([yuck_arg_mul_opt_action])dnl 403 | popdef([yuck_auto_opt_action])dnl 404 | } 405 | return; 406 | } 407 | 408 | DEFUN void yuck_auto_usage(const yuck_t src[[static 1U]]) 409 | { 410 | switch (src->cmd) { 411 | default: 412 | YUCK_NOCMD: 413 | puts("Usage: YUCK_UMB_STR [[OPTION]]...dnl 414 | ifelse(yuck_cmds(), [], [], [ COMMAND])[]dnl 415 | ifelse(defn([YUCK_UMB_POSARG]), [], [], [ defn([YUCK_UMB_POSARG])])\n\ 416 | ifelse(yuck_umb_desc(), [], [], [dnl 417 | \n\ 418 | yuck_C_literal(yuck_umb_desc())\n\ 419 | ])dnl 420 | "); 421 | break; 422 | foreachq([__CMD], yuck_cmds(), [ 423 | case yuck_cmd(defn([__CMD])): 424 | puts("Usage: YUCK_UMB_STR dnl 425 | yuck_cmd_string(defn([__CMD]))[]dnl 426 | ifelse(yuck_idents(defn([__CMD])), [], [], [ [[OPTION]]...])[]dnl 427 | ifelse(yuck_cmd_posarg(defn([__CMD])), [], [], [ yuck_cmd_posarg(defn([__CMD]))])\n\ 428 | ifelse(yuck_cmd_desc(defn([__CMD])), [], [], [dnl 429 | \n\ 430 | yuck_C_literal(yuck_cmd_desc(defn([__CMD])))\n\ 431 | ])dnl 432 | "); 433 | break; 434 | ]) 435 | } 436 | 437 | #if defined yuck_post_usage 438 | yuck_post_usage(src); 439 | #endif /* yuck_post_usage */ 440 | return; 441 | } 442 | 443 | DEFUN void yuck_auto_help(const yuck_t src[[static 1U]]) 444 | { 445 | yuck_auto_usage(src); 446 | 447 | ifelse(yuck_cmds(), [], [], [dnl 448 | if (src->cmd == YUCK_NOCMD) { 449 | /* also output a list of commands */ 450 | puts("COMMAND may be one of:\n\ 451 | foreachq([__CMD], yuck_cmds(), [yuck_C_literal(yuck_cmd_line(defn([__CMD])))\n\ 452 | ])"); 453 | } 454 | ])dnl 455 | 456 | /* leave a not about common options */ 457 | if (src->cmd == YUCK_NOCMD) { 458 | ifelse(yuck_cmds(), [], [dnl 459 | ; 460 | ], [dnl 461 | puts("\ 462 | Options accepted by all commands:"); 463 | ])dnl 464 | ifelse(yuck_cmds(), [], [], [dnl 465 | } else { 466 | puts("\ 467 | Common options:\n\ 468 | foreachq([__IDN], yuck_idents([]), [dnl 469 | yuck_C_literal(backquote([yuck_option_help_line(defn([__IDN]), [])]))[]dnl 470 | ])dnl 471 | "); 472 | ])dnl 473 | } 474 | 475 | switch (src->cmd) { 476 | default:foreachq([__CMD], yuck_umbcmds(), [ 477 | case yuck_cmd(defn([__CMD])): 478 | puts("\ 479 | ifelse(defn([__CMD]), [], [], [dnl 480 | ifelse(yuck_idents(defn([__CMD])), [], [], [dnl 481 | Command-specific options:\n\ 482 | ])dnl 483 | ])dnl 484 | foreachq([__IDN], yuck_idents(defn([__CMD])), [dnl 485 | yuck_C_literal(backquote([yuck_option_help_line(defn([__IDN]), defn([__CMD]))]))[]dnl 486 | ])dnl 487 | "); 488 | break; 489 | ]) 490 | } 491 | 492 | #if defined yuck_post_help 493 | yuck_post_help(src); 494 | #endif /* yuck_post_help */ 495 | 496 | #if defined PACKAGE_BUGREPORT 497 | puts("\n\ 498 | Report bugs to " PACKAGE_BUGREPORT); 499 | #endif /* PACKAGE_BUGREPORT */ 500 | return; 501 | } 502 | 503 | DEFUN void yuck_auto_version(const yuck_t src[[static 1U]]) 504 | { 505 | switch (src->cmd) { 506 | default: 507 | ifdef([YUCK_VERSION], [dnl 508 | puts("YUCK_UMB_STR YUCK_VERSION"); 509 | ], [dnl 510 | #if 0 511 | 512 | #elif defined package_string 513 | puts(package_string); 514 | #elif defined package_version 515 | printf("YUCK_UMB_STR %s\n", package_version); 516 | #elif defined PACKAGE_STRING 517 | puts(PACKAGE_STRING); 518 | #elif defined PACKAGE_VERSION 519 | puts("YUCK_UMB_STR " PACKAGE_VERSION); 520 | #elif defined VERSION 521 | puts("YUCK_UMB_STR " VERSION); 522 | #else /* !PACKAGE_VERSION, !VERSION */ 523 | puts("YUCK_UMB_STR unknown version"); 524 | #endif /* PACKAGE_VERSION */ 525 | ])dnl 526 | break; 527 | } 528 | 529 | #if defined yuck_post_version 530 | yuck_post_version(src); 531 | #endif /* yuck_post_version */ 532 | return; 533 | } 534 | popdef([DEFUN])dnl 535 | 536 | #if defined __INTEL_COMPILER 537 | # pragma warning (pop) 538 | #elif defined __GNUC__ 539 | # if __GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 6 540 | # pragma GCC diagnostic pop 541 | # endif /* GCC version */ 542 | #endif /* __INTEL_COMPILER */ 543 | changequote`'dnl 544 | -------------------------------------------------------------------------------- /src/yuck-coru.h.m4: -------------------------------------------------------------------------------- 1 | /* -*- c -*- */ 2 | changequote`'changequote([,])dnl 3 | changecom([#])dnl 4 | #if !defined INCLUDED_yuck_h_ 5 | #define INCLUDED_yuck_h_ 6 | 7 | #include 8 | 9 | #define YUCK_OPTARG_NONE ((void*)0x1U) 10 | 11 | enum yuck_cmds_e { 12 | pushdef([last], yuck_cmd())pushdef([first], defn([last]))[]dnl 13 | /* value used when no command was specified */ 14 | first = 0U, 15 | 16 | /* actual commands */ 17 | foreachq([cmd], yuck_cmds(), [define([last], yuck_cmd(defn([cmd])))[]last, 18 | ]) 19 | /* convenience identifiers */ 20 | YUCK_NOCMD = first, 21 | YUCK_NCMDS = last 22 | popdef([last])popdef([first])[]dnl 23 | }; 24 | 25 | define([yuck_slot_predecl], [dnl 26 | yuck_iftype([$1], [$2], 27 | [arg,mul], [size_t ]yuck_canon([$1], [$2])[_nargs], 28 | [arg,mul,opt], [size_t ]yuck_canon([$1], [$2])[_nargs], 29 | )dnl 30 | ])dnl 31 | 32 | define([yuck_slot_decl], [dnl 33 | pushdef([pre], [yuck_slot_predecl([$1], [$2])])dnl 34 | pushdef([ident], [yuck_slot_identifier([$1], [$2])])dnl 35 | yuck_iftype([$1], [$2], 36 | [flag], [unsigned int ident;], 37 | [arg], [char *ident;], 38 | [arg,opt], [char *ident;], 39 | [arg,mul], [pre; char **ident;], 40 | [arg,mul,opt], [pre; char **ident;], 41 | [auto], [/* $1 is handled automatically */])dnl 42 | popdef([pre])dnl 43 | popdef([ident])dnl 44 | ])dnl 45 | 46 | ifelse(yuck_cmds(), [], [dnl 47 | typedef struct yuck_s yuck_t; 48 | ], [dnl 49 | typedef union yuck_u yuck_t; 50 | ])dnl 51 | 52 | foreachq([cmd], yuck_cmds(), [ 53 | /* convenience structure for `cmd' */ 54 | struct yuck_cmd_[]defn([cmd])[]_s { 55 | enum yuck_cmds_e [cmd]; 56 | 57 | /* left-over arguments, the command string is never a part of this */ 58 | size_t nargs; 59 | char **args; 60 | foreachq([slot], yuck_idents(), [ 61 | yuck_slot_decl(defn([slot]))[]dnl 62 | ]) 63 | foreachq([slot], yuck_idents(defn([cmd])), [ 64 | yuck_slot_decl(defn([slot]), defn([cmd]))[]dnl 65 | ]) 66 | }; 67 | ]) 68 | 69 | ifelse(yuck_cmds(), [], [dnl 70 | /* generic struct */ 71 | struct yuck_s { 72 | enum yuck_cmds_e cmd; 73 | 74 | /* left-over arguments, 75 | * the command string is never a part of this */ 76 | size_t nargs; 77 | char **args; 78 | 79 | /* slots common to all commands */ 80 | foreachq([slot], yuck_idents(), [ 81 | yuck_slot_decl(defn([slot]))[]dnl 82 | ]) 83 | }; 84 | ], [dnl else 85 | union yuck_u { 86 | /* generic struct */ 87 | struct { 88 | enum yuck_cmds_e cmd; 89 | 90 | /* left-over arguments, 91 | * the command string is never a part of this */ 92 | size_t nargs; 93 | char **args; 94 | 95 | /* slots common to all commands */ 96 | foreachq([slot], yuck_idents(), [dnl 97 | yuck_slot_decl(defn([slot])) 98 | ])dnl 99 | }; 100 | 101 | /* depending on CMD at most one of the following structs is filled in 102 | * if CMD is YUCK_NONE no slots of this union must be accessed */ 103 | foreachq([cmd], yuck_cmds(), [dnl 104 | struct yuck_cmd_[]defn([cmd])[]_s defn([cmd]); 105 | ])dnl 106 | }; 107 | ]) 108 | 109 | pushdef([DECLF], ifdef([YUCK_HEADER], [extern], [static]))[]dnl 110 | DECLF __attribute__((nonnull(1))) int 111 | yuck_parse(yuck_t*, int argc, char *argv[[]]); 112 | DECLF __attribute__((nonnull(1))) void yuck_free(yuck_t*); 113 | 114 | DECLF __attribute__((nonnull(1))) void yuck_auto_help(const yuck_t*); 115 | DECLF __attribute__((nonnull(1))) void yuck_auto_usage(const yuck_t*); 116 | DECLF __attribute__((nonnull(1))) void yuck_auto_version(const yuck_t*); 117 | 118 | /* some hooks */ 119 | #if defined yuck_post_help 120 | DECLF __attribute__((nonnull(1))) void yuck_post_help(const yuck_t*); 121 | #endif /* yuck_post_help */ 122 | 123 | #if defined yuck_post_usage 124 | DECLF __attribute__((nonnull(1))) void yuck_post_usage(const yuck_t*); 125 | #endif /* yuck_post_usage */ 126 | 127 | #if defined yuck_post_version 128 | DECLF __attribute__((nonnull(1))) void yuck_post_version(const yuck_t*); 129 | #endif /* yuck_post_version */ 130 | popdef([DECLF])[]dnl 131 | 132 | #endif /* INCLUDED_yuck_h_ */ 133 | changequote`'dnl 134 | -------------------------------------------------------------------------------- /src/yuck-custom.example.m4: -------------------------------------------------------------------------------- 1 | changequote`'changequote([,])dnl 2 | changecom([#])dnl 3 | define([calloc], [malloc($1 * $2)]) 4 | define([realloc], [realloc($@)]) 5 | define([free], [free($@)]) 6 | -------------------------------------------------------------------------------- /src/yuck-scmver.h: -------------------------------------------------------------------------------- 1 | /*** yuck-version.h -- snarf versions off project cwds 2 | * 3 | * Copyright (C) 2013-2024 Sebastian Freundt 4 | * 5 | * Author: Sebastian Freundt 6 | * 7 | * This file is part of yuck. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 13 | * 1. Redistributions of source code must retain the above copyright 14 | * notice, this list of conditions and the following disclaimer. 15 | * 16 | * 2. Redistributions in binary form must reproduce the above copyright 17 | * notice, this list of conditions and the following disclaimer in the 18 | * documentation and/or other materials provided with the distribution. 19 | * 20 | * 3. Neither the name of the author nor the names of any contributors 21 | * may be used to endorse or promote products derived from this 22 | * software without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR 25 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 31 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 32 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 33 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 34 | * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | * 36 | ***/ 37 | #if !defined INCLUDED_yuck_version_h_ 38 | #define INCLUDED_yuck_version_h_ 39 | 40 | #include "stdlib.h" 41 | 42 | typedef const struct yuck_version_s *yuck_version_t; 43 | 44 | typedef enum { 45 | YUCK_SCM_ERROR = -1, 46 | YUCK_SCM_TARBALL, 47 | YUCK_SCM_GIT, 48 | YUCK_SCM_BZR, 49 | YUCK_SCM_HG, 50 | } yuck_scm_t; 51 | 52 | struct yuck_version_s { 53 | yuck_scm_t scm; 54 | unsigned int dirty:1U; 55 | char vtag[16U]; 56 | unsigned int dist; 57 | /* up to 28bits of revision id (hash for git), 58 | * the lower 4bits denote the length */ 59 | unsigned int rvsn; 60 | }; 61 | 62 | extern const char *const yscm_strs[]; 63 | 64 | 65 | /* public api */ 66 | /** 67 | * Determine SCM version of file(s) in PATH. */ 68 | extern int yuck_version(struct yuck_version_s *restrict v, const char *path); 69 | 70 | /** 71 | * Read a reference file FN and return scm version information. */ 72 | extern int yuck_version_read(struct yuck_version_s *restrict, const char *fn); 73 | 74 | /** 75 | * Write scm version information in V to reference file FN. */ 76 | extern int yuck_version_write(const char *fn, const struct yuck_version_s *v); 77 | 78 | /** 79 | * Write scm version into buffer. */ 80 | extern ssize_t yuck_version_write_fd(int fd, const struct yuck_version_s *v); 81 | 82 | /** 83 | * Compare two version objects, return <0 if V1 < V2, >0 if V1 > V2 and 84 | * 0 if V1 and V2 are considered equal. */ 85 | extern int yuck_version_cmp(yuck_version_t v1, yuck_version_t v2); 86 | 87 | #endif /* INCLUDED_yuck_version_h_ */ 88 | -------------------------------------------------------------------------------- /src/yuck-scmver.m4: -------------------------------------------------------------------------------- 1 | changequote`'changequote([,])dnl 2 | divert([-1]) 3 | changecom([##]) 4 | 5 | ## we used to define YUCK_SCMVER_VERSION in m4 terms here 6 | ## however in C it's so much easier to come by with the same thing 7 | ## so we reserve this file for future (m4-based) goodness 8 | 9 | divert[]dnl 10 | changequote()dnl 11 | -------------------------------------------------------------------------------- /src/yuck.am: -------------------------------------------------------------------------------- 1 | ## automake rules for yuck 2 | ## set the following variables in the including Makefile.am beforehand 3 | ## noinst_PROGRAMS 4 | ## BUILT_SOURCES 5 | ## EXTRA_DIST 6 | ## DISTCLEANFILES 7 | 8 | yuck_CPPFLAGS = -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE 9 | yuck_CPPFLAGS += -D_ALL_SOURCE 10 | yuck_CPPFLAGS += -D_DARWIN_C_SOURCE 11 | yuck_CPPFLAGS += -D_NETBSD_SOURCE 12 | 13 | noinst_PROGRAMS += yuck-bootstrap 14 | yuck_bootstrap_SOURCES = yuck.c 15 | yuck_bootstrap_CPPFLAGS = $(yuck_CPPFLAGS) 16 | yuck_bootstrap_CPPFLAGS += -DBOOTSTRAP 17 | yuck_bootstrap_CPPFLAGS += -DWITH_SCMVER 18 | 19 | noinst_PROGRAMS += yuck 20 | yuck_SOURCES = yuck.c yuck.yuck 21 | yuck_SOURCES += yuck-scmver.c yuck-scmver.h yuck-scmver.m4 22 | yuck_SOURCES += yuck.m4 23 | yuck_SOURCES += yuck-coru.c.m4 yuck-coru.h.m4 24 | yuck_SOURCES += yuck.man.m4 25 | yuck_CPPFLAGS += -DYUCK_TEMPLATE_PATH='"$(abs_srcdir)"' 26 | yuck_CPPFLAGS += -DWITH_SCMVER 27 | BUILT_SOURCES += yuck.yucc 28 | 29 | ## aix make wants all prereq's to exist 30 | EXTRA_DIST += yuck.m4i 31 | EXTRA_DIST += yuck.yucc 32 | 33 | DISTCLEANFILES += yuck.m4i yuck.yucc 34 | 35 | ## also include custom Makefile recipes 36 | include $(srcdir)/yuck.mk 37 | -------------------------------------------------------------------------------- /src/yuck.m4: -------------------------------------------------------------------------------- 1 | changequote`'changequote([,])dnl 2 | divert([-1]) 3 | 4 | ## this is a little domain language for the yuck processor 5 | 6 | # foreachq(x, [item_1, item_2, ..., item_n], stmt) 7 | # quoted list, alternate improved version 8 | define([foreachq], [ifelse([$2], [], [], 9 | [pushdef([$1])_$0([$1], [$3], [], $2)popdef([$1])])]) 10 | define([_foreachq], [ifelse([$#], [3], [], 11 | [define([$1], [$4])$2[]$0([$1], [$2], 12 | shift(shift(shift($@))))])]) 13 | 14 | #### append $2 to $1, separated by $3. 15 | define([append], [define([$1], ifdef([$1], [defn([$1])[$3]])[$2])]) 16 | ## like append, but append only non-empty arguments 17 | define([append_ne], [ifelse([$2], [], [], [append([$1], [$2], [$3])])]) 18 | ## like append_ne, but append only non-existing arguments 19 | define([append_nene], [ifelse(index([$3]defn([$1])[$3], [$3$2$3]), [-1], 20 | [append_ne([$1], [$2], [$3])])]) 21 | 22 | define([appendq], [define([$1], ifdef([$1], [defn([$1])[$3]])dquote([$2]))]) 23 | ## like appendq, but append only non-empty arguments 24 | define([appendq_ne], [ifelse([$2], [], [], [append([$1], dquote([$2]), [$3])])]) 25 | ## like appendq_ne, but append only non-existing arguments 26 | define([appendq_nene], [ifelse(index([$3]defn([$1])[$3], [$3]dquote($2)[$3]), [-1], 27 | [appendq_ne([$1], [$2], [$3])])]) 28 | 29 | define([first_nonnil], [ifelse([$#], [0], [], [$1], [], 30 | [first_nonnil(shift($@))], [], [], [$1])]) 31 | define([first], [_first($*)]) 32 | define([_first], [$1]) 33 | define([second], [_second($*)]) 34 | define([_second], [$2]) 35 | define([thirds], [_thirds($*)]) 36 | define([_thirds], [quote(shift(shift($@)))]) 37 | 38 | define([quote], [ifelse([$#], [0], [], [[$*]])]) 39 | define([dquote], [[$@]]) 40 | define([equote], [dquote($*)]) 41 | 42 | define([backquote], [_$0([$1], [(], -=<{($1)}>=-, [}>=-])]) 43 | define([_backquote], [dnl 44 | ifelse([$4], [}>=-], [dnl 45 | changequote([-=<{$2], [)}>=-])$3changequote([, ])], [dnl else 46 | $0([$1], [($2], -=<{($2$1)}>=-, [}>=-])_ignore$2])]) 47 | 48 | define([_ignore]) 49 | 50 | define([_splice], [ifelse(eval([$#] > [3]), [0], [[$1], [$2], [$3]], [[$1], [$2], [$3], _splice([$1], shift(shift(shift($@))))])]) 51 | 52 | define([cond], [ifelse([$#], [0], [], [$#], [1], [$1], [_$0($@)])]) 53 | define([_cond], [dnl 54 | ifelse([$1], [$2], [$3], 55 | [$#], [3], [], 56 | [$#], [4], [$4], 57 | [$0([$1], shift(shift(shift($@))))])]) 58 | 59 | define([downcase], [dnl 60 | translit([$1], [ABCDEFGHIJKLMNOPQRSTUVWXYZ], [abcdefghijklmnopqrstuvwxyz])[]dnl 61 | ]) 62 | 63 | define([upcase], [dnl 64 | translit([$1], [abcdefghijklmnopqrstuvwxyz], [ABCDEFGHIJKLMNOPQRSTUVWXYZ])[]dnl 65 | ]) 66 | 67 | ## select a diversion, clearing all other diversions 68 | define([select_divert], [divert[]undivert($1)[]divert(-1)[]undivert[]divert(0)]) 69 | 70 | 71 | define([yuck_set_version], [dnl 72 | define([YUCK_VERSION], [$1]) 73 | ]) 74 | 75 | ## yuck_set_umbrella([ident], [umbrella], [[posarg]]) 76 | define([yuck_set_umbrella], [dnl 77 | define([YUCK_UMB], [$1]) 78 | define([YUCK_UMB_STR], [$2]) 79 | define([YUCK_UMB_POSARG], [$3]) 80 | ]) 81 | 82 | ## yuck_set_umbrella_desc([ident], [desc]) 83 | define([yuck_set_umbrella_desc], [dnl 84 | define([YUCK_UMB_$1_desc], [$2]) 85 | 86 | ## define yuck_add_inter here, corresponding to IDENT 87 | define([YUCK_INTER_CMD], [YUCK_UMB_$1_desc]) 88 | ]) 89 | 90 | ## yuck_set_umbrella_max_posargs([ident], [N]) 91 | define([yuck_set_umbrella_max_posargs], [dnl 92 | define([YUCK_UMB_$1_max_posargs], [$2]) 93 | define([YUCK_MAX_POSARGS], [$2]) 94 | ]) 95 | 96 | ## yuck_add_command([ident], [command], [[posarg]]) 97 | define([yuck_add_command], [dnl 98 | define([YUCK_CMD], [$1]) 99 | append_nene([YUCK_ALL_CMDS], [$1], [,]) 100 | define([YUCK_$1_STR], [$2]) 101 | define([YUCK_POSARG_$1], [$3]) 102 | ]) 103 | 104 | ## yuck_set_command_desc([ident], [desc]) 105 | define([yuck_set_command_desc], [dnl 106 | define([YUCK_CMD_$1_desc], [$2]) 107 | 108 | ## define yuck_add_inter here, corresponding to IDENT 109 | define([YUCK_INTER_CMD], [YUCK_CMD_$1_desc]) 110 | ]) 111 | 112 | ## yuck_set_umbrella_max_posargs([ident], [N]) 113 | define([yuck_set_command_max_posargs], [dnl 114 | define([YUCK_CMD_$1_max_posargs], [$2]) 115 | ]) 116 | 117 | ## yuck_add_inter([desc]) 118 | #### append interim DESC to last command desc 119 | define([yuck_add_inter], [dnl 120 | append(defn([YUCK_INTER_CMD]), [$1], [ 121 | 122 | ]) 123 | ]) 124 | 125 | ## yuck_add_option([ident], [short], [long], [type]) 126 | define([yuck_add_option], [dnl 127 | ## quote the elements of the type arg first 128 | ## before any possible expansion is in scope 129 | pushdef([type], equote([$4])) 130 | pushdef([ident], [$1]) 131 | pushdef([cmd], defn([YUCK_CMD])) 132 | 133 | ifelse([$2], [], [], 134 | index([0123456789], [$2]), [-1], [], 135 | [dnl else 136 | define([YUCK_SHORTS_HAVE_NUMERALS], [1]) 137 | ]) 138 | 139 | ifdef([YUCK_]defn([cmd])[_]defn([ident])[_canon], [], [dnl 140 | ## process only if new 141 | appendq_ne([YUCK_]defn([cmd])[_I], defn([ident]), [,]) 142 | 143 | ## forward maps 144 | define([YUCK_]defn([cmd])[_]defn([ident])[_canon], defn([ident])) 145 | define([YUCK_]defn([cmd])[_]defn([ident])[_type], defn([type])) 146 | 147 | ## reverse maps 148 | define([YUCK_]defn([cmd])[_]defn([ident])[_short], [$2]) 149 | define([YUCK_]defn([cmd])[_]defn([ident])[_long], [$3]) 150 | ]) 151 | 152 | popdef([ident]) 153 | popdef([cmd]) 154 | popdef([type]) 155 | ]) 156 | 157 | ## yuck_set_option_desc([ident], [desc]) 158 | define([yuck_set_option_desc], [dnl 159 | define([YUCK_]defn([YUCK_CMD])[_$1_desc], [$2]) 160 | ]) 161 | 162 | ## some yopts here, mostly flags 163 | define([yuck_setopt_allow_unknown_dash], [dnl 164 | define([YOPT_ALLOW_UNKNOWN_DASH]) 165 | ]) 166 | 167 | define([yuck_setopt_allow_unknown_dashdash], [dnl 168 | define([YOPT_ALLOW_UNKNOWN_DASHDASH]) 169 | ]) 170 | 171 | 172 | ## helpers for the m4c and m4h 173 | 174 | ## yuck_canon([opt], [[cmd]]) 175 | define([yuck_canon], [defn([YUCK_$2_$1_canon])]) 176 | 177 | ## yuck_option_type([opt], [[cmd]]) 178 | define([yuck_option_type], [defn([YUCK_$2_$1_type])]) 179 | 180 | ## yuck_type([type-spec]) 181 | define([yuck_type], [first([$1])]) 182 | 183 | ## yuck_type_name([type-spec]) 184 | define([yuck_type_name], [second([$1])]) 185 | 186 | ## yuck_type_sufx([type-spec]) 187 | define([yuck_type_sufx], [thirds([$1])]) 188 | 189 | ## yuck_slot_identifier([option], [[cmd]]) 190 | define([yuck_slot_identifier], [dnl 191 | pushdef([canon], yuck_canon([$1], [$2]))dnl 192 | pushdef([type], yuck_option_type([$1], [$2]))dnl 193 | dnl 194 | defn([canon])[_]yuck_type(defn([type]))[]dnl 195 | cond(yuck_type_sufx(defn([type])), [mul], [s], [mul,opt], [s])[]dnl 196 | dnl 197 | popdef([canon])dnl 198 | popdef([type])dnl 199 | ]) 200 | 201 | ## yuck_cnt_slot([option], [[cmd]]) 202 | define([yuck_cnt_slot], [dnl 203 | pushdef([type], yuck_option_type([$1], [$2]))dnl 204 | ifelse(yuck_type(defn([type])), [arg], [dnl 205 | ifelse(first(yuck_type_sufx(defn([type]))), [mul], [dnl 206 | pushdef([idn], [yuck_canon([$1], [$2])[_nargs]])dnl 207 | ifelse([$2], [], [idn], [$2.idn])[]dnl 208 | popdef([idn])dnl 209 | ])[]dnl 210 | ])[]dnl 211 | popdef([type])dnl 212 | ]) 213 | 214 | ## yuck_slot([option], [[cmd]]) 215 | define([yuck_slot], [dnl 216 | pushdef([idn], yuck_slot_identifier([$1], [$2]))dnl 217 | dnl 218 | ifelse([$2], [], defn([idn]), [$2.]defn([idn]))[]dnl 219 | dnl 220 | popdef([idn])dnl 221 | ]) 222 | 223 | ## yuck_iftype([opt], [cmd], [type], [body], [[type], [body]]...) 224 | define([yuck_iftype], [dnl 225 | pushdef([type], yuck_option_type([$1], [$2]))dnl 226 | pushdef([tsuf], yuck_type_sufx(defn([type])))dnl 227 | pushdef([res], yuck_type(defn([type])))dnl 228 | append_ne([res], defn([tsuf]), [,])[]dnl 229 | []ifelse(_splice(defn([res]), shift(shift($@))))[]dnl 230 | popdef([tsuf])dnl 231 | popdef([type])dnl 232 | popdef([res])dnl 233 | ]) 234 | 235 | ## yuck_umbcmds(), umbrella + commands 236 | define([yuck_umbcmds], [ifdef([YUCK_ALL_CMDS], [[,]defn([YUCK_ALL_CMDS])], dquote([[]]))]) 237 | 238 | ## yuck_cmds(), just the commands 239 | define([yuck_cmds], [defn([YUCK_ALL_CMDS])]) 240 | 241 | ## yuck_cmd([command]) 242 | define([yuck_cmd], [upcase(defn([YUCK_UMB]))[_CMD_]ifelse([$1], [], [NONE], [upcase([$1])])]) 243 | 244 | ## yuck_cmd_string 245 | define([yuck_cmd_string], [defn([YUCK_]$1[_STR])]) 246 | 247 | ## yuck_cmd_posarg 248 | define([yuck_cmd_posarg], [defn([YUCK_POSARG_]$1)]) 249 | 250 | ## yuck_umb_desc([[umb]]) getter for the umbrella description 251 | define([yuck_umb_desc], [defn([YUCK_UMB_]ifelse([$1], [], defn([YUCK_UMB]), [$1])[_desc])]) 252 | 253 | ## yuck_cmd_desc([cmd]) getter for the command description 254 | define([yuck_cmd_desc], [defn([YUCK_CMD_$1_desc])]) 255 | 256 | ## yuck_idents([cmd]) 257 | define([yuck_idents], [defn([YUCK_$1_I])]) 258 | 259 | ## yuck_short([ident], [[cmd]]) 260 | define([yuck_short], [defn([YUCK_$2_$1_short])]) 261 | 262 | ## yuck_long([ident], [[cmd]]) 263 | define([yuck_long], [defn([YUCK_$2_$1_long])]) 264 | 265 | ## yuck_option_desc([ident], [[cmd]]) 266 | define([yuck_option_desc], [defn([YUCK_$2_$1_desc])]) 267 | 268 | ## type actions 269 | define([_yuck_option_action], [dnl 270 | pushdef([type], yuck_option_type([$1], [$2]))dnl 271 | pushdef([prim], yuck_type(defn([type])))dnl 272 | pushdef([sufx], yuck_type_sufx(defn([type])))dnl 273 | quote([yuck_]defn([prim])ifelse(defn([sufx]), [], [], [_]translit(defn([sufx]), [,], [_]))[_action][(quote([$1]), quote([$2]))])dnl 274 | popdef([type])dnl 275 | popdef([prim])dnl 276 | popdef([sufx])dnl 277 | ])dnl 278 | define([yuck_expand], [$1]) 279 | define([yuck_option_action], [yuck_expand(_$0([$1], [$2]))]) 280 | 281 | ## yuck_option_help_lhs([ident], [[cmd]]) 282 | define([yuck_option_help_lhs], [dnl 283 | pushdef([s], [backquote([yuck_short([$1], [$2])])])dnl 284 | pushdef([l], [backquote([yuck_long([$1], [$2])])])dnl 285 | pushdef([type], yuck_option_type([$1], [$2]))dnl 286 | pushdef([prel], ifelse(l, [], [], [=]))dnl 287 | pushdef([yuck_arg_action], [defn([prel])[]yuck_type_name(yuck_option_type([$1], [$2]))])dnl 288 | pushdef([yuck_arg_opt_action], [defn([prel])[]yuck_type_name(yuck_option_type([$1], [$2]))])dnl 289 | pushdef([yuck_arg_mul_action], [defn([prel])[]yuck_type_name(yuck_option_type([$1], [$2]))...])dnl 290 | pushdef([yuck_arg_mul_opt_action], [defn([prel])[]yuck_type_name(yuck_option_type([$1], [$2]))...])dnl 291 | [ ]ifelse(s, [], [ ], [-s[]ifelse(l, [], [], [[, ]])])[]dnl 292 | ifelse(l, [], [], [--l])[]dnl 293 | ifelse(yuck_type(defn([type])), [arg], [dnl 294 | ifelse(l, [], [ ], [])backquote([yuck_option_action([$1], [$2])])[]dnl 295 | ])[]dnl 296 | popdef([type])dnl 297 | popdef([prel])dnl 298 | popdef([s])dnl 299 | popdef([l])dnl 300 | popdef([yuck_arg_action])dnl 301 | popdef([yuck_arg_opt_action])dnl 302 | popdef([yuck_arg_mul_action])dnl 303 | popdef([yuck_arg_mul_opt_action])dnl 304 | ]) 305 | 306 | define([xleft], [_$0([$1], 0, [$2])]) 307 | define([_xleft], [dnl 308 | ifelse(eval(incr(incr([$2])) <= [$3]), [1], [dnl 309 | substr([$1], [$2], 2)[]$0([$1], incr(incr([$2])), [$3])[]dnl 310 | ], eval(incr([$2]) <= [$3]), [1], [dnl 311 | substr([$1], [$2], 1)[]dnl 312 | ])[]dnl 313 | ]) 314 | 315 | define([xright], [_$0([$1], [$2])]) 316 | define([_xright], [dnl 317 | ifelse(eval([$2] >= len([$1])), [0], [dnl 318 | substr([$1], [$2], 2)[]$0([$1], incr(incr([$2])))[]dnl 319 | ])[]dnl 320 | ]) 321 | 322 | define([yuck_esc], [backquote([_$0([$1], [$2], [$3], [$4])])]) 323 | define([_yuck_esc], [dnl 324 | pushdef([__next_sep], index([$1], [$2]))[]dnl 325 | ifelse([$1], [], [], defn([__next_sep]), [-1], [$4[$1]], [dnl 326 | [$4]xleft([$1], defn([__next_sep]))[$3]dnl 327 | $0(backquote([xright([$1], eval(defn([__next_sep]) + len([$2])))]), [$2], [$3], [$4])[]dnl 328 | ])[]dnl 329 | popdef([__next_sep])dnl 330 | ])dnl 331 | 332 | define([yuck_indent_line], [yuck_esc([$1], [ 333 | ], [ 334 | ], [ ])]) 335 | 336 | ## yuck_option_help_line([ident], [[cmd]]) 337 | define([yuck_option_help_line], [dnl 338 | pushdef([lhs], [backquote([yuck_option_help_lhs([$1], [$2])])])dnl 339 | pushdef([desc], [yuck_option_desc([$1], [$2])])dnl 340 | pushdef([indesc], [yuck_indent_line(backquote([desc]))])dnl 341 | pushdef([lenlhs], len(lhs))dnl 342 | ifelse(indesc, [], [lhs], 343 | eval(lenlhs >= 23), [0], [dnl 344 | lhs[]backquote([xright(indesc, lenlhs)])[]dnl 345 | ], eval(lenlhs >= 24), [0], [dnl 346 | lhs[]backquote([xright(indesc, decr(lenlhs))])[]dnl 347 | ], [dnl 348 | lhs[ 349 | ]backquote([indesc])[]dnl 350 | ]) 351 | popdef([lenlhs])dnl 352 | popdef([indesc])dnl 353 | popdef([desc])dnl 354 | popdef([lhs])dnl 355 | ]) 356 | 357 | ## yuck_first_line([string]) 358 | define([yuck_first_line], [dnl 359 | pushdef([lnlen], [index([$1], [ 360 | ])])dnl 361 | backquote([ifelse(lnlen, -1, [$1], [xleft([$1], lnlen)])])[]dnl 362 | popdef([lnlen])dnl 363 | ]) 364 | 365 | ## yuck_cmd_line([cmd]) 366 | define([yuck_cmd_line], [dnl 367 | pushdef([lhs], [backquote([yuck_cmd_string([$1])])])dnl 368 | pushdef([indesc], [dnl 369 | yuck_first_line(backquote([yuck_cmd_desc([$1])]))])dnl 370 | pushdef([lenlhs], len(lhs))dnl 371 | ifelse(indesc, [], [lhs], 372 | eval(lenlhs >= 11), [0], [dnl 373 | lhs[]backquote([xright(indesc, lenlhs)])[]dnl 374 | ], eval(lenlhs >= 12), [0], [dnl 375 | lhs[]backquote([xright(indesc, decr(lenlhs))])[]dnl 376 | ], [dnl 377 | lhs 378 | backquote([indesc])[]dnl 379 | ])dnl 380 | popdef([lenlhs])dnl 381 | popdef([indesc])dnl 382 | popdef([lhs])dnl 383 | ]) 384 | 385 | ## \n -> \\n\\ 386 | define([yuck_esc_newline], [yuck_esc([$1], [ 387 | ], [\n\ 388 | ])]) 389 | 390 | ## " -> \" 391 | define([yuck_esc_quote], [yuck_esc([$1], ["], [\"])])dnl " 392 | 393 | ## \ -> \\ 394 | define([yuck_esc_backslash], [yuck_esc([$1], [\], [\\])])dnl 395 | 396 | define([yuck_C_literal], [dnl 397 | yuck_esc_newline(yuck_esc_quote(yuck_esc_backslash([$1])))[]dnl 398 | ])dnl 399 | 400 | 401 | ## coroutine stuff 402 | define([yield], [goto $1; back_from_$1:]) 403 | define([coroutine], [define([this_coru], [$1])$1:]) 404 | define([resume], [goto back_from_[]this_coru]) 405 | define([resume_at], [goto $1]) 406 | define([quit], [goto out]) 407 | 408 | divert[]dnl 409 | changequote`'dnl 410 | -------------------------------------------------------------------------------- /src/yuck.man.m4: -------------------------------------------------------------------------------- 1 | .\" auto generated by yuck -*- nroff -*- 2 | changequote`'changequote([,])dnl 3 | ifdef([YUCK_VERSION], [], [dnl else (!YUCK_VERSION) 4 | ifdef([YUCK_SCMVER_VERSION], [dnl then 5 | define([YUCK_VERSION], [YUCK_SCMVER_VERSION])[]dnl 6 | ], [dnl else (!YUCK_SCMVER_VERSION) 7 | define([YUCK_VERSION], [unknown])dnl 8 | ])dnl 9 | ])dnl 10 | define([ucase], [translit([$1], [abcdefghijklmnopqrstuvwxyz], [ABCDEFGHIJKLMNOPQRSTUVWXYZ])])dnl 11 | ifdef([YUCK_PKG_STR], [], [define([YUCK_PKG_STR], [YUCK_UMB_STR])])dnl 12 | .TH ucase(YUCK_UMB_STR) "1" "YUCK_MAN_DATE" "YUCK_PKG_STR YUCK_VERSION" "User Commands" 13 | .SH NAME 14 | pushdef([umb_desc], [yuck_first_line(yuck_umb_desc())])dnl 15 | pushdef([alt_desc], [manual page for YUCK_PKG_STR YUCK_VERSION])dnl 16 | YUCK_UMB_STR - first_nonnil(umb_desc, alt_desc) 17 | popdef([umb_desc])dnl 18 | popdef([alt_desc])dnl 19 | .SH SYNOPSIS 20 | .B YUCK_UMB_STR 21 | [[\fIOPTION\fR]]...[ ]dnl 22 | ifelse(yuck_cmds(), [], [], [\fICOMMAND\fR]) 23 | []dnl 24 | yuck_esc(dnl 25 | yuck_esc(dnl 26 | yuck_esc(dnl 27 | yuck_esc(dnl 28 | yuck_esc(translit(defn([YUCK_UMB_POSARG]), [[]], []), 29 | [ -], [\fR -]), 30 | [ ], [ \fI]), 31 | [], [\fR\fI]), 32 | [], [\fR]), 33 | [...], [\fR...]) 34 | .SH DESCRIPTION 35 | yuck_umb_desc() 36 | ifelse(yuck_cmds(), [], [], [dnl 37 | 38 | .PP 39 | \fICOMMAND\fR may be one of: 40 | foreachq([__CMD__], yuck_cmds(), [dnl 41 | .TP 42 | .B yuck_cmd_string(__CMD__) 43 | . 44 | yuck_cmd_desc(__CMD__) 45 | ])dnl 46 | ])dnl 47 | 48 | .PP 49 | define([yuck_man_option], [dnl 50 | pushdef([lhs], [yuck_option_help_lhs([$1], [$2])])dnl 51 | yuck_esc(dnl 52 | yuck_esc(dnl 53 | yuck_esc(dnl 54 | yuck_esc(dnl 55 | yuck_esc(dnl 56 | yuck_esc(dnl 57 | yuck_esc(lhs, 58 | [,], [\fR,]), 59 | [ -], [ \fB-]), 60 | [], [\fR]), 61 | [=], [\fR=]), 62 | [=], [=\fI]), 63 | [], [\fR]), 64 | [...], [\fR...])dnl 65 | popdef([lhs])dnl 66 | ]) 67 | Recognized \fIOPTION\fRs: 68 | foreachq([__IDN__], yuck_idents(), [dnl 69 | .TP 70 | .B yuck_man_option(defn([__IDN__]), []) 71 | yuck_option_desc(defn([__IDN__]), []) 72 | ])dnl 73 | dnl 74 | ifelse(yuck_cmds(), [], [], [dnl 75 | .SH COMMANDS 76 | ])dnl 77 | foreachq([__CMD__], yuck_cmds(), [ 78 | .P 79 | .B YUCK_UMB_STR yuck_cmd_string(__CMD__) 80 | [[\fIOPTION\fR]]... 81 | yuck_esc(dnl 82 | yuck_esc(dnl 83 | yuck_esc(dnl 84 | yuck_esc(dnl 85 | yuck_esc(translit(yuck_cmd_posarg(__CMD__), [[]], []), 86 | [ -], [\fR -]), 87 | [ ], [ \fI]), 88 | [], [\fR\fI]), 89 | [], [\fR]), 90 | [...], [\fR...]) 91 | .br 92 | yuck_cmd_desc(C) 93 | .P 94 | \fIOPTION\fRs specific to the \fB[]yuck_cmd_string(__CMD__)\fR command: 95 | foreachq([__IDN__], yuck_idents(__CMD__), [dnl 96 | .TP 97 | .B yuck_option_help_lhs(defn([__IDN__]), defn([__CMD__])) 98 | yuck_option_desc(defn([__IDN__]), defn([__CMD__])) 99 | ])dnl 100 | ])dnl 101 | foreachq([__INC__], defn([YUCK_INCLUDES]), [dnl 102 | include(__INC__) 103 | ]) 104 | ifdef([YUCK_NFO_STR], [ 105 | .SH "SEE ALSO" 106 | The full documentation for 107 | .B YUCK_UMB_STR 108 | is maintained as a Texinfo manual. If the 109 | .B info 110 | and 111 | .B YUCK_UMB_STR 112 | programs are properly installed at your site, the command 113 | .IP 114 | .B info ifelse(YUCK_NFO_STR, YUCK_UMB_STR, [YUCK_NFO_STR], [(YUCK_NFO_STR)YUCK_UMB_STR]) 115 | .PP 116 | should give you access to the complete manual. 117 | ])dnl 118 | .\" yuck.m4man ends here 119 | changequote`'dnl 120 | -------------------------------------------------------------------------------- /src/yuck.mk: -------------------------------------------------------------------------------- 1 | ## bootstrapping rules, made for inclusion in your own Makefiles 2 | yuck.m4i: yuck.yuck 3 | $(MAKE) $(AM_MAKEFLAGS) yuck-bootstrap 4 | $(AM_V_GEN) $(builddir)/yuck-bootstrap$(EXEEXT) $(srcdir)/yuck.yuck > $@ \ 5 | || { rm -f -- $@; false; } 6 | 7 | yuck.yucc: yuck.m4i yuck.m4 yuck-coru.h.m4 yuck-coru.c.m4 8 | $(AM_V_GEN) $(M4) $(srcdir)/yuck.m4 yuck.m4i \ 9 | $(srcdir)/yuck-coru.h.m4 $(srcdir)/yuck-coru.c.m4 | \ 10 | tr '\002\003\016\017' '[]()' > $@ \ 11 | || { rm -f -- $@; false; } 12 | -------------------------------------------------------------------------------- /src/yuck.yuck: -------------------------------------------------------------------------------- 1 | Usage: yuck COMMAND [ARG]... 2 | 3 | Generate command line option parsers for umbrella commands. 4 | 5 | -k, --keep Keep intermediary files. 6 | -o, --output=FILE Output goes into FILE instead of stdout. 7 | 8 | 9 | ## Usages of the single commands 10 | Usage: yuck [OPTION]... gen [FILE]... 11 | 12 | Generate a parser from definitions in FILE, or stdin if omitted. 13 | 14 | -H, --header=FILE Also generate a header file. 15 | --no-auto-flags Do not add auto flags (--help, --version). 16 | --no-auto-help Do not add auto --help flag 17 | --no-auto-version Do not add auto --version flag 18 | --no-auto-actions Do not automatically handle auto flags. 19 | --version=VERSION Hardwire version number. 20 | --custom=FILE Include custom macros from FILE. 21 | -p, --preserve Preserve indentation and newlines. 22 | 23 | 24 | ## GENMAN 25 | Usage: yuck [OPTION]... genman [FILE]... 26 | 27 | Generate a man page from definitions in FILE, or stdin if omitted. 28 | 29 | --version-string=STRING Hardwire version number as STRING. 30 | --version-file=FILE Hardwire version number from FILE. 31 | --package=STRING Use package STRING instead of umbrella. 32 | -i, --include=FILE... Include sections from FILE 33 | --info-page[=NAME] Include reference to Texinfo manual. 34 | 35 | 36 | ## GENDSL 37 | Usage: yuck gendsl [FILE]... 38 | 39 | Generate the intermediary description of definitions from FILE, or stdin 40 | if omitted. 41 | 42 | --no-auto-flags Do not add auto flags (--help, --version). 43 | --no-auto-help Do not add auto --help flag 44 | --no-auto-version Do not add auto --version flag 45 | --no-auto-actions Do not automatically handle auto flags. 46 | --version=VERSION Hardwire version number. 47 | -p, --preserve Preserve indentation and newlines. 48 | 49 | 50 | ## VER 51 | Usage: yuck scmver [PATH] 52 | 53 | Guess version number for SCM controlled PATH. 54 | If PATH is a file run a transformation. 55 | If PATH is a directory just output the version number. 56 | 57 | Transformations are done through the m4 processor: 58 | YUCK_SCMVER_VTAG will expand to the tag name. 59 | YUCK_SCMVER_SCM will expand to the name of the SCM used. 60 | YUCK_SCMVER_DIST will expand to the distance, that is the number of 61 | commits since the last tag. 62 | YUCK_SCMVER_RVSN will expand to the current commit number. 63 | YUCK_SCMVER_FLAG_DIRTY is set for changes in the source tree that have 64 | not yet been committed. 65 | 66 | Definitions in the template yuck-scmver.m4 are prepended, and by 67 | default this defines the YUCK_SCMVER_VERSION macro that expands to the 68 | full version number. 69 | 70 | 71 | -v, --verbose Print additional information on stderr. 72 | --reference=FILE Store version reference in FILE and don't touch 73 | the output file if nothing has changed. 74 | -f, --force Force operation even if the current scm version 75 | coincides with the reference version. 76 | -n, --use-reference Use version number provided in the reference 77 | file instead of determining it. 78 | --ignore-noscm Don't treat no scm as error. 79 | 80 | 81 | Usage: yuck config 82 | 83 | Output config values for yuck. 84 | 85 | --m4 Print m4 value used during yuck build. 86 | -------------------------------------------------------------------------------- /test/Makefile.am: -------------------------------------------------------------------------------- 1 | # Help the Developers and yourself. Just use the C locale and settings 2 | # for the compilation. They can still be overriden by make LANG= 3 | # but that is general a not very good idea 4 | LANG=C 5 | LC_ALL=C 6 | 7 | AM_CFLAGS = $(EXTRA_CFLAGS) 8 | AM_CPPFLAGS = -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_BSD_SOURCE 9 | AM_CPPFLAGS += -D_ALL_SOURCE 10 | AM_CPPFLAGS += -D_NETBSD_SOURCE 11 | AM_CPPFLAGS += -D_DEFAULT_SOURCE 12 | AM_CPPFLAGS += -UHAVE_CONFIG_H -UHAVE_VERSION_H 13 | 14 | EXTRA_DIST = $(TESTS) 15 | check_PROGRAMS = 16 | TESTS = 17 | TEST_EXTENSIONS = 18 | BUILT_SOURCES = 19 | CLEANFILES = $(BUILT_SOURCES) 20 | 21 | ## summon our helper 22 | include clitoris.am 23 | AM_CLIT_LOG_FLAGS = -v --builddir $(top_builddir)/src 24 | TESTS_ENVIRONMENT = root=$(top_srcdir) YUCK_TEMPLATE_PATH="$(abs_top_srcdir)/src" 25 | 26 | 27 | TESTS += plain_01.clit 28 | TESTS += plain_02.clit 29 | TESTS += plain_03.clit 30 | TESTS += plain_04.clit 31 | EXTRA_DIST += plain_01.yuck 32 | EXTRA_DIST += plain_02.yuck 33 | EXTRA_DIST += plain_03.yuck 34 | EXTRA_DIST += plain_04.yuck 35 | 36 | TESTS += plain_05.clit 37 | TESTS += plain_06.clit 38 | EXTRA_DIST += plain_05.yuck 39 | EXTRA_DIST += plain_06.yuck 40 | 41 | TESTS += outfn_01.clit 42 | TESTS += outfn_02.clit 43 | TESTS += outfn_03.clit 44 | 45 | TESTS += subcmd_01.clit 46 | EXTRA_DIST += subcmd_01.yuck 47 | TESTS += subcmd_02.clit 48 | EXTRA_DIST += subcmd_02.yuck 49 | TESTS += subcmd_03.clit 50 | EXTRA_DIST += subcmd_03.yuck 51 | TESTS += subcmd_04.clit 52 | EXTRA_DIST += subcmd_04.yuck 53 | 54 | TESTS += option_01.clit 55 | EXTRA_DIST += option_01.yuck 56 | TESTS += option_02.clit 57 | EXTRA_DIST += option_02.yuck 58 | TESTS += option_03.clit 59 | EXTRA_DIST += option_03.yuck 60 | TESTS += option_04.clit 61 | EXTRA_DIST += option_04.yuck 62 | TESTS += option_05.clit 63 | EXTRA_DIST += option_05.yuck 64 | TESTS += option_06.clit 65 | EXTRA_DIST += option_06.yuck 66 | TESTS += option_07.clit 67 | EXTRA_DIST += option_07.yuck 68 | TESTS += option_08.clit 69 | EXTRA_DIST += option_08.yuck 70 | 71 | TESTS += option_09.clit 72 | EXTRA_DIST += option_09.yuck 73 | TESTS += option_10.clit 74 | EXTRA_DIST += option_10.yuck 75 | TESTS += option_11.clit 76 | TESTS += option_12.clit 77 | 78 | TESTS += optarg_01.clit 79 | EXTRA_DIST += optarg_01.yuck 80 | TESTS += optarg_02.clit 81 | EXTRA_DIST += optarg_02.yuck 82 | TESTS += optarg_03.clit 83 | EXTRA_DIST += optarg_03.yuck 84 | TESTS += optarg_04.clit 85 | EXTRA_DIST += optarg_04.yuck 86 | 87 | TESTS += mularg_01.clit 88 | EXTRA_DIST += mularg_01.yuck 89 | TESTS += mularg_02.clit 90 | EXTRA_DIST += mularg_02.yuck 91 | TESTS += mularg_03.clit 92 | EXTRA_DIST += mularg_03.yuck 93 | TESTS += mularg_04.clit 94 | EXTRA_DIST += mularg_04.yuck 95 | 96 | TESTS += muloptarg_01.clit 97 | EXTRA_DIST += muloptarg_01.yuck 98 | TESTS += muloptarg_02.clit 99 | EXTRA_DIST += muloptarg_02.yuck 100 | TESTS += muloptarg_03.clit 101 | EXTRA_DIST += muloptarg_03.yuck 102 | TESTS += muloptarg_04.clit 103 | EXTRA_DIST += muloptarg_04.yuck 104 | 105 | TESTS += noauto_01.clit 106 | TESTS += noauto_02.clit 107 | EXTRA_DIST += noauto_01.yuck 108 | 109 | BUILT_SOURCES += xmpl.yucc 110 | check_PROGRAMS += xmpl 111 | EXTRA_DIST += xmpl.c xmpl.yuck 112 | TESTS += xmpl-01.clit 113 | TESTS += xmpl-02.clit 114 | TESTS += xmpl-03.clit 115 | TESTS += xmpl-04.clit 116 | 117 | BUILT_SOURCES += xmpl-subcommands.yucc 118 | check_PROGRAMS += xmpl-subcommands 119 | EXTRA_DIST += xmpl-subcommands.c xmpl-subcommands.yuck 120 | TESTS += xmpl-subcommands-01.clit 121 | TESTS += xmpl-subcommands-02.clit 122 | TESTS += xmpl-subcommands-03.clit 123 | TESTS += xmpl-subcommands-04.clit 124 | 125 | BUILT_SOURCES += xmpl-command.yucc 126 | check_PROGRAMS += xmpl-command 127 | EXTRA_DIST += xmpl-command.c xmpl-command.yuck 128 | TESTS += xmpl-command-01.clit 129 | 130 | BUILT_SOURCES += xmpl-posarg-with-angles.yucc 131 | check_PROGRAMS += xmpl-posarg-with-angles 132 | EXTRA_DIST += xmpl-posarg-with-angles.c xmpl-posarg-with-angles.yuck 133 | TESTS += xmpl-posarg-with-angles-01.clit 134 | 135 | TESTS += scmver_01.clit 136 | TESTS += scmver_02.clit 137 | TESTS += scmver_03.clit 138 | EXTRA_DIST += scmver_02.tmpl 139 | TESTS += scmver_04.clit 140 | TESTS += scmver_05.clit 141 | EXTRA_DIST += scmver_04.ver 142 | EXTRA_DIST += scmver_05.ver 143 | TESTS += scmver_06.clit 144 | TESTS += scmver_07.clit 145 | EXTRA_DIST += scmver_06.ver 146 | EXTRA_DIST += scmver_07.ver 147 | TESTS += scmver_08.clit 148 | TESTS += scmver_09.clit 149 | 150 | EXTRA_DIST += generic.c 151 | check_PROGRAMS += generic-muloptarg_01 152 | generic_muloptarg_01_SOURCES = generic.c 153 | generic_muloptarg_01_CPPFLAGS = $(AM_CPPFLAGS) 154 | generic_muloptarg_01_CPPFLAGS += -DYUCC_FILE='"muloptarg_01.yucc"' 155 | BUILT_SOURCES += muloptarg_01.yucc 156 | TESTS += generic-muloptarg_01.clit 157 | 158 | check_PROGRAMS += generic-muloptarg_02 159 | generic_muloptarg_02_SOURCES = generic.c 160 | generic_muloptarg_02_CPPFLAGS = $(AM_CPPFLAGS) 161 | generic_muloptarg_02_CPPFLAGS += -DYUCC_FILE='"muloptarg_02.yucc"' 162 | BUILT_SOURCES += muloptarg_02.yucc 163 | TESTS += generic-muloptarg_02.clit 164 | 165 | check_PROGRAMS += generic-muloptarg_03 166 | generic_muloptarg_03_SOURCES = generic.c 167 | generic_muloptarg_03_CPPFLAGS = $(AM_CPPFLAGS) 168 | generic_muloptarg_03_CPPFLAGS += -DYUCC_FILE='"muloptarg_03.yucc"' 169 | BUILT_SOURCES += muloptarg_03.yucc 170 | TESTS += generic-muloptarg_03.clit 171 | 172 | check_PROGRAMS += generic-muloptarg_04 173 | generic_muloptarg_04_SOURCES = generic.c 174 | generic_muloptarg_04_CPPFLAGS = $(AM_CPPFLAGS) 175 | generic_muloptarg_04_CPPFLAGS += -DYUCC_FILE='"muloptarg_04.yucc"' 176 | BUILT_SOURCES += muloptarg_04.yucc 177 | TESTS += generic-muloptarg_04.clit 178 | 179 | check_PROGRAMS += generic-mularg_01 180 | generic_mularg_01_SOURCES = generic.c 181 | generic_mularg_01_CPPFLAGS = $(AM_CPPFLAGS) 182 | generic_mularg_01_CPPFLAGS += -DYUCC_FILE='"mularg_01.yucc"' 183 | BUILT_SOURCES += mularg_01.yucc 184 | TESTS += generic-mularg_01.clit 185 | 186 | check_PROGRAMS += generic-mularg_02 187 | generic_mularg_02_SOURCES = generic.c 188 | generic_mularg_02_CPPFLAGS = $(AM_CPPFLAGS) 189 | generic_mularg_02_CPPFLAGS += -DYUCC_FILE='"mularg_02.yucc"' 190 | BUILT_SOURCES += mularg_02.yucc 191 | TESTS += generic-mularg_02.clit 192 | 193 | check_PROGRAMS += generic-mularg_03 194 | generic_mularg_03_SOURCES = generic.c 195 | generic_mularg_03_CPPFLAGS = $(AM_CPPFLAGS) 196 | generic_mularg_03_CPPFLAGS += -DYUCC_FILE='"mularg_03.yucc"' 197 | BUILT_SOURCES += mularg_03.yucc 198 | TESTS += generic-mularg_03.clit 199 | 200 | check_PROGRAMS += generic-mularg_04 201 | generic_mularg_04_SOURCES = generic.c 202 | generic_mularg_04_CPPFLAGS = $(AM_CPPFLAGS) 203 | generic_mularg_04_CPPFLAGS += -DYUCC_FILE='"mularg_04.yucc"' 204 | BUILT_SOURCES += mularg_04.yucc 205 | TESTS += generic-mularg_04.clit 206 | 207 | check_PROGRAMS += generic-optarg_01 208 | generic_optarg_01_SOURCES = generic.c 209 | generic_optarg_01_CPPFLAGS = $(AM_CPPFLAGS) 210 | generic_optarg_01_CPPFLAGS += -DYUCC_FILE='"optarg_01.yucc"' 211 | BUILT_SOURCES += optarg_01.yucc 212 | TESTS += generic-optarg_01.clit 213 | 214 | check_PROGRAMS += generic-optarg_02 215 | generic_optarg_02_SOURCES = generic.c 216 | generic_optarg_02_CPPFLAGS = $(AM_CPPFLAGS) 217 | generic_optarg_02_CPPFLAGS += -DYUCC_FILE='"optarg_02.yucc"' 218 | BUILT_SOURCES += optarg_02.yucc 219 | TESTS += generic-optarg_02.clit 220 | 221 | check_PROGRAMS += generic-optarg_03 222 | generic_optarg_03_SOURCES = generic.c 223 | generic_optarg_03_CPPFLAGS = $(AM_CPPFLAGS) 224 | generic_optarg_03_CPPFLAGS += -DYUCC_FILE='"optarg_03.yucc"' 225 | BUILT_SOURCES += optarg_03.yucc 226 | TESTS += generic-optarg_03.clit 227 | 228 | check_PROGRAMS += generic-optarg_04 229 | generic_optarg_04_SOURCES = generic.c 230 | generic_optarg_04_CPPFLAGS = $(AM_CPPFLAGS) 231 | generic_optarg_04_CPPFLAGS += -DYUCC_FILE='"optarg_04.yucc"' 232 | BUILT_SOURCES += optarg_04.yucc 233 | TESTS += generic-optarg_04.clit 234 | 235 | check_PROGRAMS += generic-option_01 236 | generic_option_01_SOURCES = generic.c 237 | generic_option_01_CPPFLAGS = $(AM_CPPFLAGS) 238 | generic_option_01_CPPFLAGS += -DYUCC_FILE='"option_01.yucc"' 239 | BUILT_SOURCES += option_01.yucc 240 | TESTS += generic-option_01.clit 241 | 242 | check_PROGRAMS += generic-option_02 243 | generic_option_02_SOURCES = generic.c 244 | generic_option_02_CPPFLAGS = $(AM_CPPFLAGS) 245 | generic_option_02_CPPFLAGS += -DYUCC_FILE='"option_02.yucc"' 246 | BUILT_SOURCES += option_02.yucc 247 | TESTS += generic-option_02.clit 248 | 249 | check_PROGRAMS += generic-option_03 250 | generic_option_03_SOURCES = generic.c 251 | generic_option_03_CPPFLAGS = $(AM_CPPFLAGS) 252 | generic_option_03_CPPFLAGS += -DYUCC_FILE='"option_03.yucc"' 253 | BUILT_SOURCES += option_03.yucc 254 | TESTS += generic-option_03.clit 255 | 256 | check_PROGRAMS += generic-option_04 257 | generic_option_04_SOURCES = generic.c 258 | generic_option_04_CPPFLAGS = $(AM_CPPFLAGS) 259 | generic_option_04_CPPFLAGS += -DYUCC_FILE='"option_04.yucc"' 260 | BUILT_SOURCES += option_04.yucc 261 | TESTS += generic-option_04.clit 262 | 263 | check_PROGRAMS += generic-option_05 264 | generic_option_05_SOURCES = generic.c 265 | generic_option_05_CPPFLAGS = $(AM_CPPFLAGS) 266 | generic_option_05_CPPFLAGS += -DYUCC_FILE='"option_05.yucc"' 267 | BUILT_SOURCES += option_05.yucc 268 | TESTS += generic-option_05.clit 269 | 270 | check_PROGRAMS += generic-option_06 271 | generic_option_06_SOURCES = generic.c 272 | generic_option_06_CPPFLAGS = $(AM_CPPFLAGS) 273 | generic_option_06_CPPFLAGS += -DYUCC_FILE='"option_06.yucc"' 274 | BUILT_SOURCES += option_06.yucc 275 | TESTS += generic-option_06.clit 276 | 277 | check_PROGRAMS += generic-option_07 278 | generic_option_07_SOURCES = generic.c 279 | generic_option_07_CPPFLAGS = $(AM_CPPFLAGS) 280 | generic_option_07_CPPFLAGS += -DYUCC_FILE='"option_07.yucc"' 281 | BUILT_SOURCES += option_07.yucc 282 | TESTS += generic-option_07.clit 283 | 284 | check_PROGRAMS += generic-option_08 285 | generic_option_08_SOURCES = generic.c 286 | generic_option_08_CPPFLAGS = $(AM_CPPFLAGS) 287 | generic_option_08_CPPFLAGS += -DYUCC_FILE='"option_08.yucc"' 288 | BUILT_SOURCES += option_08.yucc 289 | TESTS += generic-option_08.clit 290 | 291 | check_PROGRAMS += post-hook_01 292 | post_hook_01_SOURCES = post-hook.c 293 | post_hook_01_CPPFLAGS = $(AM_CPPFLAGS) 294 | post_hook_01_CPPFLAGS += -DYUCC_FILE='"plain_05.yucc"' 295 | BUILT_SOURCES += plain_05.yucc 296 | TESTS += post-hook_01.clit 297 | TESTS += post-hook_02.clit 298 | 299 | TESTS += escape_01.clit 300 | TESTS += escape_02.clit 301 | EXTRA_DIST += escape_01.yuck 302 | check_PROGRAMS += generic-escape_02 303 | generic_escape_02_SOURCES = generic.c 304 | generic_escape_02_CPPFLAGS = $(AM_CPPFLAGS) 305 | generic_escape_02_CPPFLAGS += -DYUCC_FILE='"escape_01.yucc"' 306 | BUILT_SOURCES += escape_01.yucc 307 | TESTS += escape_03.clit 308 | TESTS += escape_04.clit 309 | EXTRA_DIST += escape_03.yuck 310 | check_PROGRAMS += generic-escape_04 311 | generic_escape_04_SOURCES = generic.c 312 | generic_escape_04_CPPFLAGS = $(AM_CPPFLAGS) 313 | generic_escape_04_CPPFLAGS += -DYUCC_FILE='"escape_03.yucc"' 314 | BUILT_SOURCES += escape_03.yucc 315 | 316 | check_PROGRAMS += generic-plain_05 317 | generic_plain_05_SOURCES = generic.c 318 | generic_plain_05_CPPFLAGS = $(AM_CPPFLAGS) 319 | generic_plain_05_CPPFLAGS += -DYUCC_FILE='"plain_05.yucc"' 320 | BUILT_SOURCES += plain_05.yucc 321 | TESTS += generic-plain_05.clit 322 | 323 | check_PROGRAMS += generic-plain_06 324 | generic_plain_06_SOURCES = generic.c 325 | generic_plain_06_CPPFLAGS = $(AM_CPPFLAGS) 326 | generic_plain_06_CPPFLAGS += -DYUCC_FILE='"plain_06.yucc"' 327 | BUILT_SOURCES += plain_06.yucc 328 | TESTS += generic-plain_06.clit 329 | 330 | 331 | check_PROGRAMS += brack_01 332 | brack_01_SOURCES = generic.c 333 | brack_01_CPPFLAGS = $(AM_CPPFLAGS) 334 | brack_01_CPPFLAGS += -DYUCC_FILE='"brack_01.yucc"' 335 | EXTRA_DIST += brack_01.yuck 336 | BUILT_SOURCES += brack_01.yucc 337 | TESTS += brack_01.clit 338 | 339 | check_PROGRAMS += brack_02 340 | brack_02_SOURCES = generic.c 341 | brack_02_CPPFLAGS = $(AM_CPPFLAGS) 342 | brack_02_CPPFLAGS += -DYUCC_FILE='"brack_02.yucc"' 343 | EXTRA_DIST += brack_02.yuck 344 | BUILT_SOURCES += brack_02.yucc 345 | TESTS += brack_02.clit 346 | 347 | check_PROGRAMS += paren_01 348 | paren_01_SOURCES = generic.c 349 | paren_01_CPPFLAGS = $(AM_CPPFLAGS) 350 | paren_01_CPPFLAGS += -DYUCC_FILE='"paren_01.yucc"' 351 | EXTRA_DIST += paren_01.yuck 352 | BUILT_SOURCES += paren_01.yucc 353 | TESTS += paren_01.clit 354 | 355 | check_PROGRAMS += paren_02 356 | paren_02_SOURCES = generic.c 357 | paren_02_CPPFLAGS = $(AM_CPPFLAGS) 358 | paren_02_CPPFLAGS += -DYUCC_FILE='"paren_02.yucc"' 359 | EXTRA_DIST += paren_02.yuck 360 | BUILT_SOURCES += paren_02.yucc 361 | TESTS += paren_02.clit 362 | 363 | check_PROGRAMS += underq_01 364 | underq_01_SOURCES = generic.c 365 | underq_01_CPPFLAGS = $(AM_CPPFLAGS) 366 | underq_01_CPPFLAGS += -DYUCC_FILE='"underq_01.yucc"' 367 | EXTRA_DIST += underq_01.yuck 368 | BUILT_SOURCES += underq_01.yucc 369 | TESTS += underq_01.clit 370 | 371 | check_PROGRAMS += underq_02 372 | underq_02_SOURCES = generic.c 373 | underq_02_CPPFLAGS = $(AM_CPPFLAGS) 374 | underq_02_CPPFLAGS += -DYUCC_FILE='"underq_02.yucc"' 375 | EXTRA_DIST += underq_02.yuck 376 | BUILT_SOURCES += underq_02.yucc 377 | TESTS += underq_02.clit 378 | 379 | check_PROGRAMS += underq_03 380 | underq_03_SOURCES = generic.c 381 | underq_03_CPPFLAGS = $(AM_CPPFLAGS) 382 | underq_03_CPPFLAGS += -DYUCC_FILE='"underq_03.yucc"' 383 | EXTRA_DIST += underq_03.yuck 384 | BUILT_SOURCES += underq_03.yucc 385 | TESTS += underq_03.clit 386 | 387 | check_PROGRAMS += underq_04 388 | underq_04_SOURCES = generic.c 389 | underq_04_CPPFLAGS = $(AM_CPPFLAGS) 390 | underq_04_CPPFLAGS += -DYUCC_FILE='"underq_04.yucc"' 391 | EXTRA_DIST += underq_04.yuck 392 | BUILT_SOURCES += underq_04.yucc 393 | TESTS += underq_04.clit 394 | 395 | check_PROGRAMS += underq_05 396 | underq_05_SOURCES = generic.c 397 | underq_05_CPPFLAGS = $(AM_CPPFLAGS) 398 | underq_05_CPPFLAGS += -DYUCC_FILE='"underq_05.yucc"' 399 | EXTRA_DIST += underq_05.yuck 400 | BUILT_SOURCES += underq_05.yucc 401 | TESTS += underq_05.clit 402 | 403 | check_PROGRAMS += underq_06 404 | underq_06_SOURCES = generic.c 405 | underq_06_CPPFLAGS = $(AM_CPPFLAGS) 406 | underq_06_CPPFLAGS += -DYUCC_FILE='"underq_06.yucc"' 407 | EXTRA_DIST += underq_06.yuck 408 | BUILT_SOURCES += underq_06.yucc 409 | TESTS += underq_06.clit 410 | 411 | check_PROGRAMS += auto-dashdash 412 | auto_dashdash_SOURCES = auto-dashdash.c 413 | auto_dashdash_CPPFLAGS = $(AM_CPPFLAGS) 414 | auto_dashdash_CPPFLAGS += -DYUCC_FILE='"auto-dashdash.yucc"' 415 | EXTRA_DIST += auto-dashdash.yuck 416 | BUILT_SOURCES += auto-dashdash.yucc 417 | TESTS += auto-dashdash_01.clit 418 | TESTS += auto-dashdash_02.clit 419 | 420 | check_PROGRAMS += lone-cmd_01 421 | lone_cmd_01_SOURCES = generic.c 422 | lone_cmd_01_CPPFLAGS = $(AM_CPPFLAGS) 423 | lone_cmd_01_CPPFLAGS += -DYUCC_FILE='"lone-cmd_01.yucc"' 424 | EXTRA_DIST += lone-cmd_01.yuck 425 | BUILT_SOURCES += lone-cmd_01.yucc 426 | TESTS += lone-cmd_01.clit 427 | 428 | check_PROGRAMS += lone-cmd_02 429 | lone_cmd_02_SOURCES = generic.c 430 | lone_cmd_02_CPPFLAGS = $(AM_CPPFLAGS) 431 | lone_cmd_02_CPPFLAGS += -DYUCC_FILE='"lone-cmd_02.yucc"' 432 | EXTRA_DIST += lone-cmd_02.yuck 433 | BUILT_SOURCES += lone-cmd_02.yucc 434 | TESTS += lone-cmd_02.clit 435 | 436 | check_PROGRAMS += dashdesc_01 437 | dashdesc_01_SOURCES = generic.c 438 | dashdesc_01_CPPFLAGS = $(AM_CPPFLAGS) 439 | dashdesc_01_CPPFLAGS += -DYUCC_FILE='"dashdesc_01.yucc"' 440 | EXTRA_DIST += dashdesc_01.yuck 441 | BUILT_SOURCES += dashdesc_01.yucc 442 | TESTS += dashdesc_01.clit 443 | 444 | check_PROGRAMS += xtraarg_01 445 | xtraarg_01_SOURCES = generic.c 446 | xtraarg_01_CPPFLAGS = $(AM_CPPFLAGS) 447 | xtraarg_01_CPPFLAGS += -DYUCC_FILE='"xtraarg_01.yucc"' 448 | EXTRA_DIST += xtraarg_01.yuck 449 | BUILT_SOURCES += xtraarg_01.yucc 450 | TESTS += xtraarg_01.clit 451 | 452 | check_PROGRAMS += lastarg_01 453 | lastarg_01_SOURCES = generic.c 454 | lastarg_01_CPPFLAGS = $(AM_CPPFLAGS) 455 | lastarg_01_CPPFLAGS += -DYUCC_FILE='"lastarg_01.yucc"' 456 | EXTRA_DIST += lastarg_01.yuck 457 | BUILT_SOURCES += lastarg_01.yucc 458 | TESTS += lastarg_01.clit 459 | 460 | check_PROGRAMS += lastarg_02 461 | lastarg_02_SOURCES = generic.c 462 | lastarg_02_CPPFLAGS = $(AM_CPPFLAGS) 463 | lastarg_02_CPPFLAGS += -DYUCC_FILE='"lastarg_02.yucc"' 464 | EXTRA_DIST += lastarg_02.yuck 465 | BUILT_SOURCES += lastarg_02.yucc 466 | TESTS += lastarg_02.clit 467 | 468 | 469 | TESTS += scmver_11.clit 470 | TESTS += scmver_12.clit 471 | TESTS += scmver_13.clit 472 | TESTS += scmver_14.clit 473 | TESTS += scmver_15.clit 474 | TESTS += scmver_16.clit 475 | TESTS += scmver_17.clit 476 | TESTS += scmver_18.clit 477 | TESTS += scmver_21.clit 478 | TESTS += scmver_22.clit 479 | TESTS += scmver_23.clit 480 | TESTS += scmver_24.clit 481 | TESTS += scmver_25.clit 482 | TESTS += scmver_26.clit 483 | TESTS += scmver_27.clit 484 | TESTS += scmver_28.clit 485 | EXTRA_DIST += rudi_01.version 486 | EXTRA_DIST += rudi_02.version 487 | EXTRA_DIST += rudi_03.version 488 | EXTRA_DIST += rudi_04.version 489 | EXTRA_DIST += rudi_05.version 490 | EXTRA_DIST += rudi_06.version 491 | EXTRA_DIST += rudi_07.version 492 | EXTRA_DIST += rudi_08.version 493 | EXTRA_DIST += rudi_09.version 494 | EXTRA_DIST += rudi_10.version 495 | EXTRA_DIST += rudi_11.version 496 | EXTRA_DIST += rudi_12.version 497 | EXTRA_DIST += rudi_13.version 498 | EXTRA_DIST += rudi_14.version 499 | EXTRA_DIST += rudi_15.version 500 | EXTRA_DIST += rudi_16.version 501 | 502 | TESTS += man-01.clit 503 | EXTRA_DIST += man-01.yuck 504 | 505 | 506 | ## just to get the tests and yucc files rebuilt 507 | $(BUILT_SOURCES): $(top_builddir)/src/yuck$(EXEEXT) 508 | 509 | ## yuck rule 510 | SUFFIXES = .yuck 511 | SUFFIXES += .yucc 512 | .yuck.yucc: 513 | $(AM_V_GEN) $(TESTS_ENVIRONMENT) $(top_builddir)/src/yuck gen $< > $@ 514 | 515 | ## Makefile.am ends here 516 | -------------------------------------------------------------------------------- /test/auto-dashdash.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include YUCC_FILE 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | yuck_t argp[1U]; 7 | yuck_parse(argp, argc, argv); 8 | for (size_t i = 0U; i < argp->nargs; i++) { 9 | puts(argp->args[i]); 10 | } 11 | yuck_free(argp); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /test/auto-dashdash.yuck: -------------------------------------------------------------------------------- 1 | Usage: autodd ONE TWO -- NOARGS_ALLOWED_HERE 2 | 3 | -a Just a dummy 4 | -b Just another dummy 5 | -c And another one 6 | 7 | -------------------------------------------------------------------------------- /test/auto-dashdash_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ auto-dashdash -a FIRST -b SECOND 4 | FIRST 5 | SECOND 6 | $ 7 | -------------------------------------------------------------------------------- /test/auto-dashdash_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ auto-dashdash -a FIRST -b SECOND ANOTHER -c 4 | FIRST 5 | SECOND 6 | ANOTHER 7 | -c 8 | $ 9 | -------------------------------------------------------------------------------- /test/brack_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ brack_01 --help 4 | Usage: brack [OPTION]... 5 | 6 | This is the description, that contains [brackets]. 7 | 8 | -h, --help display this help and exit 9 | -V, --version output version information and exit 10 | 11 | $ 12 | 13 | ## brack_01.clit ends here 14 | -------------------------------------------------------------------------------- /test/brack_01.yuck: -------------------------------------------------------------------------------- 1 | Usage: brack 2 | 3 | This is the description, that contains [brackets]. 4 | -------------------------------------------------------------------------------- /test/brack_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ brack_02 --help 4 | Usage: brack [OPTION]... 5 | 6 | This is the description, that contains [brackets]. 7 | 8 | And an interim with [ ] brackets. 9 | 10 | -h, --help display this help and exit 11 | -V, --version output version information and exit 12 | 13 | $ 14 | 15 | ## brack_02.clit ends here 16 | -------------------------------------------------------------------------------- /test/brack_02.yuck: -------------------------------------------------------------------------------- 1 | Usage: brack 2 | 3 | This is the description, that contains [brackets]. 4 | 5 | And an interim with [ ] brackets. 6 | -------------------------------------------------------------------------------- /test/clitoris.am: -------------------------------------------------------------------------------- 1 | ## assumes TEST_EXTENSIONS, BUILT_SOURCES, check_PROGRAMS have been set 2 | TEST_EXTENSIONS += .clit 3 | CLIT_LOG_COMPILER = $(builddir)/clitoris 4 | 5 | ## our friendly helper 6 | check_PROGRAMS += clitoris 7 | clitoris_SOURCES = clitoris.c clitoris.yuck 8 | clitoris_CPPFLAGS = -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600 -D_BSD_SOURCE 9 | clitoris_CPPFLAGS += -D_ALL_SOURCE -D_NETBSD_SOURCE 10 | clitoris_CPPFLAGS += -UHAVE_VERSION_H 11 | clitoris_LDADD = 12 | if HAVE_PTY_H 13 | clitoris_LDADD += -lutil 14 | endif HAVE_PTY_H 15 | BUILT_SOURCES += clitoris.yucc 16 | 17 | ## yuck rule 18 | clitoris.yucc: clitoris.yuck 19 | $(AM_V_GEN) PATH=$(top_builddir)/src:"$${PATH}" \ 20 | yuck$(EXEEXT) gen -o $@ $< 21 | -------------------------------------------------------------------------------- /test/clitoris.yuck: -------------------------------------------------------------------------------- 1 | Usage: clitoris [OPTION]... TEST_FILE 2 | 3 | Run .clit regression test files. 4 | 5 | --builddir=DIR Specify where the compiled binaries can be found. 6 | --srcdir=DIR Specify where the source tree resides. 7 | --shell=CMD Use CMD as shell command, default: /bin/sh 8 | 9 | -v, --verbose Repeat execution steps on stderr. 10 | -t, --pseudo-tty Allocate a pseudo-tty for the tests to run in. 11 | 12 | --timeout=SECS Time out after SECS seconds. 13 | 14 | -k, --keep-going Don't break on the first failure or differing output 15 | 16 | --diff=CMD Use specified diff command instead of the one in PATH. 17 | -x, --exit-code[=N] Map any non-0 exit code from the commands to N, 18 | (default: 1), or, if N is omitted, pass the exit 19 | code through as is. 20 | -------------------------------------------------------------------------------- /test/dashdesc_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ dashdesc_01 --help 4 | Usage: dashdesc [OPTION]... [FILE]... 5 | 6 | Print FILE. 7 | 8 | -h, --help display this help and exit 9 | -V, --version output version information and exit 10 | --format=SPEC Output according to SPEC, a format string where 11 | - %b expands to the beginning 12 | - %e expands to the end 13 | - %s expands to the summary 14 | - %u expands to the uid 15 | 16 | $ 17 | 18 | ## dashdesc_01.clit ends here 19 | -------------------------------------------------------------------------------- /test/dashdesc_01.yuck: -------------------------------------------------------------------------------- 1 | Usage: dashdesc [FILE]... 2 | 3 | Print FILE. 4 | 5 | --format=SPEC Output according to SPEC, a format string where 6 | - %b expands to the beginning 7 | - %e expands to the end 8 | - %s expands to the summary 9 | - %u expands to the uid 10 | -------------------------------------------------------------------------------- /test/escape_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/escape_01.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([dashx], [x], [], [flag]); 13 | yuck_set_option_desc([dashx], [Tricky, with lone  and " and \ and 14 | newlines]) 15 | 16 | changequote`'dnl 17 | divert`'dnl 18 | $ 19 | 20 | ## escape_01.clit ends here 21 | -------------------------------------------------------------------------------- /test/escape_01.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x Tricky, with lone [ and " and \ and 4 | newlines 5 | 6 | -------------------------------------------------------------------------------- /test/escape_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-escape_02 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x Tricky, with lone [ and " and \ and 9 | newlines 10 | 11 | $ 12 | 13 | ## escape_02.clit ends here 14 | -------------------------------------------------------------------------------- /test/escape_03.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/escape_03.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([dashx], [x], [], [arg, FOO, opt]); 13 | yuck_set_option_desc([dashx], [Tricky, with lone  and " and \ and 14 | newlines]) 15 | 16 | changequote`'dnl 17 | divert`'dnl 18 | $ 19 | 20 | ## escape_03.clit ends here 21 | -------------------------------------------------------------------------------- /test/escape_03.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x [FOO] Tricky, with lone [ and " and \ and 4 | newlines 5 | 6 | -------------------------------------------------------------------------------- /test/escape_04.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-escape_04 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x [FOO] Tricky, with lone [ and " and \ and 9 | newlines 10 | 11 | $ 12 | 13 | ## escape_04.clit ends here 14 | -------------------------------------------------------------------------------- /test/generic-mularg_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-mularg_01 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x LEVEL... Execute more thoroughly 9 | 10 | $ 11 | 12 | ## generic-mularg_01.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-mularg_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-mularg_02 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x LEVEL... 9 | 10 | $ 11 | 12 | ## generic-mularg_02.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-mularg_03.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-mularg_03 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x, --execute=LEVEL... 9 | 10 | $ 11 | 12 | ## generic-mularg_03.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-mularg_04.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-mularg_04 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x, --execute=LEVEL... 9 | Execute thoroughly. 10 | 11 | $ 12 | 13 | ## generic-mularg_04.clit ends here 14 | -------------------------------------------------------------------------------- /test/generic-muloptarg_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-muloptarg_01 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x [LEVEL]... Execute more thoroughly 9 | 10 | $ 11 | 12 | ## generic-muloptarg_01.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-muloptarg_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-muloptarg_02 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x [LEVEL]... 9 | 10 | $ 11 | 12 | ## generic-muloptarg_02.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-muloptarg_03.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-muloptarg_03 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x, --execute[=LEVEL]... 9 | 10 | $ 11 | 12 | ## generic-muloptarg_03.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-muloptarg_04.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-muloptarg_04 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x, --execute[=LEVEL]... 9 | Execute thoroughly. 10 | 11 | $ 12 | 13 | ## generic-muloptarg_04.clit ends here 14 | -------------------------------------------------------------------------------- /test/generic-optarg_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-optarg_01 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x [LEVEL] Execute more thoroughly 9 | 10 | $ 11 | 12 | ## generic-optarg_01.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-optarg_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-optarg_02 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x [LEVEL] 9 | 10 | $ 11 | 12 | ## generic-optarg_02.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-optarg_03.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-optarg_03 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x, --execute[=LEVEL] 9 | 10 | $ 11 | 12 | ## generic-optarg_03.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-optarg_04.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-optarg_04 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x, --execute[=LEVEL] Execute thoroughly. 9 | 10 | $ 11 | 12 | ## generic-optarg_04.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-option_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-option_01 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x Execute more thoroughly 9 | 10 | $ 11 | 12 | ## generic-option_01.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-option_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-option_02 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x 9 | 10 | $ 11 | 12 | ## generic-option_02.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-option_03.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-option_03 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x, --execute 9 | 10 | $ 11 | 12 | ## generic-option_03.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-option_04.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-option_04 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x, --execute Execute thoroughly. 9 | 10 | $ 11 | 12 | ## generic-option_04.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-option_05.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-option_05 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x FOO Execute more thoroughly 9 | 10 | $ 11 | 12 | ## generic-option_05.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-option_06.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-option_06 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x, --execute=FOO Execute more thoroughly 9 | 10 | $ 11 | 12 | ## generic-option_06.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-option_07.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-option_07 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x FOO 9 | 10 | $ 11 | 12 | ## generic-option_07.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-option_08.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-option_08 --help 4 | Usage: plain [OPTION]... 5 | 6 | -h, --help display this help and exit 7 | -V, --version output version information and exit 8 | -x, --execute=FOO 9 | 10 | $ 11 | 12 | ## generic-option_08.clit ends here 13 | -------------------------------------------------------------------------------- /test/generic-plain_05.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-plain_05 --help 4 | Usage: plain [OPTION]... 5 | 6 | Some description here. 7 | 8 | More stuff after a line with just whitespace. 9 | 10 | -h, --help display this help and exit 11 | -V, --version output version information and exit 12 | 13 | $ 14 | 15 | ## generic-plain_05.clit ends here 16 | -------------------------------------------------------------------------------- /test/generic-plain_06.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ generic-plain_06 --help 4 | Usage: plain [OPTION]... 5 | 6 | Some description here. 7 | 8 | More stuff after a line with just whitespace. 9 | 10 | Another interim. 11 | 12 | -h, --help display this help and exit 13 | -V, --version output version information and exit 14 | 15 | $ 16 | 17 | ## generic-plain_06.clit ends here 18 | -------------------------------------------------------------------------------- /test/generic.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include YUCC_FILE 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | yuck_t argp[1U]; 7 | yuck_parse(argp, argc, argv); 8 | yuck_free(argp); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /test/lastarg_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ lastarg_01 -x 3 4 | $ lastarg_01 --extra 3 5 | $ ! lastarg_01 -x 6 | $ ! lastarg_01 --extra 7 | $ 8 | 9 | ## lastarg_01.clit ends here 10 | -------------------------------------------------------------------------------- /test/lastarg_01.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x, --extra=LEVEL Execute more thoroughly 4 | -------------------------------------------------------------------------------- /test/lastarg_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ lastarg_02 -x3 4 | $ lastarg_02 --extra=3 5 | $ lastarg_02 -x 6 | $ lastarg_02 --extra 7 | $ 8 | 9 | ## lastarg_02.clit ends here 10 | -------------------------------------------------------------------------------- /test/lastarg_02.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x, --extra[=LEVEL] Execute more thoroughly 4 | -------------------------------------------------------------------------------- /test/lone-cmd_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ lone-cmd_01 --help 4 | Usage: ute [OPTION]... anal FILE... 5 | 6 | Check if this is an umbrella even though it's in command syntax. 7 | 8 | -h, --help display this help and exit 9 | -V, --version output version information and exit 10 | -x, --extra One more option. 11 | 12 | $ 13 | 14 | ## lone-cmd_01.clit ends here 15 | -------------------------------------------------------------------------------- /test/lone-cmd_01.yuck: -------------------------------------------------------------------------------- 1 | Usage: ute anal FILE... 2 | 3 | Check if this is an umbrella even though it's in command syntax. 4 | 5 | -x, --extra One more option. 6 | -------------------------------------------------------------------------------- /test/lone-cmd_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ lone-cmd_02 --help 4 | Usage: ute [OPTION]... FILE... 5 | 6 | Check if this is an umbrella even though it's in command syntax. 7 | 8 | -h, --help display this help and exit 9 | -V, --version output version information and exit 10 | -x, --extra One more option. 11 | 12 | $ 13 | 14 | ## lone-cmd_02.clit ends here 15 | -------------------------------------------------------------------------------- /test/lone-cmd_02.yuck: -------------------------------------------------------------------------------- 1 | Usage: ute FILE... 2 | 3 | Check if this is an umbrella even though it's in command syntax. 4 | 5 | -x, --extra One more option. 6 | -------------------------------------------------------------------------------- /test/man-01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ ! yuck genman "${srcdir}/man-01.yuck" | grep -- "dnl" 4 | $ 5 | 6 | ## man-01.clit ends here 7 | -------------------------------------------------------------------------------- /test/man-01.yuck: -------------------------------------------------------------------------------- 1 | Usage: command 2 | 3 | Usage: command subcommand 4 | -------------------------------------------------------------------------------- /test/mularg_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/mularg_01.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([dashx], [x], [], [arg, LEVEL, mul]); 13 | yuck_set_option_desc([dashx], [Execute more thoroughly]) 14 | 15 | changequote`'dnl 16 | divert`'dnl 17 | $ 18 | 19 | ## mularg_01.clit ends here 20 | -------------------------------------------------------------------------------- /test/mularg_01.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x LEVEL... Execute more thoroughly 4 | -------------------------------------------------------------------------------- /test/mularg_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/mularg_02.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([dashx], [x], [], [arg, LEVEL, mul]); 13 | 14 | changequote`'dnl 15 | divert`'dnl 16 | $ 17 | 18 | ## mularg_02.clit ends here 19 | -------------------------------------------------------------------------------- /test/mularg_02.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x LEVEL... 4 | -------------------------------------------------------------------------------- /test/mularg_03.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/mularg_03.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([execute], [x], [execute], [arg, LEVEL, mul]); 13 | 14 | changequote`'dnl 15 | divert`'dnl 16 | $ 17 | 18 | ## mularg_03.clit ends here 19 | -------------------------------------------------------------------------------- /test/mularg_03.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x, --execute=LEVEL... 4 | -------------------------------------------------------------------------------- /test/mularg_04.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/mularg_04.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([execute], [x], [execute], [arg, LEVEL, mul]); 13 | yuck_set_option_desc([execute], [Execute thoroughly.]) 14 | 15 | changequote`'dnl 16 | divert`'dnl 17 | $ 18 | 19 | ## mularg_04.clit ends here 20 | -------------------------------------------------------------------------------- /test/mularg_04.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x, --execute=LEVEL... Execute thoroughly. 4 | -------------------------------------------------------------------------------- /test/muloptarg_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/muloptarg_01.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([dashx], [x], [], [arg, LEVEL, mul, opt]); 13 | yuck_set_option_desc([dashx], [Execute more thoroughly]) 14 | 15 | changequote`'dnl 16 | divert`'dnl 17 | $ 18 | 19 | ## muloptarg_01.clit ends here 20 | -------------------------------------------------------------------------------- /test/muloptarg_01.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x [LEVEL]... Execute more thoroughly 4 | -------------------------------------------------------------------------------- /test/muloptarg_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/muloptarg_02.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([dashx], [x], [], [arg, LEVEL, mul, opt]); 13 | 14 | changequote`'dnl 15 | divert`'dnl 16 | $ 17 | 18 | ## muloptarg_02.clit ends here 19 | -------------------------------------------------------------------------------- /test/muloptarg_02.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x [LEVEL]... 4 | -------------------------------------------------------------------------------- /test/muloptarg_03.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/muloptarg_03.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([execute], [x], [execute], [arg, LEVEL, mul, opt]); 13 | 14 | changequote`'dnl 15 | divert`'dnl 16 | $ 17 | 18 | ## muloptarg_03.clit ends here 19 | -------------------------------------------------------------------------------- /test/muloptarg_03.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x, --execute[=LEVEL]... 4 | -------------------------------------------------------------------------------- /test/muloptarg_04.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/muloptarg_04.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([execute], [x], [execute], [arg, LEVEL, mul, opt]); 13 | yuck_set_option_desc([execute], [Execute thoroughly.]) 14 | 15 | changequote`'dnl 16 | divert`'dnl 17 | $ 18 | 19 | ## muloptarg_04.clit ends here 20 | -------------------------------------------------------------------------------- /test/muloptarg_04.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x, --execute[=LEVEL]... Execute thoroughly. 4 | -------------------------------------------------------------------------------- /test/noauto_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl --no-auto-flags "${srcdir}/noauto_01.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | 9 | changequote`'dnl 10 | divert`'dnl 11 | $ 12 | 13 | ## noauto_01.clit ends here 14 | -------------------------------------------------------------------------------- /test/noauto_01.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | -------------------------------------------------------------------------------- /test/noauto_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl --no-auto-actions "${srcdir}/noauto_01.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [flag]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [flag]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | 13 | changequote`'dnl 14 | divert`'dnl 15 | $ 16 | 17 | ## noauto_02.clit ends here 18 | -------------------------------------------------------------------------------- /test/optarg_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/optarg_01.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([dashx], [x], [], [arg, LEVEL, opt]); 13 | yuck_set_option_desc([dashx], [Execute more thoroughly]) 14 | 15 | changequote`'dnl 16 | divert`'dnl 17 | $ 18 | 19 | ## optarg_01.clit ends here 20 | -------------------------------------------------------------------------------- /test/optarg_01.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x [LEVEL] Execute more thoroughly 4 | -------------------------------------------------------------------------------- /test/optarg_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/optarg_02.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([dashx], [x], [], [arg, LEVEL, opt]); 13 | 14 | changequote`'dnl 15 | divert`'dnl 16 | $ 17 | 18 | ## optarg_02.clit ends here 19 | -------------------------------------------------------------------------------- /test/optarg_02.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x [LEVEL] 4 | -------------------------------------------------------------------------------- /test/optarg_03.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/optarg_03.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([execute], [x], [execute], [arg, LEVEL, opt]); 13 | 14 | changequote`'dnl 15 | divert`'dnl 16 | $ 17 | 18 | ## optarg_03.clit ends here 19 | -------------------------------------------------------------------------------- /test/optarg_03.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x, --execute[=LEVEL] 4 | -------------------------------------------------------------------------------- /test/optarg_04.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/optarg_04.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([execute], [x], [execute], [arg, LEVEL, opt]); 13 | yuck_set_option_desc([execute], [Execute thoroughly.]) 14 | 15 | changequote`'dnl 16 | divert`'dnl 17 | $ 18 | 19 | ## optarg_04.clit ends here 20 | -------------------------------------------------------------------------------- /test/optarg_04.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x, --execute[=LEVEL] Execute thoroughly. 4 | -------------------------------------------------------------------------------- /test/option_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/option_01.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([dashx], [x], [], [flag]); 13 | yuck_set_option_desc([dashx], [Execute more thoroughly]) 14 | 15 | changequote`'dnl 16 | divert`'dnl 17 | $ 18 | 19 | ## option_01.clit ends here 20 | -------------------------------------------------------------------------------- /test/option_01.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x Execute more thoroughly 4 | -------------------------------------------------------------------------------- /test/option_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/option_02.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([dashx], [x], [], [flag]); 13 | 14 | changequote`'dnl 15 | divert`'dnl 16 | $ 17 | 18 | ## option_02.clit ends here 19 | -------------------------------------------------------------------------------- /test/option_02.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x 4 | -------------------------------------------------------------------------------- /test/option_03.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/option_03.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([execute], [x], [execute], [flag]); 13 | 14 | changequote`'dnl 15 | divert`'dnl 16 | $ 17 | 18 | ## option_03.clit ends here 19 | -------------------------------------------------------------------------------- /test/option_03.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x, --execute 4 | -------------------------------------------------------------------------------- /test/option_04.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/option_04.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([execute], [x], [execute], [flag]); 13 | yuck_set_option_desc([execute], [Execute thoroughly.]) 14 | 15 | changequote`'dnl 16 | divert`'dnl 17 | $ 18 | 19 | ## option_04.clit ends here 20 | -------------------------------------------------------------------------------- /test/option_04.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x, --execute Execute thoroughly. 4 | -------------------------------------------------------------------------------- /test/option_05.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/option_05.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([dashx], [x], [], [arg, FOO]); 13 | yuck_set_option_desc([dashx], [Execute more thoroughly]) 14 | 15 | changequote`'dnl 16 | divert`'dnl 17 | $ 18 | 19 | ## option_05.clit ends here 20 | -------------------------------------------------------------------------------- /test/option_05.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x FOO Execute more thoroughly 4 | -------------------------------------------------------------------------------- /test/option_06.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/option_06.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([execute], [x], [execute], [arg, FOO]); 13 | yuck_set_option_desc([execute], [Execute more thoroughly]) 14 | 15 | changequote`'dnl 16 | divert`'dnl 17 | $ 18 | 19 | ## option_06.clit ends here 20 | -------------------------------------------------------------------------------- /test/option_06.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x, --execute=FOO Execute more thoroughly 4 | -------------------------------------------------------------------------------- /test/option_07.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/option_07.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([dashx], [x], [], [arg, FOO]); 13 | 14 | changequote`'dnl 15 | divert`'dnl 16 | $ 17 | 18 | ## option_07.clit ends here 19 | -------------------------------------------------------------------------------- /test/option_07.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x FOO 4 | -------------------------------------------------------------------------------- /test/option_08.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/option_08.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([execute], [x], [execute], [arg, FOO]); 13 | 14 | changequote`'dnl 15 | divert`'dnl 16 | $ 17 | 18 | ## option_08.clit ends here 19 | -------------------------------------------------------------------------------- /test/option_08.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | -x, --execute=FOO 4 | -------------------------------------------------------------------------------- /test/option_09.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/option_09.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([perform], [], [perform], [flag]); 13 | yuck_set_option_desc([perform], [Print, write, or otherwise output]) 14 | 15 | changequote`'dnl 16 | divert`'dnl 17 | $ 18 | 19 | ## option_09.clit ends here 20 | -------------------------------------------------------------------------------- /test/option_09.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | --perform Print, write, or otherwise output 4 | -------------------------------------------------------------------------------- /test/option_10.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/option_10.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | yuck_add_option([perform], [], [perform], [flag]); 13 | yuck_set_option_desc([perform], [Print, write, or, to end the line in a comma, 14 | otherwise output]) 15 | 16 | changequote`'dnl 17 | divert`'dnl 18 | $ 19 | 20 | ## option_10.clit ends here 21 | -------------------------------------------------------------------------------- /test/option_10.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | --perform Print, write, or, to end the line in a comma, 4 | otherwise output 5 | -------------------------------------------------------------------------------- /test/option_11.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gen "${srcdir}/option_09.yuck" | grep -- "--perform" 4 | --perform Print, write, or otherwise output\n\ 5 | $ 6 | 7 | ## option_11.clit ends here 8 | -------------------------------------------------------------------------------- /test/option_12.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gen "${srcdir}/option_10.yuck" | grep -- "--perform" 4 | --perform Print, write, or, to end the line in a comma,\n\ 5 | $ 6 | 7 | ## option_12.clit ends here 8 | -------------------------------------------------------------------------------- /test/outfn_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | ## see if all the output goes into outfn_01.x 4 | $ yuck gen -o "outfn_01.x" "${srcdir}/plain_01.yuck" 5 | $ test -s "outfn_01.x" 6 | $ rm -f "outfn_01.x" 7 | $ 8 | -------------------------------------------------------------------------------- /test/outfn_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | ## see if output goes into outfn_02.h 4 | $ yuck gen -H "outfn_02.h" "${srcdir}/plain_01.yuck" > "outfn_02.c" 5 | $ test -s "outfn_02.h" 6 | $ test -s "outfn_02.c" 7 | $ rm -f "outfn_02.h" "outfn_02.c" 8 | $ 9 | -------------------------------------------------------------------------------- /test/outfn_03.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | ## see if header output goes into outfn_03.h and beef into outfn_03.c 4 | $ yuck gen -H "outfn_03.h" -o "outfn_03.c" "${srcdir}/plain_01.yuck" 5 | $ test -s "outfn_03.h" 6 | $ test -s "outfn_03.c" 7 | $ rm -f "outfn_03.h" "outfn_03.c" 8 | $ 9 | -------------------------------------------------------------------------------- /test/paren_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ paren_01 --help 4 | Usage: paren [OPTION]... 5 | 6 | This is the description, that contains (parens), and (this 7 | time they're on different lines). 8 | 9 | -h, --help display this help and exit 10 | -V, --version output version information and exit 11 | 12 | $ 13 | 14 | ## paren_01.clit ends here 15 | -------------------------------------------------------------------------------- /test/paren_01.yuck: -------------------------------------------------------------------------------- 1 | Usage: paren 2 | 3 | This is the description, that contains (parens), and (this 4 | time they're on different lines). 5 | -------------------------------------------------------------------------------- /test/paren_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ paren_02 --help 4 | Usage: paren [OPTION]... 5 | 6 | This is the description, that contains (parens), and (this 7 | time they're on different lines). 8 | 9 | And an interim with (") parens. 10 | 11 | -h, --help display this help and exit 12 | -V, --version output version information and exit 13 | 14 | $ 15 | 16 | ## paren_02.clit ends here 17 | -------------------------------------------------------------------------------- /test/paren_02.yuck: -------------------------------------------------------------------------------- 1 | Usage: paren 2 | 3 | This is the description, that contains (parens), and (this 4 | time they're on different lines). 5 | 6 | And an interim with (") parens. 7 | -------------------------------------------------------------------------------- /test/plain_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/plain_01.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | 13 | changequote`'dnl 14 | divert`'dnl 15 | $ 16 | 17 | ## plain_01.clit ends here 18 | -------------------------------------------------------------------------------- /test/plain_01.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | -------------------------------------------------------------------------------- /test/plain_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/plain_02.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], [FILE...]) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | 13 | changequote`'dnl 14 | divert`'dnl 15 | $ 16 | 17 | ## plain_02.clit ends here 18 | -------------------------------------------------------------------------------- /test/plain_02.yuck: -------------------------------------------------------------------------------- 1 | usage: plain FILE... 2 | -------------------------------------------------------------------------------- /test/plain_03.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/plain_03.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], [-f FILE...]) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | 13 | changequote`'dnl 14 | divert`'dnl 15 | $ 16 | 17 | ## plain_03.clit ends here 18 | -------------------------------------------------------------------------------- /test/plain_03.yuck: -------------------------------------------------------------------------------- 1 | usage: plain [-r] [-x] -f FILE... 2 | -------------------------------------------------------------------------------- /test/plain_04.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/plain_04.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | changequote`'dnl 8 | divert`'dnl 9 | $ 10 | 11 | ## plain_04.clit ends here 12 | -------------------------------------------------------------------------------- /test/plain_04.yuck: -------------------------------------------------------------------------------- 1 | usage blablabla 2 | -------------------------------------------------------------------------------- /test/plain_05.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/plain_05.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_set_umbrella_desc([plain], [Some description here.]) 9 | yuck_add_option([help], [h], [help], [auto]) 10 | yuck_set_option_desc([help], [display this help and exit]) 11 | yuck_add_option([version], [V], [version], [auto]) 12 | yuck_set_option_desc([version], [output version information and exit]) 13 | yuck_add_inter([More stuff after a line with just whitespace.]) 14 | 15 | changequote`'dnl 16 | divert`'dnl 17 | $ 18 | 19 | ## plain_05.clit ends here 20 | -------------------------------------------------------------------------------- /test/plain_05.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | Some description here. 4 | 5 | More stuff after a line with just whitespace. 6 | -------------------------------------------------------------------------------- /test/plain_06.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/plain_06.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_set_umbrella_desc([plain], [Some description here.]) 9 | yuck_add_option([help], [h], [help], [auto]) 10 | yuck_set_option_desc([help], [display this help and exit]) 11 | yuck_add_option([version], [V], [version], [auto]) 12 | yuck_set_option_desc([version], [output version information and exit]) 13 | yuck_add_inter([More stuff after a line with just whitespace.]) 14 | yuck_add_inter([Another interim.]) 15 | 16 | changequote`'dnl 17 | divert`'dnl 18 | $ 19 | 20 | ## plain_06.clit ends here 21 | -------------------------------------------------------------------------------- /test/plain_06.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain 2 | 3 | Some description here. 4 | 5 | More stuff after a line with just whitespace. 6 | 7 | Another interim. 8 | -------------------------------------------------------------------------------- /test/post-hook.c: -------------------------------------------------------------------------------- 1 | #include 2 | #define yuck_post_help yuck_post_help 3 | #define yuck_post_version yuck_post_version 4 | #define yuck_post_usage yuck_post_usage 5 | #include YUCC_FILE 6 | 7 | static void yuck_post_help(const yuck_t *x) 8 | { 9 | puts("SOME POST HELP TEXT"); 10 | return; 11 | } 12 | 13 | static void yuck_post_version(const yuck_t *x) 14 | { 15 | puts("(C) 2014 written by yuck test-suite"); 16 | return; 17 | } 18 | 19 | static void yuck_post_usage(const yuck_t *x) 20 | { 21 | puts("Options are as follows"); 22 | return; 23 | } 24 | 25 | int main(int argc, char *argv[]) 26 | { 27 | yuck_t argp[1U]; 28 | yuck_parse(argp, argc, argv); 29 | yuck_free(argp); 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /test/post-hook_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ post-hook_01 --help 4 | Usage: plain [OPTION]... 5 | 6 | Some description here. 7 | 8 | More stuff after a line with just whitespace. 9 | 10 | Options are as follows 11 | -h, --help display this help and exit 12 | -V, --version output version information and exit 13 | 14 | SOME POST HELP TEXT 15 | $ 16 | -------------------------------------------------------------------------------- /test/post-hook_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ post-hook_01 --version 4 | plain unknown version 5 | (C) 2014 written by yuck test-suite 6 | $ 7 | -------------------------------------------------------------------------------- /test/rudi_01.version: -------------------------------------------------------------------------------- 1 | 0.3.2.git0.c5b707d 2 | -------------------------------------------------------------------------------- /test/rudi_02.version: -------------------------------------------------------------------------------- 1 | v0.3.2.git0.c5b707d 2 | -------------------------------------------------------------------------------- /test/rudi_03.version: -------------------------------------------------------------------------------- 1 | 0.3.2-0-gc5b707d 2 | -------------------------------------------------------------------------------- /test/rudi_04.version: -------------------------------------------------------------------------------- 1 | v0.3.2-0-gc5b707d 2 | -------------------------------------------------------------------------------- /test/rudi_05.version: -------------------------------------------------------------------------------- 1 | 0.3.2.git1.c5b7abc 2 | -------------------------------------------------------------------------------- /test/rudi_06.version: -------------------------------------------------------------------------------- 1 | v0.3.2.git1.c5b7abc 2 | -------------------------------------------------------------------------------- /test/rudi_07.version: -------------------------------------------------------------------------------- 1 | 0.3.2-1-gc5b7abc 2 | -------------------------------------------------------------------------------- /test/rudi_08.version: -------------------------------------------------------------------------------- 1 | v0.3.2-1-gc5b7abc 2 | -------------------------------------------------------------------------------- /test/rudi_09.version: -------------------------------------------------------------------------------- 1 | 0.3.2.git0 -------------------------------------------------------------------------------- /test/rudi_10.version: -------------------------------------------------------------------------------- 1 | V0.3.2.git0 -------------------------------------------------------------------------------- /test/rudi_11.version: -------------------------------------------------------------------------------- 1 | 0.3.2.git1 -------------------------------------------------------------------------------- /test/rudi_12.version: -------------------------------------------------------------------------------- 1 | V0.3.2.git1 -------------------------------------------------------------------------------- /test/rudi_13.version: -------------------------------------------------------------------------------- 1 | 0.3.2-0 -------------------------------------------------------------------------------- /test/rudi_14.version: -------------------------------------------------------------------------------- 1 | v0.3.2-0 -------------------------------------------------------------------------------- /test/rudi_15.version: -------------------------------------------------------------------------------- 1 | 0.3.2-1 -------------------------------------------------------------------------------- /test/rudi_16.version: -------------------------------------------------------------------------------- 1 | v0.3.2-1 -------------------------------------------------------------------------------- /test/scmver_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ { cd "${srcdir}"; git describe --dirty --abbrev=7; } | \ 4 | sed -e 's/^v//' -e 's/-g/-/' -e 's/-/-git/' -e 'y/-/./' > "scmver_01.version" 5 | $ if test -s "scmver_01.version"; then \ 6 | yuck scmver "${srcdir}/"; \ 7 | fi 8 | < scmver_01.version 9 | $ rm -f -- "scmver_01.version" 10 | $ 11 | 12 | ## scmver_01.clit ends here 13 | -------------------------------------------------------------------------------- /test/scmver_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ { cd "${srcdir}"; git describe --abbrev=7 || true; } > "scmver_02.version" 4 | $ if test -s "scmver_02.version"; then \ 5 | yuck scmver "${srcdir}/scmver_02.tmpl"; \ 6 | fi 7 | < scmver_02.version 8 | $ rm -f -- "scmver_02.version" 9 | $ 10 | 11 | ## scmver_02.clit ends here 12 | -------------------------------------------------------------------------------- /test/scmver_02.tmpl: -------------------------------------------------------------------------------- 1 | changequote`'changequote([,])dnl 2 | v[]YUCK_SCMVER_VTAG[]dnl 3 | ifelse(YUCK_SCMVER_DIST, [0], [], [dnl else 4 | [-]YUCK_SCMVER_DIST[-]g[]YUCK_SCMVER_RVSN[]dnl 5 | ]) 6 | -------------------------------------------------------------------------------- /test/scmver_03.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ { yuck scmver "${srcdir}/" || true; } > ".test.ver" 4 | $ if test -s ".test.ver"; then \ 5 | yuck scmver -n --reference ".test.ver"; \ 6 | fi 7 | < .test.ver 8 | $ rm -f -- .test.ver 9 | $ 10 | 11 | ## scmver_03.clit ends here 12 | -------------------------------------------------------------------------------- /test/scmver_04.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/scmver_04.ver" 4 | < "${srcdir}/scmver_04.ver" 5 | $ 6 | -------------------------------------------------------------------------------- /test/scmver_04.ver: -------------------------------------------------------------------------------- 1 | 0.1.9.git33.b2fdd96 2 | -------------------------------------------------------------------------------- /test/scmver_05.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/scmver_05.ver" 4 | < "${srcdir}/scmver_04.ver" 5 | $ 6 | -------------------------------------------------------------------------------- /test/scmver_05.ver: -------------------------------------------------------------------------------- 1 | 0.1.9-33-gb2fdd96 2 | -------------------------------------------------------------------------------- /test/scmver_06.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/scmver_06.ver" 4 | < "${srcdir}/scmver_06.ver" 5 | $ 6 | -------------------------------------------------------------------------------- /test/scmver_06.ver: -------------------------------------------------------------------------------- 1 | 0.1.9.bzr33.41 2 | -------------------------------------------------------------------------------- /test/scmver_07.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/scmver_07.ver" 4 | < "${srcdir}/scmver_06.ver" 5 | $ 6 | -------------------------------------------------------------------------------- /test/scmver_07.ver: -------------------------------------------------------------------------------- 1 | 0.1.9-33-b41 2 | -------------------------------------------------------------------------------- /test/scmver_08.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ echo "0.1.9-33-gbabacafe0123" | yuck scmver -n --reference - 4 | 0.1.9.git33.babacaf 5 | $ 6 | -------------------------------------------------------------------------------- /test/scmver_09.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ echo "0.1.9.git33.babacafe012345" | yuck scmver -n --reference - 4 | 0.1.9.git33.babacaf 5 | $ 6 | -------------------------------------------------------------------------------- /test/scmver_11.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/rudi_01.version" 4 | 0.3.2 5 | $ 6 | 7 | ## scmver_11.clit ends here 8 | -------------------------------------------------------------------------------- /test/scmver_12.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/rudi_02.version" 4 | 0.3.2 5 | $ 6 | 7 | ## scmver_12.clit ends here 8 | -------------------------------------------------------------------------------- /test/scmver_13.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/rudi_03.version" 4 | 0.3.2 5 | $ 6 | 7 | ## scmver_13.clit ends here 8 | -------------------------------------------------------------------------------- /test/scmver_14.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/rudi_04.version" 4 | 0.3.2 5 | $ 6 | 7 | ## scmver_14.clit ends here 8 | -------------------------------------------------------------------------------- /test/scmver_15.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/rudi_05.version" 4 | 0.3.2.git1.c5b7abc 5 | $ 6 | 7 | ## scmver_15.clit ends here 8 | -------------------------------------------------------------------------------- /test/scmver_16.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/rudi_06.version" 4 | 0.3.2.git1.c5b7abc 5 | $ 6 | 7 | ## scmver_16.clit ends here 8 | -------------------------------------------------------------------------------- /test/scmver_17.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/rudi_07.version" 4 | 0.3.2.git1.c5b7abc 5 | $ 6 | 7 | ## scmver_17.clit ends here 8 | -------------------------------------------------------------------------------- /test/scmver_18.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/rudi_08.version" 4 | 0.3.2.git1.c5b7abc 5 | $ 6 | 7 | ## scmver_18.clit ends here 8 | -------------------------------------------------------------------------------- /test/scmver_21.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/rudi_09.version" 4 | 0.3.2 5 | $ 6 | 7 | ## scmver_21.clit ends here 8 | -------------------------------------------------------------------------------- /test/scmver_22.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/rudi_10.version" 4 | 0.3.2 5 | $ 6 | 7 | ## scmver_22.clit ends here 8 | -------------------------------------------------------------------------------- /test/scmver_23.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/rudi_11.version" 4 | 0.3.2.git1.0 5 | $ 6 | 7 | ## scmver_23.clit ends here 8 | -------------------------------------------------------------------------------- /test/scmver_24.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/rudi_12.version" 4 | 0.3.2.git1.0 5 | $ 6 | 7 | ## scmver_24.clit ends here 8 | -------------------------------------------------------------------------------- /test/scmver_25.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/rudi_13.version" 4 | 0.3.2 5 | $ 6 | 7 | ## scmver_25.clit ends here 8 | -------------------------------------------------------------------------------- /test/scmver_26.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/rudi_14.version" 4 | 0.3.2 5 | $ 6 | 7 | ## scmver_26.clit ends here 8 | -------------------------------------------------------------------------------- /test/scmver_27.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/rudi_15.version" 4 | 0.3.2 5 | $ 6 | 7 | ## scmver_27.clit ends here 8 | -------------------------------------------------------------------------------- /test/scmver_28.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck scmver -n --reference "${srcdir}/rudi_16.version" 4 | 0.3.2 5 | $ 6 | 7 | ## scmver_28.clit ends here 8 | -------------------------------------------------------------------------------- /test/subcmd_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/subcmd_01.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], []) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | 13 | yuck_add_command([foo], [foo], []) 14 | 15 | yuck_add_command([bar], [bar], []) 16 | 17 | changequote`'dnl 18 | divert`'dnl 19 | $ 20 | 21 | ## subcmd_01.clit ends here 22 | -------------------------------------------------------------------------------- /test/subcmd_01.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain COMMAND 2 | 3 | Usage: plain foo 4 | 5 | Usage: plain bar 6 | -------------------------------------------------------------------------------- /test/subcmd_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/subcmd_02.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], [FILE...]) 8 | yuck_add_option([help], [h], [help], [auto]) 9 | yuck_set_option_desc([help], [display this help and exit]) 10 | yuck_add_option([version], [V], [version], [auto]) 11 | yuck_set_option_desc([version], [output version information and exit]) 12 | 13 | yuck_add_command([foo], [foo], [FILE...]) 14 | 15 | yuck_add_command([bar], [bar], [FILE...]) 16 | 17 | changequote`'dnl 18 | divert`'dnl 19 | $ 20 | 21 | ## subcmd_02.clit ends here 22 | -------------------------------------------------------------------------------- /test/subcmd_02.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain COMMAND FILE... 2 | 3 | Usage: plain foo FILE... 4 | 5 | Usage: plain bar FILE... 6 | -------------------------------------------------------------------------------- /test/subcmd_03.clit: -------------------------------------------------------------------------------- 1 | 2 | #!/usr/bin/clitoris ## -*- shell-script -*- 3 | 4 | $ yuck gendsl "${srcdir}/subcmd_03.yuck" 5 | changequote`'changequote([,])dnl 6 | divert([-1]) 7 | 8 | yuck_set_umbrella([plain], [plain], []) 9 | yuck_set_umbrella_desc([plain], [Run plain tool.]) 10 | yuck_add_option([help], [h], [help], [auto]) 11 | yuck_set_option_desc([help], [display this help and exit]) 12 | yuck_add_option([version], [V], [version], [auto]) 13 | yuck_set_option_desc([version], [output version information and exit]) 14 | 15 | yuck_add_command([foo], [foo], []) 16 | yuck_set_command_desc([foo], [Run plain tool in foo mode.]) 17 | 18 | yuck_add_command([bar], [bar], []) 19 | yuck_set_command_desc([bar], [Run plain tool in bar mode.]) 20 | 21 | changequote`'dnl 22 | divert`'dnl 23 | $ 24 | 25 | ## subcmd_03.clit ends here 26 | -------------------------------------------------------------------------------- /test/subcmd_03.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain COMMAND 2 | 3 | Run plain tool. 4 | 5 | Usage: plain foo 6 | 7 | Run plain tool in foo mode. 8 | 9 | Usage: plain bar 10 | 11 | Run plain tool in bar mode. 12 | -------------------------------------------------------------------------------- /test/subcmd_04.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ yuck gendsl "${srcdir}/subcmd_04.yuck" 4 | changequote`'changequote([,])dnl 5 | divert([-1]) 6 | 7 | yuck_set_umbrella([plain], [plain], [FILE...]) 8 | yuck_set_umbrella_desc([plain], [Run plain tool.]) 9 | yuck_add_option([help], [h], [help], [auto]) 10 | yuck_set_option_desc([help], [display this help and exit]) 11 | yuck_add_option([version], [V], [version], [auto]) 12 | yuck_set_option_desc([version], [output version information and exit]) 13 | 14 | yuck_add_command([foo], [foo], [FILE...]) 15 | yuck_set_command_desc([foo], [Run plain tool in foo mode.]) 16 | 17 | yuck_add_command([bar], [bar], [FILE...]) 18 | yuck_set_command_desc([bar], [Run plain tool in bar mode.]) 19 | 20 | changequote`'dnl 21 | divert`'dnl 22 | $ 23 | 24 | ## subcmd_04.clit ends here 25 | -------------------------------------------------------------------------------- /test/subcmd_04.yuck: -------------------------------------------------------------------------------- 1 | Usage: plain COMMAND FILE... 2 | 3 | Run plain tool. 4 | 5 | Usage: plain foo FILE... 6 | 7 | Run plain tool in foo mode. 8 | 9 | Usage: plain bar FILE... 10 | 11 | Run plain tool in bar mode. 12 | -------------------------------------------------------------------------------- /test/underq_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ underq_01 --help 4 | Usage: foo [OPTION]... [next]... 5 | 6 | Make sure next argument is valid. 7 | 8 | -h, --help display this help and exit 9 | -V, --version output version information and exit 10 | 11 | $ 12 | 13 | ## underq_01.clit ends here 14 | -------------------------------------------------------------------------------- /test/underq_01.yuck: -------------------------------------------------------------------------------- 1 | Usage: foo [next]... 2 | 3 | Make sure next argument is valid. 4 | -------------------------------------------------------------------------------- /test/underq_02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ underq_02 --help 4 | Usage: foo [OPTION]... [next]... 5 | 6 | Make sure next argument is valid, even with divert(-1). 7 | 8 | -h, --help display this help and exit 9 | -V, --version output version information and exit 10 | --args=BAR... Set next argument to any of the BARs. 11 | --next Actually do use the next argument. 12 | 13 | $ 14 | 15 | ## underq_02.clit ends here 16 | -------------------------------------------------------------------------------- /test/underq_02.yuck: -------------------------------------------------------------------------------- 1 | Usage: foo [next]... 2 | 3 | Make sure next argument is valid, even with divert(-1). 4 | 5 | --args=BAR... Set next argument to any of the BARs. 6 | 7 | --next Actually do use the next argument. 8 | -------------------------------------------------------------------------------- /test/underq_03.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ underq_03 --help 4 | Usage: foo [OPTION]... [next]... 5 | 6 | Make sure next argument is valid, even with divert(-1) or define(X,Y). 7 | 8 | -h, --help display this help and exit 9 | -V, --version output version information and exit 10 | --args=BAR... Set next argument to any of the BARs, X or Y? 11 | --next Actually do use the next argument. 12 | 13 | $ 14 | 15 | ## underq_03.clit ends here 16 | -------------------------------------------------------------------------------- /test/underq_03.yuck: -------------------------------------------------------------------------------- 1 | Usage: foo [next]... 2 | 3 | Make sure next argument is valid, even with divert(-1) or define(X,Y). 4 | 5 | --args=BAR... Set next argument to any of the BARs, X or Y? 6 | 7 | --next Actually do use the next argument. 8 | -------------------------------------------------------------------------------- /test/underq_04.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ underq_04 --help 4 | Usage: foo [OPTION]... [next]... 5 | 6 | Make sure next argument is valid, even with divert(-1) or define(X,Y). 7 | 8 | -h, --help display this help and exit 9 | -V, --version output version information and exit 10 | --args=BAR... divert to BAR. 11 | --next divert(2) to X. 12 | 13 | $ 14 | 15 | ## underq_04.clit ends here 16 | -------------------------------------------------------------------------------- /test/underq_04.yuck: -------------------------------------------------------------------------------- 1 | Usage: foo [next]... 2 | 3 | Make sure next argument is valid, even with divert(-1) or define(X,Y). 4 | 5 | --args=BAR... divert to BAR. 6 | 7 | --next divert(2) to X. 8 | -------------------------------------------------------------------------------- /test/underq_05.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ underq_05 --help 4 | Usage: foo [OPTION]... [next]... 5 | 6 | Make sure next argument is valid, even with divert(-1) or define(X,Y). 7 | 8 | -h, --help display this help and exit 9 | -V, --version output version information and exit 10 | --divert=TEXT divert using TEXT. 11 | --undivert Simply undivert everything. 12 | --dnl do not look mode 13 | 14 | $ 15 | 16 | ## underq_05.clit ends here 17 | -------------------------------------------------------------------------------- /test/underq_05.yuck: -------------------------------------------------------------------------------- 1 | Usage: foo [next]... 2 | 3 | Make sure next argument is valid, even with divert(-1) or define(X,Y). 4 | 5 | --divert=TEXT divert using TEXT. 6 | --undivert Simply undivert everything. 7 | --dnl do not look mode 8 | 9 | -------------------------------------------------------------------------------- /test/underq_06.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ underq_06 --help 4 | Usage: foo [OPTION]... [next]... 5 | 6 | Make sure next argument is valid, even with divert(-1) or define(X,Y). 7 | 8 | -h, --help display this help and exit 9 | -V, --version output version information and exit 10 | --divert=TEXT divert using TEXT, or nothing. 11 | --undivert Simply undivert everything. 12 | --dnl do not look mode (dnl for short) 13 | 14 | $ 15 | 16 | ## underq_06.clit ends here 17 | -------------------------------------------------------------------------------- /test/underq_06.yuck: -------------------------------------------------------------------------------- 1 | Usage: foo [next]... 2 | 3 | Make sure next argument is valid, even with divert(-1) or define(X,Y). 4 | 5 | --divert=TEXT divert using TEXT, or nothing. 6 | --undivert Simply undivert everything. 7 | --dnl do not look mode (dnl for short) 8 | 9 | -------------------------------------------------------------------------------- /test/xmpl-01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ xmpl --help 4 | Usage: xmpl [OPTION]... 5 | 6 | Shows off yuck. 7 | 8 | -h, --help display this help and exit 9 | -V, --version output version information and exit 10 | -x, --extra Produce some extra bling. 11 | -o, --output=FILE Output bling to file. 12 | 13 | $ 14 | 15 | ## xmpl.clit ends here 16 | -------------------------------------------------------------------------------- /test/xmpl-02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ xmpl -x 4 | BLING BLING! 5 | $ 6 | 7 | ## xmpl-02.clit ends here 8 | -------------------------------------------------------------------------------- /test/xmpl-03.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ xmpl -x -o foo 4 | BLING BLING! 5 | $ 6 | 7 | ## xmpl-03.clit ends here 8 | -------------------------------------------------------------------------------- /test/xmpl-04.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ ! xmpl -x --does-not-exist 4 | $ 5 | 6 | ## xmpl-04.clit ends here 7 | -------------------------------------------------------------------------------- /test/xmpl-command-01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ xmpl-command --help 4 | Usage: xmpl [OPTION]... COMMAND 5 | 6 | Shows off yuck. 7 | 8 | COMMAND may be one of: 9 | turbo Run xmpl in turbo mode 10 | 11 | Options accepted by all commands: 12 | -h, --help display this help and exit 13 | -V, --version output version information and exit 14 | -x, --extra Produce some extra bling. 15 | -o, --output=FILE Output bling to file. 16 | 17 | $ 18 | 19 | ## xmpl-command-01.clit ends here 20 | -------------------------------------------------------------------------------- /test/xmpl-command.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "xmpl-command.yucc" 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | yuck_t argp[1U]; 7 | yuck_parse(argp, argc, argv); 8 | 9 | if (argp->extra_flag) { 10 | puts("BLING BLING!"); 11 | } 12 | 13 | switch (argp->cmd) { 14 | case XMPL_CMD_NONE: 15 | default: 16 | puts("no command :("); 17 | break; 18 | } 19 | 20 | yuck_free(argp); 21 | return 0; 22 | } 23 | -------------------------------------------------------------------------------- /test/xmpl-command.yuck: -------------------------------------------------------------------------------- 1 | Usage: xmpl 2 | Shows off yuck. 3 | 4 | -x, --extra Produce some extra bling. 5 | -o, --output=FILE Output bling to file. 6 | 7 | Usage: xmpl turbo [FILE]... 8 | Run xmpl in turbo mode 9 | 10 | -x, --extra-turbo Use more turbos than normal. 11 | -------------------------------------------------------------------------------- /test/xmpl-posarg-with-angles-01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ xmpl-posarg-with-angles --help 4 | Usage: xmpl [OPTION]... < ANGLE_FILE > OUTPUT 5 | 6 | Shows off yuck. 7 | 8 | -h, --help display this help and exit 9 | -V, --version output version information and exit 10 | 11 | $ 12 | 13 | ## xmpl-posarg-with-angles-01.clit ends here 14 | -------------------------------------------------------------------------------- /test/xmpl-posarg-with-angles.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "xmpl-posarg-with-angles.yucc" 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | yuck_t argp[1U]; 7 | yuck_parse(argp, argc, argv); 8 | 9 | switch (argp->cmd) { 10 | case XMPL_CMD_NONE: 11 | default: 12 | puts("no command :("); 13 | break; 14 | } 15 | 16 | yuck_free(argp); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /test/xmpl-posarg-with-angles.yuck: -------------------------------------------------------------------------------- 1 | Usage: xmpl < ANGLE_FILE > OUTPUT 2 | Shows off yuck. 3 | -------------------------------------------------------------------------------- /test/xmpl-subcommands-01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ xmpl-subcommands --help 4 | Usage: xmpl [OPTION]... COMMAND 5 | 6 | Shows off yuck. 7 | 8 | COMMAND may be one of: 9 | turbo Run xmpl in turbo mode 10 | 11 | Options accepted by all commands: 12 | -h, --help display this help and exit 13 | -V, --version output version information and exit 14 | -x, --extra Produce some extra bling. 15 | -o, --output=FILE Output bling to file. 16 | 17 | $ 18 | 19 | ## xmpl-subcommands.clit ends here 20 | -------------------------------------------------------------------------------- /test/xmpl-subcommands-02.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ xmpl-subcommands turbo --help 4 | Usage: xmpl turbo [OPTION]... [FILE]... 5 | 6 | Run xmpl in turbo mode 7 | 8 | Common options: 9 | -h, --help display this help and exit 10 | -V, --version output version information and exit 11 | -x, --extra Produce some extra bling. 12 | -o, --output=FILE Output bling to file. 13 | 14 | Command-specific options: 15 | -x, --extra-turbo Use more turbos than normal. 16 | 17 | $ 18 | 19 | ## xmpl-subcommands-02.clit ends here 20 | -------------------------------------------------------------------------------- /test/xmpl-subcommands-03.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ xmpl-subcommands -x 4 | BLING BLING! 5 | no command :( 6 | $ 7 | 8 | ## xmpl-subcommands-03.clit ends here 9 | -------------------------------------------------------------------------------- /test/xmpl-subcommands-04.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris 2 | 3 | $ xmpl-subcommands -x turbo 4 | BLING BLING! 5 | TURBOOOO :) 6 | $ 7 | 8 | ## xmpl-subcommands-04.clit ends here 9 | -------------------------------------------------------------------------------- /test/xmpl-subcommands.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "xmpl-subcommands.yucc" 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | yuck_t argp[1U]; 7 | yuck_parse(argp, argc, argv); 8 | 9 | if (argp->extra_flag) { 10 | puts("BLING BLING!"); 11 | } 12 | 13 | switch (argp->cmd) { 14 | case XMPL_CMD_NONE: 15 | default: 16 | puts("no command :("); 17 | break; 18 | case XMPL_CMD_TURBO: 19 | puts("TURBOOOO :)"); 20 | break; 21 | } 22 | 23 | yuck_free(argp); 24 | return 0; 25 | } 26 | -------------------------------------------------------------------------------- /test/xmpl-subcommands.yuck: -------------------------------------------------------------------------------- 1 | Usage: xmpl 2 | Shows off yuck. 3 | 4 | -x, --extra Produce some extra bling. 5 | -o, --output=FILE Output bling to file. 6 | 7 | Usage: xmpl turbo [FILE]... 8 | Run xmpl in turbo mode 9 | 10 | -x, --extra-turbo Use more turbos than normal. 11 | -------------------------------------------------------------------------------- /test/xmpl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "xmpl.yucc" 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | struct yuck_s argp[1]; 7 | yuck_parse(argp, argc, argv); 8 | 9 | if (argp->extra_flag) { 10 | puts("BLING BLING!"); 11 | } 12 | 13 | yuck_free(argp); 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /test/xmpl.yuck: -------------------------------------------------------------------------------- 1 | Usage: xmpl 2 | Shows off yuck. 3 | 4 | -x, --extra Produce some extra bling. 5 | -o, --output=FILE Output bling to file. 6 | -------------------------------------------------------------------------------- /test/xtraarg_01.clit: -------------------------------------------------------------------------------- 1 | #!/usr/bin/clitoris ## -*- shell-script -*- 2 | 3 | $ ! xtraarg_01 -n8 4 | $ ! xtraarg_01 --no-extra=8 5 | $ 6 | 7 | ## xtraarg_01.clit ends here 8 | -------------------------------------------------------------------------------- /test/xtraarg_01.yuck: -------------------------------------------------------------------------------- 1 | Usage: foo 2 | 3 | -n, --no-extra An option that take no argument. 4 | -------------------------------------------------------------------------------- /version.mk.in: -------------------------------------------------------------------------------- 1 | VERSION = YUCK_SCMVER_VERSION 2 | PACKAGE_VERSION = $(VERSION) 3 | PACKAGE_STRING = $(PACKAGE) $(VERSION) 4 | --------------------------------------------------------------------------------