Lines Matching defs:bsdcat

9  * Command line parser for bsdcat.
24 #include "bsdcat.h"
28 * Short options for bsdcat. Please keep this sorted.
33 * Long options for bsdcat. Please keep this list sorted.
36 * defined in bsdcat.h. Also note that so far I've found no need
56 * has, of course, been shamelessly tailored for bsdcat. (If you're
85 * bsdcat.c.
94 bsdcat_getopt(struct bsdcat *bsdcat)
111 bsdcat->argument = NULL;
114 if (bsdcat->getopt_state == state_start) {
116 ++bsdcat->argv;
117 --bsdcat->argc;
118 if (*bsdcat->argv == NULL)
121 bsdcat->getopt_state = state_next_word;
127 if (bsdcat->getopt_state == state_next_word) {
129 if (bsdcat->argv[0] == NULL)
132 if (bsdcat->argv[0][0] != '-')
135 if (strcmp(bsdcat->argv[0], "--") == 0) {
136 ++bsdcat->argv;
137 --bsdcat->argc;
141 bsdcat->getopt_word = *bsdcat->argv++;
142 --bsdcat->argc;
143 if (bsdcat->getopt_word[1] == '-') {
145 bsdcat->getopt_state = state_long;
146 bsdcat->getopt_word += 2; /* Skip leading '--' */
149 bsdcat->getopt_state = state_short;
150 ++bsdcat->getopt_word; /* Skip leading '-' */
157 if (bsdcat->getopt_state == state_short) {
159 opt = *bsdcat->getopt_word++;
162 bsdcat->getopt_state = state_next_word;
175 /* If arg is run-in, bsdcat->getopt_word already points to it. */
176 if (bsdcat->getopt_word[0] == '\0') {
178 bsdcat->getopt_word = *bsdcat->argv;
179 if (bsdcat->getopt_word == NULL) {
185 ++bsdcat->argv;
186 --bsdcat->argc;
189 bsdcat->getopt_state = state_long;
192 bsdcat->getopt_state = state_next_word;
193 bsdcat->argument = bsdcat->getopt_word;
199 if (bsdcat->getopt_state == state_long) {
201 bsdcat->getopt_state = state_next_word;
204 p = strchr(bsdcat->getopt_word, '=');
206 optlength = (size_t)(p - bsdcat->getopt_word);
207 bsdcat->argument = (char *)(uintptr_t)(p + 1);
209 optlength = strlen(bsdcat->getopt_word);
215 if (popt->name[0] != bsdcat->getopt_word[0])
218 if (strncmp(bsdcat->getopt_word, popt->name, optlength) == 0) {
233 long_prefix, bsdcat->getopt_word);
239 long_prefix, bsdcat->getopt_word, match->name, match2->name);
246 if (bsdcat->argument == NULL) {
247 bsdcat->argument = *bsdcat->argv;
248 if (bsdcat->argument == NULL) {
254 ++bsdcat->argv;
255 --bsdcat->argc;
259 if (bsdcat->argument != NULL) {