PATCH: mm-0.02 to use strict.

Stijn Jonker SJCJonker at SJC.NL
Mon Dec 9 22:28:53 GMT 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello all,

This is a patch to mailscanner-mrtg-0.02.

I'm not a perl monkey but i made some small modifications to allow it to
run under the strict directive. This enforces all variables to be pre
declared before using them.

Also the usage exits with 1 instead of 0.

Just my small contribution!

- --
Met Vriendelijke groet/Yours Sincerely
Stijn Jonker <SJCJonker at sjc.nl>

- --
Outlook Express is actually an incredibly effective virus distribution system which only pretends to be an email program.
[by Eric Lee]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE99RkmjU9r45tKnOARAjVWAKDRdDKIsyChUHDjg4zzXt+LXrwxoQCdGJn/
aGANLGlIUVZ6CECgCOoF9VA=
=fToL
-----END PGP SIGNATURE-----
-------------- next part --------------
diff -urN mailscanner-mrtg-0.02-sjc/mailscanner-mrtg mailscanner-mrtg-0.02/mailscanner-mrtg
--- mailscanner-mrtg-0.02-sjc/mailscanner-mrtg	Mon Dec  9 23:22:12 2002
+++ mailscanner-mrtg-0.02/mailscanner-mrtg	Mon Dec  9 23:20:48 2002
@@ -35,11 +35,13 @@
 my($cmd) = shift;
 
 use FileHandle;
+use strict qw{%Config $hostname $Total $Total2 $debug $cmd};
 if ($debug) { Debug ("Using FileHandle") }
 
 ReadConfFile();
 
 # You mean to tell me perl doesn't have a friggin' switch command????
+if (defined($cmd)){
 SWITCH: {
 	if ($cmd eq "cpu")		{ Cpu();		last SWITCH; };
 	if ($cmd eq "inqueue") 		{ InQueue(); 		last SWITCH; };
@@ -53,6 +55,10 @@
 	if ($cmd eq "spam") 		{ Spam(); 		last SWITCH; };
 	if ($cmd eq "spoolusage")	{ SpoolUsage(); 	last SWITCH; };
 	if ($cmd eq "virus") 		{ Virus(); 		last SWITCH; }
+	print "ERROR: Unknown command-line option $cmd\n";
+	Usage();
+}
+} else {
 	Usage();
 }
 
@@ -420,7 +426,7 @@
 print "spoolusage  : returns the percent of disk space available in \\var\\spool \n";
 print "virus	    : returns the number of virus' caught today\n";
 print "\n";
-exit;
+exit(1);
 }
 
 sub Virus {


More information about the MailScanner mailing list