trans-coord-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

trans-coord/gnun/server/gnun AUTHORS ChangeLog ...


From: Pavel Kharitonov
Subject: trans-coord/gnun/server/gnun AUTHORS ChangeLog ...
Date: Tue, 08 Oct 2013 04:38:27 +0000

CVSROOT:        /sources/trans-coord
Module name:    trans-coord
Changes by:     Pavel Kharitonov <ineiev>       13/10/08 04:38:27

Modified files:
        gnun/server/gnun: AUTHORS ChangeLog GNUmakefile GNUmakefile.team 
                          Makefile.am NEWS README add-fuzzy-diff.in 
                          config.mk.in configure.ac diff-po.awk.in 
                          expand-ssi.awk gnun-add-fuzzy-diff.in 
                          gnun-diff-po.in gnun-init-po.in 
                          gnun-merge-preconverted.in gnun-preconvert.in 
                          gnun-report.in gnun-validate-html.in 
                          make-prototype.awk update-localized-urls.in 
                          validate-html-notify.in 
Added files:
        gnun/server/gnun: mailfail.in 

Log message:
        Improve portability.
        
        * configure.ac: Add checks for `date' `-d' option; configure
        `BASH', `BASE64_ENCODE', `MKTEMP', `MAIL', `XMLLINT'; use
        `AC_PATH_PROG' instead of `AC_CHECK_PROG'.
        * Makefile.am (pkglibexec_SCRIPTS, CLEANFILES):
        Include `mailfail'.
        (dist_pkglibexec_SCRIPTS): Exclude `mailfail'.
        (EXTRA_DIST): Include `mailfail.in'.
        (edit): Add substitutions for `BASE64_ENCODE', `BASH',
        `MAIL', `MKTEMP', `XMLLINT'.
        (stamp-config.mk): Don't use unportable `$<'.
        * GNUmakefile (mark-outdated, extract-title):
        ($(rootdir)/gnusflashes.%.include, triggers):
        Invoke grep more portably.
        (mailfail): New target.
        * mailfail: Rename to...
        * mailfail.in: Renamed file; use @BASH@, @MKTEMP@, @address@hidden
        (touch-hook, validate-article):
        ($(template-dir)/po/whatsnew.%.html): Remove `touch-hook'.
        (extract-title): Replace `base64' with $(BASE64_ENCODE).
        (announce, $(template-dir)/po/whatsnew.%.html): Use $(MAIL).
        ($(template-dir)/po/whatsnew.%.html): Replace `cp -a'
        with `cp -p' and `touch --reference' with `touch -r'.
        (grace-is-over): Use more portable `date' invocations.
        (article-rules): Replace `diff -I' with a more portable
        construct.  Reword checking for whether to $(ANNOUNCE).
        * GNUmakefile.team (DIFF_PO_LANG, sync, notify-translator):
        Invoke grep more portably.
        * (cmp-POs): Replace `diff -I' with a more portable
        construct.
        * README: Document dependencies on `bash', `mktemp', `mail',
        `base64' or `uuencode'.
        * add-fuzzy-diff: Use @address@hidden
        * config.mk.in (BASE64_ENCODE, MAIL, SHELL): New definitions.
        * diff-po.awk.in: Use @MKTEMP@ and @address@hidden
        * expand-ssi.awk:
        * make-prototype.awk: Make it work with some non-GNU awks.
        * gnun-add-fuzzy-diff.in:
        * gnun-diff-po.in:
        * gnun-init-po.in:
        * gnun-merge-preconverted.in:
        * gnun-preconvert.in:
        * gnun-report.in:
        * gnun-validate-html.in:
        * update-localized-urls.in:
        * validate-html-notify.in: Use @BASH@, @MKTEMP@, @address@hidden
        * NEWS:
        * AUTHORS: Update.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/AUTHORS?cvsroot=trans-coord&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/ChangeLog?cvsroot=trans-coord&r1=1.388&r2=1.389
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/GNUmakefile?cvsroot=trans-coord&r1=1.169&r2=1.170
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/GNUmakefile.team?cvsroot=trans-coord&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/Makefile.am?cvsroot=trans-coord&r1=1.36&r2=1.37
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/NEWS?cvsroot=trans-coord&r1=1.94&r2=1.95
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/README?cvsroot=trans-coord&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/add-fuzzy-diff.in?cvsroot=trans-coord&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/config.mk.in?cvsroot=trans-coord&r1=1.11&r2=1.12
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/configure.ac?cvsroot=trans-coord&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/diff-po.awk.in?cvsroot=trans-coord&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/expand-ssi.awk?cvsroot=trans-coord&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/gnun-add-fuzzy-diff.in?cvsroot=trans-coord&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/gnun-diff-po.in?cvsroot=trans-coord&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/gnun-init-po.in?cvsroot=trans-coord&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/gnun-merge-preconverted.in?cvsroot=trans-coord&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/gnun-preconvert.in?cvsroot=trans-coord&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/gnun-report.in?cvsroot=trans-coord&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/gnun-validate-html.in?cvsroot=trans-coord&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/make-prototype.awk?cvsroot=trans-coord&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/update-localized-urls.in?cvsroot=trans-coord&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/validate-html-notify.in?cvsroot=trans-coord&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/mailfail.in?cvsroot=trans-coord&rev=1.1

Patches:
Index: AUTHORS
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/AUTHORS,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- AUTHORS     31 Aug 2013 14:09:41 -0000      1.17
+++ AUTHORS     8 Oct 2013 04:38:22 -0000       1.18
@@ -26,7 +26,8 @@
         Makefile.am, README, dtd/README, doc/gnun.texi,
         doc/web-trans.texi.
 
-    Tiny changes in config.mk.in, dtd/Makefile.am, gnun.mk.
+    Tiny changes in config.mk.in, dtd/Makefile.am, gnun.mk,
+        mailfail.in.
 
 Brett Smith <address@hidden>
     "Distribution Terms" section in doc/web-trans.texi

Index: ChangeLog
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/ChangeLog,v
retrieving revision 1.388
retrieving revision 1.389
diff -u -b -r1.388 -r1.389
--- ChangeLog   6 Sep 2013 18:05:11 -0000       1.388
+++ ChangeLog   8 Oct 2013 04:38:23 -0000       1.389
@@ -1,3 +1,55 @@
+2013-10-08  Pavel Kharitonov  <address@hidden>
+
+       Improve portability.
+
+       * configure.ac: Add checks for `date' `-d' option; configure
+       `BASH', `BASE64_ENCODE', `MKTEMP', `MAIL', `XMLLINT'; use
+       `AC_PATH_PROG' instead of `AC_CHECK_PROG'.
+       * Makefile.am (pkglibexec_SCRIPTS, CLEANFILES):
+       Include `mailfail'.
+        (dist_pkglibexec_SCRIPTS): Exclude `mailfail'.
+       (EXTRA_DIST): Include `mailfail.in'.
+       (edit): Add substitutions for `BASE64_ENCODE', `BASH',
+       `MAIL', `MKTEMP', `XMLLINT'.
+       (stamp-config.mk): Don't use unportable `$<'.
+       * GNUmakefile (mark-outdated, extract-title):
+       ($(rootdir)/gnusflashes.%.include, triggers):
+       Invoke grep more portably.
+       (mailfail): New target.
+       * mailfail: Rename to...
+       * mailfail.in: Renamed file; use @BASH@, @MKTEMP@, @address@hidden
+       (touch-hook, validate-article):
+       ($(template-dir)/po/whatsnew.%.html): Remove `touch-hook'.
+       (extract-title): Replace `base64' with $(BASE64_ENCODE).
+       (announce, $(template-dir)/po/whatsnew.%.html): Use $(MAIL).
+       ($(template-dir)/po/whatsnew.%.html): Replace `cp -a'
+       with `cp -p' and `touch --reference' with `touch -r'.
+       (grace-is-over): Use more portable `date' invocations.
+       (article-rules): Replace `diff -I' with a more portable
+       construct.  Reword checking for whether to $(ANNOUNCE).
+       * GNUmakefile.team (DIFF_PO_LANG, sync, notify-translator):
+       Invoke grep more portably.
+       * (cmp-POs): Replace `diff -I' with a more portable
+       construct.
+       * README: Document dependencies on `bash', `mktemp', `mail',
+       `base64' or `uuencode'.
+       * add-fuzzy-diff: Use @address@hidden
+       * config.mk.in (BASE64_ENCODE, MAIL, SHELL): New definitions.
+       * diff-po.awk.in: Use @MKTEMP@ and @address@hidden
+       * expand-ssi.awk:
+       * make-prototype.awk: Make it work with some non-GNU awks.
+       * gnun-add-fuzzy-diff.in:
+       * gnun-diff-po.in:
+       * gnun-init-po.in:
+       * gnun-merge-preconverted.in:
+       * gnun-preconvert.in:
+       * gnun-report.in:
+       * gnun-validate-html.in:
+       * update-localized-urls.in:
+       * validate-html-notify.in: Use @BASH@, @MKTEMP@, @address@hidden
+       * NEWS:
+       * AUTHORS: Update.
+
 2013-09-06  Pavel Kharitonov  <address@hidden>
 
        * GNUmakefile (article-rules): Don't commit the generated HTML

