Bob Russell                      rsr3@pge.com
Pacific Gas and Electric Company
San Francisco, California

NOTES from the author:

Here's a Perl script I wrote to generate subscription requests for a list.
It takes several input formats, with or without the users' names.  See
below for details.  You will need to change the value of the variable
$domain to match your own domain name--I've already changed it so that it
is NOT our domain.  Then pipe the output to mailx or ilp to send the
commands to Listproc.

-------------------

gen-subs takes a list of email addresses or corporate ids and optional user
names, and creates subscription requests for each.  Input is STDIN.  Output
is STDOUT.  Use redirection.

Syntax:  gen-subs [-q] [-l list-name] [-p list-password]
   -q             Don't notify subscribers they've been subscribed
                  (quiet mode).
   -l list-name   The name of the list to be subscribed to.
   -p password    The list's password.

Input format (any of the following formats can be mixed or matched):

rsr3 Bob Russell
rsr3@pge.com Bob Russell
rsr3
rsr3@pge.com

The last two formats generate a subscription with the user name of
Autosubscribed.  All of them generate an email address of rsr3@pge.com.

-------- Begin Script -------------

#!/usr/perl/bin/perl

# Script to create ADD requests for a list of email address/user name combinations.
# Syntax:
#   gen-subs [-q] [-l list-name] [-p password]
#
#     -q           Do a quiet add.
#     -l list-name Name of the list to add the subscribers to.
#     -p password  Password of the list.

# Author  Bob Russell  1/6/97

require "getopts.pl";
&Getopts('ql:p:');  # quiet listname password
$quiet = 'quiet' if ($opt_q);
$list = 'list';
$password = 'password';
$list = $opt_l if ($opt_l);
$password = $opt_p if ($opt_p);
$domain = '@yourdomain.com';

while ($line = <STDIN> {
   ($address,@name) = split(" ",$line);
   if ($address !~ /\@/) {
      $address = $address . $domain;
      }
   if (!$name[0]) {
      $name[0] = 'Autosubscribed';
      warn "No name given to subscribe $address\n";
      }
   print "$quiet add  $list $password $address @name\n";
   }

----------------------
