[Commits] [SCM] claws branch, gtk3, updated. 4.0.0-49-g0931e0643

wwp at claws-mail.org wwp at claws-mail.org
Thu Aug 19 16:24:55 UTC 2021


The branch, gtk3 has been updated
       via  0931e06430de0b954b6a360f7785853a6b536a1c (commit)
      from  73746b23ffa18601bb0d18404b721511285f2133 (commit)

Summary of changes:
 tools/README      |  3 ++-
 tools/fix_date.sh | 25 +++++++++++++++++++++----
 2 files changed, 23 insertions(+), 5 deletions(-)


- Log -----------------------------------------------------------------
commit 0931e06430de0b954b6a360f7785853a6b536a1c
Author: wwp <subscript at free.fr>
Date:   Thu Aug 19 18:24:42 2021 +0200

     fix_date.sh: document the fact coreutils, dos2unix, grep and sed are required,
    fallback writing temporary files to $HOME if /tmp is not writable.

diff --git a/tools/README b/tools/README
index 2a5e22689..fd033a5c4 100644
--- a/tools/README
+++ b/tools/README
@@ -37,7 +37,8 @@ Other tools:
                                 Insert files into a new Compose window
   filter_conv_new.pl            Convert new-style Sylpheed filters to filtering
   filter_conv.pl                Convert old-style Sylpheed filters to filtering
-  fix-date.sh                   Replace/Add a message's Date field
+  fix_date.sh                   Replace/Add a message's Date field (coreutils,
+                                dos2unix, grep and sed are required in PATH)
   mairix.sh                     A wrapper to mairix, to enable global searches in
                                 mail folders
   nautilus2claws-mail.sh        Send files from Nautilus
diff --git a/tools/fix_date.sh b/tools/fix_date.sh
index 1cb8f37aa..379807d68 100755
--- a/tools/fix_date.sh
+++ b/tools/fix_date.sh
@@ -28,7 +28,7 @@
 
 # TODO: fallback to X-OriginalArrivalTime: ?
 
-VERSION="0.1.3"
+VERSION="0.1.4"
 
 
 version()
@@ -49,6 +49,8 @@ usage()
 	echo "  -r --rfc      force re-writing of Date: header when it's not RFC-compliant"
 	echo "  -s --strict   use RFC-strict matching patterns for dates"
 	echo "  --            end of switches (in case a filename starts with a -)"
+    echo "this script requires coreutils (cat, cut, head, tr), dos2unix, grep and set"
+    echo "in PATH to work"
 	exit $1
 }
 
@@ -112,9 +114,24 @@ fi
 test $# -lt 1 && \
 	usage 1
 
-TMP="/tmp/${0##*/}.$$.tmp"
-HEADERS="/tmp/${0##*/}.$$.headers.tmp"
-BODY="/tmp/${0##*/}.$$.body.tmp"
+for PROG in dos2unix grep sed
+do
+    type "$PROG" >/dev/null 2>&1 || \
+        { echo "error: $PROG not found in PATH"; exit 1; }
+done
+
+TMPDIR="/tmp"
+TMP="$TMPDIR/${0##*/}.$$.tmp"
+echo > "$TMP" >/dev/null 2>&1
+if [ $? -eq 0 ]
+then
+    rm -f "$TMP" >/dev/null 2>&1
+else
+    TMPDIR="$HOME"
+    TMP="$TMPDIR/${0##*/}.$$.tmp"
+fi
+HEADERS="$TMPDIR/${0##*/}.$$.headers.tmp"
+BODY="$TMPDIR/${0##*/}.$$.body.tmp"
 
 DATE_REGEXP='( (Mon|Tue|Wed|Thu|Fri|Sat|Sun),)? [0-9]+ (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]+ [0-9]+:[0-9]+:[0-9]+ [+-]?[0-9]+'
 DATE_REGEXP_STRICT='(Mon|Tue|Wed|Thu|Fri|Sat|Sun), [0-9]+ (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]+ [0-9]+:[0-9]+:[0-9]+ [+-]?[0-9]+'

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list