home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / com / utils / elm / sources / mailrc.awk < prev    next >
Text File  |  1990-04-28  |  1KB  |  65 lines

  1. #
  2. # @(#)$Id: mailrc.awk,v 4.1 90/04/28 22:44:44 syd Exp $
  3. #    Copyright (c) 1986, 1987 Dave Taylor
  4. #    Copyright (c) 1988, 1989, 1990 USENET Community Trust
  5. # Bug reports, patches, comments, suggestions should be sent to:
  6. #
  7. #    Syd Weinstein, Elm Coordinator - elm@DSI.COM
  8. #                     dsinc!elm
  9. #
  10. # $Log:    mailrc.awk,v $
  11. # Revision 4.1  90/04/28  22:44:44  syd
  12. # checkin of Elm 2.3 as of Release PL0
  13. #
  14. #
  15.  
  16.  
  17. BEGIN {
  18.     print "# MSG alias_text file, from a .mailrc file..."
  19.     print ""
  20.       }
  21.  
  22. next_line == 1 {
  23.  
  24.     next_line = 0;
  25.         group = ""
  26.     for (i = 1; i <= NF; i++) {
  27.       if (i == NF && $i == "\\") sep = ""
  28.       else                       sep = ", "
  29.  
  30.       if ($i == "\\") {
  31.         group = sprintf("%s,", group)
  32.         next_line = 1;
  33.       }
  34.       else if (length(group) > 0)
  35.         group = sprintf("%s%s%s", group, sep, $i);
  36.       else
  37.         group = $i;
  38.       }
  39.       print "\t" group
  40.  
  41.     }
  42.  
  43. $1 ~ /[Aa]lias|[Gg]roup/ {
  44.  
  45.     if ( NF == 3)
  46.       print $2 " = user alias = " $3;
  47.     else {
  48.       group = ""
  49.       for (i = 3; i <= NF; i++) {
  50.         if (i == NF && $i == "\\") sep = ""
  51.         else        sep = ", "
  52.  
  53.         if ($i == "\\") {
  54.            group = sprintf("%s,", group)
  55.            next_line = 1;
  56.         }
  57.         else if (length(group) > 0)
  58.            group = sprintf("%s%s%s", group, sep, $i);
  59.         else
  60.            group = $i;
  61.         }
  62.         print $2 " = group alias = " group;
  63.       }
  64.      }
  65.