#!/bin/bash

if ! test -w .
    then
    printf "cannot write output files in the current directory:\n" >&2
    pwd >&2
    exit 1
fi

for INFILE in "${@}"
    do
    test -r ${INFILE} &&\
    vim -f     +"syn on"\
            +"let html_use_css = 1"\
            +"run! syntax/2html.vim"\
            +"1,$ s/ [c]olor: #000000/ color: #ffffff/"\
            +"1,$ s/[b]ackground-color: #ffffff/background-color: #000000"\
            +"wq"\
            +"q"\
            ${INFILE}\
            || printf "cannot open: ${INFILE}\n" >&2
done