|
|
1.1 root 1: /* showattr.c - */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/quipu/dish/RCS/showattr.c,v 7.0 89/11/23 22:20:21 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/quipu/dish/RCS/showattr.c,v 7.0 89/11/23 22:20:21 mrose Rel $
9: *
10: *
11: * $Log: showattr.c,v $
12: * Revision 7.0 89/11/23 22:20:21 mrose
13: * Release 6.0
14: *
15: */
16:
17: /*
18: * NOTICE
19: *
20: * Acquisition, use, and distribution of this module and related
21: * materials are subject to the restrictions of a license agreement.
22: * Consult the Preface in the User's Manual for the full terms of
23: * this agreement.
24: *
25: */
26:
27:
28: #include "quipu/util.h"
29: #include "quipu/attrvalue.h"
30: #include "quipu/entry.h"
31:
32: extern Entry current_entry;
33: extern DN current_dn;
34: extern DN dn;
35:
36: #define OPT (!frompipe || rps -> ps_byteno == 0 ? opt : rps)
37: #define RPS (!frompipe || opt -> ps_byteno == 0 ? rps : opt)
38: extern char frompipe;
39: extern PS rps, opt;
40:
41: extern char value_flag;
42: extern char key_flag;
43: extern char print_format;
44: extern char show_all_flag;
45:
46: static Attr_Sequence ignore_attr = NULLATTR;
47: static char ignore_unknown = FALSE;
48:
49: showattribute (at)
50: AttributeType at;
51: {
52: Attr_Sequence eptr;
53:
54: if (! show_all_flag) {
55: if ( ! check_want_attr (at))
56: return;
57: } else if ( ! check_want_tmp_attr (at))
58: return;
59:
60: for (eptr = current_entry->e_attributes; eptr != NULLATTR; eptr = eptr->attr_link) {
61: /* Tiptoe through the list of types until one matches, and then print value. */
62: if (AttrT_cmp (eptr->attr_type,at) == 0) {
63: if (value_flag)
64: if (key_flag)
65: as_comp_print (RPS,eptr,print_format);
66: else
67: avs_print (RPS,eptr->attr_value,print_format);
68: else {
69: AttrT_print (RPS,at,print_format);
70: ps_print (RPS, "\n");
71: }
72: break;
73: }
74:
75: if (eptr == NULLATTR)
76: if (key_flag)
77: ps_printf (OPT, "%-21s - (No such attribute in this entry)\n", at->oa_ot.ot_name);
78: else
79: ps_printf (OPT, "No value\n");
80:
81: }
82: }
83:
84:
85: show_unknown ()
86: {
87: ignore_unknown = TRUE;
88: }
89:
90: check_want_attr (at)
91: AttributeType at;
92: {
93: Attr_Sequence as;
94:
95: if (at == NULLTABLE_ATTR)
96: return (ignore_unknown);
97:
98: if (at->oa_syntax == 0)
99: return (ignore_unknown);
100:
101: for (as=ignore_attr; as != NULLATTR; as=as->attr_link)
102: if (AttrT_cmp (at,as->attr_type) == 0)
103: return (FALSE);
104:
105: return (check_want_tmp_attr(at));
106: }
107:
108: check_want_tmp_attr (at)
109: AttributeType at;
110: {
111: Attr_Sequence as;
112: Attr_Sequence as2;
113: extern Attr_Sequence tmp_ignore;
114: extern Attr_Sequence as_flag;
115:
116: if (at->oa_syntax == 0)
117: return (ignore_unknown || show_all_flag);
118:
119: for (as=tmp_ignore; as != NULLATTR; as=as->attr_link)
120: if (AttrT_cmp (at,as->attr_type) == 0) {
121: /* may be explicitly wanted... */
122: for (as2=as_flag; as2 != NULLATTR; as2=as2->attr_link)
123: if (AttrT_cmp (as2->attr_type,as->attr_type) == 0)
124: return (TRUE);
125: return (FALSE);
126: }
127:
128: return (TRUE);
129: }
130:
131: new_ignore (ptr)
132: char * ptr;
133: {
134: AttributeType at;
135: Attr_Sequence newas;
136:
137: if ((at = str2AttrT (ptr)) == NULLAttrT)
138: return;
139: newas = as_comp_new (at,NULLAV,NULLACL_INFO);
140: ignore_attr = as_merge(ignore_attr,newas);
141: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.