"Fossies" - the Fresh Open Source Software Archive

Member "darktable-3.6.1/tools/authors_h.sh" (10 Sep 2021, 2772 Bytes) of package /linux/misc/darktable-3.6.1.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "authors_h.sh": 3.2.1_vs_3.4.0.

    1 #!/bin/bash
    2 
    3 # MIT License
    4 #
    5 # Copyright (c) 2016 Roman Lebedev
    6 #
    7 # Permission is hereby granted, free of charge, to any person obtaining a copy
    8 # of this software and associated documentation files (the "Software"), to deal
    9 # in the Software without restriction, including without limitation the rights
   10 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   11 # copies of the Software, and to permit persons to whom the Software is
   12 # furnished to do so, subject to the following conditions:
   13 #
   14 # The above copyright notice and this permission notice shall be included in all
   15 # copies or substantial portions of the Software.
   16 #
   17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   18 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   19 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   20 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   21 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   22 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   23 # SOFTWARE.
   24 
   25 set -e
   26 
   27 # https://github.com/travis-ci/travis-ci/issues/8812#issuecomment-347457115
   28 # Since TracisCI uses LC_ALL=en_US.UTF-8 by default we change these envs. This should keep BSD sed working.
   29 export LANG=C
   30 export LC_ALL=C 
   31 
   32 AUTHORS="$1"
   33 H_FILE="$2"
   34 
   35 echo "#pragma once" > "$H_FILE"
   36 echo "" >> "$H_FILE"
   37 
   38 # category counter
   39 SECTIONS=0
   40 
   41 function print_section()
   42 {
   43     # only add if non empty
   44     if [ -n "${CONTENT}" ]; then
   45         echo "static const char *section${SECTIONS}[] = {" >> "$H_FILE"
   46         echo "$CONTENT" >> "$H_FILE"
   47         echo "  NULL };" >> "$H_FILE"
   48         echo "gtk_about_dialog_add_credit_section (GTK_ABOUT_DIALOG(dialog), _(\"${SECTION}\"), section${SECTIONS});" >> "$H_FILE"
   49         echo "" >> "$H_FILE"
   50     fi
   51 }
   52 
   53 # extract section name
   54 section="\* (.*):"
   55 
   56 while IFS="" read -r p || [ -n "$p" ]; do
   57   if [[ $p =~ $section ]]; then
   58       if [ $SECTIONS -gt 0 ]; then
   59           print_section
   60       fi
   61 
   62       SECTIONS=$((SECTIONS+1))
   63       # only select short name
   64       SECTION=$(echo "${BASH_REMATCH[1]}" | sed 's/Sub-module //' | sed 's/ (.*)//')
   65       CONTENT=""
   66   else
   67       # general thanks for previous contributors are hardcoded
   68       if [ "$p" = "" ] || [ "${p:0:13}" = "And all those" ]; then
   69           continue
   70       fi
   71 
   72       #on some weird configs read doesn't remove new line, remove it here just to be sure
   73       LINE=$(echo -n "$p" | tr -d '[:cntrl:]')
   74       CONTENT="\"$LINE\",$CONTENT"
   75   fi
   76 done < "$AUTHORS"
   77 
   78 print_section
   79 
   80 # vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2
   81 # kate: tab-width: 2; replace-tabs on; indent-width 2; tab-indents: off;
   82 # kate: indent-mode sh; remove-trailing-spaces modified;