#!/usr/bin/perl # MPD # # Douglas Thrift # # $Id$ use strict; use warnings; use File::Basename; use IO::Prompt; if ($#ARGV != 1) { print 'Usage: ' . basename($0) . " [input] [output]\n"; exit 1; } my $input = shift; my $output = shift; umask 0077; open INPUT, "<$input" or die basename($0) . ": $!\n"; open OUTPUT, ">$output" or die basename($0) . ": $!\n"; while () { if (/^\tset user (\w+) password(?: (?:admin|operator|user))?$/) { my $user = $1; my $password = prompt("$user\'s password: ", -e => '*'); s/$user password/$user $password/; } print OUTPUT; } close INPUT; close OUTPUT;