diff options
author | Karl Berry <karl@freefriends.org> | 2010-02-27 17:31:54 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-02-27 17:31:54 +0000 |
commit | cad9c7b7552dabd8248a903fa699d4764cb05723 (patch) | |
tree | e3cdc5411e8ffef074304e6e6df84ccf6d90311f /Master/texmf-dist/doc/support | |
parent | f156b9f9622bbc52d6d48f41cc9e7910cdcd8039 (diff) |
new package lua-alt-getopt 0.7.0 (26feb10)
git-svn-id: svn://tug.org/texlive/trunk@17228 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/support')
7 files changed, 362 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/support/lua-alt-getopt/ChangeLog b/Master/texmf-dist/doc/support/lua-alt-getopt/ChangeLog new file mode 100644 index 00000000000..caf91e665f8 --- /dev/null +++ b/Master/texmf-dist/doc/support/lua-alt-getopt/ChangeLog @@ -0,0 +1,60 @@ +2009-10-18 Aleksey Cheusov <vle@gmx.net> + + * Makefile, NEWS: + version -> 0.7.0 + Release notes in NEWS + + * alt_getopt.lua, tests/test.out: + Do not use error() for exiting, use os.exit() instead + + * alt_getopt, tests/test.out, tests/test.sh: + Additional regression tests/examples + + * alt_getopt.lua, tests/test.out: + POSIX getopt("xo:") accepts './app -xoVVV' and './app -xo VVV' + treating them as './app -x -o VVV'. Now Lua alt_getopt does the same. + +2009-04-26 Aleksey Cheusov <vle@gmx.net> + + * Makefile, NEWS, alt_getopt.lua: + version -> 0.6.0 + NEWS: release notes + s/2008/2009/ + + * alt_getopt.lua: + Minor clean-ups and improvements suggested by Leo P.: + - package.seeall is removed + - gmatch instead of loop + - others + +2009-01-12 Aleksey Cheusov <vle@gmx.net> + + * Makefile: + renamed tarball to lua-alt-getopt + version -> 0.5.0 + +2009-01-11 Aleksey Cheusov <vle@gmx.net> + + * Makefile: + version -> 0.4.0 + + * alt_getopt.lua, tests/test.out, tests/test.sh: + os.exit --> error + + * README, alt_getopt.lua: + README added + minor code clean-ups + +2009-01-10 Aleksey Cheusov <vle@gmx.net> + + * Makefile: PROJECTNAME is set + + * tests/_test.res: + removed + + * Makefile, alt_getopt, alt_getopt.lua, tests/_test.res, tests/test.out, tests/test.sh: + Imported sources + + * Makefile, alt_getopt, alt_getopt.lua, tests/_test.res, tests/test.out, tests/test.sh: + New file. + diff --git a/Master/texmf-dist/doc/support/lua-alt-getopt/Makefile b/Master/texmf-dist/doc/support/lua-alt-getopt/Makefile new file mode 100644 index 00000000000..e68b3507363 --- /dev/null +++ b/Master/texmf-dist/doc/support/lua-alt-getopt/Makefile @@ -0,0 +1,31 @@ +PREFIX?=/usr/local +LUAVER?=5.1 +LUAMODDIR?=${PREFIX}/lib/lua/${LUAVER} + +################################################## + +VERSION= 0.7.0 +PROJECTNAME= lua-alt-getopt +BIRTHDATE= 2009-01-10 + +FILES= alt_getopt.lua +FILESDIR= ${LUAMODDIR} + +INST_DIR?= ${INSTALL} -d + +################################################## +.PHONY: install-dirs +install-dirs: + $(INST_DIR) ${DESTDIR}${LUAMODDIR} + +.PHONY: test +test: + @echo 'running tests...'; \ + ln -f -s ${.CURDIR}/alt_getopt.lua ${.CURDIR}/tests; \ + export OBJDIR=${.OBJDIR}; \ + if cd ${.CURDIR}/tests && ./test.sh; \ + then echo ' succeeded'; \ + else echo ' failed'; false; \ + fi + +.include <bsd.prog.mk> diff --git a/Master/texmf-dist/doc/support/lua-alt-getopt/NEWS b/Master/texmf-dist/doc/support/lua-alt-getopt/NEWS new file mode 100644 index 00000000000..64195baf227 --- /dev/null +++ b/Master/texmf-dist/doc/support/lua-alt-getopt/NEWS @@ -0,0 +1,23 @@ +====================================================================== +Version 0.7.0, by Aleksey Cheusov, Sun, 18 Oct 2009 14:17:28 +0300 + + FIX: POSIX getopt("xo:") accepts './app -xoVVV' and './app -xo VVV' + treating them as './app -x -o VVV'. + Now Lua alt_getopt does the same. + + Additional regression tests/examples + + error() function is not used for exiting anymore. + os.exit() is used instead. + +====================================================================== +Version 0.6.0, by Aleksey Cheusov, Sun, 26 Apr 2009 19:52:38 +0300 + + FIXED: global variable 'optind'. Now it is local. + Minor improvements and code clean-ups. + Thanks to Leo P. <shell slact net> for all this. + +====================================================================== +Version 0.5.0, by Aleksey Cheusov + + First publicly available release diff --git a/Master/texmf-dist/doc/support/lua-alt-getopt/README b/Master/texmf-dist/doc/support/lua-alt-getopt/README new file mode 100644 index 00000000000..91131baa030 --- /dev/null +++ b/Master/texmf-dist/doc/support/lua-alt-getopt/README @@ -0,0 +1,36 @@ +lua_altgetopt is a MIT-licenced module for Lua programming language +for processing application's arguments the same way +BSD/GNU getopt_long(3) functions do. + +Main features and goals: +1) compatibility to SUS "Utility Syntax Guidelines" +http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html#tag_12_02 +guidelines 3-13. +2) This module is for plain Lua +2) No extra dependencies +3) No hooks, no functional tricks ;-) +4) Support for long options, e.g. compatibility with getopt_long(3) C function + present in *BSD and GNU libc. +5) Long options may optionally have one-char synonym or other long synonym +6) Strict error checking (checks for an incorrect use of options) +7) alt_getopt.lua is a Lua module. + +In particular alt_getopt.lua supports the following + -kVALUE, -k VALUE, --key=VALUE, --key VALUE, + -abcd is equivalent to -a -b -c -d if neither of them accept value. +All options must be declared as accepting value or not. + +Two ways of options handling are provided. +See alt_getopt application which is a part of regression tests. + +Makefile: +It's probably useless for end users, you can copy alt_getopt.lua +to the destination yourself. Otherwise use BSD make, +NetBSD make is preferred because NetBSD is my development platform. + +If 'make test' fails on your platform/Lua, please let me know. +If you find a a bug, register it here +http://luaforge.net/project/lua_altgetopt +or send me bugreport directly. + +Author: Aleksey Cheusov <vle@gmx.net> diff --git a/Master/texmf-dist/doc/support/lua-alt-getopt/alt_getopt b/Master/texmf-dist/doc/support/lua-alt-getopt/alt_getopt new file mode 100644 index 00000000000..4a48bf4206b --- /dev/null +++ b/Master/texmf-dist/doc/support/lua-alt-getopt/alt_getopt @@ -0,0 +1,34 @@ +#!/usr/bin/env lua + +require "alt_getopt" + +local long_opts = { + verbose = "v", + help = "h", + fake = 0, + len = 1, + output = "o", + set_value = "S", + ["set-output"] = "o" +} + +local ret +local optarg +local optind +opts,optind,optarg = alt_getopt.get_ordered_opts (arg, "hVvo:n:S:", long_opts) +for i,v in ipairs (opts) do + if optarg [i] then + io.write ("option `" .. v .. "': " .. optarg [i] .. "\n") + else + io.write ("option `" .. v .. "'\n") + end +end + +optarg,optind = alt_getopt.get_opts (arg, "hVvo:n:S:", long_opts) +for k,v in pairs (optarg) do + io.write ("fin-option `" .. k .. "': " .. v .. "\n") +end + +for i = optind,#arg do + io.write (string.format ("ARGV [%s] = %s\n", i, arg [i])) +end diff --git a/Master/texmf-dist/doc/support/lua-alt-getopt/tests/test.out b/Master/texmf-dist/doc/support/lua-alt-getopt/tests/test.out new file mode 100644 index 00000000000..cdd2edb941a --- /dev/null +++ b/Master/texmf-dist/doc/support/lua-alt-getopt/tests/test.out @@ -0,0 +1,130 @@ +================================================================= +======= args: ../alt_getopt -h - +option `h' +fin-option `h': 1 +ARGV [2] = - +================================================================= +======= args: ../alt_getopt --help +option `h' +fin-option `h': 1 +================================================================= +======= args: ../alt_getopt -h --help -v --verbose -V -o 123 -o234 +option `h' +option `h' +option `v' +option `v' +option `V' +option `o': 123 +option `o': 234 +fin-option `V': 1 +fin-option `h': 1 +fin-option `o': 234 +fin-option `v': 1 +================================================================= +======= args: ../alt_getopt --output 123 --output 234 -n 999 -n9999 --len 5 --fake /dev/null +option `o': 123 +option `o': 234 +option `n': 999 +option `n': 9999 +option `len': 5 +option `fake' +fin-option `len': 5 +fin-option `fake': 1 +fin-option `o': 234 +fin-option `n': 9999 +ARGV [11] = /dev/null +================================================================= +======= args: ../alt_getopt -hVv -- -1 -2 -3 +option `h' +option `V' +option `v' +fin-option `h': 1 +fin-option `v': 1 +fin-option `V': 1 +ARGV [3] = -1 +ARGV [4] = -2 +ARGV [5] = -3 +================================================================= +======= args: ../alt_getopt --fake -v -- -1 -2 -3 +option `fake' +option `v' +fin-option `fake': 1 +fin-option `v': 1 +ARGV [4] = -1 +ARGV [5] = -2 +ARGV [6] = -3 +================================================================= +======= args: ../alt_getopt - -1 -2 -3 +ARGV [1] = - +ARGV [2] = -1 +ARGV [3] = -2 +ARGV [4] = -3 +================================================================= +======= args: ../alt_getopt --fake -v - -1 -2 -3 +option `fake' +option `v' +fin-option `fake': 1 +fin-option `v': 1 +ARGV [3] = - +ARGV [4] = -1 +ARGV [5] = -2 +ARGV [6] = -3 +================================================================= +======= args: ../alt_getopt -1 -2 -3 +Unknown option `-1' +================================================================= +======= args: ../alt_getopt -hvV +option `h' +option `v' +option `V' +fin-option `h': 1 +fin-option `V': 1 +fin-option `v': 1 +================================================================= +======= args: ../alt_getopt -ho 123 +option `h' +option `o': 123 +fin-option `o': 123 +fin-option `h': 1 +================================================================= +======= args: ../alt_getopt -hoV 123 +option `h' +option `o': V +fin-option `o': V +fin-option `h': 1 +ARGV [2] = 123 +================================================================= +======= args: ../alt_getopt --unknown +Unknown option `--unknown' +================================================================= +======= args: ../alt_getopt --output=file.out -nNNN --len=LENGTH +option `o': file.out +option `n': NNN +option `len': LENGTH +fin-option `len': LENGTH +fin-option `o': file.out +fin-option `n': NNN +================================================================= +======= args: ../alt_getopt --output --file-- +option `o': --file-- +fin-option `o': --file-- +================================================================= +======= args: ../alt_getopt --output +Missed value for option `--output' +================================================================= +======= args: ../alt_getopt -ho +Missed value for option `-o' +================================================================= +======= args: ../alt_getopt --help -o +Missed value for option `-o' +================================================================= +======= args: ../alt_getopt --help=value +Bad usage of option `--help=value' +================================================================= +======= args: ../alt_getopt -ofile1 --set_value 111 --output file2 --set-output=file3 +option `o': file1 +option `S': 111 +option `o': file2 +option `o': file3 +fin-option `o': file3 +fin-option `S': 111 diff --git a/Master/texmf-dist/doc/support/lua-alt-getopt/tests/test.sh b/Master/texmf-dist/doc/support/lua-alt-getopt/tests/test.sh new file mode 100644 index 00000000000..8487a8e7e45 --- /dev/null +++ b/Master/texmf-dist/doc/support/lua-alt-getopt/tests/test.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +runtest (){ + printf '=================================================================\n' + printf '======= args: %s\n' "$*" + "$@" 2>&1 | awk '/stack traceback:/, /\[C\]: [?]/ {next} {print}' +} + +do_test_getopt (){ + runtest ../alt_getopt -h - + runtest ../alt_getopt --help + runtest ../alt_getopt -h --help -v --verbose -V -o 123 -o234 + runtest ../alt_getopt --output 123 --output 234 -n 999 -n9999 --len 5 --fake /dev/null + runtest ../alt_getopt -hVv -- -1 -2 -3 + runtest ../alt_getopt --fake -v -- -1 -2 -3 + runtest ../alt_getopt - -1 -2 -3 + runtest ../alt_getopt --fake -v - -1 -2 -3 + runtest ../alt_getopt -1 -2 -3 + runtest ../alt_getopt -hvV + runtest ../alt_getopt -ho 123 + runtest ../alt_getopt -hoV 123 + runtest ../alt_getopt --unknown + runtest ../alt_getopt --output='file.out' -nNNN --len=LENGTH + runtest ../alt_getopt --output --file-- + + runtest ../alt_getopt --output + runtest ../alt_getopt -ho + runtest ../alt_getopt --help -o + runtest ../alt_getopt --help=value + runtest ../alt_getopt -ofile1 --set_value 111 --output file2 \ + --set-output=file3 + + true +} + +do_test (){ + do_test_getopt +} + +OBJDIR=${OBJDIR:=.} + +do_test > $OBJDIR/_test.res 2>&1 + +if ! diff -u test.out $OBJDIR/_test.res; then + echo "rewrite fails" 1>&2 + exit 1 +fi + |