ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/FreeBSDAdmin/VPN/mpd.pl
Revision: 1007
Committed: 2008-05-19T00:43:51-07:00 (17 years, 1 month ago) by douglas
Content type: text/x-perl
File size: 617 byte(s)
Log Message:
Woo!

File Contents

# User Rev Content
1 douglas 1007 #!/usr/bin/perl
2     # MPD
3     #
4     # Douglas Thrift
5     #
6     # $Id$
7    
8     use strict;
9     use warnings;
10    
11     use File::Basename;
12     use IO::Prompt;
13    
14     if ($#ARGV != 1)
15     {
16     print 'Usage: ' . basename($0) . " [input] [output]\n";
17    
18     exit 1;
19     }
20    
21     my $input = shift;
22     my $output = shift;
23    
24     umask 0077;
25    
26     open INPUT, "<$input" or die basename($0) . ": $!\n";
27     open OUTPUT, ">$output" or die basename($0) . ": $!\n";
28    
29     while (<INPUT>)
30     {
31     if (/^\tset user (\w+) password(?: (?:admin|operator|user))?$/)
32     {
33     my $user = $1;
34     my $password = prompt("$user\'s password: ", -e => '*');
35    
36     s/$user password/$user $password/;
37     }
38    
39     print OUTPUT;
40     }
41    
42     close INPUT;
43     close OUTPUT;

Properties

Name Value
svn:executable *
svn:keywords Id