]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/sendmail/contrib/passwd-to-alias.pl
This commit was generated by cvs2svn to compensate for changes in r56545,
[FreeBSD/FreeBSD.git] / contrib / sendmail / contrib / passwd-to-alias.pl
1 #!/bin/perl
2
3 #
4 #  Convert GECOS information in password files to alias syntax.
5 #
6 #  Contributed by Kari E. Hurtta <Kari.Hurtta@ozone.fmi.fi>
7 #
8
9 print "# Generated from passwd by $0\n";
10
11 while (@a = getpwent) {
12     ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = @a;
13
14     ($fullname = $gcos) =~ s/,.*$//;
15
16     if (!-d $dir || !-x $shell) {
17         print "$name: root\n";
18     }
19
20     $fullname =~ s/\.*[ _]+\.*/./g;
21     $fullname =~ tr [åäöÅÄÖé] [aaoAAOe];  # <hakan@af.lu.se> 1997-06-15
22     if ($fullname =~ /^[a-zA-Z][a-zA-Z-]+(\.[a-zA-Z][a-zA-Z-]+)+$/) {  
23 #   if ($fullname =~ /^[a-zA-Z]+(\.[a-zA-Z]+)+$/) {    # Kari E. Hurtta
24         print "$fullname: $name\n";
25     } else {
26         print "# $fullname: $name\n";
27     }
28 };
29
30 endpwent;