Check-in [451de8e10d]
Not logged in
Overview
Comment:silktorrent_packager_t1.bash upgrade
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 451de8e10d8e0c91a98ccd65a5c4d3fe2c5afc74
User & Date: martin_vahi on 2017-03-14 05:12:06
Other Links: manifest | tags
Context
2017-03-14 05:29
BSD -> MIT check-in: e1fbe131b4 user: martin_vahi tags: trunk
2017-03-14 05:12
silktorrent_packager_t1.bash upgrade check-in: 451de8e10d user: martin_vahi tags: trunk
2017-01-07 16:36
mmmv_silkexec attic check-in: 7c010a3f80 user: martin_vahi tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Added milestone_releases/silktorrent_packager_t1_2017_03_14.bash version [a78df15c2e].

            1  +#!/usr/bin/env bash
            2  +#==========================================================================
            3  +#
            4  +# Copyright 2016, martin.vahi@softf1.com that has an
            5  +# Estonian personal identification code of 38108050020.
            6  +# All rights reserved.
            7  +#
            8  +# Redistribution and use in source and binary forms, with or
            9  +# without modification, are permitted provided that the following
           10  +# conditions are met:
           11  +#
           12  +# * Redistributions of source code must retain the above copyright
           13  +#   notice, this list of conditions and the following disclaimer.
           14  +# * Redistributions in binary form must reproduce the above copyright
           15  +#   notice, this list of conditions and the following disclaimer
           16  +#   in the documentation and/or other materials provided with the
           17  +#   distribution.
           18  +# * Neither the name of the Martin Vahi nor the names of its
           19  +#   contributors may be used to endorse or promote products derived
           20  +#   from this software without specific prior written permission.
           21  +#
           22  +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
           23  +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
           24  +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
           25  +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
           26  +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
           27  +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
           28  +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
           29  +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
           30  +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
           31  +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
           32  +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
           33  +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
           34  +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
           35  +#
           36  +#
           37  +#--------------------------------------------------------------------------
           38  +# TODO: 
           39  +#     Due to the dumb re-initialization of the whole 
           40  +#     Ruby interpreter for every small string operation in this script,
           41  +#     the current version of this script is terribly slow.
           42  +#     It could be faster, if gawk/awk were used, but the 
           43  +#     gawk/awk has been intentionally thrown out, because the gawk and awk 
           44  +#     behave differently from each other. On BSD there tends to be only "awk",
           45  +#     while the Linux tends to have only the "gawk".
           46  +#     At some point most of this script must be re-written, reimplemented, 
           47  +#     in something more advanced than Bash. Most likely Ruby. 
           48  +#
           49  +#     The need for the rewrite comes mainly from the fact that 
           50  +#     the passing of string values as console parameters 
           51  +#     runs into the classical macro processing related problems. 
           52  +#     The slowness in the name of portability and correctness 
           53  +#     of this, first, reference implementation, 
           54  +#     can be tolerated for a while. The reason, why this script has been
           55  +#     written in Bash at first place is that at first the goal was to 
           56  +#     try to create something very "simple", something that
           57  +#     depends only on programs that are very likely available
           58  +#     on PATH, but as it turns out, the various tests and 
           59  +#     string processing and other operations require 
           60  +#     quite a lot of more advanced tools than the Bash is, so
           61  +#     the simplicity and short start-up time has been totally
           62  +#     lost and the current script bears a heavy penalty from 
           63  +#     the relatively huge number of operating system process start-ups,
           64  +#     including the relatively huge number of initializations of
           65  +#     the Ruby interpreter.   
           66  +#
           67  +#     The lesson to be learnt from this case is that 
           68  +#     because projects get far more complex than 
           69  +#     initially anticipated, more advanced programming languages 
           70  +#     should be preferred to less advanced programming languages 
           71  +#     from the very start of the project. The current case here
           72  +#     seems to be a more high level version of the microcontroller projects'
           73  +#     assembler versus C dilemma.
           74  +#
           75  +#
           76  +#==========================================================================
           77  +S_FP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
           78  +S_FP_ORIG="`pwd`"
           79  +S_TIMESTAMP="`date +%Y`_`date +%m`_`date +%d`_T_`date +%H`h_`date +%M`min_`date +%S`s"
           80  +
           81  +#--------------------------------------------------------------------------
           82  +# Semi-auto-stamps:
           83  +
           84  +# RENESSAATOR_BLOCK_START
           85  +# RENESSAATOR_BLOCK_ID=block_15d8c335-b177-48d0-a3d6-12d261c031e7
           86  +# RENESSAATOR_SOURCE_LANGUAGE=Ruby
           87  +# RENESSAATOR_SOURCE_START
           88  +# #----------------------------------------------------------
           89  +# func_throw_t1=lambda do |s_in,s_guid_0|
           90  +# s_guid_1="401ec65f-5b1f-4504-a37f-802070e031e7"
           91  +# puts("\n")
           92  +# puts("echo \"\"")
           93  +# puts("echo \"Code generation script failed.\" \n")
           94  +# puts("echo \"GUID=='"+s_guid_1+"'\";  \n")
           95  +# puts("echo \"GUID=='"+s_guid_0+"'\";  \n")
           96  +# puts("echo \"\"")
           97  +# puts("exit 1 # exit with error \n")
           98  +# raise(Exception.new("\n\n s_in=="+s_in+"\n GUID=="+s_guid_0+"\n\n"))
           99  +# end # func_throw_t1
          100  +# #--------------
          101  +# # The problem is that neither the "uuid", nor the "uuidgen"
          102  +# # might be available on the PATH. The creation of the inital value of the
          103  +# # s_0 has been tested on both, Linux and BSD, but not with all shells.
          104  +# s_0=(`which uuidgen 2>/dev/null 1>/dev/null; echo $?`).to_s
          105  +# s_0=s_0.gsub(/[\n\s\r]/,"")
          106  +# s_guid_generation_program_name="#not_yet_set"
          107  +# #--------------
          108  +# func_assert_s_0_format_t1=lambda do |s_in|
          109  +# if (s_in!="0")&&(s_in!="1")
          110  +# s_guid_0="4a232c25-89db-4ec7-b57f-802070e031e7"
          111  +# func_throw_t1.call(s_in,s_guid_0)
          112  +# end # if
          113  +# end # func_assert_s_0_format_t1
          114  +# #--------------
          115  +# func_assert_s_0_format_t1.call(s_0)
          116  +# #--------------
          117  +# if s_0=="0"
          118  +# s_guid_generation_program_name="uuidgen"
          119  +# #----
          120  +# else
          121  +# #----
          122  +# s_0=(`which uuid 2>/dev/null 1>/dev/null; echo $?`).to_s
          123  +# s_0=s_0.gsub(/[\n\s\r]/,"")
          124  +# func_assert_s_0_format_t1.call(s_0)
          125  +# if s_0=="0"
          126  +# s_guid_generation_program_name="uuid"
          127  +# else
          128  +# s_guid_2="35309005-bf20-49ac-b27f-802070e031e7"
          129  +# func_throw_t1.call(s_0,s_guid_2)
          130  +# end # if
          131  +# #-------------
          132  +# end # if
          133  +# #--------------
          134  +# # A test to find out, whether the GUID generation program
          135  +# # on the PATH exits with an error code 0.
          136  +# s_ruby="s_0=(`"+s_guid_generation_program_name+" 2>/dev/null 1>/dev/null; echo $?`).to_s"
          137  +# eval(s_ruby)
          138  +# s_0=s_0.gsub(/[\n\s\r]/,"")
          139  +# func_assert_s_0_format_t1.call(s_0)
          140  +# if s_0!="0"
          141  +# s_guid_3="77ae3663-07ab-4e74-976f-802070e031e7"
          142  +# func_throw_t1.call(s_0,s_guid_3)
          143  +# end # if
          144  +# #--------------
          145  +# s_ruby="s_0=(`"+s_guid_generation_program_name+" 2>/dev/null`).to_s"
          146  +# eval(s_ruby)
          147  +# s_0=s_0.gsub(/[\n\s\r]/,"")
          148  +# s_script_version=s_0
          149  +# #----
          150  +# if s_script_version.length!=36
          151  +# s_guid_4="a24d2e3c-f4d4-49b4-956f-802070e031e7"
          152  +# func_throw_t1.call(s_script_version,s_guid_4)
          153  +# end # if
          154  +# #--------------
          155  +# s="\n"
          156  +# s<<"# The S_SCRIPT_VERSION is in 2 parts to allow \n"
          157  +# s<<"# the error message GUIDs to be updated without \n"
          158  +# s<<"# unsyncing the S_SCRIPT_VERSION from the \n"
          159  +# s<<"# S_SCRIPT_VERSION_GENERATION_DATE.\n"
          160  +# i_0=12
          161  +# s<<"S_SCRIPT_VERSION_SUBPART_1=\""+s_script_version[0..i_0]+"\"\n"
          162  +# s<<"S_SCRIPT_VERSION_SUBPART_2=\""+s_script_version[(i_0+1)..(-1)]+"\"\n"
          163  +# s<<"S_SCRIPT_VERSION=\"$S_SCRIPT_VERSION_SUBPART_1$S_SCRIPT_VERSION_SUBPART_2\""
          164  +# puts(s)
          165  +# #----------------------------------------------------------
          166  +# ob_date=Time.new
          167  +# s=""
          168  +# s<<"\nS_SCRIPT_VERSION_GENERATION_DATE=\""
          169  +# s<<(ob_date.year.to_s+"y_")
          170  +# s<<(ob_date.month.to_s+"month_")
          171  +# s<<(ob_date.day.to_s+"day_")
          172  +# s<<(ob_date.hour.to_s+"h_")
          173  +# s<<(ob_date.min.to_s+"min_")
          174  +# s<<(ob_date.sec.to_s+"sec_")
          175  +# s<<(ob_date.usec.to_s+"usec")
          176  +# s<<"\"\n"
          177  +# puts(s)
          178  +# #----------------------------------------------------------
          179  +# RENESSAATOR_SOURCE_END
          180  +# 
          181  +# RENESSAATOR_AUTOGENERATED_TEXT_START
          182  +
          183  +# The S_SCRIPT_VERSION is in 2 parts to allow 
          184  +# the error message GUIDs to be updated without 
          185  +# unsyncing the S_SCRIPT_VERSION from the 
          186  +# S_SCRIPT_VERSION_GENERATION_DATE.
          187  +S_SCRIPT_VERSION_SUBPART_1="cd56e610-cc52"
          188  +S_SCRIPT_VERSION_SUBPART_2="-4776-b024-9ec382af71d4"
          189  +S_SCRIPT_VERSION="$S_SCRIPT_VERSION_SUBPART_1$S_SCRIPT_VERSION_SUBPART_2"
          190  +
          191  +S_SCRIPT_VERSION_GENERATION_DATE="2017y_3month_14day_7h_2min_4sec_547231usec"
          192  +
          193  +# RENESSAATOR_AUTOGENERATED_TEXT_END
          194  +# RENESSAATOR_BLOCK_END
          195  +
          196  +#--------------------------------------------------------------------------
          197  +
          198  +func_mmmv_exit_if_not_on_path_t2() { # S_COMMAND_NAME
          199  +    local S_COMMAND_NAME=$1
          200  +    local S_LOCAL_VARIABLE="`which $S_COMMAND_NAME 2>/dev/null`"
          201  +    if [ "$S_LOCAL_VARIABLE" == "" ]; then
          202  +        echo ""
          203  +        echo "Command \"$S_COMMAND_NAME\" could not be found from the PATH. "
          204  +        echo "The execution of the Bash script is aborted."
          205  +        echo "GUID=='1ab9ed41-0d69-4aa5-b77f-802070e031e7'"
          206  +        echo ""
          207  +        #----
          208  +        cd $S_FP_ORIG
          209  +        exit 1 # exit with error
          210  +    fi
          211  +} # func_mmmv_exit_if_not_on_path_t2
          212  +
          213  +
          214  +# A list of the console tools that the rest of the 
          215  +# verification functions in this Bash script depend on.
          216  +# The presence of the rest of the console applications
          217  +# are studied by the other verification functions. 
          218  +
          219  +    func_mmmv_exit_if_not_on_path_t2 "grep"
          220  +    func_mmmv_exit_if_not_on_path_t2 "ruby"
          221  +    func_mmmv_exit_if_not_on_path_t2 "uname"
          222  +    func_mmmv_exit_if_not_on_path_t2 "which"
          223  +
          224  +#--------------------------------------------------------------------------
          225  +
          226  +# SB_USE_GAWK_IN_STEAD_OF_AWK="not_set_yet"
          227  +# func_mmmv_silktorrent_init_awk_versus_gawk() { 
          228  +#     local SB_AWK_AND_GAWK_ARE_BOTH_UNUSABLE="f"
          229  +#     #--------
          230  +#     local S_TMP_0="`which gawk 2>/dev/null`"
          231  +#     if [ "$S_TMP_0" == "" ]; then
          232  +#         S_TMP_0="`which awk 2>/dev/null`"
          233  +#         if [ "$S_TMP_0" == "" ]; then
          234  +#             SB_AWK_AND_GAWK_ARE_BOTH_UNUSABLE="t"
          235  +#         else
          236  +#             SB_USE_GAWK_IN_STEAD_OF_AWK="f"
          237  +#         fi
          238  +#     else
          239  +#         SB_USE_GAWK_IN_STEAD_OF_AWK="t"
          240  +#     fi
          241  +#     #--------
          242  +#     if [ "$SB_AWK_AND_GAWK_ARE_BOTH_UNUSABLE" == "t" ]; then
          243  +#         echo ""
          244  +#         echo "Neither \"awk\", nor \"gawk\" is usable,"
          245  +#         echo "but at least one of them is required to be usable."
          246  +#         echo "The execution of the Bash script is aborted."
          247  +#         echo "GUID=='979a642b-6b93-436c-a47f-802070e031e7'"
          248  +#         echo ""
          249  +#         #----
          250  +#         cd $S_FP_ORIG
          251  +#         exit 1 # exit with error
          252  +#     fi
          253  +# } # func_mmmv_silktorrent_init_awk_versus_gawk
          254  +# 
          255  +# func_mmmv_silktorrent_init_awk_versus_gawk
          256  +# 
          257  +# if [ "$SB_USE_GAWK_IN_STEAD_OF_AWK" != "t" ]; then
          258  +#     if [ "$SB_USE_GAWK_IN_STEAD_OF_AWK" != "f" ]; then
          259  +#         echo ""
          260  +#         echo "This script is flawed."
          261  +#         echo ""
          262  +#         echo "    SB_USE_GAWK_IN_STEAD_OF_AWK=$SB_USE_GAWK_IN_STEAD_OF_AWK"
          263  +#         echo ""
          264  +#         echo "GUID=='375e9340-6011-4561-927f-802070e031e7'"
          265  +#         echo ""
          266  +#         #----
          267  +#         cd $S_FP_ORIG
          268  +#         exit 1 # exit with error
          269  +#     fi
          270  +# fi
          271  +
          272  +#--------------------------------------------------------------------------
          273  +
          274  +S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT=""
          275  +func_mmmv_operating_system_type_t1() {
          276  +    if [ "$S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT" == "" ]; then
          277  +        S_TMP_0="`uname -a | grep -E [Ll]inux`"
          278  +        if [ "$S_TMP_0" != "" ]; then
          279  +            S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT="Linux"
          280  +        else
          281  +            S_TMP_0="`uname -a | grep BSD `"
          282  +            if [ "$S_TMP_0" != "" ]; then
          283  +                S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT="BSD"
          284  +            else
          285  +                S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT="undetermined"
          286  +            fi
          287  +        fi
          288  +    fi
          289  +} # func_mmmv_operating_system_type_t1
          290  +
          291  +#--------------------------------------------------------------------------
          292  +
          293  +func_mmmv_operating_system_type_t1
          294  +if [ "$S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT" != "Linux" ]; then
          295  +    if [ "$S_FUNC_MMMV_OPERATING_SYSTEM_TYPE_T1_RESULT" != "BSD" ]; then
          296  +        echo ""
          297  +        echo "  The classical command line utilities at "
          298  +        echo "  different operating systems, for example, Linux and BSD,"
          299  +        echo "  differ. This script is designed to run only on "
          300  +        echo "  Linux and some BSD variants."
          301  +        echo "  If You are willing to risk that some of Your data "
          302  +        echo "  is deleted and/or Your operating system instance"
          303  +        echo "  becomes permanently flawed, to the point that "
          304  +        echo "  it will not even boot, then You may edit the Bash script that "
          305  +        echo "  displays this error message by modifying the test that "
          306  +        echo "  checks for the operating system type."
          307  +        echo ""
          308  +        echo "  If You do decide to edit this Bash script, then "
          309  +        echo "  a recommendation is to test Your modifications "
          310  +        echo "  within a virtual machine or, if virtual machines are not"
          311  +        echo "  an option, as some new operating system user that does not have "
          312  +        echo "  any access to the vital data/files."
          313  +        echo "  GUID=='0e2ad440-7a2b-42a7-a27f-802070e031e7'"
          314  +        echo ""
          315  +        echo "  Aborting script without doing anything."
          316  +        echo ""
          317  +        exit 1 # exit with error
          318  +    fi
          319  +fi
          320  +
          321  +
          322  +#--------------------------------------------------------------------------
          323  +
          324  +
          325  +SB_EXISTS_ON_PATH_T1_RESULT="f"
          326  +func_sb_exists_on_path_t1 () {
          327  +    local S_NAME_OF_THE_EXECUTABLE_1="$1" # first function argument
          328  +    #--------
          329  +    local S_TMP_0="" # declaration
          330  +    local S_TMP_1="" # declaration
          331  +    local S_TMP_2="" # declaration
          332  +    #--------
          333  +    # Function calls like
          334  +    #
          335  +    #     func_sb_exists_on_path_t1 ""
          336  +    #     func_sb_exists_on_path_t1 " "
          337  +    #     func_sb_exists_on_path_t1 "ls ps" # contains a space
          338  +    #
          339  +    # are not allowed.
          340  +    if [ "$S_NAME_OF_THE_EXECUTABLE_1" == "" ] ; then
          341  +        echo ""
          342  +        echo "The Bash function "
          343  +        echo ""
          344  +        echo "    func_sb_exists_on_path_t1 "
          345  +        echo ""
          346  +        echo "is not designed to handle an argument that "
          347  +        echo "equals with an empty string."
          348  +        echo "GUID=='419b1786-df9e-4f50-856f-802070e031e7'"
          349  +        echo ""
          350  +        #----
          351  +        cd $S_FP_ORIG
          352  +        exit 1 # exit with error
          353  +    fi
          354  +    S_TMP_0="`ruby -e \"print('$S_NAME_OF_THE_EXECUTABLE_1'.to_s.gsub(/[\s]+/,''));\" `"
          355  +    if [ "$S_NAME_OF_THE_EXECUTABLE_1" != "$S_TMP_0" ] ; then
          356  +        echo ""
          357  +        echo "The Bash function "
          358  +        echo ""
          359  +        echo "    func_sb_exists_on_path_t1 "
          360  +        echo ""
          361  +        echo "is not designed to handle an argument value that contains "
          362  +        echo "spaces or tabulation characters."
          363  +        echo "The received value in parenthesis:($S_NAME_OF_THE_EXECUTABLE_1)."
          364  +        echo "GUID=='84cd9645-2a1b-4881-a56f-802070e031e7'"
          365  +        echo ""
          366  +        #----
          367  +        cd $S_FP_ORIG
          368  +        exit 1 # exit with error
          369  +    fi
          370  +    #--------
          371  +    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_1 2>/dev/null\`"
          372  +    local S_TMP_2="S_TMP_1=$S_TMP_0"
          373  +    eval ${S_TMP_2}
          374  +    #----
          375  +    if [ "$S_TMP_1" == "" ] ; then
          376  +        SB_EXISTS_ON_PATH_T1_RESULT="f"
          377  +    else
          378  +        SB_EXISTS_ON_PATH_T1_RESULT="t"
          379  +    fi
          380  +} # func_sb_exists_on_path_t1 
          381  +
          382  +
          383  +
          384  +func_assert_exists_on_path_t2 () {
          385  +    local S_NAME_OF_THE_EXECUTABLE_1="$1" # first function argument
          386  +    local S_NAME_OF_THE_EXECUTABLE_2="$2" # optional argument
          387  +    local S_NAME_OF_THE_EXECUTABLE_3="$3" # optional argument
          388  +    local S_NAME_OF_THE_EXECUTABLE_4="$4" # optional argument
          389  +    #--------
          390  +    # Function calls like
          391  +    #
          392  +    #     func_assert_exists_on_path_t2  ""    ""  "ls"
          393  +    #     func_assert_exists_on_path_t2  "ls"  ""  "ps"
          394  +    #
          395  +    # are not allowed by the spec of this function, but it's OK to call
          396  +    #
          397  +    #     func_assert_exists_on_path_t2  "ls" "" 
          398  +    #     func_assert_exists_on_path_t2  "ls" "ps" ""
          399  +    #     func_assert_exists_on_path_t2  "ls" ""   "" ""
          400  +    #
          401  +    #
          402  +    local SB_THROW="f"
          403  +    if [ "$S_NAME_OF_THE_EXECUTABLE_1" == "" ] ; then
          404  +        SB_THROW="t"
          405  +    else
          406  +        if [ "$S_NAME_OF_THE_EXECUTABLE_2" == "" ] ; then
          407  +            if [ "$S_NAME_OF_THE_EXECUTABLE_3" != "" ] ; then
          408  +                SB_THROW="t"
          409  +            fi
          410  +            if [ "$S_NAME_OF_THE_EXECUTABLE_4" != "" ] ; then
          411  +                SB_THROW="t"
          412  +            fi
          413  +        else
          414  +            if [ "$S_NAME_OF_THE_EXECUTABLE_3" == "" ] ; then
          415  +                if [ "$S_NAME_OF_THE_EXECUTABLE_4" != "" ] ; then
          416  +                    SB_THROW="t"
          417  +                fi
          418  +            fi
          419  +        fi
          420  +    fi
          421  +    #----
          422  +    if [ "$SB_THROW" == "t" ] ; then
          423  +        echo ""
          424  +        echo "The Bash function "
          425  +        echo ""
          426  +        echo "    func_assert_exists_on_path_t2 "
          427  +        echo ""
          428  +        echo "is not designed to handle series of arguments, where "
          429  +        echo "empty strings precede non-empty strings."
          430  +        echo "GUID=='1f7ef235-2182-44c7-a26f-802070e031e7'"
          431  +        echo ""
          432  +        #----
          433  +        cd $S_FP_ORIG
          434  +        exit 1 # exit with error
          435  +    fi
          436  +    if [ "$5" != "" ] ; then
          437  +        echo ""
          438  +        echo "This Bash function is designed to work with at most 4 input arguments"
          439  +        echo "GUID=='794ad84b-a08a-424e-816f-802070e031e7'"
          440  +        echo ""
          441  +        #----
          442  +        cd $S_FP_ORIG
          443  +        exit 1 # exit with error
          444  +    fi
          445  +    #--------
          446  +    # Function calls like
          447  +    #
          448  +    #     func_assert_exists_on_path_t2 " "
          449  +    #     func_assert_exists_on_path_t2 "ls ps" # contains a space
          450  +    #
          451  +    # are not allowed.
          452  +    SB_THROW="f" 
          453  +    local S_TMP_0=""
          454  +    local S_TMP_1=""
          455  +    local S_TMP_2=""
          456  +    #----
          457  +    if [ "$SB_THROW" == "f" ] ; then
          458  +        S_TMP_0="`ruby -e \"print('$S_NAME_OF_THE_EXECUTABLE_1'.to_s.gsub(/[\s]+/,''));\" `"
          459  +        if [ "$S_NAME_OF_THE_EXECUTABLE_1" != "$S_TMP_0" ] ; then
          460  +            SB_THROW="t" 
          461  +            S_TMP_1="$S_NAME_OF_THE_EXECUTABLE_1"
          462  +            S_TMP_2="GUID=='13f85894-0f63-4f5d-855f-802070e031e7'"
          463  +        fi
          464  +    fi
          465  +    #----
          466  +    if [ "$SB_THROW" == "f" ] ; then
          467  +        S_TMP_0="`ruby -e \"print('$S_NAME_OF_THE_EXECUTABLE_2'.to_s.gsub(/[\s]+/,''));\" `"
          468  +        if [ "$S_NAME_OF_THE_EXECUTABLE_2" != "$S_TMP_0" ] ; then
          469  +            SB_THROW="t" 
          470  +            S_TMP_1="$S_NAME_OF_THE_EXECUTABLE_2"
          471  +            S_TMP_2="GUID=='58d3e782-de58-4948-955f-802070e031e7'"
          472  +        fi
          473  +    fi
          474  +    #----
          475  +    if [ "$SB_THROW" == "f" ] ; then
          476  +        S_TMP_0="`ruby -e \"print('$S_NAME_OF_THE_EXECUTABLE_3'.to_s.gsub(/[\s]+/,''));\" `"
          477  +        if [ "$S_NAME_OF_THE_EXECUTABLE_3" != "$S_TMP_0" ] ; then
          478  +            SB_THROW="t" 
          479  +            S_TMP_1="$S_NAME_OF_THE_EXECUTABLE_3"
          480  +            S_TMP_2="GUID=='458621df-baae-44b3-845f-802070e031e7'"
          481  +        fi
          482  +    fi
          483  +    #----
          484  +    if [ "$SB_THROW" == "f" ] ; then
          485  +        S_TMP_0="`ruby -e \"print('$S_NAME_OF_THE_EXECUTABLE_4'.to_s.gsub(/[\s]+/,''));\" `"
          486  +        if [ "$S_NAME_OF_THE_EXECUTABLE_4" != "$S_TMP_0" ] ; then
          487  +            SB_THROW="t" 
          488  +            S_TMP_1="$S_NAME_OF_THE_EXECUTABLE_4"
          489  +            S_TMP_2="GUID=='e47b0f21-ca52-4c16-925f-802070e031e7'"
          490  +        fi
          491  +    fi
          492  +    #--------
          493  +    if [ "$SB_THROW" == "t" ] ; then
          494  +        echo ""
          495  +        echo "The Bash function "
          496  +        echo ""
          497  +        echo "    func_assert_exists_on_path_t2 "
          498  +        echo ""
          499  +        echo "is not designed to handle an argument value that contains "
          500  +        echo "spaces or tabulation characters."
          501  +        echo "The unaccepted value in parenthesis:($S_TMP_1)."
          502  +        echo "Branch $S_TMP_2."
          503  +        echo "GUID=='7f763031-0dfe-4ae6-835f-802070e031e7'"
          504  +        echo ""
          505  +        #----
          506  +        cd $S_FP_ORIG
          507  +        exit 1 # exit with error
          508  +    fi
          509  +    SB_THROW="f" # Just a reset, should I forget to reset it later.
          510  +    #---------------
          511  +    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_1 2>/dev/null\`"
          512  +    local S_TMP_1=""
          513  +    local S_TMP_2="S_TMP_1=$S_TMP_0"
          514  +    eval ${S_TMP_2}
          515  +    #----
          516  +    if [ "$S_TMP_1" == "" ] ; then
          517  +        if [ "$S_NAME_OF_THE_EXECUTABLE_2" == "" ] ; then
          518  +        if [ "$S_NAME_OF_THE_EXECUTABLE_3" == "" ] ; then
          519  +        if [ "$S_NAME_OF_THE_EXECUTABLE_4" == "" ] ; then
          520  +            echo ""
          521  +            echo "This bash script requires the \"$S_NAME_OF_THE_EXECUTABLE_1\" to be on the PATH."
          522  +            echo "GUID=='7f2264f1-a416-4f98-834f-802070e031e7'"
          523  +            echo ""
          524  +            #----
          525  +            cd $S_FP_ORIG
          526  +            exit 1 # exit with error
          527  +        fi
          528  +        fi
          529  +        fi
          530  +    else
          531  +        return # at least one of the programs was available at the PATH
          532  +    fi
          533  +    #--------
          534  +    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_2 2>/dev/null\`"
          535  +    S_TMP_1=""
          536  +    S_TMP_2="S_TMP_1=$S_TMP_0"
          537  +    eval ${S_TMP_2}
          538  +    #----
          539  +    if [ "$S_TMP_1" == "" ] ; then
          540  +        if [ "$S_NAME_OF_THE_EXECUTABLE_3" == "" ] ; then
          541  +        if [ "$S_NAME_OF_THE_EXECUTABLE_4" == "" ] ; then
          542  +            echo ""
          543  +            echo "This bash script requires that either \"$S_NAME_OF_THE_EXECUTABLE_1\" or "
          544  +            echo " \"$S_NAME_OF_THE_EXECUTABLE_2\" is available on the PATH."
          545  +            echo "GUID=='7bad5248-aedd-4b92-b24f-802070e031e7'"
          546  +            echo ""
          547  +            #----
          548  +            cd $S_FP_ORIG
          549  +            exit 1 # exit with error
          550  +        fi
          551  +        fi
          552  +    else
          553  +        return # at least one of the programs was available at the PATH
          554  +    fi
          555  +    #--------
          556  +    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_3 2>/dev/null\`"
          557  +    S_TMP_1=""
          558  +    S_TMP_2="S_TMP_1=$S_TMP_0"
          559  +    eval ${S_TMP_2}
          560  +    #----
          561  +    if [ "$S_TMP_1" == "" ] ; then
          562  +        if [ "$S_NAME_OF_THE_EXECUTABLE_4" == "" ] ; then
          563  +            echo ""
          564  +            echo "This bash script requires that either \"$S_NAME_OF_THE_EXECUTABLE_1\" or "
          565  +            echo " \"$S_NAME_OF_THE_EXECUTABLE_2\" or \"$S_NAME_OF_THE_EXECUTABLE_3\" "
          566  +            echo "is available on the PATH."
          567  +            echo "GUID=='52da2cb7-f5d3-4ada-b14f-802070e031e7'"
          568  +            echo ""
          569  +            #----
          570  +            cd $S_FP_ORIG
          571  +            exit 1 # exit with error
          572  +        fi
          573  +    else
          574  +        return # at least one of the programs was available at the PATH
          575  +    fi
          576  +    #--------
          577  +    S_TMP_0="\`which $S_NAME_OF_THE_EXECUTABLE_4 2>/dev/null\`"
          578  +    S_TMP_1=""
          579  +    S_TMP_2="S_TMP_1=$S_TMP_0"
          580  +    eval ${S_TMP_2}
          581  +    #----
          582  +    if [ "$S_TMP_1" == "" ] ; then
          583  +        echo ""
          584  +        echo "This bash script requires that either \"$S_NAME_OF_THE_EXECUTABLE_1\" or "
          585  +        echo " \"$S_NAME_OF_THE_EXECUTABLE_2\" or \"$S_NAME_OF_THE_EXECUTABLE_3\" or "
          586  +        echo " \"$S_NAME_OF_THE_EXECUTABLE_4\" is available on the PATH."
          587  +        echo "GUID=='0f19542b-b29f-48cb-a44f-802070e031e7'"
          588  +        echo ""
          589  +        #----
          590  +        cd $S_FP_ORIG
          591  +        exit 1 # exit with error
          592  +    else
          593  +        return # at least one of the programs was available at the PATH
          594  +    fi
          595  +    #--------
          596  +} # func_assert_exists_on_path_t2
          597  +
          598  +func_assert_exists_on_path_t2 "bash"     # this is a bash script itself, but
          599  +                                         # it might have been executed by 
          600  +                                         # specifying the full path to the bash command,
          601  +                                         # without having the bash available on the PATH.
          602  +
          603  +func_assert_exists_on_path_t2 "basename" # for extracting file names from full paths
          604  +func_assert_exists_on_path_t2 "cat"    # opposite to split
          605  +func_assert_exists_on_path_t2 "sha256sum" "sha256" "rhash"
          606  +func_assert_exists_on_path_t2 "tigerdeep" "rhash"
          607  +func_assert_exists_on_path_t2 "whirlpooldeep" "rhash"
          608  +func_assert_exists_on_path_t2 "tar"
          609  +#--------
          610  +func_assert_exists_on_path_t2 "file"   # for checking the MIME type of the potential tar file
          611  +func_assert_exists_on_path_t2 "filesize" "ruby"
          612  +#--------
          613  +# The following commands have been already checked at the start of this cript.
          614  +#     func_assert_exists_on_path_t2 "gawk" 
          615  +#     func_assert_exists_on_path_t2 "grep"
          616  +#     func_assert_exists_on_path_t2 "uname"  # to check the OS type
          617  +#--------
          618  +#func_assert_exists_on_path_t2 "readlink"
          619  +func_assert_exists_on_path_t2 "ruby"  # anything over/equal v.2.1 will probably do
          620  +#func_assert_exists_on_path_t2 "split" # for cutting files
          621  +#func_assert_exists_on_path_t2 "test"
          622  +func_assert_exists_on_path_t2 "uuidgen" "uuid" # GUID generation on Linux and BSD
          623  +#func_assert_exists_on_path_t2 "xargs"  # not in use yet 
          624  +func_assert_exists_on_path_t2 "wc" # for checking hash lengths   
          625  +
          626  +#--------------------------------------------------------------------------
          627  +
          628  +# If the S_CANDIDATE is a positive whole number, including 0 and 000042, 
          629  +# then it returns the positive whole number in a form, where 
          630  +# the leading zeros have been removed. Otherwise it returns
          631  +# an empty string. 
          632  +#
          633  +#     "00000" ->   "0"
          634  +#    "+00000" ->   "0"
          635  +#    "-00000" ->    ""
          636  +#     "00042" ->  "42"
          637  +#    "+00042" ->  "42"
          638  +#     "00420" -> "420"
          639  +#       "420" -> "420"
          640  +#       "+42" ->  "42"
          641  +#       "-42" ->    ""
          642  +#          "" ->    ""
          643  +#         " " ->    ""
          644  +#       "4.2" ->    ""
          645  +#     "a  bc" ->    ""
          646  +#
          647  +# A more detailed list of the conversion cases are described at the
          648  +# 
          649  +#     func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t2()
          650  +#
          651  +S_FUNC_MMMV_X_POSITIVE_WHOLE_NUMBER_OR_AN_EMPTYSTRING_T1_OUT=""
          652  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1() { # S_CANDIDATE
          653  +    local S_CANDIDATE="$1" # TODO: fix it to handle a case, where the 
          654  +                           #       S_CANDIDATE contains spaces.
          655  +    #--------
          656  +    local S_TMP_0="" # declaration
          657  +    local S_TMP_1="" # declaration
          658  +    S_FUNC_MMMV_X_POSITIVE_WHOLE_NUMBER_OR_AN_EMPTYSTRING_T1_OUT=""
          659  +    local SB_FAILED='f'
          660  +    #--------
          661  +    if [ "$S_CANDIDATE" == "" ]; then
          662  +        SB_FAILED="t"
          663  +    fi
          664  +    #--------
          665  +    if [ "$SB_FAILED" == "f" ]; then
          666  +        # This is a bugfix/workarond that does not have almost anything 
          667  +        # to do with the algorithm itself, but it exists only to cope with 
          668  +        # with the Ruby macro line.
          669  +        # blabla="`ruby -e \"print('$S_CANDIDATE'.to_s. blabla
          670  +        S_TMP_0="`echo \"$S_CANDIDATE\" | ruby -e \"x=readline; print(x.to_s.gsub(/[\\\"\'\\s]+/,''));\" `"
          671  +        if [ "$S_TMP_0" != "$S_CANDIDATE" ]; then
          672  +            SB_FAILED="t"
          673  +        fi 
          674  +    fi
          675  +    #--------
          676  +    if [ "$SB_FAILED" == "f" ]; then
          677  +        # TODO: The next line is the funny one that does not make sense, but it documents the situation.
          678  +        S_TMP_0="`ruby -e \"print('$S_CANDIDATE'.to_s.gsub(/[\s]+/,''));\" `"
          679  +        if [ "$S_TMP_0" != "$S_CANDIDATE" ]; then
          680  +            SB_FAILED="t"
          681  +        fi 
          682  +    fi
          683  +    #--------
          684  +    if [ "$SB_FAILED" == "f" ]; then
          685  +        # Covers cases like "+","++42","++++++42","-42","4ab2","4,2","4.2","42.","42-","42+","4+2"
          686  +        S_TMP_0="`ruby -e \"print('$S_CANDIDATE'.to_s.gsub(/^[+]/,''));\" `"
          687  +        # At the previous line: "+" -> ""
          688  +        if [ "$S_TMP_0" == "" ]; then  
          689  +            # "$S_CANDIDATE" == "+"
          690  +            SB_FAILED="t"
          691  +        else
          692  +            S_TMP_1="`ruby -e \"print('$S_TMP_0'.to_s.gsub(/[\d]+/,''));\" `"
          693  +            if [ "$S_TMP_1" != "" ]; then
          694  +                SB_FAILED="t"
          695  +            fi 
          696  +        fi 
          697  +    fi
          698  +    #--------
          699  +    if [ "$SB_FAILED" == "f" ]; then
          700  +        # At this line the S_CANDIDATE is valid, but it may  have 
          701  +        # the following forms: 
          702  +        #
          703  +        #     "0","+0","+0000","+0042","+420","0000","42","0042"
          704  +        #
          705  +        # At this line the S_TMP_0 
          706  +        #
          707  +        #     "$S_CANDIDATE" -> "$S_TMP_0"
          708  +        #
          709  +        #           "+00042" -> "00042"
          710  +        #               "+0" ->     "0"
          711  +        #
          712  +        # at one of the previous if-blocks.
          713  +        S_TMP_1="`ruby -e \"print('$S_TMP_0'.to_s.gsub(/^[0]+/,''));\" `"
          714  +        if [ "$S_TMP_1" == "" ]; then
          715  +            S_FUNC_MMMV_X_POSITIVE_WHOLE_NUMBER_OR_AN_EMPTYSTRING_T1_OUT="0"
          716  +        else
          717  +            S_FUNC_MMMV_X_POSITIVE_WHOLE_NUMBER_OR_AN_EMPTYSTRING_T1_OUT="$S_TMP_1"
          718  +        fi 
          719  +    fi
          720  +} # func_mmmv_x_positive_whole_number_or_an_emptystring_t1
          721  +
          722  +
          723  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1() { # S_IN S_EXPECTED
          724  +    local S_IN="$1"
          725  +    local S_EXPECTED="$2"
          726  +    #--------
          727  +    func_mmmv_x_positive_whole_number_or_an_emptystring_t1 "$S_IN"
          728  +    local S_FUNC="$S_FUNC_MMMV_X_POSITIVE_WHOLE_NUMBER_OR_AN_EMPTYSTRING_T1_OUT"
          729  +    if [ "$S_FUNC" != "$S_EXPECTED" ]; then
          730  +        echo ""
          731  +        echo "A test of the func_mmmv_x_positive_whole_number_or_an_emptystring_t1 failed."
          732  +        echo ""
          733  +        echo "    S_IN=$S_IN"
          734  +        echo ""
          735  +        echo "    S_FUNC=$S_FUNC"
          736  +        echo ""
          737  +        echo "    S_EXPECTED=$S_EXPECTED"
          738  +        echo ""
          739  +        #----
          740  +        cd $S_FP_ORIG
          741  +        exit 1 # exit with error
          742  +    fi
          743  +} # func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1
          744  +
          745  +
          746  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t2() { 
          747  +#----------------------------------------
          748  +# RENESSAATOR_BLOCK_START
          749  +# RENESSAATOR_BLOCK_ID=block_0452757a-2b6f-4275-bc52-6320305021e7_city
          750  +# RENESSAATOR_SOURCE_LANGUAGE=Ruby
          751  +# RENESSAATOR_SOURCE_START
          752  +# #---------------------------
          753  +# ar=Array.new  # elements are arrays: [s_in, s_expected]
          754  +# ar<<["00000","0"]
          755  +# ar<<["+0000.0",""]
          756  +# ar<<["+00000","0"]
          757  +# ar<<["+0","0"]
          758  +# ar<<["0","0"]
          759  +# ar<<["0+",""]
          760  +# ar<<["+0000,0",""]
          761  +# ar<<["-00000",""]
          762  +# ar<<["-0000,0",""]
          763  +# ar<<["-0000.0",""]
          764  +# ar<<["-00000-",""]
          765  +# ar<<["00000-",""]
          766  +# ar<<["00000 ",""]
          767  +# ar<<[" 00000",""]
          768  +# ar<<["--00000",""]
          769  +# ar<<["++00000",""]
          770  +# ar<<["000-00",""]
          771  +# ar<<["-0",""]
          772  +# ar<<["0-",""]
          773  +# ar<<["0000-",""]
          774  +# ar<<["+0000-",""]
          775  +# ar<<["-0000-",""]
          776  +# ar<<["-0000+",""]
          777  +# ar<<["0000+",""]
          778  +# ar<<["000+00",""]
          779  +# ar<<["00042","42"]
          780  +# ar<<["+00042","42"]
          781  +# ar<<["00420","420"]
          782  +# ar<<["+00420","420"]
          783  +# ar<<["00420+",""]
          784  +# ar<<["004+20",""]
          785  +# ar<<["420","420"]
          786  +# ar<<["+420","420"]
          787  +# ar<<["420+",""]
          788  +# ar<<["1","1"]
          789  +# ar<<["-1",""]
          790  +# ar<<["1-",""]
          791  +# ar<<["+1","1"]
          792  +# ar<<["9","9"]
          793  +# ar<<["+9","9"]
          794  +# ar<<["9000","9000"]
          795  +# ar<<["09000","9000"]
          796  +# ar<<["+09000","9000"]
          797  +# ar<<["++09000",""]
          798  +# ar<<["09000+",""]
          799  +# ar<<["09000-",""]
          800  +# ar<<["09000--",""]
          801  +# ar<<["-9",""]
          802  +# ar<<["++9",""]
          803  +# ar<<["9+",""]
          804  +# ar<<["9++",""]
          805  +# ar<<["9+-",""]
          806  +# ar<<["+-9",""]
          807  +# ar<<["42","42"]
          808  +# ar<<["+42","42"]
          809  +# ar<<["++42",""]
          810  +# ar<<["+42 ",""]
          811  +# ar<<["+4 2",""]
          812  +# ar<<[" +4 2",""]
          813  +# ar<<[" +42",""]
          814  +# ar<<["-42",""]
          815  +# ar<<[" -42",""]
          816  +# ar<<[" -42 ",""]
          817  +# ar<<["--42",""]
          818  +# ar<<["----42",""]
          819  +# ar<<["+42---",""]
          820  +# ar<<["-4-2",""]
          821  +# ar<<["-4-2-",""]
          822  +# ar<<["4-2-",""]
          823  +# ar<<["42-",""]
          824  +# ar<<["42---",""]
          825  +# ar<<["+4+2",""]
          826  +# ar<<["4+2",""]
          827  +# ar<<["42+",""]
          828  +# ar<<["42+++",""]
          829  +# ar<<["+42+",""]
          830  +# ar<<["4.2",""]
          831  +# ar<<["4,2",""]
          832  +# ar<<["4 2",""]
          833  +# ar<<["4 +2",""]
          834  +# ar<<["4 2+",""]
          835  +# ar<<["42 ",""]
          836  +# ar<<["42.",""]
          837  +# ar<<["42,",""]
          838  +# ar<<["a  bc",""]
          839  +# ar<<["",""]
          840  +# ar<<["+",""]
          841  +# ar<<["++",""]
          842  +# ar<<["+++",""]
          843  +# ar<<["-",""]
          844  +# ar<<["--",""]
          845  +# ar<<["---",""]
          846  +# ar<<["-+",""]
          847  +# ar<<["+-",""]
          848  +# ar<<["+---",""]
          849  +# ar<<["\\\"",""]
          850  +# ar<<["'",""]
          851  +# ar<<["'42",""]
          852  +# ar<<["42'",""]
          853  +# ar<<[" ",""]
          854  +# ar<<["   ",""]
          855  +# #---------------------------
          856  +# ht=Hash.new
          857  +# ar.each do |ar_0|
          858  +# x_0=ar_0[0]
          859  +# if ht.has_key? x_0
          860  +# raise Exception.new("\nDuplicate:["+x_0.to_s+"]\n")
          861  +# else
          862  +# ht[x_0]=42
          863  +# end # if
          864  +# end # loop
          865  +# #--------
          866  +# s_test_func_name="func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1"
          867  +# s_lc_0=s_test_func_name+"  \""
          868  +# s_lc_1="\"  \""
          869  +# s_lc_2="\""
          870  +# func_write_test=lambda do |s_in,s_expected|
          871  +# puts(s_lc_0+s_in+s_lc_1+s_expected+s_lc_2+"\n")
          872  +# end # func_write_test
          873  +# ar.each{|ar_0| func_write_test.call(ar_0[0],ar_0[1])}
          874  +# RENESSAATOR_SOURCE_END
          875  +# 
          876  +# RENESSAATOR_AUTOGENERATED_TEXT_START
          877  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "00000"  "0"
          878  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+0000.0"  ""
          879  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+00000"  "0"
          880  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+0"  "0"
          881  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "0"  "0"
          882  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "0+"  ""
          883  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+0000,0"  ""
          884  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "-00000"  ""
          885  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "-0000,0"  ""
          886  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "-0000.0"  ""
          887  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "-00000-"  ""
          888  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "00000-"  ""
          889  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "00000 "  ""
          890  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  " 00000"  ""
          891  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "--00000"  ""
          892  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "++00000"  ""
          893  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "000-00"  ""
          894  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "-0"  ""
          895  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "0-"  ""
          896  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "0000-"  ""
          897  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+0000-"  ""
          898  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "-0000-"  ""
          899  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "-0000+"  ""
          900  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "0000+"  ""
          901  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "000+00"  ""
          902  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "00042"  "42"
          903  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+00042"  "42"
          904  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "00420"  "420"
          905  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+00420"  "420"
          906  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "00420+"  ""
          907  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "004+20"  ""
          908  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "420"  "420"
          909  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+420"  "420"
          910  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "420+"  ""
          911  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "1"  "1"
          912  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "-1"  ""
          913  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "1-"  ""
          914  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+1"  "1"
          915  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "9"  "9"
          916  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+9"  "9"
          917  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "9000"  "9000"
          918  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "09000"  "9000"
          919  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+09000"  "9000"
          920  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "++09000"  ""
          921  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "09000+"  ""
          922  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "09000-"  ""
          923  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "09000--"  ""
          924  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "-9"  ""
          925  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "++9"  ""
          926  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "9+"  ""
          927  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "9++"  ""
          928  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "9+-"  ""
          929  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+-9"  ""
          930  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "42"  "42"
          931  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+42"  "42"
          932  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "++42"  ""
          933  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+42 "  ""
          934  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+4 2"  ""
          935  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  " +4 2"  ""
          936  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  " +42"  ""
          937  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "-42"  ""
          938  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  " -42"  ""
          939  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  " -42 "  ""
          940  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "--42"  ""
          941  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "----42"  ""
          942  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+42---"  ""
          943  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "-4-2"  ""
          944  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "-4-2-"  ""
          945  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "4-2-"  ""
          946  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "42-"  ""
          947  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "42---"  ""
          948  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+4+2"  ""
          949  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "4+2"  ""
          950  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "42+"  ""
          951  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "42+++"  ""
          952  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+42+"  ""
          953  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "4.2"  ""
          954  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "4,2"  ""
          955  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "4 2"  ""
          956  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "4 +2"  ""
          957  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "4 2+"  ""
          958  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "42 "  ""
          959  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "42."  ""
          960  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "42,"  ""
          961  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "a  bc"  ""
          962  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  ""  ""
          963  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+"  ""
          964  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "++"  ""
          965  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+++"  ""
          966  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "-"  ""
          967  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "--"  ""
          968  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "---"  ""
          969  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "-+"  ""
          970  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+-"  ""
          971  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "+---"  ""
          972  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "\""  ""
          973  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "'"  ""
          974  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "'42"  ""
          975  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "42'"  ""
          976  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  " "  ""
          977  +func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t1  "   "  ""
          978  +
          979  +# RENESSAATOR_AUTOGENERATED_TEXT_END
          980  +# RENESSAATOR_BLOCK_END
          981  +#----------------------------------------
          982  +} # func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t2
          983  +
          984  +# func_mmmv_x_positive_whole_number_or_an_emptystring_t1_tester_t2
          985  +# exit 1 # exit with an error, because the test code should be outcommented.
          986  +
          987  +#--------------------------------------------------------------------------
          988  +
          989  +# Throws, if the argument is present.
          990  +func_mmmv_assert_arg_is_absent_t1() {
          991  +    local S_ARG_X="$1" 
          992  +    local S_ARG_X_NAME="$2" 
          993  +    local S_GUID="$3" 
          994  +    #--------
          995  +    if [ "$S_GUID" == "" ] ; then
          996  +        echo ""
          997  +        echo "The implementation of the function that "
          998  +        echo "calls the "
          999  +        echo ""
         1000  +        echo "    func_mmmv_assert_arg_is_absent_t1"
         1001  +        echo ""
         1002  +        echo "is flawed. The call to the "
         1003  +        echo ""
         1004  +        echo "    func_mmmv_assert_arg_is_absent_t1"
         1005  +        echo ""
         1006  +        echo "misses the third function argument, "
         1007  +        echo "which is expected to be a GUID."
         1008  +        echo "GUID=='34b848b2-0751-425d-bf4f-802070e031e7'"
         1009  +        echo ""
         1010  +        #----
         1011  +        cd $S_FP_ORIG
         1012  +        exit 1 # exit with error
         1013  +    fi
         1014  +    if [ "$S_ARG_X_NAME" == "" ] ; then
         1015  +        echo ""
         1016  +        echo "The implementation of the function that "
         1017  +        echo "calls the "
         1018  +        echo ""
         1019  +        echo "    func_mmmv_assert_arg_is_absent_t1"
         1020  +        echo ""
         1021  +        echo "is flawed. The call to the "
         1022  +        echo ""
         1023  +        echo "    func_mmmv_assert_arg_is_absent_t1"
         1024  +        echo ""
         1025  +        echo "misses the second function argument."
         1026  +        echo "GUID=='53caac5b-c560-4e59-844f-802070e031e7'"
         1027  +        echo "GUID=='$S_GUID'"
         1028  +        echo ""
         1029  +        #----
         1030  +        cd $S_FP_ORIG
         1031  +        exit 1 # exit with error
         1032  +    fi
         1033  +    #--------
         1034  +    if [ "$S_ARG_X" != "" ] ; then
         1035  +        echo ""
         1036  +        echo "If the first console argument is \"$S_ARGV_0\", then "
         1037  +        echo "the $S_ARG_X_NAME is required to be absent, "
         1038  +        echo "but currently "
         1039  +        echo ""
         1040  +        echo "    <$S_ARG_X_NAME>=$S_ARG_X"
         1041  +        echo ""
         1042  +        echo "GUID=='3fba6917-df0d-4112-b14f-802070e031e7'"
         1043  +        echo "GUID=='$S_GUID'"
         1044  +        echo ""
         1045  +        #----
         1046  +        cd $S_FP_ORIG
         1047  +        exit 1 # exit with error
         1048  +    fi
         1049  +} # func_mmmv_assert_arg_is_absent_t1
         1050  +
         1051  +
         1052  +#--------------------------------------------------------------------------
         1053  +
         1054  +func_mmmv_exc_hash_function_input_verification_t1() { 
         1055  +    local S_NAME_OF_THE_BASH_FUNCTION="$1" # The name of the Bash function.
         1056  +    local S_FP_2_AN_EXISTING_FILE="$2" # The first argument of the Bash function.
         1057  +    #--------
         1058  +    local S_TMP_0="" # declaration
         1059  +    local S_TMP_1="" # declaration
         1060  +    #--------
         1061  +    if [ "$S_NAME_OF_THE_BASH_FUNCTION" == "" ] ; then
         1062  +        echo ""
         1063  +        echo "The implementation of the function that "
         1064  +        echo "calls the "
         1065  +        echo ""
         1066  +        echo "    func_mmmv_exc_hash_function_input_verification_t1"
         1067  +        echo ""
         1068  +        echo "is flawed. The call to the "
         1069  +        echo ""
         1070  +        echo "    func_mmmv_exc_hash_function_input_verification_t1"
         1071  +        echo ""
         1072  +        echo "misses the first argument or the first argument is an empty string."
         1073  +        echo "GUID=='bc69232e-5669-4d65-a34f-802070e031e7'"
         1074  +        echo ""
         1075  +        #----
         1076  +        cd $S_FP_ORIG
         1077  +        exit 1 # exit with error
         1078  +    fi
         1079  +    S_TMP_0="`ruby -e \"print('$S_NAME_OF_THE_BASH_FUNCTION'.to_s.gsub(/[\s]+/,''));\" `"
         1080  +    if [ "$S_NAME_OF_THE_BASH_FUNCTION" != "$S_TMP_0" ] ; then
         1081  +        echo ""
         1082  +        echo "The implementation of the function that "
         1083  +        echo "calls the "
         1084  +        echo ""
         1085  +        echo "    func_mmmv_exc_hash_function_input_verification_t1"
         1086  +        echo ""
         1087  +        echo "is flawed. Function names are not allowed to contain spaces or tabs."
         1088  +        echo "GUID=='8b227e42-7961-4605-a34f-802070e031e7'"
         1089  +        echo ""
         1090  +        #----
         1091  +        cd $S_FP_ORIG
         1092  +        exit 1 # exit with error
         1093  +    fi
         1094  +    #--------
         1095  +    # Function calls like
         1096  +    #
         1097  +    #     <function name> ""
         1098  +    #     <function name> " "
         1099  +    #
         1100  +    # are not allowed.
         1101  +    S_TMP_0="`ruby -e \"print('$S_FP_2_AN_EXISTING_FILE'.to_s.gsub(/[\s]+/,''));\" `"
         1102  +    if [ "$S_TMP_0" == "" ] ; then
         1103  +        echo ""
         1104  +        echo "The Bash function "
         1105  +        echo ""
         1106  +        echo "    $S_NAME_OF_THE_BASH_FUNCTION"
         1107  +        echo ""
         1108  +        echo "is not designed to handle an argument that "
         1109  +        echo "equals with an empty string or a series of spaces and tabs."
         1110  +        echo "GUID=='006fc725-72b5-4cfb-833f-802070e031e7'"
         1111  +        echo ""
         1112  +        #----
         1113  +        cd $S_FP_ORIG
         1114  +        exit 1 # exit with error
         1115  +    fi
         1116  +    #--------
         1117  +    if [ ! -e $S_FP_2_AN_EXISTING_FILE ] ; then
         1118  +        echo ""
         1119  +        echo "The file "
         1120  +        echo ""
         1121  +        echo "    $S_FP_2_AN_EXISTING_FILE "
         1122  +        echo ""
         1123  +        echo "is missing or it is a broken link."
         1124  +        echo "GUID=='a2497139-9757-4665-b23f-802070e031e7'"
         1125  +        echo ""
         1126  +        #----
         1127  +        cd $S_FP_ORIG
         1128  +        exit 1 # exit with error
         1129  +    fi
         1130  +    if [ -d $S_FP_2_AN_EXISTING_FILE ] ; then
         1131  +        echo ""
         1132  +        echo "The file path "
         1133  +        echo ""
         1134  +        echo "    $S_FP_2_AN_EXISTING_FILE "
         1135  +        echo ""
         1136  +        echo "references a folder, but a file is expected."
         1137  +        echo "GUID=='eeb1bb35-bb83-49f9-823f-802070e031e7'"
         1138  +        echo ""
         1139  +        #----
         1140  +        cd $S_FP_ORIG
         1141  +        exit 1 # exit with error
         1142  +    fi
         1143  +    #--------------------
         1144  +    # At this line the verifications have all passed.
         1145  +    #--------------------
         1146  +} # func_mmmv_exc_hash_function_input_verification_t1
         1147  +
         1148  +
         1149  +#--------------------------------------------------------------------------
         1150  +
         1151  +S_FUNC_MMMV_GUID_T1_RESULT="not_yet_set"
         1152  +S_FUNC_MMMV_GUID_T1_MODE="" # optim. to skip repeating console tool selection
         1153  +func_mmmv_GUID_t1() { 
         1154  +    # Does not take any arguments.
         1155  +    #--------
         1156  +    #func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_GUID_t1" "$1"
         1157  +    #--------------------
         1158  +    # Mode selection:
         1159  +    if [ "$S_FUNC_MMMV_GUID_T1_MODE" == "" ] ; then
         1160  +        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
         1161  +        #----
         1162  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         1163  +            S_TMP_0="uuidgen" # Linux version
         1164  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
         1165  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
         1166  +                 S_FUNC_MMMV_GUID_T1_MODE="$S_TMP_0"
         1167  +            fi
         1168  +        fi
         1169  +        #----
         1170  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         1171  +            S_TMP_0="uuid"    # BSD version
         1172  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
         1173  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
         1174  +                 S_FUNC_MMMV_GUID_T1_MODE="$S_TMP_0"
         1175  +            fi
         1176  +        fi
         1177  +        #--------
         1178  +        if [ "$S_FUNC_MMMV_GUID_T1_MODE" == "" ] ; then
         1179  +            echo ""
         1180  +            echo "All of the GUID generation implementations that this script " 
         1181  +            echo "is capable of using (uuidgen, uuid) "
         1182  +            echo "are missing from the PATH."
         1183  +            echo "GUID=='206f4814-201e-4a2f-b33f-802070e031e7'"
         1184  +            echo ""
         1185  +            #----
         1186  +            cd $S_FP_ORIG
         1187  +            exit 1 # exit with error
         1188  +        fi
         1189  +        #--------
         1190  +        if [ "$?" != "0" ]; then
         1191  +            echo ""
         1192  +            echo "This script is flawed."
         1193  +            echo "GUID=='bb150913-c9b9-499d-843f-802070e031e7'"
         1194  +            echo ""
         1195  +            #----
         1196  +            cd $S_FP_ORIG
         1197  +            exit 1 # exit with error
         1198  +        fi
         1199  +        #--------
         1200  +    fi
         1201  +    #--------------------
         1202  +    S_FUNC_MMMV_GUID_T1_RESULT=""
         1203  +    #--------------------
         1204  +    if [ "$S_FUNC_MMMV_GUID_T1_MODE" == "uuidgen" ]; then
         1205  +        S_TMP_0="`uuidgen`"
         1206  +        if [ "$?" != "0" ]; then
         1207  +            echo ""
         1208  +            echo "The console application \"uuidgen\" "
         1209  +            echo "exited with an error."
         1210  +            echo ""
         1211  +            echo "----console--output--citation--start-----"
         1212  +            echo "`uuidgen`" # stdout and stderr
         1213  +            echo "----console--output--citation--end-------"
         1214  +            echo ""
         1215  +            echo "GUID=='eda70544-4dbf-4cb7-a13f-802070e031e7'"
         1216  +            echo ""
         1217  +            #----
         1218  +            cd $S_FP_ORIG
         1219  +            exit 1 # exit with error
         1220  +        fi
         1221  +        #---- 
         1222  +        S_FUNC_MMMV_GUID_T1_RESULT="$S_TMP_0"
         1223  +    fi
         1224  +    #--------------------
         1225  +    if [ "$S_FUNC_MMMV_GUID_T1_MODE" == "uuid" ]; then
         1226  +        S_TMP_0="`uuid`"
         1227  +        if [ "$?" != "0" ]; then
         1228  +            echo ""
         1229  +            echo "The console application \"uuid\" "
         1230  +            echo "exited with an error."
         1231  +            echo ""
         1232  +            echo "----console--output--citation--start-----"
         1233  +            echo "`uuid`" # stdout and stderr
         1234  +            echo "----console--output--citation--end-------"
         1235  +            echo ""
         1236  +            echo "GUID=='e209473a-96ba-41df-b23f-802070e031e7'"
         1237  +            echo ""
         1238  +            #----
         1239  +            cd $S_FP_ORIG
         1240  +            exit 1 # exit with error
         1241  +        fi
         1242  +        #---- 
         1243  +        S_FUNC_MMMV_GUID_T1_RESULT="$S_TMP_0"
         1244  +    fi
         1245  +    #--------------------
         1246  +    # The reason, why everything is done with ruby at the next 
         1247  +    # Bash assignment clause is that the "wc -m" pads its output
         1248  +    # with spaces on BSD.
         1249  +    S_TMP_0="`ruby -e \"print(ARGV[0].to_s.length.to_s);\" $S_FUNC_MMMV_GUID_T1_RESULT `"
         1250  +    #--------
         1251  +    S_TMP_1="36"
         1252  +    if [ "$S_TMP_0" != "$S_TMP_1" ]; then
         1253  +        echo ""
         1254  +        echo "According to the GUID specification, IETF RFC 4122,  "
         1255  +        echo "the length of the GUID is "
         1256  +        echo "$S_TMP_1 characters, but the result of the "
         1257  +        echo ""
         1258  +        echo "    func_mmmv_GUID_t1"
         1259  +        echo ""
         1260  +        echo "is something else. The flawed GUID candidate in parenthesis:"
         1261  +        echo "($S_FUNC_MMMV_GUID_T1_RESULT)"
         1262  +        echo ""
         1263  +        echo "The length candidate of the flawed GUID candidate in parenthesis:"
         1264  +        echo "($S_TMP_0)."
         1265  +        echo ""
         1266  +        echo "GUID=='a37e5410-207d-4349-953f-802070e031e7'"
         1267  +        echo ""
         1268  +        #----
         1269  +        cd $S_FP_ORIG
         1270  +        exit 1 # exit with error
         1271  +    fi
         1272  +    #--------------------
         1273  +} # func_mmmv_GUID_t1
         1274  +
         1275  +
         1276  +#--------------------------------------------------------------------------
         1277  +
         1278  +S_FUNC_MMMV_SHA256_T1_RESULT="not_yet_set"
         1279  +S_FUNC_MMMV_SHA256_T1_MODE="" # optim. to skip repeating console tool selection
         1280  +func_mmmv_sha256_t1() { # requires also ruby and gawk 
         1281  +    local S_FP_2_AN_EXISTING_FILE="$1" # first function argument
         1282  +    #--------
         1283  +    func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_sha256_t1" "$1"
         1284  +    #--------------------
         1285  +    # Mode selection:
         1286  +    if [ "$S_FUNC_MMMV_SHA256_T1_MODE" == "" ] ; then
         1287  +        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
         1288  +        #----
         1289  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         1290  +            S_TMP_0="sha256sum" # usually available on Linux
         1291  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
         1292  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
         1293  +                 S_FUNC_MMMV_SHA256_T1_MODE="$S_TMP_0"
         1294  +            fi
         1295  +        fi
         1296  +        #----
         1297  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         1298  +            S_TMP_0="rhash"    # part of the BSD package collection in 2016
         1299  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
         1300  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
         1301  +                 S_FUNC_MMMV_SHA256_T1_MODE="$S_TMP_0"
         1302  +            fi
         1303  +        fi
         1304  +        #----
         1305  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         1306  +            S_TMP_0="sha256"    # usually available on BSD
         1307  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
         1308  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
         1309  +                 S_FUNC_MMMV_SHA256_T1_MODE="$S_TMP_0"
         1310  +            fi
         1311  +        fi
         1312  +        # The console application "rhash" is preferred to the "sha256"
         1313  +        # because the "rhash" output can be simply processed with 
         1314  +        # "gawk", which takes over 5x less memory than the Ruby interpreter,
         1315  +        # not to mention the initialization cost of the Ruby interpreter.
         1316  +        #--------
         1317  +        if [ "$S_FUNC_MMMV_SHA256_T1_MODE" == "" ] ; then
         1318  +            echo ""
         1319  +            echo "All of the SHA-256 implementations that this script " 
         1320  +            echo "is capable of using (sha256sum, rhash, sha256) "
         1321  +            echo "are missing from the PATH."
         1322  +            echo "GUID=='d0bda5b5-afe3-4d98-a33f-802070e031e7'"
         1323  +            echo ""
         1324  +            #----
         1325  +            cd $S_FP_ORIG
         1326  +            exit 1 # exit with error
         1327  +        fi
         1328  +        #--------
         1329  +        if [ "$?" != "0" ]; then
         1330  +            echo ""
         1331  +            echo "This script is flawed."
         1332  +            echo "GUID=='8dbe0d5b-49d9-4ff1-912f-802070e031e7'"
         1333  +            echo ""
         1334  +            #----
         1335  +            cd $S_FP_ORIG
         1336  +            exit 1 # exit with error
         1337  +        fi
         1338  +        #--------
         1339  +    fi
         1340  +    #--------------------
         1341  +    S_FUNC_MMMV_SHA256_T1_RESULT=""
         1342  +    #--------------------
         1343  +    if [ "$S_FUNC_MMMV_SHA256_T1_MODE" == "sha256sum" ]; then
         1344  +        S_TMP_0="`sha256sum $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
         1345  +        if [ "$?" != "0" ]; then
         1346  +            echo ""
         1347  +            echo "The console application \"sha256sum\" "
         1348  +            echo "exited with an error."
         1349  +            echo ""
         1350  +            echo "----console--output--citation--start-----"
         1351  +            echo "`sha256sum $S_FP_2_AN_EXISTING_FILE`" # stdout and stderr
         1352  +            echo "----console--output--citation--end-------"
         1353  +            echo ""
         1354  +            echo "GUID=='beca8510-daa3-4e5d-952f-802070e031e7'"
         1355  +            echo ""
         1356  +            #----
         1357  +            cd $S_FP_ORIG
         1358  +            exit 1 # exit with error
         1359  +        fi
         1360  +        S_FUNC_MMMV_SHA256_T1_RESULT="`ruby -e \"print(ARGV[0]);\" $S_TMP_0 `"
         1361  +    fi
         1362  +    #--------------------
         1363  +    if [ "$S_FUNC_MMMV_SHA256_T1_MODE" == "rhash" ]; then
         1364  +        S_TMP_0="`rhash --sha256 $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
         1365  +        if [ "$?" != "0" ]; then
         1366  +            echo ""
         1367  +            echo "The console application \"rhash\" "
         1368  +            echo "exited with an error."
         1369  +            echo ""
         1370  +            echo "----console--output--citation--start-----"
         1371  +            echo "`rhash --sha256 $S_FP_2_AN_EXISTING_FILE `"
         1372  +            echo "----console--output--citation--end-------"
         1373  +            echo ""
         1374  +            echo "GUID=='ab91f85a-ec98-4500-852f-802070e031e7'"
         1375  +            echo ""
         1376  +            #----
         1377  +            cd $S_FP_ORIG
         1378  +            exit 1 # exit with error
         1379  +        fi
         1380  +        S_FUNC_MMMV_SHA256_T1_RESULT="`ruby -e \"print(ARGV[0]);\" $S_TMP_0 `"
         1381  +    fi
         1382  +    #--------------------
         1383  +    if [ "$S_FUNC_MMMV_SHA256_T1_MODE" == "sha256" ]; then
         1384  +        #----
         1385  +        S_FUNC_MMMV_SHA256_T1_RESULT=\
         1386  +        "`S_TMP_0=\"\`sha256 $S_FP_2_AN_EXISTING_FILE\`\" ruby -e \"s0=ENV['S_TMP_0'].to_s;ix_0=s0.index(') = ');print s0[(ix_0+4)..(-1)]\" 2>/dev/null`"
         1387  +        #----
         1388  +        if [ "$?" != "0" ]; then
         1389  +            echo ""
         1390  +            echo "The console application \"sha256\" "
         1391  +            echo "exited with an error."
         1392  +            echo ""
         1393  +            echo "----console--output--citation--start-----"
         1394  +            echo \
         1395  +            "`S_TMP_0=\"\`sha256 $S_FP_2_AN_EXISTING_FILE\`\" ruby -e \"s0=ENV['S_TMP_0'].to_s;ix_0=s0.index(') = ');print s0[(ix_0+4)..(-1)]\"`"
         1396  +            echo "----console--output--citation--end-------"
         1397  +            echo ""
         1398  +            echo "GUID=='f962bf2d-cc00-49b0-922f-802070e031e7'"
         1399  +            echo ""
         1400  +            #----
         1401  +            cd $S_FP_ORIG
         1402  +            exit 1 # exit with error
         1403  +        fi
         1404  +    fi
         1405  +    #--------------------
         1406  +    # The reason, why everything is done with ruby at the next 
         1407  +    # Bash assignment clause is that the "wc -m" pads its output
         1408  +    # with spaces on BSD.
         1409  +    S_TMP_0="`ruby -e \"print(ARGV[0].to_s.length.to_s);\" $S_FUNC_MMMV_SHA256_T1_RESULT `"
         1410  +    #--------
         1411  +    S_TMP_1="64"
         1412  +    if [ "$S_TMP_0" != "$S_TMP_1" ]; then
         1413  +        echo ""
         1414  +        echo "According to the specification of the SHA-256 hash algorithm"
         1415  +        echo "the length of the SHA-256 hash is "
         1416  +        echo "$S_TMP_1 hexadecimal characters, but the result of the "
         1417  +        echo ""
         1418  +        echo "    func_mmmv_sha256_t1"
         1419  +        echo ""
         1420  +        echo "is something else. The flawed hash candidate in parenthesis:"
         1421  +        echo "($S_FUNC_MMMV_SHA256_T1_RESULT)"
         1422  +        echo ""
         1423  +        echo "The length candidate of the flawed hash candidate in parenthesis:"
         1424  +        echo "($S_TMP_0)."
         1425  +        echo ""
         1426  +        echo "GUID=='43a74951-a648-48c6-8d2f-802070e031e7'"
         1427  +        echo ""
         1428  +        #----
         1429  +        cd $S_FP_ORIG
         1430  +        exit 1 # exit with error
         1431  +    fi
         1432  +    #--------------------
         1433  +} # func_mmmv_sha256_t1
         1434  +
         1435  +
         1436  +#--------------------------------------------------------------------------
         1437  +
         1438  +S_FUNC_MMMV_TIGERHASH_T1_RESULT="not_yet_set"
         1439  +S_FUNC_MMMV_TIGERHASH_T1_MODE="" # optim. to skip repeating console tool selection
         1440  +func_mmmv_tigerhash_t1() { # requires also ruby and gawk 
         1441  +    local S_FP_2_AN_EXISTING_FILE="$1" # first function argument
         1442  +    #--------
         1443  +    local S_TMP_0 # declaration
         1444  +    local S_TMP_1 # declaration
         1445  +    func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_tigerhash_t1" "$1"
         1446  +    #--------------------
         1447  +    # Mode selection:
         1448  +    if [ "$S_FUNC_MMMV_TIGERHASH_T1_MODE" == "" ] ; then
         1449  +        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
         1450  +        #----
         1451  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         1452  +            S_TMP_0="tigerdeep" # usually available on Linux
         1453  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
         1454  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
         1455  +                 S_FUNC_MMMV_TIGERHASH_T1_MODE="$S_TMP_0"
         1456  +            fi
         1457  +        fi
         1458  +        #----
         1459  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         1460  +            S_TMP_0="rhash"    # part of the BSD package collection in 2016
         1461  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
         1462  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
         1463  +                 S_FUNC_MMMV_TIGERHASH_T1_MODE="$S_TMP_0"
         1464  +            fi
         1465  +        fi
         1466  +        #--------
         1467  +        if [ "$S_FUNC_MMMV_TIGERHASH_T1_MODE" == "" ] ; then
         1468  +            echo ""
         1469  +            echo "All of the Tiger hash implementations that this script " 
         1470  +            echo "is capable of using (tigerdeep, rhash) "
         1471  +            echo "are missing from the PATH."
         1472  +            echo "GUID=='90b8e050-605e-4739-a12f-802070e031e7'"
         1473  +            echo ""
         1474  +            #----
         1475  +            cd $S_FP_ORIG
         1476  +            exit 1 # exit with error
         1477  +        fi
         1478  +        #--------
         1479  +        if [ "$?" != "0" ]; then
         1480  +            echo ""
         1481  +            echo "This script is flawed."
         1482  +            echo "GUID=='1493164d-7f39-403d-a52f-802070e031e7'"
         1483  +            echo ""
         1484  +            #----
         1485  +            cd $S_FP_ORIG
         1486  +            exit 1 # exit with error
         1487  +        fi
         1488  +        #--------
         1489  +        func_sb_exists_on_path_t1 "ruby" 
         1490  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         1491  +            echo ""
         1492  +            echo "\"ruby\" is missing from the PATH, but "
         1493  +            echo "this function requires that it is on the PATH."
         1494  +            echo "GUID=='6ae5d3c3-8172-4f53-a42f-802070e031e7'"
         1495  +            echo ""
         1496  +            #----
         1497  +            cd $S_FP_ORIG
         1498  +            exit 1 # exit with error
         1499  +        fi
         1500  +        #--------
         1501  +        if [ "$?" != "0" ]; then
         1502  +            echo ""
         1503  +            echo "This script is flawed."
         1504  +            echo "GUID=='12a86372-9c15-497a-922f-802070e031e7'"
         1505  +            echo ""
         1506  +            #----
         1507  +            cd $S_FP_ORIG
         1508  +            exit 1 # exit with error
         1509  +        fi
         1510  +        #--------
         1511  +    fi
         1512  +    #--------------------
         1513  +    S_FUNC_MMMV_TIGERHASH_T1_RESULT=""
         1514  +    #--------------------
         1515  +    if [ "$S_FUNC_MMMV_TIGERHASH_T1_MODE" == "tigerdeep" ]; then
         1516  +        S_TMP_0="`tigerdeep $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
         1517  +        if [ "$?" != "0" ]; then
         1518  +            echo ""
         1519  +            echo "The console application \"tigerdeep\" "
         1520  +            echo "exited with an error."
         1521  +            echo ""
         1522  +            echo "----console--output--citation--start-----"
         1523  +            echo "`tigerdeep $S_FP_2_AN_EXISTING_FILE`" # stdout and stderr
         1524  +            echo "----console--output--citation--end-------"
         1525  +            echo ""
         1526  +            echo "GUID=='e181fb22-837b-43a1-851f-802070e031e7'"
         1527  +            echo ""
         1528  +            #----
         1529  +            cd $S_FP_ORIG
         1530  +            exit 1 # exit with error
         1531  +        fi
         1532  +        # The "tigerdeep" returns a single line that has the format of 
         1533  +        #
         1534  +        #     <the hash> <path to the file>
         1535  +        #
         1536  +        # The following line is to pick the first column from that line.
         1537  +        S_FUNC_MMMV_TIGERHASH_T1_RESULT="`ruby -e \"print(ARGV[0]);\" $S_TMP_0`"
         1538  +    fi
         1539  +    #--------------------
         1540  +    if [ "$S_FUNC_MMMV_TIGERHASH_T1_MODE" == "rhash" ]; then
         1541  +        S_TMP_0="`rhash --tiger $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
         1542  +        if [ "$?" != "0" ]; then
         1543  +            echo ""
         1544  +            echo "The console application \"rhash\" "
         1545  +            echo "exited with an error."
         1546  +            echo ""
         1547  +            echo "----console--output--citation--start-----"
         1548  +            echo "`rhash --tiger $S_FP_2_AN_EXISTING_FILE `"
         1549  +            echo "----console--output--citation--end-------"
         1550  +            echo ""
         1551  +            echo "GUID=='a33c823b-57d7-4cd0-a11f-802070e031e7'"
         1552  +            echo ""
         1553  +            #----
         1554  +            cd $S_FP_ORIG
         1555  +            exit 1 # exit with error
         1556  +        fi
         1557  +        S_FUNC_MMMV_TIGERHASH_T1_RESULT="`ruby -e \"print(ARGV[0]);\" $S_TMP_0`"
         1558  +    fi
         1559  +    #--------------------
         1560  +    # The reason, why everything is done with ruby at the next 
         1561  +    # Bash assignment clause is that the "wc -m" pads its output
         1562  +    # with spaces on BSD.
         1563  +    S_TMP_0="`ruby -e \"print(ARGV[0].to_s.length.to_s);\" $S_FUNC_MMMV_TIGERHASH_T1_RESULT `"
         1564  +    #--------
         1565  +    S_TMP_1="48"
         1566  +    if [ "$S_TMP_0" != "$S_TMP_1" ]; then
         1567  +        echo ""
         1568  +        echo "According to the specification of the Tiger hash algorithm"
         1569  +        echo "the length of the Tiger hash is "
         1570  +        echo "$S_TMP_1 hexadecimal characters, but the result of the "
         1571  +        echo ""
         1572  +        echo "    func_mmmv_tigerhash_t1"
         1573  +        echo ""
         1574  +        echo "is something else. The flawed hash candidate in parenthesis:"
         1575  +        echo "($S_FUNC_MMMV_TIGERHASH_T1_RESULT)"
         1576  +        echo ""
         1577  +        echo "The length candidate of the flawed hash candidate in parenthesis:"
         1578  +        echo "($S_TMP_0)."
         1579  +        echo ""
         1580  +        echo "GUID=='cc5bba27-d0cb-4b45-841f-802070e031e7'"
         1581  +        echo ""
         1582  +        #----
         1583  +        cd $S_FP_ORIG
         1584  +        exit 1 # exit with error
         1585  +    fi
         1586  +    #--------------------
         1587  +} # func_mmmv_tigerhash_t1
         1588  +
         1589  +
         1590  +#--------------------------------------------------------------------------
         1591  +
         1592  +S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT="not_yet_set"
         1593  +S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE="" # optim. to skip repeating console tool selection
         1594  +func_mmmv_whirlpoolhash_t1() { # requires also ruby and gawk 
         1595  +    local S_FP_2_AN_EXISTING_FILE="$1" # first function argument
         1596  +    #--------
         1597  +    func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_whirlpoolhash_t1" "$1"
         1598  +    #--------------------
         1599  +    # Mode selection:
         1600  +    if [ "$S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE" == "" ] ; then
         1601  +        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
         1602  +        #----
         1603  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         1604  +            S_TMP_0="whirlpooldeep" # usually available on Linux
         1605  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
         1606  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
         1607  +                 S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE="$S_TMP_0"
         1608  +            fi
         1609  +        fi
         1610  +        #----
         1611  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         1612  +            S_TMP_0="rhash"    # part of the BSD package collection in 2016
         1613  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
         1614  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
         1615  +                 S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE="$S_TMP_0"
         1616  +            fi
         1617  +        fi
         1618  +        #--------
         1619  +        if [ "$S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE" == "" ] ; then
         1620  +            echo ""
         1621  +            echo "All of the Whirlpool hash implementations that this script " 
         1622  +            echo "is capable of using (whirlpooldeep, rhash) "
         1623  +            echo "are missing from the PATH."
         1624  +            echo "GUID=='1057ae42-12a7-4a43-9b1f-802070e031e7'"
         1625  +            echo ""
         1626  +            #----
         1627  +            cd $S_FP_ORIG
         1628  +            exit 1 # exit with error
         1629  +        fi
         1630  +        #--------
         1631  +        if [ "$?" != "0" ]; then
         1632  +            echo ""
         1633  +            echo "This script is flawed."
         1634  +            echo "GUID=='254cbf85-edf6-470f-a11f-802070e031e7'"
         1635  +            echo ""
         1636  +            #----
         1637  +            cd $S_FP_ORIG
         1638  +            exit 1 # exit with error
         1639  +        fi
         1640  +        #--------
         1641  +    fi
         1642  +    #--------------------
         1643  +    S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT=""
         1644  +    #--------------------
         1645  +    if [ "$S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE" == "whirlpooldeep" ]; then
         1646  +        S_TMP_0="`whirlpooldeep $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
         1647  +        if [ "$?" != "0" ]; then
         1648  +            echo ""
         1649  +            echo "The console application \"whirlpooldeep\" "
         1650  +            echo "exited with an error."
         1651  +            echo ""
         1652  +            echo "----console--output--citation--start-----"
         1653  +            echo "`whirlpooldeep $S_FP_2_AN_EXISTING_FILE`" # stdout and stderr
         1654  +            echo "----console--output--citation--end-------"
         1655  +            echo ""
         1656  +            echo "GUID=='25b4bd13-b0b6-4d0d-941f-802070e031e7'"
         1657  +            echo ""
         1658  +            #----
         1659  +            cd $S_FP_ORIG
         1660  +            exit 1 # exit with error
         1661  +        fi
         1662  +        S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT="`ruby -e \"print(ARGV[0]);\" $S_TMP_0 `"
         1663  +    fi
         1664  +    #--------------------
         1665  +    if [ "$S_FUNC_MMMV_WHIRLPOOLHASH_T1_MODE" == "rhash" ]; then
         1666  +        S_TMP_0="`rhash --whirlpool $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
         1667  +        if [ "$?" != "0" ]; then
         1668  +            echo ""
         1669  +            echo "The console application \"rhash\" "
         1670  +            echo "exited with an error."
         1671  +            echo ""
         1672  +            echo "----console--output--citation--start-----"
         1673  +            echo "`rhash --whirlpool $S_FP_2_AN_EXISTING_FILE `"
         1674  +            echo "----console--output--citation--end-------"
         1675  +            echo ""
         1676  +            echo "GUID=='2eaf4542-d700-4137-931f-802070e031e7'"
         1677  +            echo ""
         1678  +            #----
         1679  +            cd $S_FP_ORIG
         1680  +            exit 1 # exit with error
         1681  +        fi
         1682  +        S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT="`ruby -e \"print(ARGV[0]);\" $S_TMP_0 `"
         1683  +    fi
         1684  +    #--------------------
         1685  +    # The reason, why everything is done with ruby at the next 
         1686  +    # Bash assignment clause is that the "wc -m" pads its output
         1687  +    # with spaces on BSD.
         1688  +    S_TMP_0="`ruby -e \"print(ARGV[0].to_s.length.to_s);\" $S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT `"
         1689  +    #--------
         1690  +    S_TMP_1="128"
         1691  +    if [ "$S_TMP_0" != "$S_TMP_1" ]; then
         1692  +        echo ""
         1693  +        echo "According to the specification of the Whirlpool hash algorithm"
         1694  +        echo "the length of the Tiger hash is "
         1695  +        echo "$S_TMP_1 hexadecimal characters, but the result of the "
         1696  +        echo ""
         1697  +        echo "    func_mmmv_whirlpoolhash_t1"
         1698  +        echo ""
         1699  +        echo "is something else. The flawed hash candidate in parenthesis:"
         1700  +        echo "($S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT)"
         1701  +        echo ""
         1702  +        echo "The length candidate of the flawed hash candidate in parenthesis:"
         1703  +        echo "($S_TMP_0)."
         1704  +        echo ""
         1705  +        echo "GUID=='a34afc59-ecee-4d4d-850f-802070e031e7'"
         1706  +        echo ""
         1707  +        #----
         1708  +        cd $S_FP_ORIG
         1709  +        exit 1 # exit with error
         1710  +    fi
         1711  +    #--------------------
         1712  +} # func_mmmv_whirlpoolhash_t1
         1713  +
         1714  +
         1715  +#--------------------------------------------------------------------------
         1716  +
         1717  +S_FUNC_MMMV_FILESIZE_T1_RESULT="not_yet_set"
         1718  +S_FUNC_MMMV_FILESIZE_T1_MODE="" # optim. to skip repeating console tool selection
         1719  +func_mmmv_filesize_t1() { 
         1720  +    local S_FP_2_AN_EXISTING_FILE="$1" # first function argument
         1721  +    #--------
         1722  +    func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_filesize_t1" "$1"
         1723  +    #--------------------
         1724  +    # Mode selection:
         1725  +    if [ "$S_FUNC_MMMV_FILESIZE_T1_MODE" == "" ] ; then
         1726  +        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
         1727  +        #----
         1728  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         1729  +            S_TMP_0="filesize" # usually available on Linux
         1730  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
         1731  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
         1732  +                 S_FUNC_MMMV_FILESIZE_T1_MODE="$S_TMP_0"
         1733  +            fi
         1734  +        fi
         1735  +        #----
         1736  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         1737  +            S_TMP_0="ruby"    # helps on BSD
         1738  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
         1739  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
         1740  +                 S_FUNC_MMMV_FILESIZE_T1_MODE="$S_TMP_0"
         1741  +            fi
         1742  +        fi
         1743  +        #--------
         1744  +        if [ "$S_FUNC_MMMV_FILESIZE_T1_MODE" == "" ] ; then
         1745  +            echo ""
         1746  +            echo "All of the applications that this function is " 
         1747  +            echo "capable of using for finding out file size (filesize, ruby)"
         1748  +            echo "are missing from the PATH."
         1749  +            echo "GUID=='2406f8f2-b4d4-4a87-810f-802070e031e7'"
         1750  +            echo ""
         1751  +            #----
         1752  +            cd $S_FP_ORIG
         1753  +            exit 1 # exit with error
         1754  +        fi
         1755  +        #--------
         1756  +        if [ "$?" != "0" ]; then
         1757  +            echo ""
         1758  +            echo "This script is flawed."
         1759  +            echo "GUID=='f8128f65-9fbd-4d2c-b30f-802070e031e7'"
         1760  +            echo ""
         1761  +            #----
         1762  +            cd $S_FP_ORIG
         1763  +            exit 1 # exit with error
         1764  +        fi
         1765  +        #--------
         1766  +    fi
         1767  +    #--------------------
         1768  +    S_FUNC_MMMV_FILESIZE_T1_RESULT=""
         1769  +    #--------------------
         1770  +    if [ "$S_FUNC_MMMV_FILESIZE_T1_MODE" == "filesize" ]; then
         1771  +        S_TMP_0="`filesize $S_FP_2_AN_EXISTING_FILE 2>/dev/null`"
         1772  +        if [ "$?" != "0" ]; then
         1773  +            echo ""
         1774  +            echo "The console application \"filesize\" "
         1775  +            echo "exited with an error."
         1776  +            echo ""
         1777  +            echo "----console--output--citation--start-----"
         1778  +            echo "`filesize $S_FP_2_AN_EXISTING_FILE`" # stdout and stderr
         1779  +            echo "----console--output--citation--end-------"
         1780  +            echo ""
         1781  +            echo "GUID=='35da64ce-6da9-4143-920f-802070e031e7'"
         1782  +            echo ""
         1783  +            #----
         1784  +            cd $S_FP_ORIG
         1785  +            exit 1 # exit with error
         1786  +        fi
         1787  +        S_FUNC_MMMV_FILESIZE_T1_RESULT="`ruby -e \"print(ARGV[0]);\" $S_TMP_0 `"
         1788  +    fi
         1789  +    #--------------------
         1790  +    if [ "$S_FUNC_MMMV_FILESIZE_T1_MODE" == "ruby" ]; then
         1791  +        S_TMP_0="`ruby -e \"printf(File.size('$S_FP_2_AN_EXISTING_FILE').to_s)\" 2>/dev/null`"
         1792  +        if [ "$?" != "0" ]; then
         1793  +            echo ""
         1794  +            echo "The console application \"ruby\" "
         1795  +            echo "exited with an error."
         1796  +            echo ""
         1797  +            echo "----console--output--citation--start-----"
         1798  +            echo "`ruby -e \"printf(File.size('$S_FP_2_AN_EXISTING_FILE').to_s)\"`"
         1799  +            echo "----console--output--citation--end-------"
         1800  +            echo ""
         1801  +            echo "GUID=='6efcd543-0ae5-4369-950f-802070e031e7'"
         1802  +            echo ""
         1803  +            #----
         1804  +            cd $S_FP_ORIG
         1805  +            exit 1 # exit with error
         1806  +        fi
         1807  +        S_FUNC_MMMV_FILESIZE_T1_RESULT="$S_TMP_0"
         1808  +    fi
         1809  +    #--------------------
         1810  +    S_TMP_0="`ruby -e \"print((''+ARGV[0]).gsub(/[\s]+/,''));\" $S_FUNC_MMMV_FILESIZE_T1_RESULT `"
         1811  +    local SB_THROW="f"
         1812  +    if [ "$S_TMP_0" != "$S_FUNC_MMMV_FILESIZE_T1_RESULT" ]; then
         1813  +        SB_THROW="t"
         1814  +    else
         1815  +        if [ "$S_FUNC_MMMV_FILESIZE_T1_RESULT" == "" ]; then
         1816  +            SB_THROW="t"
         1817  +        fi
         1818  +    fi
         1819  +    #----
         1820  +    if [ "$SB_THROW" == "t" ]; then
         1821  +        echo ""
         1822  +        echo "The result of the "
         1823  +        echo ""
         1824  +        echo "    func_mmmv_filesize_t1"
         1825  +        echo ""
         1826  +        echo "for "
         1827  +        echo ""
         1828  +        echo "($S_FUNC_MMMV_FILESIZE_T1_RESULT)"
         1829  +        echo ""
         1830  +        echo "either contain spaces, tabs or is an empty string," 
         1831  +        echo "which is wrong, because even a file with the size of 0 "
         1832  +        echo "should have a file size of \"0\", which is not an empty string."
         1833  +        echo "GUID=='14ab3053-b0f1-4c5c-930f-802070e031e7'"
         1834  +        echo ""
         1835  +        #----
         1836  +        cd $S_FP_ORIG
         1837  +        exit 1 # exit with error
         1838  +    fi
         1839  +    #--------------------
         1840  +} # func_mmmv_filesize_t1
         1841  +
         1842  +
         1843  +#--------------------------------------------------------------------------
         1844  +
         1845  +func_mmmv_silktorrent_packager_t1_bash_print_help_msg_t1() { 
         1846  +    echo ""
         1847  +    echo "Command line format: "
         1848  +    echo ""
         1849  +    echo "<the name of this script>  ARGLIST "
         1850  +    echo ""
         1851  +    echo "  ARGLIST :== help | WRAP | UNWRAP | RUN_SELFTEST | VERIFY |"
         1852  +    echo "              VERIFY_PACKET_NAME_FORMAT_V1 | version | version_timestamp "
         1853  +    echo ""
         1854  +    echo "                   WRAP :== wrap         <file path> (N_OF_RANDOM_TEXT_BLOCKS)?"
         1855  +    echo "N_OF_RANDOM_TEXT_BLOCKS :==                           <positive whole number> "
         1856  +    echo ""
         1857  +    echo "                 UNWRAP :== unwrap       <file path> "
         1858  +    echo "           RUN_SELFTEST :== test_hash_t1 <file path> "
         1859  +    echo "                 VERIFY :== verify       <file path> "
         1860  +    echo ""
         1861  +    echo "  VERIFY_PACKET_NAME_FORMAT_V1 :== verify_packet_name_format_v1 X<packet name "
         1862  +    echo "                                                                 candidate string>X"
         1863  +    echo ""
         1864  +    echo ""
         1865  +    echo "If this API is used correctly and there are no other "
         1866  +    echo "reasons for the failure of this script, then "
         1867  +    echo "all of the verification commands exit with error code 0 "
         1868  +    echo "regardless of whether the verification fails or passes."
         1869  +    echo "All verification commands return a string that "
         1870  +    echo "belongs to the set {\"verification_passed\", "
         1871  +    echo "                    \"verification_failed\"}."
         1872  +    echo ""
         1873  +    echo "If the working directory contains a folder named \"custom_headers\" and "
         1874  +    echo "that folder is recursively readable/copyable, then the command \"wrap\" "
         1875  +    echo "adds that folder to the header folder of the newly created Silktorrent packet."
         1876  +    echo "If there is a failure at the recursive copying of the \"custom_headers\", "
         1877  +    echo "then this script exits with a non-0 error code "
         1878  +    echo "before the Silktorrent packet is created."
         1879  +    echo ""
         1880  +    echo ""
         1881  +} # func_mmmv_silktorrent_packager_t1_bash_print_help_msg_t1
         1882  +
         1883  +#--------------------------------------------------------------------------
         1884  +
         1885  +func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1() { 
         1886  +    local S_FP_0="$1" # Path to the file. 
         1887  +    #--------
         1888  +    if [ "$S_FP_0" == "" ]; then
         1889  +        echo ""
         1890  +        echo "The 2. console argument is expected to be "
         1891  +        echo "a path to a file, but currently "
         1892  +        echo "the 2. console argument is missing."
         1893  +        echo "GUID=='4ca91a2f-28bd-4347-810f-802070e031e7'"
         1894  +        echo ""
         1895  +        #----
         1896  +        cd $S_FP_ORIG
         1897  +        exit 1 # exit with error
         1898  +    fi
         1899  +    #--------
         1900  +    if [ ! -e "$S_FP_0" ]; then
         1901  +        if [ -h "$S_FP_0" ]; then
         1902  +            echo ""
         1903  +            echo "The file path "
         1904  +            echo ""
         1905  +            echo "    $S_FP_0"
         1906  +            echo ""
         1907  +            echo "is a path of a broken symlink, but symlinks "
         1908  +            echo "are not supported at all."
         1909  +            echo "The reason, why symlinks to files are not supported is that "
         1910  +            echo "the file size of symlinks can differ from "
         1911  +            echo "the file size of the target of the symlink."
         1912  +            echo "GUID=='5740b6b3-90b4-4500-810f-802070e031e7'"
         1913  +            echo ""
         1914  +        else
         1915  +            echo ""
         1916  +            echo "The file with the path of "
         1917  +            echo ""
         1918  +            echo "    $S_FP_0"
         1919  +            echo ""
         1920  +            echo "does not exist."
         1921  +            echo "GUID=='87c16d21-e78b-48af-b6fe-802070e031e7'"
         1922  +            echo ""
         1923  +        fi
         1924  +        #----
         1925  +        cd $S_FP_ORIG
         1926  +        exit 1 # exit with error
         1927  +    fi
         1928  +    #--------
         1929  +    if [ -d "$S_FP_0" ]; then
         1930  +        if [ -h "$S_FP_0" ]; then
         1931  +            echo ""
         1932  +            echo "The path "
         1933  +            echo ""
         1934  +            echo "    $S_FP_0"
         1935  +            echo ""
         1936  +            echo "references a symlink that references folder, but "
         1937  +            echo "a file is expected."
         1938  +            echo "GUID=='9ad6cd5d-5668-435f-b5fe-802070e031e7'"
         1939  +            echo ""
         1940  +        else
         1941  +            echo ""
         1942  +            echo "The path "
         1943  +            echo ""
         1944  +            echo "    $S_FP_0"
         1945  +            echo ""
         1946  +            echo "references a folder, but it is expected to "
         1947  +            echo "to reference a file."
         1948  +            echo "GUID=='3e955ea5-497b-4d25-81fe-802070e031e7'"
         1949  +            echo ""
         1950  +        fi
         1951  +        #----
         1952  +        cd $S_FP_ORIG
         1953  +        exit 1 # exit with error
         1954  +    fi
         1955  +    #--------
         1956  +    if [ -h "$S_FP_0" ]; then
         1957  +        echo ""
         1958  +        echo "The path "
         1959  +        echo ""
         1960  +        echo "    $S_FP_0"
         1961  +        echo ""
         1962  +        echo "references a symlink, a file is expected."
         1963  +        echo "The reason, why symlinks to files are not supported is that "
         1964  +        echo "the file size of symlinks can differ from "
         1965  +        echo "the file size of the target of the symlink."
         1966  +        echo "GUID=='95383c69-07f5-47c0-89fe-802070e031e7'"
         1967  +        echo ""
         1968  +        #----
         1969  +        cd $S_FP_ORIG
         1970  +        exit 1 # exit with error
         1971  +    fi
         1972  +} # func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1
         1973  +
         1974  +
         1975  +#--------------------------------------------------------------------------
         1976  +
         1977  +func_mmmv_silktorrent_packager_t1_bash_exc_assert_packet_name_candidate_exists_t1() { 
         1978  +    local S_FP_0="$1" # Path to the file. 
         1979  +    #--------
         1980  +    if [ "$S_FP_0" == "" ]; then
         1981  +        echo ""
         1982  +        echo "The 2. console argument is expected to be "
         1983  +        echo "a Silktorrent packet name candidate, but currently "
         1984  +        echo "the 2. console argument is missing."
         1985  +        echo "GUID=='31e54d03-8016-436b-85bd-802070e031e7'"
         1986  +        echo ""
         1987  +        #----
         1988  +        cd $S_FP_ORIG
         1989  +        exit 1 # exit with error
         1990  +    fi
         1991  +} # func_mmmv_silktorrent_packager_t1_bash_exc_assert_packet_name_candidate_exists_t1
         1992  +
         1993  +
         1994  +#--------------------------------------------------------------------------
         1995  +
         1996  +S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER="for input and output"
         1997  +S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE="" # optim.  hack
         1998  +func_mmmv_silktorrent_packager_t1_bash_reverse_string() { 
         1999  +    local S_IN="$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER"
         2000  +    #--------------------
         2001  +    local S_TMP_0="" # declaration
         2002  +    # Mode selection:
         2003  +    if [ "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE" == "" ] ; then
         2004  +        SB_EXISTS_ON_PATH_T1_RESULT="f"  # if-block init
         2005  +        #----
         2006  +        if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "f" ] ; then
         2007  +            S_TMP_0="ruby"    # helps on BSD
         2008  +            func_sb_exists_on_path_t1 "$S_TMP_0" 
         2009  +            if [ "$SB_EXISTS_ON_PATH_T1_RESULT" == "t" ] ; then
         2010  +                 S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE="$S_TMP_0"
         2011  +            fi
         2012  +        fi
         2013  +        #--------
         2014  +        if [ "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE" == "" ] ; then
         2015  +            echo ""
         2016  +            echo "All of the applications that this function is " 
         2017  +            echo "capable of using for reversing a string(ruby)"
         2018  +            echo "are missing from the PATH."
         2019  +            echo "GUID=='85bbf612-0a2b-485f-b4bd-802070e031e7'"
         2020  +            echo ""
         2021  +            #----
         2022  +            cd $S_FP_ORIG
         2023  +            exit 1 # exit with error
         2024  +        fi
         2025  +        #--------
         2026  +        if [ "$?" != "0" ]; then
         2027  +            echo ""
         2028  +            echo "This script is flawed."
         2029  +            echo "GUID=='e779be52-3b1a-402e-91bd-802070e031e7'"
         2030  +            echo ""
         2031  +            #----
         2032  +            cd $S_FP_ORIG
         2033  +            exit 1 # exit with error
         2034  +        fi
         2035  +        #--------
         2036  +    fi
         2037  +    #--------------------
         2038  +    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER=""
         2039  +    #--------
         2040  +    if [ "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_MODE" == "ruby" ]; then
         2041  +        #----
         2042  +        S_TMP_0="`ruby -e \"puts(ARGV[0].to_s.reverse)\" "$S_IN" 2>/dev/null`"
         2043  +        if [ "$?" != "0" ]; then
         2044  +            echo ""
         2045  +            echo "The console application \"ruby\" "
         2046  +            echo "exited with an error."
         2047  +            echo ""
         2048  +            echo "----console--output--citation--start-----"
         2049  +            echo "`ruby -e \"puts('$S_IN'.reverse)\"`" # with the stderr
         2050  +            echo "----console--output--citation--end-------"
         2051  +            echo ""
         2052  +            echo "GUID=='32b59258-f7d6-4a83-95bd-802070e031e7'"
         2053  +            echo ""
         2054  +            #----
         2055  +            cd $S_FP_ORIG
         2056  +            exit 1 # exit with error
         2057  +        fi
         2058  +        S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER="$S_TMP_0"
         2059  +    fi
         2060  +    #--------------------
         2061  +} # func_mmmv_silktorrent_packager_t1_bash_reverse_string
         2062  +
         2063  +
         2064  +#--------------------------------------------------------------------------
         2065  +
         2066  +# As of 2016 the maximum file name length on Linux is 255 characters.
         2067  +# At
         2068  +#
         2069  +#    http://unix.stackexchange.com/questions/32795/what-is-the-maximum-allowed-filename-and-folder-size-with-ecryptfs
         2070  +#
         2071  +# the eCryptfs related recommendation is to keep the lengths
         2072  +# of file names to less than 140 characters. 
         2073  +#
         2074  +# A citation from 
         2075  +# http://windows.microsoft.com/en-us/windows/file-names-extensions-faq#1TC=windows-7
         2076  +# archival copy: https://archive.is/UKBmd
         2077  +#     "Windows limits a single path to 260 characters."
         2078  +#
         2079  +# A citation from CygWin mailing list:
         2080  +# https://cygwin.com/ml/cygwin/2004-10/msg01323.html
         2081  +# archival copy: https://archive.is/GRvFK
         2082  +#     "The Unicode versions of several functions permit a 
         2083  +#     maximum path length of 32,767 characters, 
         2084  +#     composed of components up to 255 characters in length. 
         2085  +#     To specify such a path, use the "\\?\" prefix. For example, 
         2086  +#     "\\?\D:\<path>". To specify such a UNC path, use the "\\?\UNC\" 
         2087  +#     prefix. For example, "\\?\UNC\<server>\<share>". 
         2088  +#     Note that these prefixes are not used as part of the path 
         2089  +#     itself. They indicate that the path should be passed to the 
         2090  +#     system with minimal modification. An implication of this is 
         2091  +#     that you cannot use forward slashes to represent path separators 
         2092  +#     or a period to represent the current directory."
         2093  +# Related pages:
         2094  +# https://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx
         2095  +# archival copy: https://archive.is/p891y
         2096  +#
         2097  +# To allow database indexes that store the 
         2098  +# file names of the blogs 
         2099  +# to work as efficiently as possible, the first
         2100  +# characters of the file name should be as 
         2101  +# uniformly random set of characters as possible.
         2102  +# If file name starts with a secure hash, then 
         2103  +# that requirement is met. 
         2104  +#
         2105  +# The parser that dismantles the file name to relevant components 
         2106  +# should be implementable in different programming languages
         2107  +# without investing considerable amount of development time.
         2108  +# The syntax of the file name should also allow the
         2109  +# file name to be parsed computationally cheaply.
         2110  +#
         2111  +# As of 2016_05 the file extension  .stblob seems to be unused.
         2112  +# Therefore the "silktorrent blob", .stblob, can be used for the 
         2113  +# extension of the blob files.
         2114  +#
         2115  +# Compression of the blobs IS NOT ALLOWED, because the 
         2116  +# blobs must be extractable without becoming a victim 
         2117  +# of an attack, where 100GiB of zeros is packed to a
         2118  +# small file. The container format is the tar format,
         2119  +# without any compression.
         2120  +S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_BLOB2FILENAME_T1_RESULT="not set"
         2121  +func_mmmv_silktorrent_packager_t1_bash_blob2filename_t1() { 
         2122  +    local S_FP_0="$1" # Path to the file. 
         2123  +    #----
         2124  +    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
         2125  +    #--------
         2126  +    # The Tiger     hash has  48 characters.
         2127  +    # The Whirlpool hash has 128 characters.
         2128  +    # The SHA-256   hash has  64 characters.
         2129  +    #
         2130  +    # A file size of 1TiB is ~10^12 ~ 13 characters
         2131  +    # A file size of 1PiB is ~10^15 ~ 14 characters
         2132  +    # A file size of 1EiB is ~10^18 ~ 19 characters
         2133  +    # A file size of 1ZiB is ~10^21 ~ 22 characters
         2134  +    # A file size of 1YiB is ~10^24 ~ 25 characters
         2135  +    # 
         2136  +    # The max. file name length on Linux and 
         2137  +    # Windows (Unicode API) is 255 characters.
         2138  +    #----
         2139  +    # The character budget:
         2140  +    #        6 characters --- file name format type ID 
         2141  +    #                         rgx_in_ruby=/v[\d]{4}[_]/
         2142  +    # echo "v0034_s2342_" | gawk '{ gsub(/_/, "_\n"); print }' | \
         2143  +    #                       gawk '/^v[0-9]{4}_/ {printf "%s",$1 }' | \
         2144  +    #                       gawk '{gsub(/[v_]/,"");printf "%s", $1 }'
         2145  +    #
         2146  +    #   max 32 characters --- file size    
         2147  +    #                         rgx_in_ruby=/s[\d]+[_]/
         2148  +    #                         echo "v0034_" | gawk '/^v[0-9]{4}_/ {printf "%s",$1 }'
         2149  +    # echo "v0034_s2342_" | gawk '{ gsub(/_/, "_\n"); print }' | \
         2150  +    #                       gawk '/^s[0-9]+_/ {printf "%s",$1 }' | \
         2151  +    #                       gawk '{gsub(/[s_]/,"");printf "%s", $1 }'
         2152  +    #
         2153  +    #
         2154  +    #       66 characters --- SHA-256  
         2155  +    #                         rgx_in_ruby=/h[\dabcdef]{64}[_]/
         2156  +    # echo "h`sha256sum /dev/null | gawk '/[0-9abcdef]/ {printf "%s",$1}'`_" | \
         2157  +    #                               gawk '/^h[0-9abcdef]+_/ {printf "%s",$1 }' | \
         2158  +    #                               gawk '{gsub(/[h_]/,"");printf "%s", $1 }'
         2159  +    #
         2160  +    #
         2161  +    #       50 characters --- Tiger
         2162  +    #                         rgx_in_ruby=/i[\dabcdef]{48}$/   # lacks the ending "_" 
         2163  +    #                                                          # for db index optimization
         2164  +    #                         The gawk code is as with the sha256, 
         2165  +    #                         except that sha256sum-> tigerdeep, "^h"->"^i",
         2166  +    #                         "[h_]"->"[i_]"
         2167  +    #
         2168  +    #--------
         2169  +    # As the current version of this script depends on Ruby anyway,
         2170  +    # the gawk regex based branches that are really
         2171  +    # complex and require multiple gawk calls can be left unimplemented.
         2172  +    # That way this script becomes more succinct.
         2173  +    #--------------------
         2174  +    func_mmmv_tigerhash_t1 "$S_FP_0"
         2175  +    #echo "       Tiger: $S_FUNC_MMMV_TIGERHASH_T1_RESULT"
         2176  +    #func_mmmv_whirlpoolhash_t1 "$S_FP_0"
         2177  +    #echo "   Whirlpool: $S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT"
         2178  +    func_mmmv_sha256_t1 "$S_FP_0"
         2179  +    #echo "      SHA256: $S_FUNC_MMMV_SHA256_T1_RESULT"
         2180  +    func_mmmv_filesize_t1 "$S_FP_0"
         2181  +    #echo "   file size: $S_FUNC_MMMV_FILESIZE_T1_RESULT"
         2182  +    #--------
         2183  +    local S_NAME_REVERSED="bolbts." # ".stblob".reverse
         2184  +    local S_0="v0001_s$S_FUNC_MMMV_FILESIZE_T1_RESULT"
         2185  +    S_NAME_REVERSED="$S_NAME_REVERSED$S_0"
         2186  +    S_0="_h$S_FUNC_MMMV_SHA256_T1_RESULT"
         2187  +    S_NAME_REVERSED="$S_NAME_REVERSED$S_0"
         2188  +    S_0="_i$S_FUNC_MMMV_TIGERHASH_T1_RESULT"
         2189  +    S_NAME_REVERSED="$S_NAME_REVERSED$S_0"
         2190  +    #----
         2191  +    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER="$S_NAME_REVERSED"
         2192  +    func_mmmv_silktorrent_packager_t1_bash_reverse_string
         2193  +    S_0="$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_REVERSE_STRING_REGISTER"
         2194  +    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_BLOB2FILENAME_T1_RESULT="$S_0"
         2195  +} # func_mmmv_silktorrent_packager_t1_bash_blob2filename_t1
         2196  +
         2197  +
         2198  +#--------------------------------------------------------------------------
         2199  +
         2200  +func_mmmv_delete_tmp_folder_t1(){
         2201  +    local S_FP_0="$1" # folder path
         2202  +    #--------
         2203  +    if [ ! -e "$S_FP_0" ]; then
         2204  +        echo ""
         2205  +        echo "This script is flawed. The folder "
         2206  +        echo "    $S_FP_0"
         2207  +        echo "is expected to exist during the "
         2208  +        echo "call to this function."
         2209  +        echo "GUID=='7574bf34-b0c4-4ba9-a5bd-802070e031e7'"
         2210  +        echo ""
         2211  +        #----
         2212  +        cd $S_FP_ORIG
         2213  +        exit 1 # exit with error
         2214  +    fi
         2215  +    #--------
         2216  +    # To avoid a situation, where due to some 
         2217  +    # flaw the home folder or something else important 
         2218  +    # gets accidentally recursively deleted, 
         2219  +    # the following test transforms the path from 
         2220  +    # /tmp/../home/blabla
         2221  +    # to a full path without the dots and then studies, whether
         2222  +    # the full path points to somewhere in the /tmp
         2223  +    local S_FP_1="`cd $S_FP_0; pwd`"
         2224  +    if [ ! -e "$S_FP_1" ]; then
         2225  +        echo ""
         2226  +        echo "This script is flawed. The folder "
         2227  +        echo "    $S_FP_1"
         2228  +        echo "is missing."
         2229  +        echo "GUID=='89fc6c50-6a1b-4e68-b4bd-802070e031e7'"
         2230  +        echo ""
         2231  +        #----
         2232  +        cd $S_FP_ORIG
         2233  +        exit 1 # exit with error
         2234  +    fi
         2235  +    local S_TMP_0="`echo \"$S_FP_1\" | grep -E ^/home `"
         2236  +    if [ "$S_TMP_0" != "" ]; then
         2237  +        echo ""
         2238  +        echo "This script is flawed."
         2239  +        echo "The temporary sandbox folder must reside in /tmp."
         2240  +        echo ""
         2241  +        echo "S_FP_0==$S_FP_0"
         2242  +        echo ""
         2243  +        echo "S_FP_1==$S_FP_1"
         2244  +        echo ""
         2245  +        echo "S_TMP_0==$S_TMP_0"
         2246  +        echo ""
         2247  +        echo "GUID=='33f9e721-d141-4a15-93ad-802070e031e7'"
         2248  +        echo ""
         2249  +        #----
         2250  +        cd $S_FP_ORIG
         2251  +        exit 1 # exit with error
         2252  +    fi
         2253  +    # Just to be sure, the same thing is checked by a slightly 
         2254  +    # different regex and using the "==" in stead of the "!=".
         2255  +    S_TMP_0="`echo \"$S_FP_1\" | grep -E ^/tmp/`" 
         2256  +    if [ "$S_TMP_0" == "" ]; then
         2257  +        echo ""
         2258  +        echo "This script is flawed."
         2259  +        echo "The temporary sandbox folder must reside in /tmp."
         2260  +        echo ""
         2261  +        echo "S_FP_0==$S_FP_0"
         2262  +        echo ""
         2263  +        echo "S_FP_1==$S_FP_1"
         2264  +        echo ""
         2265  +        echo "S_TMP_0==$S_TMP_0"
         2266  +        echo ""
         2267  +        echo "GUID=='5322e2c5-5408-456c-96ad-802070e031e7'"
         2268  +        echo ""
         2269  +        #----
         2270  +        cd $S_FP_ORIG
         2271  +        exit 1 # exit with error
         2272  +    fi
         2273  +    #--------
         2274  +    rm -fr $S_FP_1
         2275  +    if [ -e "$S_FP_1" ]; then
         2276  +        echo ""
         2277  +        echo "Something went wrong. The recursive deletion of the temporary folder, "
         2278  +        echo "    $S_FP_1"
         2279  +        echo "failed."
         2280  +        echo "GUID=='53d85f13-83de-4ab2-85ad-802070e031e7'"
         2281  +        echo ""
         2282  +        #----
         2283  +        cd $S_FP_ORIG
         2284  +        exit 1 # exit with error
         2285  +    fi
         2286  +} # func_mmmv_delete_tmp_folder_t1
         2287  +
         2288  +
         2289  +#--------------------------------------------------------------------------
         2290  +
         2291  +# Throws, if there exists a file with the same path.
         2292  +func_mmmv_create_folder_if_it_does_not_already_exist_t1(){
         2293  +    local S_FP_0="$1" # folder path
         2294  +    #--------
         2295  +    if [ "$S_FP_0" == "" ]; then
         2296  +        # Using gawk and alike to cover also cases, where
         2297  +        # $S_FP_0=="  "
         2298  +        # is intentionally left out to avoid the overhead, but
         2299  +        # due to some luck the mkdir exits with an error code greater than 0,
         2300  +        # if it misses a path argument. 
         2301  +        echo ""
         2302  +        echo "S_FP_0==\"\""
         2303  +        echo "GUID=='7a6a8222-46a8-4fc2-a3ad-802070e031e7'"
         2304  +        echo ""
         2305  +        #----
         2306  +        cd $S_FP_ORIG
         2307  +        exit 1 # exit with error
         2308  +    fi
         2309  +    #--------------------
         2310  +    if [ -e "$S_FP_0" ]; then
         2311  +        if [ ! -d "$S_FP_0" ]; then
         2312  +            echo ""
         2313  +            echo "The path that is suppose to reference either "
         2314  +            echo "an existing folder or a non-existent folder, "
         2315  +            echo "references a file."
         2316  +            echo "GUID=='568dee95-94ef-4508-b5ad-802070e031e7'"
         2317  +            echo ""
         2318  +            #----
         2319  +            cd $S_FP_ORIG
         2320  +            exit 1 # exit with error
         2321  +        fi
         2322  +    fi
         2323  +    #--------
         2324  +    mkdir -p $S_FP_0
         2325  +    if [ "$?" != "0" ]; then 
         2326  +        echo ""
         2327  +        echo "mkdir for path "
         2328  +        echo "    $S_FP_0"
         2329  +        echo "failed."
         2330  +        echo "GUID=='47dbaf49-8151-467d-939d-802070e031e7'"
         2331  +        echo ""
         2332  +        #----
         2333  +        cd $S_FP_ORIG
         2334  +        exit 1 # exit with error
         2335  +    fi
         2336  +    #----
         2337  +    if [ ! -e "$S_FP_0" ]; then
         2338  +        echo ""
         2339  +        echo "mkdir execution succeeded, but for some other reason the folder "
         2340  +        echo "    $S_FP_0"
         2341  +        echo "does not exist."
         2342  +        echo "GUID=='87415d1b-e2b5-4f0e-829d-802070e031e7'"
         2343  +        echo ""
         2344  +        #----
         2345  +        cd $S_FP_ORIG
         2346  +        exit 1 # exit with error
         2347  +    fi
         2348  +} # func_mmmv_create_folder_if_it_does_not_already_exist_t1
         2349  +
         2350  +
         2351  +#--------------------------------------------------------------------------
         2352  +
         2353  +S_FUNC_FUNC_MMMV_CREATE_TMP_FOLDER_T1_RESULT="" # == "" on failure
         2354  +                                                # otherwise full file path
         2355  +func_mmmv_create_tmp_folder_t1(){
         2356  +    # Does not take any arguments.
         2357  +    #--------
         2358  +    #func_mmmv_exc_hash_function_input_verification_t1 "func_mmmv_GUID_t1" "$1"
         2359  +    #--------------------
         2360  +    S_FUNC_FUNC_MMMV_CREATE_TMP_FOLDER_T1_RESULT="" # value for failure
         2361  +    func_mmmv_GUID_t1
         2362  +    if [ "$S_FUNC_MMMV_GUID_T1_RESULT" == "" ]; then
         2363  +        echo ""
         2364  +        echo "This script is flawed. GUID generation failed and "
         2365  +        echo "the GUID generation function did not throw despite "
         2366  +        echo "the fact that it should have detected its own failure."
         2367  +        echo "GUID=='594ff3b3-10bd-42db-b19d-802070e031e7'"
         2368  +        echo ""
         2369  +        #----
         2370  +        cd $S_FP_ORIG
         2371  +        exit 1 # exit with error
         2372  +    fi
         2373  +    #----
         2374  +    local S_TMP_0="/tmp/tmp_silktorrent_$S_FUNC_MMMV_GUID_T1_RESULT"
         2375  +    # The following few if-clauses form a short unrolled loop. The unrolling 
         2376  +    # is for simplicity, because it is Bash, where loops are nasty.
         2377  +    if [ -e "$S_TMP_0" ]; then
         2378  +        func_mmmv_GUID_t1
         2379  +        S_TMP_0="/tmp/tmp_silktorrent_$S_FUNC_MMMV_GUID_T1_RESULT"
         2380  +    fi
         2381  +    if [ -e "$S_TMP_0" ]; then
         2382  +        func_mmmv_GUID_t1
         2383  +        S_TMP_0="/tmp/tmp_silktorrent_$S_FUNC_MMMV_GUID_T1_RESULT"
         2384  +    fi
         2385  +    if [ -e "$S_TMP_0" ]; then
         2386  +        func_mmmv_GUID_t1
         2387  +        S_TMP_0="/tmp/tmp_silktorrent_$S_FUNC_MMMV_GUID_T1_RESULT"
         2388  +    fi
         2389  +    if [ -e "$S_TMP_0" ]; then
         2390  +        func_mmmv_GUID_t1
         2391  +        S_TMP_0="/tmp/tmp_silktorrent_$S_FUNC_MMMV_GUID_T1_RESULT"
         2392  +    fi
         2393  +    #----
         2394  +    if [ -e "$S_TMP_0" ]; then
         2395  +        echo ""
         2396  +        echo "This script failed to generate a locally unique path."
         2397  +        echo "GUID=='59d91812-4ab7-4c2a-879d-802070e031e7'"
         2398  +        echo ""
         2399  +        #----
         2400  +        cd $S_FP_ORIG
         2401  +        exit 1 # exit with error
         2402  +    fi
         2403  +    func_mmmv_create_folder_if_it_does_not_already_exist_t1 "$S_TMP_0"
         2404  +    if [ ! -e "$S_TMP_0" ]; then
         2405  +        echo ""
         2406  +        echo "mkdir for path "
         2407  +        echo "    $S_TMP_0"
         2408  +        echo "failed."
         2409  +        echo "GUID=='5c8e3d01-c703-4ea0-a28d-802070e031e7'"
         2410  +        echo ""
         2411  +        #----
         2412  +        cd $S_FP_ORIG
         2413  +        exit 1 # exit with error
         2414  +    fi
         2415  +    S_FUNC_FUNC_MMMV_CREATE_TMP_FOLDER_T1_RESULT="$S_TMP_0"
         2416  +} # func_mmmv_create_tmp_folder_t1 
         2417  +
         2418  +
         2419  +#--------------------------------------------------------------------------
         2420  +
         2421  +S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_GET_PACKET_FORMAT_VERSION_T1_RESULT="not set"
         2422  +func_mmmv_silktorrent_packager_t1_bash_get_packet_format_version_t1() { 
         2423  +    local S_FP_0="$1" # Path to the file. 
         2424  +    #----
         2425  +    # It's not necessary for the file to actually exist,
         2426  +    # because this function only analyzes the file path string.
         2427  +    # func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
         2428  +    if [ "$S_FP_0" == "" ]; then
         2429  +        echo ""
         2430  +        echo "The file path candidate must not be an empty string."
         2431  +        echo "GUID=='ef933b2b-a50e-4957-818d-802070e031e7'"
         2432  +        echo ""
         2433  +        #----
         2434  +        cd $S_FP_ORIG
         2435  +        exit 1 # exit with error
         2436  +    fi 
         2437  +    #----
         2438  +    # The 
         2439  +    #
         2440  +    #     basename /tmp/foo/
         2441  +    #
         2442  +    # returns
         2443  +    #
         2444  +    #     foo
         2445  +    #
         2446  +    # That is to say, the "basename" ignores the rightmost slash.
         2447  +    #----
         2448  +    local S_TMP_0="`ruby -e \"\
         2449  +        s='noslash';\
         2450  +        if(('$S_FP_0'.reverse)[0..0]=='/') then \
         2451  +            s='slash_present';\
         2452  +        end;\
         2453  +        puts(s);\
         2454  +        \"`"
         2455  +    if [ "$S_TMP_0" != "noslash" ]; then
         2456  +        echo ""
         2457  +        echo "The path candidate must not end with a slash."
         2458  +        echo ""
         2459  +        echo "    S_FP_0==$S_FP_0"
         2460  +        echo ""
         2461  +        echo "    S_TMP_0==$S_TMP_0"
         2462  +        echo ""
         2463  +        echo "GUID=='6a5dc354-4293-4c9f-b28d-802070e031e7'"
         2464  +        echo ""
         2465  +        #----
         2466  +        cd $S_FP_ORIG
         2467  +        exit 1 # exit with error
         2468  +    fi
         2469  +    basename $S_FP_0 1>/dev/null # to set a value to the $? in this scope 
         2470  +    if [ "$?" != "0" ]; then
         2471  +        echo ""
         2472  +        echo "The command "
         2473  +        echo ""
         2474  +        echo "    basename $S_FP_0 "
         2475  +        echo ""
         2476  +        echo "exited with an error."
         2477  +        echo "GUID=='ec6c175c-bab0-408a-b38d-802070e031e7'"
         2478  +        echo ""
         2479  +        #----
         2480  +        cd $S_FP_ORIG
         2481  +        exit 1 # exit with error
         2482  +    fi 
         2483  +    S_TMP_0="`basename $S_FP_0`"
         2484  +    if [ "$S_TMP_0" == "" ]; then
         2485  +        echo ""
         2486  +        echo "The file path candidate must be a string that "
         2487  +        echo "is not an empty string after "
         2488  +        echo "all of the spaces and tabs have been removed from it."
         2489  +        echo "GUID=='1b402ae2-09dd-45fc-b28d-802070e031e7'"
         2490  +        echo ""
         2491  +        #----
         2492  +        cd $S_FP_ORIG
         2493  +        exit 1 # exit with error
         2494  +    fi 
         2495  +    #--------
         2496  +    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_GET_PACKET_FORMAT_VERSION_T1_RESULT=""
         2497  +    local S_OUT="unsupported_by_this_script_version"
         2498  +    #--------
         2499  +    # In Ruby
         2500  +    #     "foo.stblob"[0..(-8)]=="foo"
         2501  +    #     "foo.stblob"[(-99)..(-1)]==nil
         2502  +    # 
         2503  +    local S_TMP_1="`ruby -e \"\
         2504  +        x='$S_TMP_0'[0..(-8)];\
         2505  +        if(x!=nil) then\
         2506  +            md=x.reverse.match(/v[\\d]+/);\
         2507  +            if(md!=nil) then\
         2508  +                s_0=(md[0].to_s)[1..(-1)];\
         2509  +                print(s_0.sub(/^[0]+/,''));\
         2510  +            end;\
         2511  +        end;\
         2512  +        \"`"
         2513  +    # echo "$S_TMP_0"
         2514  +    # echo "$S_TMP_1"
         2515  +    #----
         2516  +    if [ "$S_TMP_1" != "" ]; then
         2517  +        S_OUT="silktorrent_packet_format_version_$S_TMP_1"
         2518  +    fi 
         2519  +    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_GET_PACKET_FORMAT_VERSION_T1_RESULT="$S_OUT"
         2520  +} # func_mmmv_silktorrent_packager_t1_bash_get_packet_format_version_t1
         2521  +
         2522  +
         2523  +#--------------------------------------------------------------------------
         2524  +
         2525  +S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_VERIFY_FILE_NAME_T1_RESULT="not set"
         2526  +func_mmmv_silktorrent_packager_t1_bash_verify_file_name_t1() { 
         2527  +    local S_FP_0="$1" # Path to the file. 
         2528  +    #----
         2529  +    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
         2530  +    #--------
         2531  +    func_mmmv_silktorrent_packager_t1_bash_get_packet_format_version_t1 "$S_FP_0"
         2532  +    local S_PACKET_FORMAT="$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_GET_PACKET_FORMAT_VERSION_T1_RESULT"
         2533  +    if [ "$S_PACKET_FORMAT" == "unsupported_by_this_script_version" ]; then
         2534  +        echo ""
         2535  +        echo "There exists a possibility that the "
         2536  +        echo "Silktorrent packet candidate is actually OK, but "
         2537  +        echo "this is an older version of the Silktorrent implementation and "
         2538  +        echo "the older version does not support "
         2539  +        echo "newer Silktorrent packet formats. "
         2540  +        echo "The file path of the Silktorrent packet candidate:"
         2541  +        echo ""
         2542  +        echo "    $S_FP_0"
         2543  +        echo ""
         2544  +        echo "GUID=='5aa78147-2c10-4f63-947d-802070e031e7'"
         2545  +        echo ""
         2546  +        #----
         2547  +        cd $S_FP_ORIG
         2548  +        exit 1 # exit with error
         2549  +    fi
         2550  +    #--------
         2551  +    local S_TMP_1=""
         2552  +    if [ "$S_PACKET_FORMAT" == "silktorrent_packet_format_version_1" ]; then
         2553  +        func_mmmv_silktorrent_packager_t1_bash_blob2filename_t1 "$S_FP_0"
         2554  +        #echo "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_BLOB2FILENAME_T1_RESULT"
         2555  +        S_TMP_1="$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_BLOB2FILENAME_T1_RESULT"
         2556  +    fi
         2557  +    #----
         2558  +    if [ "$S_TMP_1" == "" ]; then
         2559  +        echo ""
         2560  +        echo "This script is flawed."
         2561  +        echo "It should have thrown before the control flow reaches this line."
         2562  +        echo "GUID=='318cca35-4f39-4a2c-937d-802070e031e7'"
         2563  +        echo ""
         2564  +        #----
         2565  +        cd $S_FP_ORIG
         2566  +        exit 1 # exit with error
         2567  +    fi
         2568  +    #--------
         2569  +    local S_TMP_0="`basename $S_FP_0`" # The S_TMP_0 must be evaluated 
         2570  +                                       # after the various functions to 
         2571  +                                       # counter a situation, where 
         2572  +                                       # the S_TMP_0 is overwritten 
         2573  +                                       # by the name-calc function 
         2574  +                                       # or by one of the sub-functions
         2575  +                                       # of the name-calc function.
         2576  +                                       # The flaw occurs, when the 
         2577  +                                       # S_TMP_0 is used within the 
         2578  +                                       # name-calc function without  
         2579  +                                       # declaring it to be a local
         2580  +                                       # variable.
         2581  +    #--------
         2582  +    #echo "S_FP_0==$S_FP_0"
         2583  +    #echo "S_TMP_0==$S_TMP_0"
         2584  +    #echo "S_TMP_1==$S_TMP_1"
         2585  +    local S_OUT=""
         2586  +    if [ "$S_TMP_1" == "$S_TMP_0" ]; then
         2587  +        S_OUT="verification_passed"
         2588  +    else
         2589  +        S_OUT="verification_failed"
         2590  +    fi
         2591  +    S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_VERIFY_FILE_NAME_T1_RESULT="$S_OUT"
         2592  +} # func_mmmv_silktorrent_packager_t1_bash_verify_file_name_t1
         2593  +
         2594  +
         2595  +#--------------------------------------------------------------------------
         2596  +
         2597  +func_mmmv_silktorrent_packager_t1_bash_test_1() { 
         2598  +    local S_FP_0="$1" # Path to the file. 
         2599  +    #----
         2600  +    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
         2601  +    #--------
         2602  +    echo ""
         2603  +    #----
         2604  +    func_mmmv_tigerhash_t1 "$S_FP_0"
         2605  +    echo "       Tiger: $S_FUNC_MMMV_TIGERHASH_T1_RESULT"
         2606  +    func_mmmv_whirlpoolhash_t1 "$S_FP_0"
         2607  +    echo "   Whirlpool: $S_FUNC_MMMV_WHIRLPOOLHASH_T1_RESULT"
         2608  +    func_mmmv_sha256_t1 "$S_FP_0"
         2609  +    echo "      SHA256: $S_FUNC_MMMV_SHA256_T1_RESULT"
         2610  +    func_mmmv_filesize_t1 "$S_FP_0"
         2611  +    echo "   file size: $S_FUNC_MMMV_FILESIZE_T1_RESULT"
         2612  +    #----
         2613  +    echo ""
         2614  +} # func_mmmv_silktorrent_packager_t1_bash_test_1
         2615  +
         2616  +
         2617  +#--------------------------------------------------------------------------
         2618  +
         2619  +func_mmmv_silktorrent_packager_t1_bash_wrap_t1() {
         2620  +    local S_FP_0="$1" # Path to the file. 
         2621  +    #----
         2622  +    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
         2623  +    #--------
         2624  +    func_mmmv_create_tmp_folder_t1
         2625  +    if [ "$S_FUNC_FUNC_MMMV_CREATE_TMP_FOLDER_T1_RESULT" == "" ]; then
         2626  +        echo "This script is flawed, because the folder "
         2627  +        echo "creation function should have thrown "
         2628  +        echo "before the control flow reaches this branch." 
         2629  +        echo "GUID=='dc42402d-7e17-46e1-b57d-802070e031e7'"
         2630  +        #----
         2631  +        cd $S_FP_ORIG
         2632  +        exit 1 # exit with error
         2633  +    fi
         2634  +    local S_FP_TMP_0="$S_FUNC_FUNC_MMMV_CREATE_TMP_FOLDER_T1_RESULT"
         2635  +    if [ ! -e "$S_FP_TMP_0" ]; then
         2636  +        echo "This script is flawed."
         2637  +        echo "May be some other thread deleted the folder or"
         2638  +        echo "the folder creation function returned a valid path, but"
         2639  +        echo "did not actually create the folder that it was supposed create."
         2640  +        echo "S_FP_TMP_0==$S_FP_TMP_0"
         2641  +        echo "GUID=='3511389d-bb47-4185-a57d-802070e031e7'"
         2642  +        #----
         2643  +        cd $S_FP_ORIG
         2644  +        exit 1 # exit with error
         2645  +    fi
         2646  +    #--------
         2647  +    local S_TMP_0="" # declaration
         2648  +    local S_TMP_1="" # declaration
         2649  +    local S_FN_CUSTOM_HEADERS="custom_headers"
         2650  +    local S_FP_TMP_SILKTORRENT_PACKET="$S_FP_TMP_0/silktorrent_packet"
         2651  +    local S_FP_TMP_SILKTORRENT_PACKET_TAR="$S_FP_TMP_0/silktorrent_packet.tar"
         2652  +    local S_FP_TMP_PAYLOAD="$S_FP_TMP_SILKTORRENT_PACKET/payload"
         2653  +    local S_FP_TMP_HEADER="$S_FP_TMP_SILKTORRENT_PACKET/header"
         2654  +    local S_FP_TMP_HEADER_SALT_TXT="$S_FP_TMP_HEADER/silktorrent_salt.txt"
         2655  +    func_mmmv_create_folder_if_it_does_not_already_exist_t1 "$S_FP_TMP_PAYLOAD" # uses mkdir -p
         2656  +    func_mmmv_create_folder_if_it_does_not_already_exist_t1 "$S_FP_TMP_HEADER"
         2657  +    #--------
         2658  +    S_TMP_0="`pwd`/$S_FN_CUSTOM_HEADERS"
         2659  +    if [ -e "$S_TMP_0" ]; then
         2660  +        if [ ! -d "$S_TMP_0" ]; then
         2661  +            echo ""
         2662  +            echo "The "
         2663  +            echo ""
         2664  +            echo "    $S_TMP_0"
         2665  +            echo ""
         2666  +            echo "exists, but it is not a folder."
         2667  +            echo "GUID=='46e9e734-c3b4-44f5-847d-802070e031e7'"
         2668  +            echo ""
         2669  +            #----
         2670  +            cd $S_FP_ORIG
         2671  +            exit 1 # exit with error
         2672  +        fi
         2673  +        #----
         2674  +        # Number of files/folders in the $S_TMP_0, if counted non-recursively.
         2675  +        S_TMP_1="`cd $S_TMP_0; ruby -e \"print(Dir::glob('*').size.to_s)\"`" 
         2676  +        #----
         2677  +        if [ "$S_TMP_1" == "" ]; then
         2678  +            echo ""
         2679  +            echo "This script is flawed."
         2680  +            echo ""
         2681  +            echo "    pwd=`pwd`"
         2682  +            echo "    S_TMP_0=$S_TMP_0"
         2683  +            echo ""
         2684  +            echo "GUID=='65b01b46-fdbb-4aa0-b46d-802070e031e7'"
         2685  +            echo ""
         2686  +            #----
         2687  +            cd $S_FP_ORIG
         2688  +            exit 1 # exit with error
         2689  +        fi
         2690  +        if [ "$S_TMP_1" != "0" ]; then
         2691  +            cp -f -R $S_TMP_0 $S_FP_TMP_HEADER/
         2692  +            if [ "$?" != "0" ]; then
         2693  +                echo ""
         2694  +                echo "The recursive copying of the folder "
         2695  +                echo ""
         2696  +                echo "    $S_TMP_0 "
         2697  +                echo ""
         2698  +                echo "failed with an error code of $?."
         2699  +                echo "GUID=='2a2c784c-31d4-4c87-816d-802070e031e7'"
         2700  +                echo ""
         2701  +                #----
         2702  +                cd $S_FP_ORIG
         2703  +                exit 1 # exit with error
         2704  +            fi
         2705  +        fi
         2706  +    fi
         2707  +    #--------
         2708  +    # Salting makes sure that it is not possible to 
         2709  +    # conclude the payload bitstream from the 
         2710  +    # Silktorrent packet (file) name, forcing censoring
         2711  +    # parties to download packages 
         2712  +    # that they are not looking for and allowing
         2713  +    # censorship dodgers to publish the same payload bitstream
         2714  +    # in multiple, differet, Silktorrent packages.
         2715  +    func_mmmv_GUID_t1
         2716  +    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
         2717  +    func_mmmv_GUID_t1
         2718  +    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
         2719  +    func_mmmv_GUID_t1
         2720  +    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
         2721  +    func_mmmv_GUID_t1
         2722  +    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
         2723  +    func_mmmv_GUID_t1
         2724  +    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
         2725  +    func_mmmv_GUID_t1
         2726  +    echo "$S_FUNC_MMMV_GUID_T1_RESULT" >> $S_FP_TMP_HEADER_SALT_TXT
         2727  +    #-------------------------
         2728  +    # The file size/Silktorrent pakcket size must also be salted.
         2729  +    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION_WARP_NRAND" != "" ]; then
         2730  +        ruby -e \
         2731  +            "Random.new_seed;i=0;\
         2732  +             puts '';\
         2733  +             (10+$S_SILKTORRENT_PACKAGER_T1_ACTION_WARP_NRAND).times{\
         2734  +                 i=i+1;\
         2735  +                 print(rand(10**6).to_s(16));\
         2736  +                 if((i%10)==0) then \
         2737  +                     puts '';\
         2738  +                     i=0;\
         2739  +                 end;\
         2740  +             }" \
         2741  +             >> $S_FP_TMP_HEADER_SALT_TXT
         2742  +    else 
         2743  +        ruby -e \
         2744  +            "Random.new_seed;i=0;\
         2745  +             puts '';\
         2746  +             rand(10**6).times{\
         2747  +                 i=i+1;\
         2748  +                 print(rand(10**6).to_s(16));\
         2749  +                 if((i%10)==0) then \
         2750  +                     puts '';\
         2751  +                     i=0;\
         2752  +                 end;\
         2753  +             }" \
         2754  +             >> $S_FP_TMP_HEADER_SALT_TXT
         2755  +    fi
         2756  +    if [ "$?" != "0" ]; then
         2757  +        echo ""
         2758  +        echo "Salting failed. \$?==$?"
         2759  +        echo "GUID=='39232452-bcfd-42cb-915d-802070e031e7'"
         2760  +        echo ""
         2761  +        #----
         2762  +        cd $S_FP_ORIG
         2763  +        exit 1 # exit with error
         2764  +    fi
         2765  +    #-------------------------
         2766  +    cp -f $S_FP_0 $S_FP_TMP_PAYLOAD/
         2767  +    if [ "$?" != "0" ]; then
         2768  +        echo ""
         2769  +        echo "The command "
         2770  +        echo ""
         2771  +        echo "    cp -f \$S_FP_0 \$S_FP_TMP_PAYLOAD/ "
         2772  +        echo ""
         2773  +        echo "failed. Either this script is flawed or something else went wrong. "
         2774  +        echo ""
         2775  +        echo "    S_FP_0==$S_FP_0"
         2776  +        echo ""
         2777  +        echo "    S_FP_TMP_PAYLOAD=$S_FP_TMP_PAYLOAD"
         2778  +        echo ""
         2779  +        echo "GUID=='786ab828-2356-4699-a55d-802070e031e7'"
         2780  +        echo ""
         2781  +        #----
         2782  +        cd $S_FP_ORIG
         2783  +        exit 1 # exit with error
         2784  +    fi
         2785  +    #--------
         2786  +    local S_FP_TMP_ORIG_0="`pwd`"
         2787  +    cd $S_FP_TMP_SILKTORRENT_PACKET/.. 
         2788  +    tar -cf $S_FP_TMP_SILKTORRENT_PACKET_TAR ./`basename $S_FP_TMP_SILKTORRENT_PACKET` 2>/dev/null
         2789  +    cd $S_FP_TMP_ORIG_0
         2790  +    if [ "$?" != "0" ]; then
         2791  +        echo ""
         2792  +        echo "The command "
         2793  +        echo ""
         2794  +        echo "    tar -cf \$S_FP_TMP_SILKTORRENT_PACKET_TAR \$S_FP_TMP_SILKTORRENT_PACKET "
         2795  +        echo ""
         2796  +        echo "failed. Either this script is flawed or something else went wrong. "
         2797  +        echo ""
         2798  +        echo "    S_FP_TMP_SILKTORRENT_PACKET=$S_FP_TMP_SILKTORRENT_PACKET"
         2799  +        echo ""
         2800  +        echo "    S_FP_TMP_SILKTORRENT_PACKET_TAR==$S_FP_TMP_SILKTORRENT_PACKET_TAR"
         2801  +        echo ""
         2802  +        echo "GUID=='b1be543c-0c81-42c8-825d-802070e031e7'"
         2803  +        echo ""
         2804  +        #----
         2805  +        cd $S_FP_ORIG
         2806  +        exit 1 # exit with error
         2807  +    fi
         2808  +    #----
         2809  +    func_mmmv_silktorrent_packager_t1_bash_blob2filename_t1 "$S_FP_TMP_SILKTORRENT_PACKET_TAR"
         2810  +    local S_FP_TMP_SILKTORRENT_PACKET_PUBLISHINGNAME="$S_FP_ORIG/$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_BLOB2FILENAME_T1_RESULT"
         2811  +    #---------
         2812  +    # The 2> /dev/null part is due some weird to BSD peculiarity. 
         2813  +    # The actual success/failure of the mv command is tested after
         2814  +    # its execution anyway.
         2815  +    mv -f $S_FP_TMP_SILKTORRENT_PACKET_TAR $S_FP_TMP_SILKTORRENT_PACKET_PUBLISHINGNAME 2> /dev/null
         2816  +    #---------
         2817  +    if [ "$?" != "0" ]; then
         2818  +        echo ""
         2819  +        echo "Something went wrong."
         2820  +        echo "The renaming and copying of "
         2821  +        echo "    $S_FP_TMP_SILKTORRENT_PACKET_TAR "
         2822  +        echo "to "
         2823  +        echo "    $S_FP_TMP_SILKTORRENT_PACKET_PUBLISHINGNAME "
         2824  +        echo "failed."
         2825  +        echo "GUID=='cd0cd93e-d77d-4baf-925d-802070e031e7'"
         2826  +        echo ""
         2827  +        #----
         2828  +        cd $S_FP_ORIG
         2829  +        exit 1 # exit with error
         2830  +    fi
         2831  +    if [ ! -e "$S_FP_TMP_SILKTORRENT_PACKET_PUBLISHINGNAME" ]; then
         2832  +        echo ""
         2833  +        echo "Something went wrong."
         2834  +        echo "The renaming and copying of "
         2835  +        echo ""
         2836  +        echo "    $S_FP_TMP_SILKTORRENT_PACKET_TAR "
         2837  +        echo ""
         2838  +        echo "to "
         2839  +        echo ""
         2840  +        echo "    $S_FP_TMP_SILKTORRENT_PACKET_PUBLISHINGNAME "
         2841  +        echo ""
         2842  +        echo "failed. The mv command succeed, but for some reason "
         2843  +        echo "the destination file does not exist."
         2844  +        echo "GUID=='c9a3b13f-36b4-4aac-955d-802070e031e7'"
         2845  +        echo ""
         2846  +        #----
         2847  +        cd $S_FP_ORIG
         2848  +        exit 1 # exit with error
         2849  +    fi
         2850  +    #--------
         2851  +    func_mmmv_delete_tmp_folder_t1 "$S_FP_TMP_0"
         2852  +    if [ -e "$S_FP_TMP_0" ]; then
         2853  +        echo ""
         2854  +        echo "Something went wrong."
         2855  +        echo "The deletion of the temporary folder, "
         2856  +        echo ""
         2857  +        echo "    $S_FP_TMP_0"
         2858  +        echo ""
         2859  +        echo "failed."
         2860  +        echo "GUID=='a2020c3b-30cf-49ee-a44d-802070e031e7'"
         2861  +        echo ""
         2862  +        #----
         2863  +        cd $S_FP_ORIG
         2864  +        exit 1 # exit with error
         2865  +    fi
         2866  +} # func_mmmv_silktorrent_packager_t1_bash_wrap_t1
         2867  +
         2868  +
         2869  +#--------------------------------------------------------------------------
         2870  +
         2871  +func_mmmv_silktorrent_packager_t1_bash_unwrap_t1() {
         2872  +    local S_FP_0="$1" # Path to the file. 
         2873  +    #----
         2874  +    func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_FP_0"
         2875  +    #--------
         2876  +    func_mmmv_silktorrent_packager_t1_bash_verify_file_name_t1 "$S_FP_0"
         2877  +    local S_PACKET_FORMAT="$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_GET_PACKET_FORMAT_VERSION_T1_RESULT"
         2878  +    if [ "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_VERIFY_FILE_NAME_T1_RESULT" != "verification_passed" ]; then
         2879  +        echo ""
         2880  +        echo "The Silktorrent packet candidate, "
         2881  +        echo ""
         2882  +        echo "    $S_FP_0"
         2883  +        echo ""
         2884  +        echo "failed Silktorrent packet name verification."
         2885  +        echo "There exists a possibility that the "
         2886  +        echo "Silktorrent packet candidate is actually OK, but "
         2887  +        echo "this is an older version of the Silktorrent implementation and "
         2888  +        echo "this, the older, version does not support "
         2889  +        echo "newer Silktorrent packet formats. "
         2890  +        echo "GUID=='64351e84-6947-4dd0-954d-802070e031e7'"
         2891  +        echo ""
         2892  +        #----
         2893  +        cd $S_FP_ORIG
         2894  +        exit 1 # exit with error
         2895  +    fi
         2896  +    #--------
         2897  +    local SB_FORMAT_BRANCH_EXISTS_IN_THIS_FUNCTION="f"
         2898  +    if [ "$S_PACKET_FORMAT" == "silktorrent_packet_format_version_1" ]; then
         2899  +        SB_FORMAT_BRANCH_EXISTS_IN_THIS_FUNCTION="t"
         2900  +        #----
         2901  +        local S_FP_TMP_SILKTORRENT_PACKET="`pwd`/silktorrent_packet"
         2902  +        if [ -e $S_FP_TMP_SILKTORRENT_PACKET ]; then
         2903  +            echo ""
         2904  +            echo "To avoid accidental deletion of files, "
         2905  +            echo "and some other types of flaws, "
         2906  +            echo "there is a requirement that the folder "
         2907  +            echo ""
         2908  +            echo "    ./silktorrent_packet"
         2909  +            echo ""
         2910  +            echo "must be explicitly deleted before calling this script."
         2911  +            echo "GUID=='571e3875-32e0-48d8-933d-802070e031e7'"
         2912  +            echo ""
         2913  +            #----
         2914  +            cd $S_FP_ORIG
         2915  +            exit 1 # exit with error
         2916  +        fi
         2917  +        #----
         2918  +        tar -xf $S_FP_0 2>/dev/null
         2919  +        if [ "$?" != "0" ]; then
         2920  +            echo ""
         2921  +            echo "Something went wrong. The command "
         2922  +            echo ""
         2923  +            echo "    tar -xf $S_FP_0"
         2924  +            echo ""
         2925  +            echo "exited with an error code, which is $? ."
         2926  +            echo "GUID=='1485b83e-0109-401a-b13d-802070e031e7'"
         2927  +            echo ""
         2928  +            #----
         2929  +            cd $S_FP_ORIG
         2930  +            exit 1 # exit with error
         2931  +        fi
         2932  +        rm -f $S_FP_TMP_SILKTORRENT_PACKET/header/silktorrent_salt.txt
         2933  +        #----
         2934  +        if [ ! -e $S_FP_TMP_SILKTORRENT_PACKET ]; then
         2935  +            echo ""
         2936  +            echo "Something went wrong. "
         2937  +            echo "The unpacking of the Silktorrent packet with the path of "
         2938  +            echo ""
         2939  +            echo "    $S_FP_0"
         2940  +            echo ""
         2941  +            echo "failed. The folder \"silktorrent_packet\" "
         2942  +            echo "is missing after the \"tar\" exited without any errors."
         2943  +            echo "GUID=='56860551-0d8f-4d2e-a32d-802070e031e7'"
         2944  +            echo ""
         2945  +            #----
         2946  +            cd $S_FP_ORIG
         2947  +            exit 1 # exit with error
         2948  +        fi
         2949  +    fi # silktorrent_packet_format_version_1
         2950  +    #--------
         2951  +    if [ "$SB_FORMAT_BRANCH_EXISTS_IN_THIS_FUNCTION" != "t" ]; then
         2952  +        echo ""
         2953  +        echo "This script is flawed."
         2954  +        echo "There is at least one branch missing from this function."
         2955  +        echo "GUID=='12813f55-2652-4329-a42d-802070e031e7'"
         2956  +        echo ""
         2957  +        #----
         2958  +        cd $S_FP_ORIG
         2959  +        exit 1 # exit with error
         2960  +    fi
         2961  +    #--------
         2962  +} # func_mmmv_silktorrent_packager_t1_bash_unwrap_t1
         2963  +
         2964  +
         2965  +#--------------------------------------------------------------------------
         2966  +
         2967  +func_mmmv_silktorrent_packager_t1_bash_verify_packet_name_format_v1(){
         2968  +    local S_PACKET_NAME_CANDIDATE="$1" 
         2969  +    if [ "$S_PACKET_NAME_CANDIDATE" == "" ]; then
         2970  +        echo ""
         2971  +        echo "This script is flawed."
         2972  +        echo "Input verification should have caught the "
         2973  +        echo "\"\" case before the control flow reaches this line."
         2974  +        echo "GUID=='dcdaa214-e5cf-4d89-a32d-802070e031e7'"
         2975  +        echo ""
         2976  +        #----
         2977  +        cd $S_FP_ORIG
         2978  +        exit 1 # exit with error
         2979  +    fi
         2980  +    #--------
         2981  +    local S_OUT="verification_failed" # opposite: "verification_passed"
         2982  +
         2983  +    #                         rgx_in_ruby=/v[\d]{4}[_]/
         2984  +    #                         rgx_in_ruby=/s[\d]+[_]/
         2985  +    #                         rgx_in_ruby=/h[\dabcdef]{64}[_]/
         2986  +    #                         rgx_in_ruby=/i[\dabcdef]{48}$/   # lacks the ending "_" 
         2987  +    #                                                          # for db index optimization
         2988  +    #------------------------------------------------------------------------------
         2989  +    #local S_RUBY_REGEX="/^X[\\dabcdef]{48}i[_][\\dabcdef]{64}h[_][\\d]+s[_][\\d]{4}v.stblobX\$/"
         2990  +    #                             Tiger             SHA-256       size     version
         2991  +    local S_RUBY_REGEX="/^X[\\dabcdef]{48}i[_][\\dabcdef]{64}h[_][\\d]+s[_]1000v.stblobX\$/"
         2992  +    #------------------------------------------------------------------------------
         2993  +    # test cases: 
         2994  +    #     ruby -e "puts(ARGV[0])" aa\ bb
         2995  +    #     printf %s "%q" "AA BB CC $^ \ / '\`\" <>()[];.{}" | xargs ruby -e "puts(ARGV[0])"
         2996  +    # 
         2997  +    # The S_PACKET_NAME_CANDIDATE might contain various quotation marks.
         2998  +    # If it does, then hopefully it crashes at least something so that
         2999  +    # the crash can be detected from the "$?". 
         3000  +    # The surrounding X-es, X<packet name candidate string>X, 
         3001  +    # are to counter a situation, where the file name candidate ends
         3002  +    # with a space, like "foo " and the Bash reads the console
         3003  +    # argument in as "foo" in stead of the "foo ". 
         3004  +    #----
         3005  +    #local S_TMP_0="`printf  \"%q\" \"'$S_PACKET_NAME_CANDIDATE'\" | xargs ruby -e \" \
         3006  +    local S_TMP_0="`ruby -e \" \
         3007  +        s_in=ARGV[0];\
         3008  +        rgx=$S_RUBY_REGEX;\
         3009  +        md=s_in.match(rgx);\
         3010  +        s_out='no_match';\
         3011  +        if(md!=nil) then \
         3012  +            s_out='match';\
         3013  +        end;\
         3014  +        printf(s_out);\
         3015  +        \" \"$S_PACKET_NAME_CANDIDATE\" `"
         3016  +    #----
         3017  +    if [ "$?" != "0" ]; then
         3018  +        echo ""
         3019  +        echo "Something went wrong. \$?==$? "
         3020  +        echo "    S_PACKET_NAME_CANDIDATE==$S_PACKET_NAME_CANDIDATE"
         3021  +        echo "GUID=='7ad3893e-ac0a-4e5f-b22d-802070e031e7'"
         3022  +        echo ""
         3023  +        #----
         3024  +        cd $S_FP_ORIG
         3025  +        exit 1 # exit with error
         3026  +    fi
         3027  +    #--------
         3028  +    # If the file name starts like "./foo" in stead of "foo", 
         3029  +    # then the verification also fails, 
         3030  +    # exactly as expected and demanded by the spec.
         3031  +    if [ "$S_TMP_0" == "match" ]; then
         3032  +        S_OUT="verification_passed" # opposite: "verification_failed"
         3033  +    fi
         3034  +    #--------
         3035  +    echo "$S_OUT"
         3036  +} # func_mmmv_silktorrent_packager_t1_bash_verify_packet_name_format_v1
         3037  +
         3038  +
         3039  +#--------------------------------------------------------------------------
         3040  +
         3041  +# The 
         3042  +S_SILKTORRENT_PACKAGER_T1_ACTION="" # is global to allow it to be used in the 
         3043  +                                    # error messages of different functions.
         3044  +S_SILKTORRENT_PACKAGER_T1_ACTION_WARP_NRAND="" 
         3045  +
         3046  +#--------------------------------------------------------------------------
         3047  +
         3048  +
         3049  +func_mmmv_silktorrent_packager_t1_bash_determine_action() { 
         3050  +    local S_ARGV_0="$1" # Ruby style ARGV, 0 is the first command line argument.
         3051  +    local S_ARGV_1="$2" 
         3052  +    local S_ARGV_2="$3" 
         3053  +    local S_ARGV_3="$4" 
         3054  +    #--------
         3055  +    if [ "$S_ARGV_0" == "" ]; then
         3056  +        func_mmmv_silktorrent_packager_t1_bash_print_help_msg_t1
         3057  +        #----
         3058  +        cd $S_FP_ORIG
         3059  +        exit 1 # exit with an error
         3060  +    fi
         3061  +    #----
         3062  +    local SB_0="f"
         3063  +    if [ "$S_ARGV_0" == "help" ]; then
         3064  +        SB_0="t"
         3065  +    fi
         3066  +    if [ "$S_ARGV_0" == "--help" ]; then
         3067  +        SB_0="t"
         3068  +    fi
         3069  +    if [ "$S_ARGV_0" == "?" ]; then
         3070  +        SB_0="t"
         3071  +    fi
         3072  +    if [ "$S_ARGV_0" == "-?" ]; then
         3073  +        SB_0="t"
         3074  +    fi
         3075  +    if [ "$S_ARGV_0" == "h" ]; then
         3076  +        SB_0="t"
         3077  +    fi
         3078  +    if [ "$S_ARGV_0" == "-h" ]; then
         3079  +        SB_0="t"
         3080  +    fi
         3081  +    #----
         3082  +    if [ "$SB_0" == "t" ]; then
         3083  +        func_mmmv_assert_arg_is_absent_t1 \
         3084  +                "$S_ARGV_1" \
         3085  +                "2. console argument" \
         3086  +                "adf5cf2f-6fb0-4e01-836f-802070e031e7"
         3087  +        func_mmmv_silktorrent_packager_t1_bash_print_help_msg_t1
         3088  +        #----
         3089  +        cd $S_FP_ORIG
         3090  +        exit 0 # exit without an error
         3091  +    fi
         3092  +    #--------------------------
         3093  +    if [ "$S_ARGV_0" == "version" ]; then
         3094  +        SB_0="t"
         3095  +    fi
         3096  +    if [ "$S_ARGV_0" == "--version" ]; then
         3097  +        SB_0="t"
         3098  +    fi
         3099  +    if [ "$S_ARGV_0" == "-version" ]; then
         3100  +        SB_0="t"
         3101  +    fi
         3102  +    if [ "$S_ARGV_0" == "v" ]; then
         3103  +        SB_0="t"
         3104  +    fi
         3105  +    if [ "$S_ARGV_0" == "-v" ]; then
         3106  +        SB_0="t"
         3107  +    fi
         3108  +    #----
         3109  +    if [ "$SB_0" == "t" ]; then
         3110  +        func_mmmv_assert_arg_is_absent_t1 \
         3111  +                "$S_ARGV_1" \
         3112  +                "2. console argument" \
         3113  +                "546a64c2-96fe-41fa-8c6f-802070e031e7"
         3114  +        echo "$S_SCRIPT_VERSION"
         3115  +        #----
         3116  +        cd $S_FP_ORIG
         3117  +        exit 0 # exit without an error
         3118  +    fi
         3119  +    #--------------------------
         3120  +    if [ "$S_ARGV_0" == "version_timestamp" ]; then
         3121  +        SB_0="t"
         3122  +    fi
         3123  +    if [ "$S_ARGV_0" == "--version_timestamp" ]; then
         3124  +        SB_0="t"
         3125  +    fi
         3126  +    if [ "$S_ARGV_0" == "-version_timestamp" ]; then
         3127  +        SB_0="t"
         3128  +    fi
         3129  +    if [ "$S_ARGV_0" == "vt" ]; then
         3130  +        SB_0="t"
         3131  +    fi
         3132  +    if [ "$S_ARGV_0" == "-vt" ]; then
         3133  +        SB_0="t"
         3134  +    fi
         3135  +    #----
         3136  +    if [ "$SB_0" == "t" ]; then
         3137  +        func_mmmv_assert_arg_is_absent_t1 \
         3138  +                "$S_ARGV_1" \
         3139  +                "2. console argument" \
         3140  +                "39de2191-edc0-4e2a-b26f-802070e031e7"
         3141  +        echo "$S_SCRIPT_VERSION_GENERATION_DATE"
         3142  +        #----
         3143  +        cd $S_FP_ORIG
         3144  +        exit 0 # exit without an error
         3145  +    fi
         3146  +    #--------------------------
         3147  +    # Start of actions that require the existence of at least one file.
         3148  +    local SB_FILE_REQUIRED="t"
         3149  +    local SB_REQUESTED_ACTION_EXISTS="f"
         3150  +    local S_TMP_0=""
         3151  +    local S_TMP_1=""
         3152  +    S_SILKTORRENT_PACKAGER_T1_ACTION_WARP_NRAND=""
         3153  +    #----
         3154  +    S_TMP_0="wrap" 
         3155  +    if [ "$S_ARGV_0" == "$S_TMP_0" ]; then
         3156  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         3157  +        SB_REQUESTED_ACTION_EXISTS="t"
         3158  +    fi
         3159  +    if [ "$S_ARGV_0" == "pack" ]; then   # alias
         3160  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         3161  +        SB_REQUESTED_ACTION_EXISTS="t"
         3162  +    fi
         3163  +    if [ "$S_ARGV_0" == "w" ]; then   # alias
         3164  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         3165  +        SB_REQUESTED_ACTION_EXISTS="t"
         3166  +    fi
         3167  +    if [ "$S_ARGV_0" == "-w" ]; then   # alias
         3168  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         3169  +        SB_REQUESTED_ACTION_EXISTS="t"
         3170  +    fi
         3171  +    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "$S_TMP_0" ]; then
         3172  +        if [ "$S_ARGV_2" != "" ]; then
         3173  +            func_mmmv_x_positive_whole_number_or_an_emptystring_t1 "$S_ARGV_2"
         3174  +            S_TMP_1="$S_FUNC_MMMV_X_POSITIVE_WHOLE_NUMBER_OR_AN_EMPTYSTRING_T1_OUT"
         3175  +            if [ "$S_TMP_1" == "" ]; then
         3176  +                echo ""
         3177  +                echo ""
         3178  +                echo "The N_OF_RANDOM_TEXT_BLOCKS(==$S_ARGV_2) is expected "
         3179  +                echo "to be a positive whole number."
         3180  +                echo "GUID=='3e1e0843-9eb1-44ce-a51d-802070e031e7'"
         3181  +                echo ""
         3182  +                # func_mmmv_silktorrent_packager_t1_bash_print_help_msg_t1
         3183  +                #----
         3184  +                cd $S_FP_ORIG
         3185  +                exit 1 # exit with an error
         3186  +            fi
         3187  +            #-------------------------
         3188  +            # Sets a limit that files that 
         3189  +            # have spaces and tabs in their names can not be packed
         3190  +            # without renaming or wrapping them to some tar-file that 
         3191  +            # has a space-tab-linebreak-free name.
         3192  +            func_mmmv_assert_arg_is_absent_t1 \
         3193  +                    "$S_ARGV_3" \
         3194  +                    "4. console argument" \
         3195  +                    "1357302b-c0e2-4951-835f-802070e031e7"
         3196  +            #-------------------------
         3197  +            S_SILKTORRENT_PACKAGER_T1_ACTION_WARP_NRAND="$S_TMP_1" # ==N_OF_RANDOM_TEXT_BLOCKS
         3198  +        fi
         3199  +    fi
         3200  +    #----
         3201  +    S_TMP_0="unwrap" 
         3202  +    if [ "$S_ARGV_0" == "$S_TMP_0" ]; then
         3203  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         3204  +        SB_REQUESTED_ACTION_EXISTS="t"
         3205  +    fi
         3206  +    if [ "$S_ARGV_0" == "unpack" ]; then # alias
         3207  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         3208  +        SB_REQUESTED_ACTION_EXISTS="t"
         3209  +    fi
         3210  +    if [ "$S_ARGV_0" == "uw" ]; then # alias
         3211  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         3212  +        SB_REQUESTED_ACTION_EXISTS="t"
         3213  +    fi
         3214  +    if [ "$S_ARGV_0" == "-uw" ]; then # alias
         3215  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         3216  +        SB_REQUESTED_ACTION_EXISTS="t"
         3217  +    fi
         3218  +    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "$S_TMP_0" ]; then
         3219  +        # A more streightforward check would be:
         3220  +        #
         3221  +        # func_mmmv_assert_arg_is_absent_t1 \
         3222  +        #         "$S_ARGV_3" \
         3223  +        #         "4. console argument" \
         3224  +        #         "cefb292e-5c50-4f00-b45f-802070e031e7"
         3225  +        #
         3226  +        # but in the case of the unwrap command the hack in this if-clause
         3227  +        # gives a more informative error message for 
         3228  +        # Silktorrent packet candidate files that have spaces in their name 
         3229  +        if [ "$S_ARGV_2" != "" ]; then
         3230  +            S_SILKTORRENT_PACKAGER_T1_ACTION="verify_packet_name_format_v1"
         3231  +        fi
         3232  +    fi
         3233  +    #----
         3234  +    S_TMP_0="verify" # checks the match between the blob and the file name
         3235  +    if [ "$S_ARGV_0" == "$S_TMP_0" ]; then
         3236  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         3237  +        SB_REQUESTED_ACTION_EXISTS="t"
         3238  +    fi
         3239  +    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "$S_TMP_0" ]; then
         3240  +        func_mmmv_assert_arg_is_absent_t1 \
         3241  +                "$S_ARGV_2" \
         3242  +                "3. console argument" \
         3243  +                "23069114-3e88-40ca-b55f-802070e031e7"
         3244  +    fi
         3245  +    #----
         3246  +    S_TMP_0="test_hash_t1" 
         3247  +    if [ "$S_ARGV_0" == "$S_TMP_0" ]; then
         3248  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         3249  +        SB_REQUESTED_ACTION_EXISTS="t"
         3250  +    fi
         3251  +    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "$S_TMP_0" ]; then
         3252  +        func_mmmv_assert_arg_is_absent_t1 \
         3253  +                "$S_ARGV_2" \
         3254  +                "3. console argument" \
         3255  +                "f4081fa5-06ca-440d-915f-802070e031e7"
         3256  +    fi
         3257  +    #--------
         3258  +    # Start of actions that do not require a file:
         3259  +    S_TMP_0="verify_packet_name_format_v1" 
         3260  +    if [ "$S_ARGV_0" == "$S_TMP_0" ]; then
         3261  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         3262  +        SB_REQUESTED_ACTION_EXISTS="t"
         3263  +        SB_FILE_REQUIRED="f"
         3264  +    fi
         3265  +    if [ "$S_ARGV_0" == "--verify_packet_name_format_v1" ]; then 
         3266  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         3267  +        SB_REQUESTED_ACTION_EXISTS="t"
         3268  +        SB_FILE_REQUIRED="f"
         3269  +    fi
         3270  +    if [ "$S_ARGV_0" == "verify_package_name_format_v1" ]; then 
         3271  +        #  differs from $S_TMP_0 at AAA
         3272  +        #------------------------------------------------           
         3273  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         3274  +        SB_REQUESTED_ACTION_EXISTS="t"
         3275  +        SB_FILE_REQUIRED="f"
         3276  +    fi
         3277  +    if [ "$S_ARGV_0" == "--verify_package_name_format_v1" ]; then 
         3278  +        #    differs from $S_TMP_0 at AAA
         3279  +        #------------------------------------------------           
         3280  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         3281  +        SB_REQUESTED_ACTION_EXISTS="t"
         3282  +        SB_FILE_REQUIRED="f"
         3283  +    fi
         3284  +    if [ "$S_ARGV_0" == "vnf1" ]; then  # abbreviation of "verify name format v1"
         3285  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         3286  +        SB_REQUESTED_ACTION_EXISTS="t"
         3287  +        SB_FILE_REQUIRED="f"
         3288  +    fi
         3289  +    if [ "$S_ARGV_0" == "-vnf1" ]; then  # abbreviation of "verify name format v1"
         3290  +        S_SILKTORRENT_PACKAGER_T1_ACTION="$S_TMP_0"
         3291  +        SB_REQUESTED_ACTION_EXISTS="t"
         3292  +        SB_FILE_REQUIRED="f"
         3293  +    fi
         3294  +    # The 3. console argument presence/absence check must be
         3295  +    # intentionally skipped for the "verify_packet_name_format_v1", because 
         3296  +    # the console output must return a specific string in the case of 
         3297  +    # a packet name format verification failure and any string, 
         3298  +    # including the strings that include spaces, must be allowed to be verified.
         3299  +    # 
         3300  +    # A thing to keep in mind is also that the "unwrap" command 
         3301  +    # reverts to the "verify_packet_name_format_v1" command, if the 
         3302  +    # file name of a Silktorrent packet candidate contains any spaces.
         3303  +    #----------------------------------------------------------------------
         3304  +    if [ "$SB_REQUESTED_ACTION_EXISTS" != "t" ]; then # lack of action included
         3305  +        func_mmmv_silktorrent_packager_t1_bash_print_help_msg_t1
         3306  +        #----
         3307  +        cd $S_FP_ORIG
         3308  +        exit 1 # exit with an error
         3309  +    fi
         3310  +    SB_REQUESTED_ACTION_EXISTS="f" # a reset to anticipate flaws elsewhere
         3311  +    # The action name test above has to be before the 
         3312  +    if [ "$SB_FILE_REQUIRED" == "t" ]; then
         3313  +        func_mmmv_silktorrent_packager_t1_bash_exc_assert_wrappable_file_exists_t1 "$S_ARGV_1"
         3314  +    else 
         3315  +        func_mmmv_silktorrent_packager_t1_bash_exc_assert_packet_name_candidate_exists_t1 "$S_ARGV_1"
         3316  +    fi
         3317  +    # because otherwise the error messages would be incorrect.
         3318  +    #--------
         3319  +    # The following duplicating series of if-clauses is to allow 
         3320  +    # actions to have aliases.
         3321  +    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "wrap" ]; then
         3322  +        func_mmmv_silktorrent_packager_t1_bash_wrap_t1 "$S_ARGV_1"
         3323  +        #----
         3324  +        cd $S_FP_ORIG
         3325  +        exit 0 # exit without an error
         3326  +    fi
         3327  +    #----
         3328  +    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "unwrap" ]; then
         3329  +        func_mmmv_silktorrent_packager_t1_bash_unwrap_t1 "$S_ARGV_1"
         3330  +        #----
         3331  +        cd $S_FP_ORIG
         3332  +        exit 0 # exit without an error
         3333  +    fi
         3334  +    #----
         3335  +    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "verify" ]; then
         3336  +        func_mmmv_silktorrent_packager_t1_bash_verify_file_name_t1 "$S_ARGV_1"
         3337  +        echo "$S_FUNC_MMMV_SILKTORRENT_PACKAGER_T1_BASH_VERIFY_FILE_NAME_T1_RESULT"
         3338  +        #----
         3339  +        cd $S_FP_ORIG
         3340  +        exit 0 # exit without an error
         3341  +    fi
         3342  +    #----
         3343  +    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "test_hash_t1" ]; then
         3344  +        func_mmmv_silktorrent_packager_t1_bash_test_1 "$S_ARGV_1"
         3345  +        #----
         3346  +        cd $S_FP_ORIG
         3347  +        exit 0 # exit without an error
         3348  +    fi
         3349  +    #--------
         3350  +    # Start of actions that do not require a file:
         3351  +    if [ "$S_SILKTORRENT_PACKAGER_T1_ACTION" == "verify_packet_name_format_v1" ]; then
         3352  +        func_mmmv_silktorrent_packager_t1_bash_verify_packet_name_format_v1 "$S_ARGV_1"
         3353  +        #----
         3354  +        cd $S_FP_ORIG
         3355  +        exit 0 # exit without an error
         3356  +    fi
         3357  +    #--------------------------
         3358  +        echo "" 
         3359  +        echo "This bash script is flawed. The control flow " 
         3360  +        echo "should have never reached this line."
         3361  +        echo "GUID=='30c24214-2845-45ad-841d-802070e031e7'"
         3362  +        echo ""
         3363  +        #----
         3364  +        cd $S_FP_ORIG
         3365  +        exit 1 # exit with an error
         3366  +} # func_mmmv_silktorrent_packager_t1_bash_determine_action
         3367  +
         3368  +func_mmmv_silktorrent_packager_t1_bash_determine_action $1 $2 $3 $4 $5 $6 $7
         3369  +
         3370  +
         3371  +#--------------------------------------------------------------------------
         3372  +
         3373  +
         3374  +#--------------------------------------------------------------------------
         3375  +cd $S_FP_ORIG
         3376  +exit 0 # 
         3377  +
         3378  +#==========================================================================
         3379  +# Fragments of comments and code that might find use some times later:
         3380  +#--------------------------------------------------------------------------
         3381  +#
         3382  +#   max 55 characters --- package suggested deprecation date in nanoseconds
         3383  +#                         relative to the Unix Epoch, 
         3384  +#                         written in base 10. It can be negative.
         3385  +#                         rgx_in_ruby=/t((y[-]?[\d]+)|n)[_]/
         3386  +# echo "v0034_s2342_tn_" | gawk '{ gsub(/_/, "_\n"); print }' | \
         3387  +#                          gawk '/^t(y[-]?[0-9]+|n)_/ {printf "%s",$1 }' |
         3388  +#                          gawk '{gsub(/[tyn_]/,"");printf "%s", $1 }'
         3389  +#                         
         3390  +#
         3391  +#--------
         3392  +# The awk code example originates from 
         3393  +# http://www.linuxandlife.com/2013/06/how-to-reverse-string.html
         3394  +# archival copy: https://archive.is/Cx0xF
         3395  +# S_TMP_0="`printf "$S_IN" | \
         3396  +#    awk '{ for(i=length;i!=0;i--)x=x substr($0,i,1);}END{printf  x}'`"
         3397  +#--------
         3398  +#
         3399  +#S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_2\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
         3400  +#S_TMP_0=$( printf "$S_CANDIDATE" | gawk '{gsub(/^[+]/,""); printf "%s", $1}' )
         3401  +#S_TMP_1=$( printf "$S_TMP_0"     | gawk '{gsub(/[0123456789]+/,""); printf "%s", $1}' )
         3402  +#S_TMP_0=$( printf "$S_CANDIDATE" | gawk '{gsub(/\s+/,""); printf "%s", $1}' )
         3403  +#S_TMP_1=$( printf "$S_TMP_0" | gawk '{gsub(/^[0]+/,""); printf "%s", $1}' )
         3404  +#S_TMP_0="`printf  \"$S_NAME_OF_THE_BASH_FUNCTION\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
         3405  +#S_TMP_0="`printf  \"$S_FP_2_AN_EXISTING_FILE\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
         3406  +#S_TMP_0="`printf \"$S_NAME_OF_THE_EXECUTABLE_2\" | gawk '{gsub(/\s/,"");printf "%s", $1 }'`"
         3407  +
         3408  +#==========================================================================
         3409  +