#!/bin/sh # Stand-in for z/OS tso(1), for checking the shell side of tests/zos on # Linux (see run.sh). It understands only what those tests use. [ "$1" = -t ] && shift store=${ZOS_STUB_STORE:-${TMPDIR:-/tmp}/zos-stub-store} mkdir -p $store cmd=$1 dsn=$(printf '%s' "$cmd" | sed -n "s/.*'\([^']*\)'.*/\1/p") case $cmd in TIME) echo "IKJ56650I TIME-10:00:00 AM. CPU-00:00:00 SERVICE-1 SESSION-00:00:01"; exit 0 ;; LISTALC) echo "SYS1.HELP"; exit 0 ;; ALLOCATE*DSORG\(PO\)*) mkdir "$store/$dsn" && exit 0; exit 12 ;; ALLOCATE*) : >"$store/$dsn"; exit 0 ;; FREE*) exit 0 ;; DELETE*) [ -e "$store/$dsn" ] || exit 8; rm -rf "$store/$dsn"; exit 0 ;; LISTDS*MEMBERS) [ -d "$store/$dsn" ] || exit 8; echo "$dsn"; echo "--MEMBERS--"; ls "$store/$dsn" | sed 's/^/ /'; exit 0 ;; LISTDS*) [ -e "$store/$dsn" ] || exit 8; echo "$dsn"; exit 0 ;; *) echo "COMMAND $cmd NOT FOUND" >&2; exit 12 ;; esac