Removed support for old-style "clients" file, as it makes future
[freeradius.git] / scripts / clients.pl
1 #!/usr/bin/env perl
2 #
3 #  Convert old-style "clients" file to new "clients.conf" format.
4 #
5 #  Usage: clients.pl clients new-clients.conf
6 #         The "new-clients.conf" will be over-written.
7 #
8 #
9 #       $Id$
10 #
11 if ($#ARGV != 1) {
12     print "Usage: clients.pl clients new-clients.conf\n";
13     print "       The \"new-clients.conf\" will be created if it does not exist.\n";
14     print "       If it does exist, it will be over-written.";
15     exit(1);
16 }
17
18 $old = shift;
19 $new = shift;
20
21 open OLD, "< $old"or die "Failed to open $old: $!\n";
22 open NEW, "> $new" or die "Failed to open $new: $!\n";
23
24 while (<OLD>) {
25     next if (/^\s*\#/);
26
27     split;
28
29     print NEW "client $_[0] {\n";
30     print NEW "\tsecret = $_[1]\n";
31     print NEW "}\n";
32 }