LSTOWN-L Archives

LISTSERV List Owners' Forum

LSTOWN-L

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Dan Wheeler <[log in to unmask]>
Fri, 13 Oct 1995 22:11:15 -0500
text/plain (166 lines)
There seems to be a lot of interest in figuring out how to interpret
the cryptic string of characters that encode the options for each
subscriber on our lists.  I have cracked the code.  The string of
characters is a base64 encoding of a set of variables specifying the
options.  I've written a perl script that transforms the subcription
list as received by using GET <listname> to something with entries
that look like this:
 
....F.M 951007 [log in to unmask] Dan Wheeler
....F.m 941017 [log in to unmask] Claus Berg
....FDM 951002 [log in to unmask] Oscar Wilson
....F.m 940621 WHEELER@UCBEH Dan Wheeler
....FIM 950608 [log in to unmask] Samuel Falcao
 
I'm back to the familiar M = mail and m = nomail.  The other codes in
these examples are F = fullhdr, D = digest, and I = index.  Each of
the positions indicates one option with the period representing the
default.  I'm also decoding the date.  I put the options at the
beginning of the line instead of the end so I can see them more easily
on an 80-column display.
 
My script also includes the code to decipher the topic settings, but
I've commented it out because our lists aren't using topics now.
 
The script was designed for a VMS system.  Some changes will be
necessary to run it under Unix.  One change is that you will need to
make the output filename different from the input filename.
 
The script is attached below.  I hope you find it helpful.
 
                               Peace,  Dan
 
<<  Daniel D. Wheeler, Education & Psychology, Univ. of Cincinnati  >>
<<  KIDLINK Director of Educational Services & Subcription Manager  >>
<<  Email: [log in to unmask]     URL: http://www.uc.edu/~wheeler/  >>
+++++++++++++++++++++++++< attachment >+++++++++++++++++++++++++
# Perl script to translate L-Soft LISTSERV
# subscriber information to human-readable form
#
# Version 1.1   1995 September 8
#
# by Dan Wheeler
 
 
# define associative array for base64 decoding
 
 %decode64 = (
   "A",  0, "B",  1, "C",  2, "D",  3, "E",  4, "F",  5, "G",  6, "H",  7,
   "I",  8, "J",  9, "K", 10, "L", 11, "M", 12, "N", 13, "O", 14, "P", 15,
   "Q", 16, "R", 17, "S", 18, "T", 19, "U", 20, "V", 21, "W", 22, "X", 23,
   "Y", 24, "Z", 25, "a", 26, "b", 27, "c", 28, "d", 29, "e", 30, "f", 31,
   "g", 32, "h", 33, "i", 34, "j", 35, "k", 36, "l", 37, "m", 38, "n", 39,
   "o", 40, "p", 41, "q", 42, "r", 43, "s", 44, "t", 45, "u", 46, "v", 47,
   "w", 48, "x", 49, "y", 50, "z", 51, "0", 52, "1", 53, "2", 54, "3", 55,
   "4", 56, "5", 57, "6", 58, "7", 59, "8", 60, "9", 61, "+", 62, '/', 63);
 
# open files
 
  die "Usage: $0 listname\n\n" if $#ARGV < 0;
  $INLIST =  $ARGV[0] . ".LIST";
  $OUTLIST = '>' . $ARGV[0] . ".LIST";
 
  open (INLIST) || die "Can't open input list: ";
  open (OUTLIST) || die "Can't open output list: ";
 
  print "Fixing ", $INLIST, "\n";
 
# main
  $offset = 80;
  while (<INLIST>) {
 
# copy list header
 
  if (substr($_, 0, 1) eq '*')
     {
     print OUTLIST $_;
     next ;
     } ;
 
# extract and convert binary codes
 
  $bincodes =  $decode64{substr($_, $offset + 2, 1)} * 64 * 64 * 64
             + $decode64{substr($_, $offset + 3, 1)} * 64 * 64
             + $decode64{substr($_, $offset + 4, 1)} * 64
             + $decode64{substr($_, $offset + 5, 1)} ;
 
  $nopost   =  ($bincodes >> 17 & 1) ? "X" : "." ;
  $review   =  ($bincodes >> 16 & 1) ? "R" : "." ;
  $editor   =  ($bincodes >> 15 & 1) ? "E" : "." ;
  $conceal  =  ($bincodes >> 14 & 1) ? "C" : "." ;
  $header   =  ($bincodes >> 10 & 1) ? "F" : "S" ;
 
  if  ($bincodes >> 9 & 1) { $header = "D";};
 
  $distopt  =  "." ;
  if  ($bincodes >> 5 & 1) { $distopt = "I";};
  if  ($bincodes >> 4 & 1) { $distopt = "D";};
 
  $mail     =  ($bincodes >> 3 & 1) ? "m" : "M" ;
 
# extract and convert date of last subscription change
 
  $daynum   =  $decode64{substr($_, $offset + 6, 1)} * 64 * 64 * 64
             + $decode64{substr($_, $offset + 7, 1)} * 64 * 64
             + $decode64{substr($_, $offset + 8, 1)} * 64
             + $decode64{substr($_, $offset + 9, 1)} ;
 
# convertion to YMD
# based on Pascal routine in Rugg & Feldman,
# _Turbo Pascal Program Library_ (Que)
 
  $tempa = $daynum + 68569 + 1721425;
  $tempb = int(4 * $tempa /146097);
  $tempa = $tempa - int((146097 * $tempb + 3) / 4);
  $year  = int(4000 * ($tempa + 1) / 1461001);
  $tempa = $tempa - int(1461 * $year / 4) + 31;
  $mon   = int(80 * $tempa / 2447);
  $day   = int($tempa - int(2447 * $mon / 80));
  $tempa = int($mon / 11);
  $mon   = int($mon + 2 - 12 * $tempa);
  $year  = int(100 * ($tempb - 49) + $year + $tempa);
 
#  (I really don't believe this!)
#  It seems to be a day off in places.
 
  $year  = $year % 100;
 
# extract and convert topics
 
# [these are commented out--not needed for lists that don't use topics
 
#  $topics   =  $decode64{substr($_, $offset + 10, 1)} * 64
#             + $decode64{substr($_, $offset + 11, 1)} ;
 
#  $topic1   =  $topics >> 1 & 1 ;
#  $topic2   =  $topics >> 2 & 1 ;
#  $topic3   =  $topics >> 3 & 1 ;
#  ... etc.
 
  $_    = substr($_, 0, 80);
  tr/ / /s;
 
  print OUTLIST
        $nopost,
        $review,
        $editor,
        $conceal,
        $header,
        $distopt,
        $mail,
#        $topic1,
#        $topic2,
#        $topic3,
        " ";
 
  printf OUTLIST ("%02d%02d%02d ", $year, $mon, $day);
 
  print OUTLIST $_, "\n";
 
  }
 
# finish
 
  close (INLIST);
  close (OUTLIST);

ATOM RSS1 RSS2