Index: GNUmakefile
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/GNUmakefile,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -b -r1.169 -r1.170
--- GNUmakefile 6 Sep 2013 18:05:11 -0000       1.169
+++ GNUmakefile 8 Oct 2013 04:38:23 -0000       1.170
@@ -510,7 +510,7 @@
 # matter since GRACE value is very high.
 define mark-outdated
 marker='GNUN: OUT-OF-DATE NOTICE'; \
-$(GREP) -q '^<!--'"$$$${marker}-->" $(1) \
+$(GREP) '^<!--'"$$$${marker}-->" $(1) &> /dev/null \
  || marker='#include virtual="\/server\/banner'; \
 original=$(1); original=$$$${original%$(2).html}html; \
 $(if $(WDIFF), \
@@ -669,34 +669,6 @@
 chmod +w $@
 endef
 
-# The command to touch the prerequisite $PO if HTML validation fails.
-# Unfortunately, merely touching it does not work for the automatic
-# build, because `cvs commit' is invoked after `make' and it resets
-# the `Date' keyword of the faulty target (thus resetting its
-# timestamp), so it becomes newer than the prerequisite.  `touch-hook'
-# creates an unique file in $(CURDIR) based on the target, which is
-# then processed by the `triggers' rule.  In a normal situation, the
-# filename shouldn't be unique as `make' fails on the first
-# encountered error.  However, this is necessary for `make -j' so it
-# has to be parallel safe like all the rules.  Also for `make -k'.
-# Touching the prerequisite is still needed for local non-VCS builds
-# to DTRT and halt when $PO is not rectified.
-# After a commit, cvs updates the working copy expanding all keywords
-# on the way and sets the timestamp as per the server time.  When the
-# client is not synchronized -- i.e. fencepost is currently lagging 2
-# minutes -- the timestamp is in the future so touching it after `cvs
-# commit' does not work.  The solution is to record a command sequence
-# that will update the timestamp based on the timestamp of the target.
-define touch-hook
-sleep 1 ; touch $$PO ; \
-if test -f $@ ; then \
-  echo "touch --reference=$@ --date='+1 seconds' $$PO" > $(@F).hook ; \
-else \
-  echo "echo; echo $@ has never been built." > $(@F).hook ; \
-fi; \
-exit 1
-endef
-
 # The command to filter out HTML comments
 define skip-comments
  $(SED) \
@@ -714,13 +686,14 @@
 # ANNOUNCE=yes.
 define extract-title
 title_tag='h2'; \
-if ! $(skip-comments) $$@ | $(GREP) -q "<$$$$title_tag"; \
+if ! $(skip-comments) $$@ | $(GREP) "<$$$$title_tag" > /dev/null ; \
 then title_tag='title'; fi; \
-echo -n \`$(skip-comments) $$@ | $(GREP) --max-count=1 "<$$$$title_tag"\` \
+echo -n \`$(skip-comments) $$@ \
+  | $(GREP) "<$$$$title_tag"\` | head -n 1 \
   | $(SED) '/<\/'$$$$title_tag'>/!s/$$$$/.../;\
             s/.*<'$$$$title_tag'[^>]*>//;s/<\/'$$$$title_tag'>.*//' \
   | $(SED) 's/\&[mn]dash;/--/g; s/\&nbsp;/ /g' \
-  | $(SED) 's/\&..quo;/"/g' | base64 --wrap=0
+  | $(SED) 's/\&..quo;/"/g' | $(BASE64_ENCODE)
 endef
 
 # Construct a command sequence suitable for `mail', if the .hook-ann
@@ -731,7 +704,7 @@
 define announce
 if test -f $$(@F).hook-ann; then \
   echo "echo '<URL:$$(subst $(rootdir),http://www.gnu.org,$$@)>' \
-  | mail -s '[$(2)] New translation: =?utf-8?B?`$(extract-title)`?=' \
+  | $(MAIL) -s '[$(2)] New translation: =?utf-8?B?`$(extract-title)`?=' \
     -a Keywords:$(2)-ann $(ann-addr)" > $$(@F).hook-ann; \
 fi
 endef
@@ -744,8 +717,7 @@
 # fails.
 define validate-article
 $(VALIDATESKIP) $(VALIDATE-HTML-NOTIFY) $(NOTIFYSKIP) $(transl-addr) \
-  address@hidden || ($(VCSSKIP) $(RM) address@hidden; \
-                        PO=$(1).po ; $$(touch-hook))
+  address@hidden || ($(VCSSKIP) $(RM) address@hidden; exit 1)
 endef
 
 ### Specific rules for extra templates ###
@@ -877,7 +849,7 @@
        [ -f $@ ] || (touch $@ ; $(VCSSKIP) $(vcs) add $@)
        $(fixperm)
        echo "<!--Automatically generated by GNUN; do not edit!-->" > $@
-       $(GREP) --max-count=3 '<dd>.*</dd>' $< >> $@
+       $(GREP) '<dd>.*</dd>' $< | head -n 3 >> $@
        $(SED) --in-place "s/\(\/\?\)dd>/\1p>/g" $@ || (touch $< ; exit 1)
 
 # This target is deliberately generated in the wrong sub-directory,
@@ -889,7 +861,7 @@
                                    generic.%.html
        $(if $(call find-language,$*,$(TEMPLATE_LINGUAS)),, \
          echo 'The "$*" language code is not defined in TEMPLATE_LINGUAS.' \
-           $(if $(NOTIFYSKIP),, | mail $(transl-addr) -s \
+           $(if $(NOTIFYSKIP),, | $(MAIL) $(transl-addr) -s \
              "[GNUN Error] Could not build $(subst $(rootdir)/,,$@)"); \
          exit 1)
        PO=$(template-dir)/po/whatsnew.$*.po ; $(MAILFAIL) \
@@ -903,13 +875,13 @@
 # Unconditionally update the PO file; see the comment in `generate-html'.
 # Do _not_ touch the PO file if it doesn't change; this workaround is needed
 # because we are too lazy to provide a rule for the PO file.
-       cp -a $(template-dir)/po/whatsnew.$*.po \
+       cp -p $(template-dir)/po/whatsnew.$*.po \
          $(template-dir)/po/whatsnew.$*.po1
        $(call update-po,$(template-dir)/po/whatsnew.$*.po,\
          $(template-dir)/po/whatsnew.pot,$*)
        if diff $(template-dir)/po/whatsnew.$*.po \
             $(template-dir)/po/whatsnew.$*.po1 > /dev/null; then \
-         touch --reference=$(template-dir)/po/whatsnew.$*.po1 \
+         touch -r $(template-dir)/po/whatsnew.$*.po1 \
            $(template-dir)/po/whatsnew.$*.po; \
        fi
        $(RM) $(template-dir)/po/whatsnew.$*.po1
@@ -923,8 +895,7 @@
        $(SED) --in-place \
          "s/\(<!--#include virtual=\".*whatsnew\)\(.include\" -->\)/\1.$*\2/g" 
\
          $@
-       $(VALIDATESKIP) $(VALIDATE-HTML-NOTIFY) $(NOTIFYSKIP) $(transl-addr) \
-         $@ || (PO=$(template-dir)/po/whatsnew.$*.po ; $(touch-hook))
+       $(VALIDATESKIP) $(VALIDATE-HTML-NOTIFY) $(NOTIFYSKIP) $(transl-addr) $@
 # Copy the target where it belongs.
        cp $@ $(template-dir)
 ### End of the whatsnew-specific rules ###
@@ -966,9 +937,9 @@
 
 define grace-is-over
 (timestamp="`$(call extract-outdated-date,$(1))`"; \
-  test -n "$$$${timestamp}" \
-  && test "`date --date="$(2) days ago" +%s`" \
-       -ge "`date --date="$$$${timestamp}" +%s`" \
+ test -n "$$$${timestamp}" && test $$$$(($(2)+0)) -le 0 \
+ || test $$$$((`date +%s` - ($(2)+0)*24*3600)) \
+      -ge `date -d "$$$${timestamp}" +%s || echo 0` \
 )
 endef
 
@@ -986,7 +957,7 @@
 ifeq (,$(call find-language,$(2),$(TEMPLATE_LINGUAS)))
 ifndef NOTIFYSKIP
        echo 'The "$(2)" language code is not defined in TEMPLATE_LINGUAS.' \
-         | mail $(transl-addr) -s \
+         | $(MAIL) $(transl-addr) -s \
          "[GNUN Error] Could not build $$(subst $$(rootdir)/,,$$@)"  
 else
        @echo 'The "$(2)" language code is not defined in TEMPLATE_LINGUAS.'
@@ -1020,11 +991,11 @@
        $(output-article-html)
 endif
        if test -f address@hidden ; then \
-          if diff -q -I "[$$$$]Date:" $$@ address@hidden; then \
+         if test -f $$@ -a "`diff $$@ address@hidden | $(GREP) '^[<>] ' \
+                   | $(EGREP) -v '[$$$$]Date:' | wc -c`" -eq 0; then \
             touch $$@; \
           else \
-            $(if $(and $(findstring $(ANNOUNCE),yes), \
-                      $(findstring yes,$(ANNOUNCE))), \
+            $(if $(findstring .$(ANNOUNCE).,.yes.), \
              $(call add-file,$$@,$$(@F).hook-ann), \
              $(call add-file,$$@)); \
              $$(fixperm); \
@@ -1041,7 +1012,10 @@
            fi)
        $(call extract-outdated-date,$(1).po) > /dev/null \
        || ($(call add-file,$(1)-en.html); \
-           diff -q -I "[$$$$]Date:" $(subst /po/,/,$(1:.$(2)=).html) 
$(1)-en.html \
+            test -f $(1)-en.html \
+                -a "`diff $(subst /po/,/,$(1:.$(2)=).html) $(1)-en.html \
+                  | $(GREP) '^[<>] ' \
+                  | $(EGREP) -v '[$$$$]Date:' | wc -c`" -eq 0 \
            || cp $(subst /po/,/,$(1:.$(2)=).html) $(1)-en.html)
 endef
 
@@ -1192,7 +1166,7 @@
 # The .LANG.html is empty, not suitable to be announced, so do nothing
 # in this case.
        @for t in *.hook-ann; do \
-         if ! $(GREP) --quiet 'gnun-do-not-delete-me' $$t; then \
+         if ! $(GREP) 'gnun-do-not-delete-me' $$t > /dev/null; then \
            echo -n "Sending announcement for $$t... " \
            && bash $$t && echo done.; $(RM) $$t; \
          fi; \

Index: GNUmakefile.team
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/GNUmakefile.team,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- GNUmakefile.team    13 May 2013 10:42:27 -0000      1.33
+++ GNUmakefile.team    8 Oct 2013 04:38:23 -0000       1.34
@@ -75,14 +75,14 @@
 ifneq (,$(DIFF_PO))
 DIFF_PO_LANG := $(shell \
   locale \
-  | if locale | egrep -q "^LC_ALL=."; then \
+  | if locale | egrep "^LC_ALL=." > /dev/null; then \
       grep "^LC_ALL"; \
     else \
       cat; \
     fi \
-  | egrep -q -i "=.*utf-?8" \
-  || locale -a | sed 's/^/LC_ALL=/' | egrep -m 1 "en_US\.utf-?8" \
-  || locale -a | sed 's/^/LC_ALL=/' | egrep -m 1 "\.utf-?8" || true;)
+  | egrep -i "=.*utf-?8" > /dev/null \
+  || locale -a | sed 's/^/LC_ALL=/;/en_US\.utf-?8/!d;q' | egrep "." \
+  || locale -a | sed 's/^/LC_ALL=/;/\.utf-?8/!d;q';)
 DIFF_PO := $(DIFF_PO_LANG) $(DIFF_PO)
 endif
 endif
@@ -194,7 +194,7 @@
 else ifeq ($(REPO),Bzr)
 # The behavior of `bzr commit' is not very script-friendly: it will
 # exit with an error if there are no changes to commit.
-       if $(BZR) status --versioned --short | grep --quiet '^ M'; then \
+       if $(BZR) status --versioned --short | grep '^ M' > /dev/null; then \
          $(BZR) commit $(QUIET) -m $(log) && $(BZR) push $(QUIET); \
        else \
          true; \
@@ -239,8 +239,9 @@
 define cmp-POs
 { $(MSGATTRIB) --no-obsolete --force-po -w 79 -o $1.tmp.po $1; \
   $(MSGATTRIB) --no-obsolete --force-po -w 79 $2 \
-  | diff -q -I "^$$" -I "^#\. " -I "^# type: " -I '^"POT-Creation-Date:' \
-    -I '^"PO-Revision-Date:' -I '^"Outdated-Since:' $1.tmp.po - &>/dev/null; \
+  | diff | grep '^[<>] ' $1.tmp.po - | egrep -v \
+'^..($$|#\. |# type: |"(POT-Creation-DatePO-Revision-Date|Outdated-Since):)' \
+   > /dev/null; \
   status=$$?; rm $1.tmp.po; test $$status = 0; }
 endef
 
@@ -602,11 +603,11 @@
        sed "s/^/@/" report.txt \
        | while read line; do \
            line="address@hidden"; \
-           if echo "$$$$line" | egrep -q "^( |$$$$)"; then \
+           if echo "$$$$line" | egrep "^( |$$$$)" > /dev/null; then \
              echo "$$$$line"; continue; \
            fi; \
            file="$$$${line%%:*}"; \
-           if echo $$$$file | egrep -q "$$$$regex"; then \
+           if echo $$$$file | egrep "$$$$regex" > /dev/null; then \
              echo "$$$$line"; \
            fi; \
          done > $(1).note.tmp
@@ -649,7 +650,7 @@
   case ",$$$$flags," in \
     *,force,* ) ;; \
     * ) \
