#!/bin/sh # # splinter -- the command line refuses what it cannot honour. # # What it guards: a port was read with atoi(), so "--openai-listen-port abc" # bound port 0 (a random port the operator was never told) and "-5" bound # 65531. Both started a server on a port nobody chose and said nothing. # Now a bad port is refused before anything binds, and the message names the # option and the value. set -u cd "$(dirname "$0")/.." || exit 1 . "$(dirname "$0")/sh/port.sh" D=$(mktemp -d "${TMPDIR:-/var/tmp}/splinter-args-XXXXXX") || exit 1 trap 'rm -rf "$D"' EXIT fails=0 check() { d=$1; shift; if "$@"; then :; else echo "FAIL $d"; fails=$((fails + 1)); fi; } # a port that is not a port: the run must fail, and say why refuses() { # refuses