Annotation of freem/scripts/fmd-todo, revision 1.1

1.1     ! snw         1: #!/usr/bin/env bash
        !             2: 
        !             3: #
        !             4: #   $Id$
        !             5: #    Find files that need work
        !             6: #
        !             7: #  
        !             8: #   Author: Serena Willis <snw@coherent-logic.com>
        !             9: #    Copyright (C) 2025 Coherent Logic Development LLC
        !            10: #
        !            11: #
        !            12: #   This file is part of FreeM.
        !            13: #
        !            14: #   FreeM is free software: you can redistribute it and/or modify
        !            15: #   it under the terms of the GNU Affero Public License as published by
        !            16: #   the Free Software Foundation, either version 3 of the License, or
        !            17: #   (at your option) any later version.
        !            18: #
        !            19: #   FreeM is distributed in the hope that it will be useful,
        !            20: #   but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            21: #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            22: #   GNU Affero Public License for more details.
        !            23: #
        !            24: #   You should have received a copy of the GNU Affero Public License
        !            25: #   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
        !            26: #
        !            27: #   $Log$
        !            28: #
        !            29: # SPDX-FileCopyrightText:  (C) 2025 Coherent Logic Development LLC
        !            30: # SPDX-License-Identifier: AGPL-3.0-or-later
        !            31: #
        !            32: 
        !            33: PGM=$(basename $0)
        !            34: SCRIPT_DIR=$(dirname "$0")
        !            35: 
        !            36: source "${SCRIPT_DIR}/_fmd_common.bash"
        !            37: 
        !            38: function usage() {
        !            39:     echo
        !            40:     echo "Finds FreeM source files with TODO comments"
        !            41:     echo    
        !            42:     echo "usage:  "
        !            43:     echo
        !            44:     echo "  fmd todo"
        !            45:     echo
        !            46:     exit 0
        !            47: }
        !            48: 
        !            49: if [[ $1 == "help" ]]
        !            50: then
        !            51:     usage
        !            52: fi
        !            53: 
        !            54: if [[ $# == 0 ]]
        !            55: then
        !            56:     echo "lint:  must be run from 'fmd lint'"
        !            57:     exit 1
        !            58: fi
        !            59: 
        !            60: FMD=$1
        !            61: 
        !            62: for FILE in src/*.[ch]
        !            63: do
        !            64:     grep "TODO:" "${FILE}" &> /dev/null
        !            65:     if [[ $? == 0 ]]
        !            66:     then
        !            67:         TMPF=$(mktemp)
        !            68:         cat "${FILE}" | nl -ba > ${TMPF}
        !            69:         echo "${FILE}:"
        !            70:         while read LINE
        !            71:         do
        !            72:             LNO=$(echo "${LINE}" | awk '{ print $1 }')
        !            73:             echo "${LINE}" | grep "TODO:" &> /dev/null
        !            74:             if [[ $? == 0 ]]
        !            75:             then
        !            76:                 RPART=$(echo "${LINE}" | cut -d: -f2 | sed 's/\*\///g')
        !            77:                 printf "\t- %s:  %s\n" "${LNO}" "${RPART}"
        !            78:             fi
        !            79:         done < "${TMPF}"
        !            80:         rm -f "${TMPF}"
        !            81:     fi
        !            82: done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>