Index: /main/trunk/package-kits/scripts/gs-mkservlet.pl
===================================================================
--- /main/trunk/package-kits/scripts/gs-mkservlet.pl	(revision 29684)
+++ /main/trunk/package-kits/scripts/gs-mkservlet.pl	(revision 29685)
@@ -12,33 +12,33 @@
 
 my $delete = 0;
-my $file = "/usr/share/greenstone/web/WEB-INF/servlets.xml";
-my $description = "";
-my $class = "org.greenstone.gsdl3.LibraryServlet";
-my ($name, $site, $interface);
+my %params = (
+    'file'          => "/usr/share/greenstone/web/WEB-INF/servlets.xml",
+    'name'          => undef,
+    'description'   => "",
+    'class'         => "org.greenstone.gsdl3.LibraryServlet",
+    'library'       => undef,
+    'site'          => undef,
+    'interface'     => undef,
+    'receptionist'  => "DefaultReceptionist",
+    'default_lang'  => "en",
+);
 
 while (@ARGV) {
     for (shift) {
-        if (/^-delete$/) {
-            $delete = 1;
-        } elsif (/^-file$/) {
-            ($file = shift) or die "Expected -file <file>\n";
-        } elsif (/^-name$/) {
-            ($name = shift) or die "Expected -name <name>\n";
-        } elsif (/^-desc\(ription\)?$/) {
-            ($description = shift) or die "Expected -desc <description>\n";
-        } elsif (/^-class$/) {
-            ($class = shift) or die "Expected -class <class>\n";
-        } elsif (/^-site$/) {
-            ($site = shift) or die "Expected -site <site>\n";
-        } elsif (/^-interface$/) {
-            ($interface = shift) or die "Expected -interface <interface>\n";
-        } else {
-            die "Unknown flag '$_'\n";
+        if (s/^-//) {
+            if (/^delete$/) {
+                $delete = 1;
+                last;
+            } elsif (exists $params{$_}) {
+                ($params{$_} = shift) or die "Expected -$_ <$_>\n";
+                last;
+            }
         }
+        die "Unknown flag '$_'\n";
     }
 }
 
 if ($delete) {
-    my $servlets = read_xml $file;
+    my $servlets = read_xml $params{file};
 
     my $deleted = 0;
@@ -46,8 +46,8 @@
     my $servlet_array = $servlets->get ("servlet");
     if (ref $servlet_array eq 'ARRAY') {
-        my @array = grep { $_->get ("servlet-name") ne $name } @$servlet_array;
+        my @array = grep { $_->get ("servlet-name") ne $params{name} } @$servlet_array;
         $deleted = (scalar @array < scalar @$servlet_array);
         $servlets->set ("servlet" => \@array);
-    } elsif ($servlet_array->get ("servlet-name") eq $name) {
+    } elsif ($servlet_array->get ("servlet-name") eq $params{name}) {
         $servlets->delete ("servlet");
         $deleted = 1;
@@ -56,12 +56,12 @@
     die "Servlet not found\n" unless $deleted;
     
-    write_xml ($servlets, $file);
+    write_xml ($servlets, $params{file});
 } else {
-    (defined $name and defined $site and defined $interface) or die "Requires name, site, interface\n";
+    (defined $params{name} and defined $params{site} and defined $params{interface}) or die "Requires name, site, interface\n";
 
-    Greenstone::Site->new ($site)->exists or die "Site '$site' does not exist\n";
-    Greenstone::Interface->new ($interface)->exists or die "Interface '$interface' does not exist\n";
+    Greenstone::Site->new ($params{site})->exists or die "Site '$params{site}' does not exist\n";
+    Greenstone::Interface->new ($params{interface})->exists or die "Interface '$params{interface}' does not exist\n";
 
-    my $servlets = read_xml $file;
+    my $servlets = read_xml $params{file};
 
     my $servlet_array = $servlets->get ("servlet");
@@ -70,5 +70,5 @@
     }
     for my $servlet (@$servlet_array) {
-        $servlet->get ("servlet-name") eq $name and die "A servlet already exists with that name\n";
+        $servlet->get ("servlet-name") eq $params{name} and die "A servlet already exists with that name\n";
         my $servlet_params = $servlet->get ("init-param");
         unless (ref $servlet_params eq 'ARRAY') {
@@ -85,5 +85,5 @@
             }
         }
-        $servlet_site eq $site and $servlet_interface eq $interface and
+        $servlet_site eq $params{site} and $servlet_interface eq $params{interface} and
             die "A servlet already exists with that combination of site and interface\n";
     }
@@ -101,14 +101,18 @@
         Hash::Ordered->new (
             'servlet' => Hash::Ordered->new (
-                'servlet-name' => $name,
-                'description'  => $description,
-                'servlet-class'=> $class,
+                'servlet-name' => $params{name},
+                'description'  => $params{description},
+                'servlet-class'=> $params{class},
                 'init-param'   => [
-                    init_param ('site_name', $site),
-                    init_param ('interface_name', $interface),
+                    init_param ('library_name',
+                        (defined $params{library} ? $params{library} : $params{name} )),
+                    init_param ('site_name', $params{site}),
+                    init_param ('interface_name', $params{interface}),
+                    init_param ('receptionist_class', $params{receptionist}),
+                    init_param ('default_lang', $params{default_lang}),
                 ],
             ),
         ),
-        $file,
+        $params{file},
         '>>'
     );
