1 /* $NetBSD: byte_mask.h,v 1.2 2020/03/18 19:05:21 christos Exp $ */ 2 3 #ifndef _BYTE_MASK_H_INCLUDED_ 4 #define _BYTE_MASK_H_INCLUDED_ 5 6 /*++ 7 /* NAME 8 /* byte_mask 3h 9 /* SUMMARY 10 /* map names to bit mask 11 /* SYNOPSIS 12 /* #include <byte_mask.h> 13 /* DESCRIPTION 14 /* .nf 15 16 /* 17 * Utility library. 18 */ 19 #include <vstring.h> 20 21 /* 22 * External interface. 23 */ 24 typedef struct { 25 int byte_val; 26 int mask; 27 } BYTE_MASK; 28 29 #define BYTE_MASK_FATAL (1<<0) 30 #define BYTE_MASK_ANY_CASE (1<<1) 31 #define BYTE_MASK_RETURN (1<<2) 32 #define BYTE_MASK_WARN (1<<6) 33 #define BYTE_MASK_IGNORE (1<<7) 34 35 #define BYTE_MASK_REQUIRED \ 36 (BYTE_MASK_FATAL | BYTE_MASK_RETURN | BYTE_MASK_WARN | BYTE_MASK_IGNORE) 37 #define STR_BYTE_MASK_REQUIRED (BYTE_MASK_REQUIRED) 38 39 #define BYTE_MASK_NONE 0 40 #define BYTE_MASK_DEFAULT (BYTE_MASK_FATAL) 41 42 #define byte_mask(tag, table, str) \ 43 byte_mask_opt((tag), (table), (str), BYTE_MASK_DEFAULT) 44 #define str_byte_mask(tag, table, mask) \ 45 str_byte_mask_opt(((VSTRING *) 0), (tag), (table), (mask), BYTE_MASK_DEFAULT) 46 47 extern int byte_mask_opt(const char *, const BYTE_MASK *, const char *, int); 48 extern const char *str_byte_mask_opt(VSTRING *, const char *, const BYTE_MASK *, int, int); 49 50 /* LICENSE 51 /* .ad 52 /* .fi 53 /* The Secure Mailer license must be distributed with this software. 54 /* AUTHOR(S) 55 /* Wietse Venema 56 /* IBM T.J. Watson Research 57 /* P.O. Box 704 58 /* Yorktown Heights, NY 10598, USA 59 /* 60 /* Wietse Venema 61 /* Google, Inc. 62 /* 111 8th Avenue 63 /* New York, NY 10011, USA 64 /*--*/ 65 66 #endif 67