-      grep -q : $(1).note &>/dev/null || notify=no; \
+      grep : $(1).note &> /dev/null || notify=no; \
       ;; \
   esac; \
   case $$$$notify in \
@@ -689,7 +690,7 @@
       | while read line; do \
          line="address@hidden"; \
          echo -n "$$$$line"; \
-         if echo "$$$$line" | grep -q "^[^ ]" ; then \
+         if echo "$$$$line" | grep "^[^ ]" > /dev/null ; then \
            file=$$$${line%%:*}; name=$$$${file##*/}; dir=$$$${file%/*}/; \
            if test ".$$$$dir" = ".$$$$file/"; then dir=""; fi; \
            head="  ("; \
@@ -703,7 +704,7 @@
              echo -n "$$$${head}$(WWW_URL)$$$${dir}po/$$$$name"; \
              head="   "; \
            fi; \
-           if echo "$$$$line" | grep -qF "HTML-only translation"; then \
+           if echo "$$$$line" | grep -F "HTML-only translation" > /dev/null; 
then \
              echo; \
              echo -n "$$$${head}$(WWW_URL)$$$$dir$$$${name%po}html"; \
              head="   "; \

Index: Makefile.am
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/Makefile.am,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- Makefile.am 31 Aug 2013 14:09:41 -0000      1.36
+++ Makefile.am 8 Oct 2013 04:38:23 -0000       1.37
@@ -38,7 +38,7 @@
 endif
 
 noinst_SCRIPTS = stamp-config.mk
-pkglibexec_SCRIPTS = copy-msgid update-localized-urls \
+pkglibexec_SCRIPTS = copy-msgid mailfail update-localized-urls \
  validate-html-notify
 
 if HAVE_WDIFF
@@ -50,8 +50,10 @@
 endif
 endif
 
-dist_pkglibexec_SCRIPTS = expand-ssi.awk mailfail make-prototype.awk
+dist_pkglibexec_SCRIPTS = expand-ssi.awk make-prototype.awk
 
+# Note that BASE64_ENCODE may contain `|' and `\'', so we substitute it
+# in a different way.
 edit = $(SED) \
        -e 's|@address@hidden|$(PACKAGE)|g' \
        -e 's|@address@hidden|$(PACKAGE_NAME)|g' \
@@ -63,18 +65,23 @@
        -e 's|@address@hidden|$(prefix)|g' \
        -e 's|@address@hidden|$(pkglibexecdir)|g' \
        -e 's|@address@hidden|$(AWK)|g' \
+       -e "s,@address@hidden,$(BASE64_ENCODE),g" \
+       -e 's|@address@hidden|$(BASH)|g' \
        -e 's|@address@hidden|$(GREP)|g' \
+       -e 's|@address@hidden|$(MAIL)|g' \
+       -e 's|@address@hidden|$(MKTEMP)|g' \
        -e 's|@address@hidden|$(MSGATTRIB)|g' \
        -e 's|@address@hidden|$(MSGCAT)|g' \
        -e 's|@address@hidden|$(MSGEXEC)|g' \
        -e 's|@address@hidden|$(MSGFMT)|g' \
        -e 's|@address@hidden|$(MSGMERGE)|g' \
        -e 's|@address@hidden|$(SED)|g' \
+       -e 's|@address@hidden|$(XMLLINT)|g' \
        -e 's|@address@hidden|$(WDIFF)|g'
 
-add-fuzzy-diff copy-msgid gnun-add-fuzzy-diff \
+add-fuzzy-diff copy-msgid diff-po.awk gnun-add-fuzzy-diff \
 gnun-diff-po gnun-init-po gnun-merge-preconverted gnun-report \
-gnun-validate-html diff-po.awk update-localized-urls \
+gnun-validate-html mailfail update-localized-urls \
 validate-html-notify: Makefile
        $(AM_V_at)rm -f $@ address@hidden
        $(AM_V_GEN)$(edit) '$(srcdir)/address@hidden' >address@hidden
@@ -82,8 +89,8 @@
        $(AM_V_at)mv address@hidden $@
 
 stamp-config.mk: config.mk
-       $(AM_V_GEN)$(edit) $< >$<.tmp
-       $(AM_V_at)mv $<.tmp $<
+       $(AM_V_GEN)$(edit) config.mk >config.mk.tmp
+       $(AM_V_at)mv config.mk.tmp config.mk
        $(AM_V_at)touch $@
 
 add-fuzzy-diff: $(srcdir)/add-fuzzy-diff.in
@@ -95,6 +102,7 @@
 gnun-report: $(srcdir)/gnun-report.in
 gnun-validate-html: $(srcdir)/gnun-validate-html.in
 diff-po.awk: $(srcdir)/diff-po.awk.in
+mailfail: $(srcdir)/mailfail.in
 update-localized-urls: $(srcdir)/update-localized-urls.in
 validate-html-notify: $(srcdir)/validate-html-notify.in
 
@@ -109,15 +117,15 @@
 dist_sysconf_DATA = gnun.conf
 dist_pkgdata_DATA = GNUmakefile
 
-EXTRA_DIST = add-fuzzy-diff.in copy-msgid.in \
+EXTRA_DIST = add-fuzzy-diff.in copy-msgid.in diff-po.awk.in \
             gnun-add-fuzzy-diff.in gnun-diff-po.in \
             gnun-init-po.in gnun-merge-preconverted.in \
             gnun-report.in gnun-validate-html.in \
-            diff-po.awk.in update-localized-urls.in \
+            mailfail.in update-localized-urls.in \
             validate-html-notify.in
 
-CLEANFILES = add-fuzzy-diff copy-msgid gnun-add-fuzzy-diff \
+CLEANFILES = add-fuzzy-diff copy-msgid diff-po.awk gnun-add-fuzzy-diff \
             gnun-diff-po gnun-init-po gnun-merge-preconverted gnun-report \
-            gnun-validate-html diff-po.awk \
+            gnun-validate-html mailfail \
             update-localized-urls validate-html-notify \
             stamp-config.mk

Index: NEWS
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/NEWS,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -b -r1.94 -r1.95
--- NEWS        6 Sep 2013 18:05:11 -0000       1.94
+++ NEWS        8 Oct 2013 04:38:23 -0000       1.95
@@ -28,6 +28,20 @@
     localized SSIs is now completely defined via variables
     from gnun.mk.
 
+** Portability improvements
+
+*** GNUN can now use `uuencode' when `base64' is unavailable.
+
+*** Awk implementations other than GNU Awk are supported (GNU Awk
+    is still highly recommended).
+
+*** `diff', `touch', `grep' don't need to be GNU any more (this
+    dependency was undocumented).
+
+*** Configuration variables for `bash', `mail', `mktemp', `xmllint'
+    are added, which makes it possible to have those programs in
+    custom locations.
+
 ** Bugs fixed in 0.8.
 
 *** `gnun-diff-po' didn't process empty comments correctly.

