home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / progs / adlfiltr.icn < prev    next >
Text File  |  2000-07-29  |  1KB  |  59 lines

  1. ############################################################################
  2. #
  3. #    File:     adlfiltr.icn
  4. #
  5. #    Subject:  Program to filter address list entries
  6. #
  7. #    Author:   Ralph E. Griswold
  8. #
  9. #    Date:     September 2, 1991
  10. #
  11. ############################################################################
  12. #
  13. #   This file is in the public domain.
  14. #
  15. ############################################################################
  16. #
  17. #    This program filters address lists, allowing through only those entries
  18. #  with specified selectors.
  19. #
  20. #    The options are:
  21. #
  22. #    -s arg    selects entries with characters in args (default is all)
  23. #    -x    inverts the logic, selecting characters not in args
  24. #
  25. ############################################################################
  26. #
  27. #  See also: address.doc, adlcheck.icn, adlcount.icn, adllist.icn,
  28. #     adlsort,icn, labels.icn
  29. #
  30. #  Links: adlutils, options
  31. #
  32. ############################################################################
  33.  
  34. link adlutils, options
  35.  
  36. procedure main(args)
  37.    local selectors, add, opts
  38.  
  39.    opts := options(args,"xs:")
  40.  
  41.    selectors := cset(\opts["s"]) | &cset
  42.  
  43.    if /opts["x"] then {
  44.       while add := nextadd() do
  45.          add.header ? {
  46.             move(1)
  47.             if upto(selectors) then writeadd(add)
  48.             }
  49.       }
  50.    else {
  51.       while add := nextadd() do
  52.          add.header ? {
  53.             move(1)
  54.             if not upto(selectors) then writeadd(add)
  55.             }
  56.       }
  57.  
  58. end
  59.