summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcarlosg <carlosg>2007-09-03 17:51:19 +0000
committercarlosg <carlosg>2007-09-03 17:51:19 +0000
commit223610dfa187ceda4c6b6e43ce781e53473da921 (patch)
tree933fd253fa7df906582d7015f5c12249e265652e
parent8b0ef0f6ebddf5c94719cf462aca49b577da64bf (diff)
2007-09-03 Carlos Garnacho <carlosg@gnome.org>
* Users/Shells.pm (get): get list of unique elements.
-rw-r--r--ChangeLog4
-rw-r--r--Users/Shells.pm19
2 files changed, 16 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 6e4ef7d..05a665f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-09-03 Carlos Garnacho <carlosg@gnome.org>
+
+ * Users/Shells.pm (get): get list of unique elements.
+
2007-08-29 Markus Kanet <darkvision@gmx.info>
* Init/Services.pm: Apply correctly the information for Slackware.
diff --git a/Users/Shells.pm b/Users/Shells.pm
index 6ebcfa3..26b6651 100644
--- a/Users/Shells.pm
+++ b/Users/Shells.pm
@@ -40,15 +40,16 @@ sub get_files
sub push_shell
{
my ($shells, $shell) = @_;
- push @$shells, $shell if (stat ($shell));
+
+ $$shells{$shell} = 1 if (stat ($shell));
}
sub get
{
- my ($ifh, @shells, $shell);
+ my ($ifh, %shells, $shell, @arr);
- # Init @shells, I think every *nix has /bin/false.
- &push_shell (\@shells, "/bin/false");
+ # Init shells, I think every *nix has /bin/false.
+ &push_shell (\%shells, "/bin/false");
if ($Utils::Backend::tool{"system"} eq "SunOS")
{
@@ -61,7 +62,7 @@ sub get
foreach $shell (@$possible_shells)
{
- &push_shell (\@shells, $shell);
+ &push_shell (\%shells, $shell);
}
}
else
@@ -72,13 +73,17 @@ sub get
{
next if &Utils::Util::ignore_line ($_);
chomp;
- &push_shell (\@shells, $_);
+ &push_shell (\%shells, $_);
}
&Utils::File::close_file ($ifh);
}
- return \@shells;
+ foreach $i (keys (%shells)) {
+ push @arr, $i;
+ }
+
+ return \@arr;
}
sub set