Home | History | Annotate | Line # | Download | only in global
      1 /*	$NetBSD: attr_override.h,v 1.2 2017/02/14 01:16:45 christos Exp $	*/
      2 
      3 #ifndef _ATTR_OVERRIDE_H_INCLUDED_
      4 #define _ATTR_OVERRIDE_H_INCLUDED_
      5 
      6 /*++
      7 /* NAME
      8 /*	attr_override 3h
      9 /* SUMMARY
     10 /*	apply name=value settings from string
     11 /* SYNOPSIS
     12 /*	#include <attr_override.h>
     13 /* DESCRIPTION
     14 /* .nf
     15 
     16  /*
     17   * External interface.
     18   */
     19 #include <check_arg.h>
     20 
     21 extern void attr_override(char *, const char *, const char *,...);
     22 
     23 typedef struct {
     24     const char *name;
     25     CONST_CHAR_STAR *target;
     26     int     min;
     27     int     max;
     28 } ATTR_OVER_STR;
     29 
     30 typedef struct {
     31     const char *name;
     32     const char *defval;
     33     int    *target;
     34     int     min;
     35     int     max;
     36 } ATTR_OVER_TIME;
     37 
     38 typedef struct {
     39     const char *name;
     40     int    *target;
     41     int     min;
     42     int     max;
     43 } ATTR_OVER_INT;
     44 
     45 /* Type-unchecked API, internal use only. */
     46 #define ATTR_OVER_END		0
     47 #define ATTR_OVER_STR_TABLE	1
     48 #define ATTR_OVER_TIME_TABLE	2
     49 #define ATTR_OVER_INT_TABLE	3
     50 
     51 /* Type-checked API, external use only. */
     52 #define CA_ATTR_OVER_END		0
     53 #define CA_ATTR_OVER_STR_TABLE(v)	ATTR_OVER_STR_TABLE, CHECK_CPTR(ATTR_OVER, ATTR_OVER_STR, (v))
     54 #define CA_ATTR_OVER_TIME_TABLE(v)	ATTR_OVER_TIME_TABLE, CHECK_CPTR(ATTR_OVER, ATTR_OVER_TIME, (v))
     55 #define CA_ATTR_OVER_INT_TABLE(v)	ATTR_OVER_INT_TABLE, CHECK_CPTR(ATTR_OVER, ATTR_OVER_INT, (v))
     56 
     57 CHECK_CPTR_HELPER_DCL(ATTR_OVER, ATTR_OVER_TIME);
     58 CHECK_CPTR_HELPER_DCL(ATTR_OVER, ATTR_OVER_STR);
     59 CHECK_CPTR_HELPER_DCL(ATTR_OVER, ATTR_OVER_INT);
     60 
     61 /* LICENSE
     62 /* .ad
     63 /* .fi
     64 /*	The Secure Mailer license must be distributed with this software.
     65 /* AUTHOR(S)
     66 /*	Wietse Venema
     67 /*	IBM T.J. Watson Research
     68 /*	P.O. Box 704
     69 /*	Yorktown Heights, NY 10598, USA
     70 /*--*/
     71 
     72 #endif
     73