shuf: tiny simplification
[coreutils.git] / src / set-fields.h
blob4d09038058cbeea9702308449ab28d8ec3412492
1 /* set-fields.h -- parse field list argument
3 Copyright (C) 2015-2024 Free Software Foundation, Inc.
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.
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.
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
20 struct field_range_pair
22 uintmax_t lo;
23 uintmax_t hi;
26 /* Array of `struct range_pair' holding all the finite ranges. */
27 extern struct field_range_pair *frp;
29 /* Number of finite ranges specified by the user. */
30 extern size_t n_frp;
32 /* field list parsing options */
33 enum
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) */
41 /* allocates and initializes the FRP array and N_FRP count */
42 extern void set_fields (char const *fieldstr, unsigned int options);
44 #endif