comparison lib/argmatch.h @ 1591:fccafdb9ccd1

white space changes
author Jim Meyering <jim@meyering.net>
date Thu, 31 Dec 1998 18:10:53 +0000
parents a6a81f3170d0
children 6ba864382953
comparison
equal deleted inserted replaced
1590:713508d75bc7 1591:fccafdb9ccd1
39 matches with ARG. If VALLIST is not NULL, then use it to resolve 39 matches with ARG. If VALLIST is not NULL, then use it to resolve
40 false ambiguities (i.e., different matches of ARG but corresponding 40 false ambiguities (i.e., different matches of ARG but corresponding
41 to the same values in VALLIST). */ 41 to the same values in VALLIST). */
42 42
43 int argmatch 43 int argmatch
44 PARAMS ((const char *arg, const char *const *arglist, 44 PARAMS ((const char *arg, const char *const *arglist,
45 const char *vallist, size_t valsize)); 45 const char *vallist, size_t valsize));
46 int argcasematch 46 int argcasematch
47 PARAMS ((const char *arg, const char *const *arglist, 47 PARAMS ((const char *arg, const char *const *arglist,
48 const char *vallist, size_t valsize)); 48 const char *vallist, size_t valsize));
49 49
50 # define ARGMATCH(ARG,ARGLIST,VALLIST) \ 50 # define ARGMATCH(Arg, ARGLIST, Vallist) \
51 argmatch (ARG, ARGLIST, (const char *) VALLIST, sizeof (*VALLIST)) 51 argmatch (Arg, Arglist, (const char *) Vallist, sizeof (*Vallist))
52 52
53 # define ARGCASEMATCH(ARG,ARGLIST,VALLIST) \ 53 # define ARGCASEMATCH(Arg, Arglist, Vallist) \
54 argcasematch (ARG, ARGLIST, (const char *) VALLIST, sizeof (*VALLIST)) 54 argcasematch (Arg, Arglist, (const char *) Vallist, sizeof (*Vallist))
55 55
56 56
57 57
58 /* Report on stderr why argmatch failed. Report correct values. */ 58 /* Report on stderr why argmatch failed. Report correct values. */
59 59
60 void argmatch_invalid 60 void argmatch_invalid
61 PARAMS ((const char *kind, const char *value, int problem)); 61 PARAMS ((const char *kind, const char *value, int problem));
62 62
63 /* Left for compatibility with the old name invalid_arg */ 63 /* Left for compatibility with the old name invalid_arg */
64 64
65 # define invalid_arg(KIND,VALUE,PROBLEM) \ 65 # define invalid_arg(Kind, Value, Problem) \
66 argmatch_invalid (KIND, VALUE, PROBLEM) 66 argmatch_invalid (Kind, Value, Problem)
67 67
68 68
69 69
70 /* Report on stderr the list of possible arguments. */ 70 /* Report on stderr the list of possible arguments. */
71 71
72 void argmatch_valid 72 void argmatch_valid
73 PARAMS ((const char *const *arglist, 73 PARAMS ((const char *const *arglist,
74 const char *vallist, size_t valsize)); 74 const char *vallist, size_t valsize));
75 75
76 # define ARGMATCH_VALID(ARGLIST,VALLIST) \ 76 # define ARGMATCH_VALID(Arglist, Vallist) \
77 valid_args (ARGLIST, (const char *) VALLIST, sizeof (*VALLIST)) 77 valid_args (Arglist, (const char *) Vallist, sizeof (*Vallist))
78 78
79 79
80 /* Returns matches, or, upon error, report explanatory message and 80 /* Returns matches, or, upon error, report explanatory message and
81 exit. */ 81 exit. */
82 82
83 int __xargmatch_internal 83 int __xargmatch_internal
84 PARAMS ((const char *kind, 84 PARAMS ((const char *kind,
85 const char *arg, const char *const *arglist, 85 const char *arg, const char *const *arglist,
86 const char *vallist, size_t valsize, 86 const char *vallist, size_t valsize,
87 int sensitive)); 87 int sensitive));
88 88
89 # define XARGMATCH(KIND,ARG,ARGLIST,VALLIST) \ 89 # define XARGMATCH(Kind, Arg, Arglist, Vallist) \
90 VALLIST [__xargmatch_internal (KIND, ARG, ARGLIST, \ 90 Vallist [__xargmatch_internal (Kind, Arg, Arglist, \
91 (const char *) VALLIST, sizeof (*VALLIST), 1)] 91 (const char *) Vallist, sizeof (*Vallist), 1)]
92 92
93 # define XARGCASEMATCH(KIND,ARG,ARGLIST,VALLIST) \ 93 # define XARGCASEMATCH(Kind, Arg, Arglist, Vallist) \
94 VALLIST [__xargmatch_internal (KIND, ARG, ARGLIST, \ 94 Vallist [__xargmatch_internal (Kind, Arg, Arglist, \
95 (const char *) VALLIST, sizeof (*VALLIST), 0)] 95 (const char *) Vallist, sizeof (*Vallist), 0)]
96 96
97 97
98 98
99 /* Convert a value into a corresponding argument. */ 99 /* Convert a value into a corresponding argument. */
100 100
101 const char * argmatch_to_argument 101 const char *argmatch_to_argument
102 PARAMS ((char * value, const char *const *arglist, 102 PARAMS ((char *value, const char *const *arglist,
103 const char *vallist, size_t valsize)); 103 const char *vallist, size_t valsize));
104 104
105 # define ARGMATCH_TO_ARGUMENT(VALUE,ARGLIST,VALLIST) \ 105 # define ARGMATCH_TO_ARGUMENT(Value, Arglist, Vallist) \
106 argmatch_to_argument ((char *) &VALUE, ARGLIST, \ 106 argmatch_to_argument ((char *) &Value, Arglist, \
107 (const char *) VALLIST, sizeof (*VALLIST)) 107 (const char *) Vallist, sizeof (*Vallist))
108 108
109 #endif /* _ARGMATCH_H_ */ 109 #endif /* _ARGMATCH_H_ */