[Po4a-commits] "po4a/scripts po4aman-display-po,NONE,1.1"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Fri Apr 7 22:21:44 UTC 2006


Update of /cvsroot/po4a/po4a/scripts
In directory haydn:/tmp/cvs-serv15759/scripts

Added Files:
	po4aman-display-po 
Log Message:
Add a 'scripts' directory and a new script: po4aman-display-po, by Thomas
Huriaux.


--- NEW FILE: po4aman-display-po ---
#!/bin/sh

OPTIONS="";

function usage() {
  echo "Usage: $0 -m MASTER_FILE -p PO_FILE [-o PO4A_OPT]";
  return 0;
}

while getopts m:p:ho: option
do
  case $option in
    m)
      MASTER=$OPTARG;
      ;;
    p)
      PO=$OPTARG;
      ;;
    o)
      OPTIONS="-o $OPTARG $OPTIONS";
      ;;
    h)
      usage;
      exit 0;
      ;;
    [?])
      usage 1>&2;
      exit 1;
      ;;
  esac
done

# checking mandatory options
if [ -z $MASTER ];
then
  usage 1>&2;
  exit 1;
fi;
if [ -z $PO ];
then
  usage 1>&2;
  exit 1;
fi;

# checking files
if [ ! -e $MASTER ];
then
  echo "Error: could not find master file: $MASTER" 1>&2;
  exit 1;
fi;
if [ ! -e $PO ];
then
  echo "Error: could not find po file: $PO" 1>&2;
  exit 1;
fi;


if [ "${MASTER%.gz}" = "$MASTER" ];
then
  MAINNAME=$MASTER;
else
  MAINNAME=`mktemp`;
  trap "rm $MAINNAME" EXIT SIGINT;
  gunzip -c $MASTER > $MAINNAME;
fi;

CHARSET_MASTER=`file -i $MAINNAME | cut -d "=" -f 2`;
CHARSET_PO=`file -i $PO | cut -d "=" -f 2`;

po4a-translate -f man -k 0 -m $MAINNAME -M $CHARSET_MASTER \
  -p $PO $OPTIONS| iconv -f $CHARSET_PO -t // | man -l -




More information about the Po4a-commits mailing list