From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX"  7-JUL-1992 10:52:17.83
To:	info-vax@kl.sri.com
CC:	
Subj:	Re: Aliases for addresses in MAIL

Users seem to have problems with multiple quotes, and I can sympathise even 
if I have worked out the trick of it by now.
Here is a little procedure that will take the pain out of the process
----------------------cut here for quote_addresses.com -----------------------
$!   Procedure takes a file called MAIL_NAME.IN which should consist of
$!   lines with the alias, a space, then the mail address
$!   and creates the file MAIL_NAME.OUT which can be included in a login.com
$!   as a set of define statement with the multiple quotes required
$!   eg:
$!   pete smtp%"pb@vcp.monash.edu.au"      produces
$!   $ define pete "smpt%""pb@vcp.monash.edu.au"""   
$!       
$ wrb = "write sys$output"
$ open/read filein mail_name.in
$ open/write fileout mail_name.out
$readloop:
$ read/end_of_file=eof filein defin
$ space = f$locate(" ", defin)
$ if space .eq. f$length(defin) 
$ then
$   wrb "File lines should be of form ALIAS  space  then MAIL ADDRESS"
$   exit 0
$ endif
$ q1 = f$locate("""", defin)
$ if q1 .eq. f$length(defin) 
$ then
$   wrb "No quotes found, so no double quotes needed"
$   exit 0
$ endif
$ seg2 = f$extract(q1+1,999,defin)
$ q2 = f$locate("""", seg2)
$ if q1 .eq. f$length(defin) 
$ then
$   wrb "No second matching quote found"
$   exit 0
$ endif
$ res = "$ define " + f$extract(0,space+1,defin) + """" + -
  f$extract(space+1,q1-space,defin) + """" + seg2 + """""" 
$ write fileout res
$ wrb res
$ goto readloop
$eof:
$ close fileout
$ close filein
$ wrb "   has been written to file mail_name.out"

