#! /bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
tmpfiles="$tmpfiles prog.rst"
cat <<\EOF > prog.rst
rstconv.help='rstconv [-h|--help] Displays this help''rstconv options Convert rst file''Options are:'' -i file Use specified file instead of stdin as input .rst (OPTIONAL)'' -o file Write output to specified file (REQUIRED)'' -f format Specifies the output format:'' po GNU gettext .po (portable) format (DEFAULT)'
rstconv.InvalidOption='Invalid option - '
rstconv.OptionAlreadySpecified='Option has already been specified - '
rstconv.NoOutFilename='No output filename specified'
rstconv.InvalidOutputFormat='Invalid output format -'
EOF
tmpfiles="$tmpfiles prog.pot"
: ${XGETTEXT=xgettext}
${XGETTEXT} -o prog.pot --omit-header --add-location prog.rst
tmpfiles="$tmpfiles prog.ok"
cat <<EOF > prog.ok
msgid ""
"rstconv [-h|--help] Displays this help\n"
"rstconv options Convert rst file\n"
"\n"
"Options are:\n"
" -i file Use specified file instead of stdin as input .rst (OPTIONAL)\n"
" -o file Write output to specified file (REQUIRED)\n"
" -f format Specifies the output format:\n"
" po GNU gettext .po (portable) format (DEFAULT)\n"
msgstr ""
msgid "Invalid option - "
msgstr ""
msgid "Option has already been specified - "
msgstr ""
msgid "No output filename specified"
msgstr ""
msgid "Invalid output format -"
msgstr ""
EOF
: ${DIFF=diff}
${DIFF} prog.ok prog.pot || exit 1
tmpfiles="$tmpfiles prog.pot"
: ${RSTCONV=rstconv}
if (${RSTCONV} -o prog.pot -i prog.rst) >/dev/null 2>&1; then
tmpfiles="$tmpfiles prog.ok"
cat <<EOF > prog.ok
msgid "rstconv [-h|--help] Displays this help\nrstconv options Convert rst file\n\nOptions are:\n -i file Use specified file instead of stdin as input .rst (OPTIONAL)\n -o file Write output to specified file (REQUIRED)\n -f format Specifies the output format:\n po GNU gettext .po (portable) format (DEFAULT)\n"
msgstr ""
msgid "Invalid option - "
msgstr ""
msgid "Option has already been specified - "
msgstr ""
msgid "No output filename specified"
msgstr ""
msgid "Invalid output format -"
msgstr ""
EOF
: ${DIFF=diff}
${DIFF} prog.ok prog.pot || exit 1
fi
rm -fr $tmpfiles
exit 0