[Po4a-commits] "po4a/scripts po4aman-display-po,1.4,1.5"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Sun Apr 16 19:43:41 UTC 2006


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

Modified Files:
	po4aman-display-po 
Log Message:
Use a function to report errors.


Index: po4aman-display-po
===================================================================
RCS file: /cvsroot/po4a/po4a/scripts/po4aman-display-po,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- po4aman-display-po	16 Apr 2006 18:40:50 -0000	1.4
+++ po4aman-display-po	16 Apr 2006 19:43:38 -0000	1.5
@@ -12,6 +12,11 @@
   return 0
 }
 
+function error () {
+  echo "Error: $1" 1>&2
+  exit 1
+}
+
 while getopts m:p:ho: option
 do
   case $option in
@@ -35,7 +40,13 @@
   esac
 done
 
-if [ -z "$MASTER" ] && [ -n "$PO" ]
+if [ -z $PO ]
+then
+  usage 1>&2
+  exit 1
+fi
+
+if [ -z "$MASTER" ]
 then
   echo "No manpage specified."
   echo "Trying to find the manpage according to a line reference in the PO."
@@ -75,22 +86,15 @@
   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
+  error "could not find master file: $MASTER"
 fi
 if [ ! -e $PO ]
 then
-  echo "Error: could not find po file: $PO" 1>&2
-  exit 1
+  error "could not find po file: $PO"
 fi
 
 




More information about the Po4a-commits mailing list