| 1 | /* Iterate over arguments from argv or --files0-from=FILE |
| 2 | Copyright (C) 2008-2020 Free Software Foundation, Inc. |
| 3 | |
| 4 | This program is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU General Public License as published by |
| 6 | the Free Software Foundation, either version 3 of the License, or |
| 7 | (at your option) any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License |
| 15 | along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| 16 | |
| 17 | #include <stdio.h> |
| 18 | #include <stdbool.h> |
| 19 | |
| 20 | /* Definition of _GL_ARG_NONNULL. */ |
| 21 | #include "arg-nonnull.h" |
| 22 | |
| 23 | struct argv_iterator; |
| 24 | |
| 25 | enum argv_iter_err |
| 26 | { |
| 27 | AI_ERR_OK = 1, |
| 28 | AI_ERR_EOF, |
| 29 | AI_ERR_MEM, |
| 30 | AI_ERR_READ |
| 31 | }; |
| 32 | |
| 33 | struct argv_iterator *argv_iter_init_argv (char **argv) |
| 34 | _GL_ARG_NONNULL ((1)); |
| 35 | struct argv_iterator *argv_iter_init_stream (FILE *fp) |
| 36 | _GL_ARG_NONNULL ((1)); |
| 37 | char *argv_iter (struct argv_iterator *, enum argv_iter_err *) |
| 38 | _GL_ARG_NONNULL ((1, 2)); |
| 39 | size_t argv_iter_n_args (struct argv_iterator const *) |
| 40 | _GL_ATTRIBUTE_PURE _GL_ARG_NONNULL ((1)); |
| 41 | void argv_iter_free (struct argv_iterator *) |
| 42 | _GL_ARG_NONNULL ((1)); |