Index: README
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/README,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- README      31 Aug 2013 14:09:41 -0000      1.13
+++ README      8 Oct 2013 04:38:24 -0000       1.14
@@ -29,19 +29,22 @@
 * GNU Make >= 3.81 (prereleases of 3.81 also work)
   http://www.gnu.org/software/make
 
+* GNU Bash
+  http://www.gnu.org/software/bash
+
 * GNU Sed (other `sed' implementations won't do)
   http://www.gnu.org/software/sed
 
 * GNU Gettext (>= 0.16)
   http://www.gnu.org/software/gettext
 
-* GNU Awk (other `awk' implementations are not supported)
+* Awk (GNU Awk is highly recommended)
   http://www.gnu.org/software/gawk
 
 * Po4a >= 0.34 (used to generate HTML pages)
   from http://po4a.alioth.debian.org
 
-* GNU wdiff (optionally used to produce differences)
+* GNU Wdiff (optionally used to produce differences)
   http://www.gnu.org/software/wdiff
 
 * Libxml2 (>= 2.6.24, needed for HTML validation only)
@@ -50,6 +53,16 @@
 * CVS (>= 1.12.9, needed if VCS operations are enabled)
   http://cvs.nongnu.org
 
+* Mktemp
+  http://www.mktemp.org
+
+* mail (needed for announcements)
+  http://www.gnu.org/software/mailutils
+
+* base64 or uuencode (needed for announcements)
+  http://www.gnu.org/software/coreutils
+    or
+  http://www.gnu.org/software/sharutils
 
 Bugs
 ----

Index: add-fuzzy-diff.in
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/add-fuzzy-diff.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- add-fuzzy-diff.in   30 Jan 2012 08:49:13 -0000      1.2
+++ add-fuzzy-diff.in   8 Oct 2013 04:38:24 -0000       1.3
@@ -39,7 +39,7 @@
   :create-file;
 # It seems to be considerably faster to create a new file than
 # to rewrite an existing one on fencepost (?)
-  x; s%.*%mktemp addiff.XXXXXXXXXXXXX%e;
+  x; address@hidden@ -t addiff.XXXXXXXXXXXXX%e;
   H; g;
 # Cut out the lines with current msgid.
   s/\nmsgid ".*\(\n[^\n]*\)$/\1/;

Index: config.mk.in
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/config.mk.in,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- config.mk.in        31 Aug 2013 14:09:41 -0000      1.11
+++ config.mk.in        8 Oct 2013 04:38:24 -0000       1.12
@@ -22,9 +22,11 @@
 pkglibexecdir  := @pkglibexecdir@
 
 AWK            := @AWK@
+BASE64_ENCODE  := @BASE64_ENCODE@
 SED            := @SED@
 GREP           := @GREP@
 EGREP          := @EGREP@
+MAIL           := @MAIL@
 MSGATTRIB      := @MSGATTRIB@
 MSGCAT         := @MSGCAT@
 MSGFMT         := @MSGFMT@
@@ -34,5 +36,8 @@
 WDIFF           := @WDIFF@
 MULTIVIEWS      := @MULTIVIEWS@
 
+# Force BASH as the shell.
+export SHELL   := @BASH@
+
 prefix         := @prefix@
 -include @sysconfdir@/gnun.conf

Index: configure.ac
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/configure.ac,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- configure.ac        27 Dec 2012 15:32:27 -0000      1.40
+++ configure.ac        8 Oct 2013 04:38:24 -0000       1.41
@@ -1,6 +1,7 @@
 # Process this file with autoconf to produce a configure script.
 
-# Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 2010, 2011, 2012,
+#   2013 Free Software Foundation, Inc.
 
 # This file is part of GNUnited Nations.
 
@@ -49,6 +50,23 @@
 AC_MSG_RESULT([$enable_multiviews])
 AC_SUBST([MULTIVIEWS], [$enable_multiviews])
 
+AC_MSG_CHECKING([whether `date' supports the `-d' option])
+timestamp=`date -d "2001-09-09 01:47+0000" +%s 2> /dev/null || echo FAIL`
+decent_date=no
+AS_CASE(["x$timestamp"], [x1000000020],
+[decent_date=yes
+])
+AC_MSG_RESULT([$decent_date])
+
+AS_CASE([$decent_date], [no],
+[AC_MSG_WARN([
+
+The `date' program seems to support no `-d' option.
+
+We rely on it when delaying pages regeneration; this feature may not
+work for you.
+])])
+
 AC_ARG_VAR([AWK], [the `awk' program])
 AX_CHECK_AWK_GSUB([decent_awk=yes], [decent_awk=no])
 
@@ -96,16 +114,61 @@
 ])
 ])
 
+AC_ARG_VAR([BASH], [the `bash' program])
+AC_PATH_PROG([BASH], [bash])
+AS_CASE(["x$BASH"], [x],
+[AC_MSG_ERROR([
+
+No `bash' program found.  Try configure BASH=/path/to/bash
+if you have it.
+])
+])
+
+# Detect the program to do base64 encoding.
+base64_encode=""
+AC_ARG_VAR([BASE64], [the `base64' program])
+AC_PATH_PROG([BASE64], [base64])
+AC_ARG_VAR([UUENCODE], [the `uuencode' program])
+AC_PATH_PROG([UUENCODE], [uuencode])
+AS_CASE(["x$BASE64"], [x],
+[AS_CASE(["x$UUENCODE"], [x], ,
+[base64_encode=\
+"$UUENCODE -m - | $SED ':c;N;$!bc;s/[^\n]*\n//;s/\n[^\n]*$//;s/\n//g'"
+])],
+[base64_encode="$BASE64 --wrap=0"
+])
+AS_CASE(["x$base64_encode"], [x],
+[AC_MSG_WARN([
+
+No program to do base64 encoding found.
+Announcements may not work properly.
+
+You may want to install base64 or uuencode.
+])
+base64_encode=cat
+])
+AC_SUBST([BASE64_ENCODE], [$base64_encode])
+
 AC_ARG_VAR([GREP], [the `grep' program])
 AC_ARG_VAR([EGREP], [the `egrep' program])
 AC_PROG_EGREP
 
+AC_ARG_VAR([MKTEMP], [the `mktemp' program])
+AC_PATH_PROG([MKTEMP], [mktemp])
+AS_CASE(["x$MKTEMP"], [x],
+[AC_MSG_ERROR([
+
+No `mktemp' program found.  Try configure MKTEMP=/path/to/mktemp
+if you have it.
+])
+])
+
 AC_ARG_VAR([MSGCAT], [the `msgcat' program])
-AC_CHECK_PROGS([MSGCAT], [msgcat gmsgcat])
+AC_PATH_PROGS([MSGCAT], [msgcat gmsgcat])
 AC_ARG_VAR([MSGFMT], [the `msgfmt' program])
-AC_CHECK_PROGS([MSGFMT], [msgfmt gmsgfmt])
+AC_PATH_PROGS([MSGFMT], [msgfmt gmsgfmt])
 AC_ARG_VAR([MSGEXEC], [the `msgexec' program])
-AC_CHECK_PROGS([MSGEXEC], [msgexec gmsgexec])
+AC_PATH_PROGS([MSGEXEC], [msgexec gmsgexec])
 AC_ARG_VAR([MSGMERGE], [the `msgmerge' program])
 AC_CACHE_CHECK([for msgmerge that supports --previous],
                [ac_cv_path_MSGMERGE],
@@ -139,9 +202,9 @@
 # Po4a is useless for our purpose if awk is missing.
 if test "$decent_awk" = yes; then
   AC_ARG_VAR([PO4A_GETTEXTIZE], [the `po4a-gettextize' program])
-  AC_CHECK_PROGS([PO4A_GETTEXTIZE], [po4a-gettextize])
+  AC_PATH_PROGS([PO4A_GETTEXTIZE], [po4a-gettextize])
   AC_ARG_VAR([PO4A_TRANSLATE], [the `po4a-translate' program])
-  AC_CHECK_PROGS([PO4A_TRANSLATE], [po4a-translate])
+  AC_PATH_PROGS([PO4A_TRANSLATE], [po4a-translate])
 
   # This is a weak test; should be replaced with a feature check.
   if test -n "$PO4A_TRANSLATE"; then
@@ -159,34 +222,36 @@
   gnun_cv_recent_po4a=no
 fi
 
-AC_CHECK_PROG([have_mail], [mail], [yes], [no])
+AC_PATH_PROG([MAIL], [mail])
 
 # This test is currently unnecessary, but might be useful if we rely
 # on GNU Mailutils features in the future.
-if test "$have_mail" = yes; then
+AS_CASE(["x$MAIL"], [x], [have_mail=no],
+[have_mail=yes
 AC_CACHE_CHECK([whether `mail' is from GNU Mailutils],
               [gnun_cv_gnu_mailutils],
               [gnun_cv_gnu_mailutils=no
-               if (sh -c "mail --version" 2> /dev/null | $GREP GNU \
-                   2>&1 > /dev/null) ; then
+               if $MAIL --version 2> /dev/null \
+                    | $GREP GNU 2>&1 > /dev/null ; then
                gnun_cv_gnu_mailutils=yes ;
                fi])
-fi
+])
 
 # Check for supported VCS.  Currently the tests are run only for the
 # sake of pretty-printing the summary at the end, but the results will
 # be used for the future testsuite.
-AC_CHECK_PROG([CVS], [cvs], [yes])
+AC_PATH_PROG([CVS], [cvs])
 AS_IF([test -n "$CVS"], [cvs="(CVS)"])
-AC_CHECK_PROG([SVN], [svn], [yes])
+AC_PATH_PROG([SVN], [svn])
 AS_IF([test -n "$SVN"], [svn="(Subversion)"])
-AC_CHECK_PROG([BZR], [bzr], [yes])
+AC_PATH_PROG([BZR], [bzr])
 AS_IF([test -n "$BZR"], [bzr="(Bazaar)"])
 AS_IF([test -n "$CVS" || test -n "$SVN" || test -n "$BZR"],
       [have_vcs=yes], [have_vcs=no])
 
-AC_CHECK_PROG([have_xmllint], [xmllint], [yes], [no])
-if test "$have_xmllint" = yes; then
+AC_PATH_PROG([XMLLINT], [xmllint])
+AS_CASE(["x$XMLLINT"], [x], ,
+[have_xmllint=yes
 AC_MSG_CHECKING([if XHTML DTDs are installed])
 have_dtds=no
 cat > conftest.dtd <<'EOF'
@@ -201,7 +266,7 @@
 </body>
 </html>
 EOF
-if xmllint --valid --nonet --noout conftest.dtd 2> /dev/null ; then
+if $XMLLINT --valid --nonet --noout conftest.dtd 2> /dev/null ; then
   have_dtds=yes;
 fi
   if test "$have_dtds" = no; then
@@ -209,7 +274,7 @@
   else
     AC_MSG_RESULT([$have_dtds])
   fi
-fi
+])
 
 # Our validation scripts depend on awk and xmllint.
 AS_CASE([$have_xmllint], [yes],

Index: diff-po.awk.in
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/diff-po.awk.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- diff-po.awk.in      19 May 2013 16:37:56 -0000      1.3
+++ diff-po.awk.in      8 Oct 2013 04:38:24 -0000       1.4
@@ -1,4 +1,4 @@
-#! /usr/bin/awk -f
+#! @AWK@ -f
 
 # Copyright (C) 2013 Free Software Foundation, Inc.
 
@@ -125,7 +125,7 @@
   msg_no = 0;
   comment_no = 0;
   msgstr_no = 0;
-  mktemp_cmd = "mktemp diff-po-tmp.XXXXXXXXXX"
+  mktemp_cmd = "@MKTEMP@ -t diff-po-tmp.XXXXXXXXXX"
   mktemp_cmd | getline tmp_file[0]
   close(mktemp_cmd)
   mktemp_cmd | getline tmp_file[1]

Index: expand-ssi.awk
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/expand-ssi.awk,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- expand-ssi.awk      31 Aug 2013 17:39:56 -0000      1.4
+++ expand-ssi.awk      8 Oct 2013 04:38:24 -0000       1.5
@@ -1,6 +1,6 @@
 # expand-ssi.awk: process Apache SSI directives.
 
-# Copyright (C) 2012 Free Software Foundation, Inc.
+# Copyright (C) 2013 Free Software Foundation, Inc.
 
 # This file is part of GNUnited Nations.
 
@@ -21,6 +21,9 @@
 # e.g. `&&' and `||' in `if' expressions are not supported, as well as
 # many cases of quoting; CGI includes would be expanded in a wrong way.
 
+# Fallback for awks who don't support RT.
+BEGIN { RT = "\n" }
+
 # Read whole file to `text'.
 { text = text $0 RT }
 
@@ -35,7 +38,7 @@
   str = vars[1];
   for(i = 2; i <= n; i++)
     {
-      if(vars[i] ~ /^{/)
+      if(substr(vars[i], 1, 1) == "{")
         {
           begin = 2; end = index(vars[i], "}"); rest = end + 1
         }
@@ -99,7 +102,7 @@
   gsub(/;/, "%3b", str);  gsub(/</, "%3c", str);   gsub(/>/, "%3e", str)
   gsub(/\?/, "%3f", str); gsub(/\[/, "%5b", str);  gsub(/\]/, "%5d", str)
   gsub(/\^/, "%5e", str); gsub(/`/, "%60", str);
-  gsub(/{/, "%7b", str);  gsub(/[|]/, "%7c", str); gsub(/}/, "%7d", str)
+  gsub(/\{/, "%7b", str);  gsub(/[|]/, "%7c", str); gsub(/}/, "%7d", str)
   return str
 }
 
@@ -124,9 +127,7 @@
         val = ""
       if(1 in arr)
         {
-          sub(/[[:blank:]\r\n]*$/, "", arr[1])
-          enc = substr(arr[1], length("encoding='") + 1,
-                       length(arr[1]) - length("encoding=''"));
+          enc = arr[1]
           if(enc == "entity")
             val = encode_entity(val)
           else if(enc == "url")
@@ -144,7 +145,7 @@
     }
   else
     {
-      val = substr(str,  1, match(str, /[[:blank:]\r\n]-->/))
+      val = substr(str,  1, match(str, /[ \t\r\n]-->/))
       print my_name "couldn't process echo directive `" val "'" > "/dev/stderr"
       exit 1
     }
@@ -155,8 +156,8 @@
   val)
 {
   val = str
-  sub(/^[[:blank:]]*/, "", val)
-  sub(/[[:blank:]]*$/, "", val)
+  sub(/^[ \t]*/, "", val)
+  sub(/[ \t]*$/, "", val)
   if(val ~ /^'.*'$/ || val ~ /^".*"$/)
     val = unquote(val)
   return expand_var_value(val)
@@ -170,17 +171,23 @@
 # Advanced quoting patterns like  "' '${test}' ' = '   '"
 # are also not supported (use "' ${test} ' = '   '").
 function eval_expression(str,
-  arr, lval, rval, negate, pattern_match, res)
+  arr, lval, rval, negate, pattern_match, res, idx)
 {
   # Escaped `$'s are treated the same way as unescaped in `if' expressions.
   gsub(/\\\$/, "$", str)
-  if(!match(str, /^([^=]*)=(.*)/, arr))
+  idx = index(str, "=")
+  if(!idx)
     {
       # No `=': we've got either "!string" or "string" kind of expression.
-      if(str ~ /^[[:blank:]]*!/)
+      if(str ~ /^[ \t]*!/)
         return !length(unquoted_var(substr(str, index(str, "!") + 1)))
       return length(unquoted_var(str))
     }
+  if(idx > 1)
+    arr[1] = substr(str, 1, idx - 1)
+  else
+    arr[1] = ""
+  arr[2] = substr(str, idx + 1)
   if(str ~ /!==/)
     {
       print my_name "bad expression `" str "'" > "/dev/stderr"
@@ -194,9 +201,9 @@
       arr[2] = substr(arr[2], 2)
       negate = -1
     }
-  sub(/^[[:blank:]]*/, "", arr[2])
-  sub(/[[:blank:]]*$/, "", arr[2])
-  if(arr[2] ~ /^[/].*[/]$/)
+  sub(/^[ \t]*/, "", arr[2])
+  sub(/[ \t]*$/, "", arr[2])
+  if(arr[2] ~ /^\/.*\/$/)
     {
       pattern_match = 1
       arr[2] = unquote(arr[2])
@@ -222,7 +229,7 @@
 function directive_idx(str,
   i, idx1)
 {
-  i = match(str, /[[:blank:]\r\n]-->/)
+  i = match(str, /[ \t\r\n]-->/)
   if(i == 0)
     {
       print my_name "broken chunk `<!--#" str "': directive has no end" \
@@ -304,39 +311,76 @@
       idx = directive_idx(chunks[ch_i])
 # `Set' directive: assign a variable.
       directive = substr(chunks[ch_i], 1, idx - 1)
-      if(match(directive, /^set[[:blank:]\r\n]+var=('.+'|".+")\
-[[:blank:]\r\n]+value=('.*'|".*")[[:blank:]\r\n]+-->/, pattern))
+      if(directive \
+~ /^set[ \t\r\n]+var=('.+'|".+")[ \t\r\n]+value=('.*'|".*")[ \t\r\n]+-->/)
         {
+          pattern[1] = directive
+          sub(/^set[ \t\r\n]+var=/, "", pattern[1])
+          sub(/[ \t\r\n]+value=('.*'|".*")[ \t\r\n]+-->.*/,
+              "", pattern[1])
+          pattern[2] = directive
+          sub(/^set[ \t\r\n]+var=('.+'|".+")[ \t\r\n]+value=/, \
+              "", pattern[2])
+          sub(/[ \t\r\n]+-->.*/, "", pattern[2])
           assign_var(pattern[1], pattern[2])
           if(idx <= length(chunks[ch_i]))
             printf("%s", substr(chunks[ch_i], idx) "")
           continue
         }
 # `Set' directive (different order of attributes).
-      if(match(directive, /^set[[:blank:]\r\n]+value=('.*'|".*")\
-[[:blank:]\r\n]+var=('.+'|".+")[[:blank:]\r\n]+-->/, pattern))
+      if(directive \
+~ /^set[ \t\r\n]+value=('.*'|".*")[ \t\r\n]+var=('.+'|".+")[ \t\r\n]+-->/)
         {
+          pattern[1] = directive
+          sub(/^set[ \t\r\n]+value=/, "", pattern[1])
+          sub(/[ \t\r\n]+var=('.*'|".*")[ \t\r\n]+-->.*/,
+              "", pattern[1])
+          pattern[2] = directive
+          sub(/^set[ \t\r\n]+value=('.+'|".+")[ \t\r\n]+var=/, \
+              "", pattern[2])
+          sub(/[ \t\r\n]+-->.*/, "", pattern[2])
           assign_var(pattern[2], pattern[1])
           if(idx <= length(chunks[ch_i]))
             printf("%s", substr(chunks[ch_i], idx) "")
           continue
         }
 # `Echo' directive: output a variable.
-      if(match(chunks[ch_i], /^echo[[:blank:]\r\n]+\
-(encoding="[^\"]*"[[:blank:]\r\n]+|encoding='[^']*'\
-[[:blank:]\r\n]+)?var=('[^']+'|"[^\"]+")[[:blank:]\r\n]+-->/, pattern))
+      if(chunks[ch_i] \
+~ /^echo[ \t\r\n]+(encoding=("[^\"]*"|'[^']*')[ 
\t\r\n]+)?var=('[^']+'|"[^\"]+")[ \t\r\n]+-->/)
+        {
+          if(chunks[ch_i] \
+~ /^echo[ \t\r\n]+(encoding=("[^\"]*"|'[^']*')[ \t\r\n]+)/)
         {
+              pattern[1] = chunks[ch_i]
+              sub(/^echo[ \t\r\n]+encoding=/, "", pattern[1])
+              idx1 = index(substr(pattern[1], 2), substr(pattern[1], 1, 1))
+              pattern[1] = substr(pattern[1], 2, idx1 - 1)
+            }
+          else
+            delete pattern[1]
+          pattern[2] = chunks[ch_i]
+          sub(\
+/^echo[ \t\r\n]+(encoding=("[^\"]*"|'[^']*')[ \t\r\n]+)?var=/, \
+"", pattern[2])
+          idx1 = index(substr(pattern[2], 2), substr(pattern[2], 1, 1))
+          pattern[2] = substr(pattern[2], 1, idx1 + 1)
           echo_var(chunks[ch_i], pattern)
           if(idx <= length(chunks[ch_i]))
             printf("%s", substr(chunks[ch_i], idx) "")
           continue
         }
 # `Include' directive: expand the file and rearrange chunks.
-      if(match(chunks[ch_i], \
-/^include[[:blank:]\r\n]+(file|virtual)=("[^"]*"|'[^']*')[[:blank:]\r\n]+-->/, 
\
-         pattern))
+      if(chunks[ch_i] ~ \
+/^include[ \t\r\n]+(file|virtual)=("[^"]*"|'[^']*')[ \t\r\n]+-->/)
         {
-          name = unquote(pattern[2])
+          pattern[2] = chunks[ch_i]
+          sub(/^include[ \t\r\n]+(file|virtual)=/, "", pattern[2])
+          pattern[1] = substr(pattern[2], 1, 1)
+          idx1 = index(substr(pattern[2], 2), pattern[1])
+          if(idx1 > 1)
+            name = substr(pattern[2], 2, idx1 - 1)
+          else
+            name = ""
           # Construct the real path to the file.
           # Note: relative paths actually won't work in nested includes;
           # we could track the changes of the path through assigning a path
@@ -386,8 +430,7 @@
         } # if(match(chunks[ch_i], ...
 # `If' directive: skip all branches with false conditions;
 # output the branch with true condition.
-      if(chunks[ch_i] ~ /^if[[:blank:]\r\n]+\
-expr=('.*'|".*")[[:blank:]\r\n]+-->/)
+      if(chunks[ch_i] ~ /^if[ \t\r\n]+expr=('.*'|".*")[ \t\r\n]+-->/)
         {
           depth++
           finish = 0
@@ -396,7 +439,7 @@
               exp_val = 1
               # `Else' branches are output unconditionally
               # (no matching `if'/`elif' found).
-              if(chunks[ch_i] !~ /^else[[:blank:]\r\n]+-->/)
+              if(chunks[ch_i] !~ /^else[ \t\r\n]+-->/)
                 {
                   exp_l = index(chunks[ch_i], "expr=") + length("expr=")
                   qu = substr(chunks[ch_i], exp_l, 1)
@@ -417,55 +460,53 @@
                   idx = directive_idx(chunks[ch_i])
                   # Next if: increase depth.
                   if(chunks[ch_i] \
-                     ~ 
/^if[[:blank:]\r\n]+expr=('.*'|".*")[[:blank:]\r\n]+-->/)
+                     ~ /^if[ \t\r\n]+expr=('.*'|".*")[ \t\r\n]+-->/)
                     {
                       d++; continue
                     }
                   # `Endif': break if we are at the initial depth.
-                  if(chunks[ch_i] ~ /^endif[[:blank:]\r\n]+-->/)
+                  if(chunks[ch_i] ~ /^endif[ \t\r\n]+-->/)
                     {
                       if(d-- > 0)
                         continue
                       finish = !0; process_endif(); break
                     }
                   # `Else' or `elif': break if we are at the initial depth.
-                  if(d == 0 && (chunks[ch_i] ~ /^else[[:blank:]\r\n]+-->/ \
-                     || chunks[ch_i] ~ /^elif[[:blank:]\r\n]+\
-expr=('.*'|".*")[[:blank:]\r\n]+-->/))
+                  if(d == 0 && (chunks[ch_i] ~ /^else[ \t\r\n]+-->/ \
+                     || chunks[ch_i] \
+                          ~ /^elif[ \t\r\n]+expr=('.*'|".*")[ \t\r\n]+-->/))
                     break
                 } # while (++ch_i <= ch_n)
             } # while(ch_i <= ch_n && !finish)
           continue
-        } # if(chunks[ch_i] ~ /^if[[:blank:]\r\n]+ ...
+        } # if(chunks[ch_i] ~ /^if[ \t\r\n]+ ...
 # `Elif' or `else' directive: skip up to endif (since the branch with
 # matching expression was output when processing the `if' directive).
-      if((chunks[ch_i] ~ /^else[[:blank:]\r\n]+-->/) \
-          || (chunks[ch_i] ~ /^elif[[:blank:]\r\n]+\
-expr=('.*'|".*")[[:blank:]\r\n]+-->/))
+      if((chunks[ch_i] ~ /^else[ \t\r\n]+-->/) \
+          || (chunks[ch_i] ~ /^elif[ \t\r\n]+expr=('.*'|".*")[ \t\r\n]+-->/))
         {
           d = 0; chunk_i = ch_i
           while (++ch_i <= ch_n)
             {
               idx = directive_idx(chunks[ch_i])
-              if(chunks[ch_i] ~ /^if[[:blank:]\r\n]+\
-expr=('.*'|".*")[[:blank:]\r\n]+-->/)
+              if(chunks[ch_i] ~ /^if[ \t\r\n]+expr=('.*'|".*")[ \t\r\n]+-->/)
                 d++
-              if(chunks[ch_i] ~ /^endif[[:blank:]\r\n]+-->/)
+              if(chunks[ch_i] ~ /^endif[ \t\r\n]+-->/)
                 if(d-- == 0)
                   {
                     process_endif(); break
                   }
             }
-          if(chunks[ch_i] !~ /^endif[[:blank:]\r\n]+-->/)
+          if(chunks[ch_i] !~ /^endif[ \t\r\n]+-->/)
             {
               print my_name "couldn't find matching endif for `<!--#" \
                 chunks[chunk_i] "'" > "/dev/stderr"
               exit 1
             }
           continue
-        } # if((chunks[ch_i] ~ /^else[[:blank:]\r\n]+-->/...
+        } # if((chunks[ch_i] ~ /^else[ \t\r\n]+-->/...
 # `Endif' directive: decrease depth and output the rest of the chunk.
-      if(chunks[ch_i] ~ /^endif[[:blank:]\r\n]+-->/)
+      if(chunks[ch_i] ~ /^endif[ \t\r\n]+-->/)
         {
           process_endif(); continue
         }

Index: gnun-add-fuzzy-diff.in
===================================================================
RCS file: 
/sources/trans-coord/trans-coord/gnun/server/gnun/gnun-add-fuzzy-diff.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- gnun-add-fuzzy-diff.in      30 Jan 2012 08:49:13 -0000      1.3
+++ gnun-add-fuzzy-diff.in      8 Oct 2013 04:38:24 -0000       1.4
@@ -1,6 +1,6 @@
-#! /bin/bash
+#! @BASH@
 
-# Copyright (C) 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2011, 2012, 2013 Free Software Foundation, Inc.
 
 # This file is part of GNUnited Nations.
 
@@ -23,7 +23,7 @@
 function version () {
 cat <<EOF
 gnun-add-fuzzy-diff (@PACKAGE_NAME@) @PACKAGE_VERSION@
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2013 Free Software Foundation, Inc.
 You may redistribute copies of @PACKAGE_NAME@
 under the terms of the GNU General Public License.
 For more information about these matters, see the file named COPYING.

Index: gnun-diff-po.in
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/gnun-diff-po.in,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- gnun-diff-po.in     12 Jul 2013 05:48:55 -0000      1.9
+++ gnun-diff-po.in     8 Oct 2013 04:38:25 -0000       1.10
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! @BASH@
 
 # Copyright (C) 2013 Free Software Foundation, Inc.
 
@@ -111,15 +111,15 @@
 
 # File to count msgid number, since msgexec doesn't provide
 # a variable for it, and for POT when merging is needed.
-temp=`mktemp gnun-diff-po.XXXXXXXXXX`
address@hidden@ -t gnun-diff-po.XXXXXXXXXX`
 # Files for po-msg-diff use; we could create them in po-msg-diff,
 # but then mktemp and rm would run for every compared msgstr pair.
-temp1=`mktemp gnun-diff-po1.XXXXXXXXXX`
-temp2=`mktemp gnun-diff-po2.XXXXXXXXXX`
address@hidden@ -t gnun-diff-po1.XXXXXXXXXX`
address@hidden@ -t gnun-diff-po2.XXXXXXXXXX`
 # File for the merged PO.
-temp3=`mktemp gnun-diff-po3.XXXXXXXXXX`
address@hidden@ -t gnun-diff-po3.XXXXXXXXXX`
 # Temporary file with cleared ``fuzzy'' flags and removed obsolete entries.
-temp4=`mktemp gnun-diff-po4.XXXXXXXXXX`
address@hidden@ -t gnun-diff-po4.XXXXXXXXXX`
 trap 'rm -f "$temp" "$temp1" "$temp2" "$temp3" "$temp4"' EXIT
 
 cat <<EOF

Index: gnun-init-po.in
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/gnun-init-po.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- gnun-init-po.in     31 Jul 2012 10:51:17 -0000      1.2
+++ gnun-init-po.in     8 Oct 2013 04:38:25 -0000       1.3
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! @BASH@
 # Init a translation file.
 
 # Copyright (C) 2012 Free Software Foundation, Inc.

Index: gnun-merge-preconverted.in
===================================================================
RCS file: 
/sources/trans-coord/trans-coord/gnun/server/gnun/gnun-merge-preconverted.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- gnun-merge-preconverted.in  19 Nov 2012 15:14:26 -0000      1.3
+++ gnun-merge-preconverted.in  8 Oct 2013 04:38:25 -0000       1.4
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! @BASH@
 # Merge preconverted files.
 
 # Copyright (C) 2012 Free Software Foundation, Inc.
@@ -21,7 +21,7 @@
 function version () {
 cat <<EOF
 gnun-merge-preconverted (@PACKAGE_NAME@) @PACKAGE_VERSION@
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2013 Free Software Foundation, Inc.
 You may redistribute copies of @PACKAGE_NAME@
 under the terms of the GNU General Public License.
 For more information about these matters, see the file named COPYING.

Index: gnun-preconvert.in
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/gnun-preconvert.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- gnun-preconvert.in  14 Sep 2012 04:24:19 -0000      1.3
+++ gnun-preconvert.in  8 Oct 2013 04:38:25 -0000       1.4
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! @BASH@
 # Invoke po4a-gettextize to convert an existing translation from
 # HTML to PO.
 
@@ -22,7 +22,7 @@
 function version () {
 cat <<EOF
 gnun-preconvert (@PACKAGE_NAME@) @PACKAGE_VERSION@
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2013 Free Software Foundation, Inc.
 You may redistribute copies of @PACKAGE_NAME@
 under the terms of the GNU General Public License.
 For more information about these matters, see the file named COPYING.

Index: gnun-report.in
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/gnun-report.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- gnun-report.in      8 Mar 2013 12:44:11 -0000       1.3
+++ gnun-report.in      8 Oct 2013 04:38:25 -0000       1.4
@@ -1,4 +1,4 @@
-#! /bin/bash
+#! @BASH@
 
 # Copyright (C) 2013 Free Software Foundation, Inc.
 
@@ -20,7 +20,7 @@
 function version () {
 cat <<EOF
 gnun-report (@PACKAGE_NAME@) @PACKAGE_VERSION@
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2013 Free Software Foundation, Inc.
 You may redistribute copies of @PACKAGE_NAME@
 under the terms of the GNU General Public License.
 For more information about these matters, see the file named COPYING.

Index: gnun-validate-html.in
===================================================================
RCS file: 
/sources/trans-coord/trans-coord/gnun/server/gnun/gnun-validate-html.in,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- gnun-validate-html.in       21 May 2013 10:18:34 -0000      1.18
+++ gnun-validate-html.in       8 Oct 2013 04:38:26 -0000       1.19
@@ -1,6 +1,7 @@
-#!/bin/bash
+#! @BASH@
 
-# Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 2010, 2011, 2012,
+#   2013 Free Software Foundation, Inc.
 
 # This file is part of GNUnited Nations.
 
@@ -20,7 +21,7 @@
 function version () {
 cat <<EOF
 gnun-validate-html (@PACKAGE_NAME@) @PACKAGE_VERSION@
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2013 Free Software Foundation, Inc.
 You may redistribute copies of @PACKAGE_NAME@
 under the terms of the GNU General Public License.
 For more information about these matters, see the file named COPYING.
@@ -114,8 +115,8 @@
 address@hidden@
 
 # Create two tempfiles and mark them for deletion on exit.
-TMP1=`mktemp -t gnun.1.XXXXXX`
-TMP2=`mktemp -t gnun.2.XXXXXX`
address@hidden@ -t gnun.1.XXXXXX`
address@hidden@ -t gnun.2.XXXXXX`
 trap "rm -f $TMP1 $TMP2" EXIT
 
 # Use $TMP1 if no $OUTPUT is specified.
@@ -167,7 +168,7 @@
 
 # Execute xmllint on $OUTPUT and save its output to $TMP2.
 set +e
-xmllint --path "$DTD" $VALIDATE --nonet --noout "${OUTPUT}" 2> $TMP2
address@hidden@ --path "$DTD" $VALIDATE --nonet --noout "${OUTPUT}" 2> $TMP2
 LINTSTATUS=$?
 set -e
 

Index: make-prototype.awk
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/make-prototype.awk,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- make-prototype.awk  31 Aug 2013 14:09:41 -0000      1.2
+++ make-prototype.awk  8 Oct 2013 04:38:26 -0000       1.3
@@ -17,6 +17,9 @@
 # You should have received a copy of the GNU General Public License
 # along with GNUnited Nations.  If not, see <http://www.gnu.org/licenses/>.
 
+# Fallback for awks who don't support RT.
+BEGIN { RT = "\n" }
+
 # Read whole file to `text'.
 { text = text $0 RT }
 
@@ -24,8 +27,7 @@
 
 # Program's name to prepend error messages.
   my_name = "make-prototype.awk: "
-
-  if (!match(text, /(<title>.*)(<\/div>.*<div id="footer">)(.*)/, parts))
+  if (!match(text, /<title>.*<\/div>.*<div id="footer">/))
     {
       print my_name \
         "`<title>' followed by `</div>' and `<div id=\"footer\">' not found" \
@@ -33,8 +35,16 @@
       exit 1
     }
   output = ""
+  parts[3] = substr (text, RSTART + RLENGTH)
+  text = substr (text, 1, RSTART + RLENGTH - 1)
   if (RSTART > 1)
-    output = substr(text, 1, RSTART-1)
+    {
+      output = substr (text, 1, RSTART - 1)
+      text = substr (text, RSTART)
+    }
+  match(text, /.*<\/div>/)
+  parts[1] = substr (text, 1, RLENGTH - 6)
+  parts[2] = substr (text, RLENGTH + 1 - 6)
   output = output "<gnun></gnun>"\
     "<!-- This file is automatically generated by GNUnited Nations! -->\n" \
     parts[1] \
@@ -44,13 +54,18 @@
 "*GNUN-SLOT: TRANSLATOR'S NOTES*</div>\n" \
     parts[2]
 
-  if(!match (parts[3], /(.*)(<p>.*[$]Date:.*)/, tail))
+  if(!match (parts[3], /<p>.*[$]Date:/))
     {
       print my_name \
         "no `<p>' followed by `$Date:' after `<div id=\"footer\">' found" \
          > "/dev/stderr"
       exit 1
     }
+  tail[1] = substr (parts[3], 1, RSTART + RLENGTH - 1)
+  tail[2] = substr (parts[3], RSTART + RLENGTH)
+  match (tail[1], /.*<p>/)
+  tail[2] = substr (tail[1], RSTART + RLENGTH - 3) tail[2]
+  tail[1] = substr (tail[1], 1, RSTART + RLENGTH - 1 - 3)
   printf "%s", output tail[1] \
 "\n" \
 "<div class=\"translators-credits\">\n" \

Index: update-localized-urls.in
===================================================================
RCS file: 
/sources/trans-coord/trans-coord/gnun/server/gnun/update-localized-urls.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- update-localized-urls.in    30 Jan 2012 08:49:14 -0000      1.2
+++ update-localized-urls.in    8 Oct 2013 04:38:26 -0000       1.3
@@ -1,6 +1,6 @@
-#! /bin/bash
+#! @BASH@
 
-# Copyright (C) 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2011, 2012, 2013 Free Software Foundation, Inc.
 
 # This file is part of GNUnited Nations.
 
@@ -22,7 +22,7 @@
 function version () {
 cat <<EOF
 update-localized-urls (@PACKAGE_NAME@) @PACKAGE_VERSION@
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2013 Free Software Foundation, Inc.
 You may redistribute copies of @PACKAGE_NAME@
 under the terms of the GNU General Public License.
 For more information about these matters, see the file named COPYING.
@@ -92,7 +92,7 @@
   exit 1;
 fi
 
-TMP=$(mktemp urls.XXXXXXXXXX)
address@hidden@ -t urls.XXXXXXXXXX`
 trap "rm -f ${TMP}" EXIT
 
 cat > ${TMP} <<EOF

Index: validate-html-notify.in
===================================================================
RCS file: 
/sources/trans-coord/trans-coord/gnun/server/gnun/validate-html-notify.in,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- validate-html-notify.in     19 Nov 2012 06:59:28 -0000      1.12
+++ validate-html-notify.in     8 Oct 2013 04:38:26 -0000       1.13
@@ -1,6 +1,7 @@
-#!/bin/bash
+#! @BASH@
 
-# Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 2010, 2011, 2012,
+#   2013 Free Software Foundation, Inc.
 
 # This file is part of GNUnited Nations.
 

Index: mailfail.in
===================================================================
RCS file: mailfail.in
diff -N mailfail.in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ mailfail.in 8 Oct 2013 04:38:26 -0000       1.1
@@ -0,0 +1,66 @@
+#! @BASH@
+
+# Copyright (C) 2008, 2009, 2010, 2011, 2012,
+#   2013 Free Software Foundation, Inc.
+
+# This file is part of GNUnited Nations.
+
+# GNUnited Nations is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+
+# GNUnited Nations is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GNUnited Nations.  If not, see <http://www.gnu.org/licenses/>.
+
+# Usage:
+#
+# ./mailfail [--dry-run] RCPT SUBJECT CMD [ARG ...]
+#
+# Example:
+#
+# ./mailfail address@hidden "Invalid HTML" ./validate article.html
+
+function usage() {
+    echo 1>&2 Usage: ./mailfail [--dry-run] RCPT SUBJECT CMD [ARG ...]
+    exit 1
+}
+
+[ $# -gt 0 ] || usage
+
+# Read arguments
+DRY_RUN=""
+if [ "$1" == "--dry-run" ]; then
+    [ $# -ge 4 ] || usage
+    DRY_RUN="yes"
+    RCPT="$2"
+    SUBJECT="$3"
+    shift 3
+else
+    [ $# -ge 3 ] || usage
+    RCPT="$1"
+    SUBJECT="$2"
+    shift 2
+fi
+
+# Create tempfile and mark it for deletion on exit.
address@hidden@ -t gnun.mailfail.XXXXXX`
+trap "rm -f $TMP" EXIT
+
+# Execute the command and capture it's output
+"$@" &>"$TMP"
+CMDSTATUS=$?
+cat "$TMP"
+
+# Mail the captured output, if needed
+if [ -z "$DRY_RUN" ] && [ "$CMDSTATUS" -ne 0 ]; then
+    @MAIL@ "$RCPT" -s "$SUBJECT" < "$TMP"
+fi
+
+# Exit with command's original exit status.
+exit $CMDSTATUS



reply via email to

[Prev in Thread] Current Thread [Next in Thread]