Commits

Palmer, 2E0EOL committed f08f878

First commit; option handling appears to work as we'd expect.

  • Participants

Comments (0)

Files changed (1)

+#!/usr/bin/perl -w
+#
+# This program is a quick wrapper around the Perl Text::Diff CPAN module.
+# It's purpose at the moment is just to explore how easily we can use
+# it for changes to configuration files during package installation.
+#
+# Debian dependencies:
+# libtext-diff-perl
+#
+
+use strict;
+use diagnostics;
+use warnings;
+
+#use autodie qw(:all);
+use Text::Diff;
+use Getopt::Std;
+#----------------------------------------------------------------------------
+# Standard system errors
+use constant EXIT_SUCCESS => (0);
+use constant EXIT_FAILURE => (1);
+#----------------------------------------------------------------------------
+sub Main();
+#----------------------------------------------------------------------------
+sub Main()
+{
+	my %Opts = ( );
+	my @Params = ( );
+	my $endArgs = 0;
+	foreach my $arg ( @ARGV ) {
+		if ( !$endArgs && $arg eq '--' ) {
+			$endArgs = 1;
+			next;
+		}
+		next if ( !$endArgs && index($arg, '-') == 0 ); # Let getopts() handle options
+		printf("Got parameter: %s\n", $arg);
+		push(@Params, $arg);
+	}
+	getopts('u', \%Opts);
+
+	return(EXIT_SUCCESS());
+}
+#----------------------------------------------------------------------------
+exit(Main());
+#----------------------------------------------------------------------------
+1;