+# Get and store the given command line arguments in a hash.
+my %cmdargs = ();
+
+&GetOptions (\%cmdargs,
+ 'foreground|f',
+ 'config|c=s',
+ 'help|h',
+ 'version|v',
+);
+
+# Show help / version information.
+if (defined($cmdargs{"help"})) {
+ print "Guardian $version \n";
+ print "Usage: guardian <optional arguments>\n";
+ print " -c, --config\t\tspecifiy a configuration file other than the default (/etc/guardian/guardian.conf)\n";
+ print " -f, --foreground\trun in the foreground (doesn't fork, any output goes to STDOUT)\n";
+ print " -h, --help\t\tshows this help\n";
+ print " -v, --version\t\tdisplay programm version and exit.\n";
+ exit;
+} elsif (defined($cmdargs{"version"})) {
+ print "Guardian $version \n";
+ exit;
+}
+
+# Read-in the configuration file and store the settings.
+# Push the may be given config file argument.
+my %mainsettings = &Guardian::Config::UseConfig($cmdargs{"config"});
+