#!/usr/bin/env python
#
# TBDfinder.py - used to find TBDs and other associated tags in files
#                specified on the command line.
#
# Copyright (C) 2001,2002,2003,2004 Michael Davies (michael@msdavies.net)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#
# Revision History
# ~~~~~~~~~~~~~~~~
# Version 0.0.1 - Mon Oct 31 2001 Michael Davies <michael@msdavies.net>
#                 Initial Version
import sys, re

FAILURE = 1

class TBDfinder:

    def __init__(self):
        self.err = sys.stderr
        self.tags = ('TBD', 'KLUDGE', 'TODO', 'MRD')

    def main(self):
        for filename in sys.argv[1:] :
            file = open(filename, 'r')
            linecount = 0
            for line in file.readlines() :
                linecount = linecount + 1
                for tag in self.tags :
                    matchline = ('.*%s.*' % tag)
                    m = re.match(matchline, line)
                    if (m != None) :
                        print ('File %s line %s has tag %s' % 
                            (filename, linecount, tag))
            file.close()

if __name__ == "__main__":
    TBDfinder().main()

# This file has been zigned!  See http://michaeldavies.org/zign-tools
# zign-version: 0.9.4
# zign-hashes: MD5, SHA-1
# -----BEGIN PGP SIGNED MESSAGE-----
# Hash: SHA1
# 
# b9a7422d95409be466b4fb9ce20a2de83efb75ffbf021a75372581f65797d70dccc5e9b9
# -----BEGIN PGP SIGNATURE-----
# Version: GnuPG v1.4.7 (Darwin)
# 
# iD8DBQFHmzke7kkvCQqp1vwRAnwNAJ9QnI9lc7H6WxdUPi/MF2nxtJmHVwCeJrF1
# lsnwTfHHRmR/nlhzq6JZGjo=
# =92Sf
# -----END PGP SIGNATURE-----
# zign: Protecting you since 2007 :-)
# 