diff --git a/nohtml.py b/nohtml.py index 87600f8..3137bce 100755 --- a/nohtml.py +++ b/nohtml.py @@ -1,12 +1,15 @@ #!/usr/bin/env python -# nohtml.py +# nohtml.py - Filter To Remove HTML Attachments From Email # Copyright (c) 2003 TundraWare Inc. All Rights Reserved. # For Updates See: http://www.tundraware.com/Software/nohtml + +#------------------- Nothing Below Here Should Need Changing ------------------# + # Program Information PROGNAME = "nohtml" -RCSID = "$Id: nohtml.py,v 1.1 2003/05/05 21:32:41 tundra Exp $" +RCSID = "$Id: nohtml.py,v 1.10 2003/05/05 21:56:35 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -19,15 +22,6 @@ #----------------------------------------------------------# -# Variables User Might Change # -#----------------------------------------------------------# - - - -#------------------- Nothing Below Here Should Need Changing ------------------# - - -#----------------------------------------------------------# # Imports # #----------------------------------------------------------# @@ -37,33 +31,17 @@ #----------------------------------------------------------# -# Aliases & Redefinitions # -#----------------------------------------------------------# - - - -#----------------------------------------------------------# # Constants & Literals # #----------------------------------------------------------# - -##### -# Constants -##### - -FALSE = 0 == 1 # Booleans -TRUE = not FALSE - - - ##### # Literals ##### - -lCONFFILE = os.path.join(os.getenv("HOME"), "." + PROGNAME + "rc") # conf file - +STARTHTML1 = "Content-Type:".lower() +STARTHTML2 = "text/html".lower() +ENDHTML = "".lower() #----------------------------------------------------------# @@ -72,18 +50,6 @@ ##### -# Error Messages -##### - -eERROR = "ERROR" - - -##### -# Informational Messages -##### - - -##### # Usage Prompts ##### @@ -94,25 +60,9 @@ ] -##### -# Prompts -##### - - - -#----------------------------------------------------------# -# Global Variables & Data Structures # -#----------------------------------------------------------# - - - #--------------------------- Code Begins Here ---------------------------------# -#----------------------------------------------------------# -# Object Base Class Definitions # -#----------------------------------------------------------# - #----------------------------------------------------------# @@ -121,25 +71,13 @@ ##### -# Print An Error Message -##### - -def errmsg(emsg): - print PROGNAME + " " + VERSION + " " + eERROR + ": " + emsg - -# End of 'errmsg()' - - -##### # Print Usage Information ##### def Usage(): for line in uTable: print line - -# End of 'Usage()' - + #----------------------------------------------------------# # Program Entry Point # @@ -166,3 +104,24 @@ if opt == "-v": print RCSID sys.exit(0) + +PASS = True + +for line in sys.stdin.readlines(): + + lline = line.lower() + + if lline.count(STARTHTML1) and lline.count(STARTHTML2): + PASS = False + + if PASS: + sys.stdout.write(line) + + if lline.count(ENDHTML): + DONE = True + + + + + +