#!/bin/sh
#
# ---
# see: https://github.com/kyx0r/klec/blob/master/shell/ap

if [ $# -eq 1 ]; then
  echo "Reading args as one string..."
  str=$(printf '%s\n' "$1")
  IFS="$(command -p -- printf -- ' \n|')" \
    && export IFS="${IFS%'|'}"
  for file in ${str}; do
    echo "${file}"
    fvp -v - "${file}"
    ret="$?"
    if [ "${ret}" -eq 130 ]; then
      break
    fi
  done
  exit 1
fi

for file in "$@"; do
  echo "${file}"
  fvp -v - "${file}"
  ret="$?"
  if [ "${ret}" -eq 130 ]; then
    break
  fi
done
