1 /*++
2 /* NAME
3 /*	rec_attr_map 3
4 /* SUMMARY
5 /*	map named attribute record type to pseudo record type
6 /* SYNOPSIS
7 /*	#include <rec_attr_map.h>
8 /*
9 /*	int	rec_attr_map(attr_name)
10 /*	const char *attr_name;
11 /* DESCRIPTION
12 /*	rec_attr_map() maps the record type of a named attribute to
13 /*	a pseudo record type, if such a mapping exists. The result
14 /*	is the pseudo record type in case of success, 0 on failure.
15 /* LICENSE
16 /* .ad
17 /* .fi
18 /*	The Secure Mailer license must be distributed with this software.
19 /* AUTHOR(S)
20 /*	Wietse Venema
21 /*	IBM T.J. Watson Research
22 /*	P.O. Box 704
23 /*	Yorktown Heights, NY 10598, USA
24 /*--*/
25 
26 /* System library. */
27 
28 #include <sys_defs.h>
29 #include <string.h>
30 
31 /* Global library. */
32 
33 #include <mail_proto.h>
34 #include <rec_type.h>
35 #include <rec_attr_map.h>
36 
37 /* rec_attr_map - map named attribute to pseudo record type */
38 
rec_attr_map(const char * attr_name)39 int     rec_attr_map(const char *attr_name)
40 {
41     if (strcmp(attr_name, MAIL_ATTR_DSN_ORCPT) == 0) {
42 	return (REC_TYPE_DSN_ORCPT);
43     } else if (strcmp(attr_name, MAIL_ATTR_DSN_NOTIFY) == 0) {
44 	return (REC_TYPE_DSN_NOTIFY);
45     } else if (strcmp(attr_name, MAIL_ATTR_DSN_ENVID) == 0) {
46 	return (REC_TYPE_DSN_ENVID);
47     } else if (strcmp(attr_name, MAIL_ATTR_DSN_RET) == 0) {
48 	return (REC_TYPE_DSN_RET);
49     } else if (strcmp(attr_name, MAIL_ATTR_CREATE_TIME) == 0) {
50 	return (REC_TYPE_CTIME);
51     } else {
52 	return (0);
53     }
54 }
55