summaryrefslogtreecommitdiff
path: root/ipl/progs/adlfiltr.icn
blob: 656a163a840600b5242b0f4d79e4020e03c9bb55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
############################################################################
#
#	File:     adlfiltr.icn
#
#	Subject:  Program to filter address list entries
#
#	Author:   Ralph E. Griswold
#
#	Date:     September 2, 1991
#
############################################################################
#
#   This file is in the public domain.
#
############################################################################
#
#    This program filters address lists, allowing through only those entries
#  with specified selectors.
#
#    The options are:
#
#	-s arg	selects entries with characters in args (default is all)
#	-x	inverts the logic, selecting characters not in args
#
############################################################################
#
#  See also: address.doc, adlcheck.icn, adlcount.icn, adllist.icn,
#     adlsort,icn, labels.icn
#
#  Links: adlutils, options
#
############################################################################

link adlutils, options

procedure main(args)
   local selectors, add, opts

   opts := options(args,"xs:")

   selectors := cset(\opts["s"]) | &cset

   if /opts["x"] then {
      while add := nextadd() do
         add.header ? {
            move(1)
            if upto(selectors) then writeadd(add)
            }
      }
   else {
      while add := nextadd() do
         add.header ? {
            move(1)
            if not upto(selectors) then writeadd(add)
            }
      }

end