1 /* set-fields.h -- parse field list argument
2 
3    Copyright (C) 2015-2023 Free Software Foundation, Inc.
4 
5    This program is free software: you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation, either version 3 of the License, or
8    (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
17 #ifndef SET_FIELDS_H
18 # define SET_FIELDS_H
19 
20 struct field_range_pair
21   {
22     uintmax_t lo;
23     uintmax_t hi;
24   };
25 
26 /* Array of `struct range_pair' holding all the finite ranges. */
27 extern struct field_range_pair *frp;
28 
29 /* Number of finite ranges specified by the user. */
30 extern size_t n_frp;
31 
32 /* field list parsing options */
33 enum
34 {
35   SETFLD_ALLOW_DASH = 0x01,     /* allow single dash meaning 'all fields' */
36   SETFLD_COMPLEMENT = 0x02,     /* complement the field list */
37   SETFLD_ERRMSG_USE_POS = 0x04  /* when reporting errors, say 'position' instead
38                                    of 'field' (used with cut -b/-c) */
39 };
40 
41 /* allocates and initializes the FRP array and N_FRP count */
42 extern void set_fields (char const *fieldstr, unsigned int options);
43 
44 #endif
45