]> git.pld-linux.org Git - packages/sendmail.git/blame - passwd-to-alias
- moved examples into tar file
[packages/sendmail.git] / passwd-to-alias
CommitLineData
8669ea8b 1#!/usr/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
9print "# Generated from passwd by $0\n";
10
11$wordpat = '([a-zA-Z]+?[a-zA-Z0-9-]*)?[a-zA-Z0-9]'; # 'DB2'
12while (@a = getpwent) {
13 ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = @a;
14
15 ($fullname = $gcos) =~ s/,.*$//;
16
17 if (!-d $dir || !-x $shell || $shell =~ m!/bin/(false|true)$!) {
18 print "$name: root\n"; # handle pseudo user
19 }
20
21 $fullname =~ s/\.*[ _]+\.*/./g;
22