Lines Matching refs:go
282 Getopt go; in parse_args() local
333 ksh_getopt_reset(&go, GF_ERROR|GF_PLUSOPT); in parse_args()
334 while ((optc = ksh_getopt(argv, &go, opts)) != -1) { in parse_args()
335 set = (go.info & GI_PLUS) ? 0 : 1; in parse_args()
341 array = go.optarg; in parse_args()
347 if (go.optarg == NULL) { in parse_args()
358 i = option(go.optarg); in parse_args()
370 bi_errorf("%s: %s", go.optarg, "bad option"); in parse_args()
383 chvt(go.optarg); in parse_args()
409 if (!(go.info & GI_MINUSMINUS) && argv[go.optind] && in parse_args()
410 (argv[go.optind][0] == '-' || argv[go.optind][0] == '+') && in parse_args()
411 argv[go.optind][1] == '\0') { in parse_args()
413 if (argv[go.optind][0] == '-') in parse_args()
416 go.optind++; in parse_args()
420 *setargsp = !arrayset && ((go.info & GI_MINUSMINUS) || in parse_args()
421 argv[go.optind]); in parse_args()
434 for (i = go.optind; argv[i]; i++) in parse_args()
436 qsort(&argv[go.optind], i - go.optind, sizeof(void *), in parse_args()
440 go.optind += set_array(array, tobool(arrayset > 0), in parse_args()
441 argv + go.optind); in parse_args()
443 return (go.optind); in parse_args()
892 ksh_getopt_reset(Getopt *go, int flags) in ksh_getopt_reset() argument
894 go->optind = 1; in ksh_getopt_reset()
895 go->optarg = NULL; in ksh_getopt_reset()
896 go->p = 0; in ksh_getopt_reset()
897 go->flags = flags; in ksh_getopt_reset()
898 go->info = 0; in ksh_getopt_reset()
899 go->buf[1] = '\0'; in ksh_getopt_reset()
929 ksh_getopt(const char **argv, Getopt *go, const char *optionsp) in ksh_getopt() argument
934 if (go->p == 0 || (c = argv[go->optind - 1][go->p]) == '\0') { in ksh_getopt()
935 const char *arg = argv[go->optind], flag = arg ? *arg : '\0'; in ksh_getopt()
937 go->p = 1; in ksh_getopt()
939 go->optind++; in ksh_getopt()
940 go->p = 0; in ksh_getopt()
941 go->info |= GI_MINUSMINUS; in ksh_getopt()
947 (!(go->flags & GF_PLUSOPT) || flag != '+')) || in ksh_getopt()
949 go->p = 0; in ksh_getopt()
952 go->optind++; in ksh_getopt()
953 go->info &= ~(GI_MINUS|GI_PLUS); in ksh_getopt()
954 go->info |= flag == '-' ? GI_MINUS : GI_PLUS; in ksh_getopt()
956 go->p++; in ksh_getopt()
960 go->buf[0] = c; in ksh_getopt()
961 go->optarg = go->buf; in ksh_getopt()
964 (go->flags & GF_NONAME) ? "" : argv[0], in ksh_getopt()
965 (go->flags & GF_NONAME) ? "" : ": ", c, in ksh_getopt()
967 if (go->flags & GF_ERROR) in ksh_getopt()
979 if (argv[go->optind - 1][go->p]) in ksh_getopt()
980 go->optarg = argv[go->optind - 1] + go->p; in ksh_getopt()
981 else if (argv[go->optind]) in ksh_getopt()
982 go->optarg = argv[go->optind++]; in ksh_getopt()
984 go->optarg = NULL; in ksh_getopt()
987 go->buf[0] = c; in ksh_getopt()
988 go->optarg = go->buf; in ksh_getopt()
992 (go->flags & GF_NONAME) ? "" : argv[0], in ksh_getopt()
993 (go->flags & GF_NONAME) ? "" : ": ", c, in ksh_getopt()
995 if (go->flags & GF_ERROR) in ksh_getopt()
999 go->p = 0; in ksh_getopt()
1002 go->optarg = argv[go->optind - 1] + go->p; in ksh_getopt()
1003 go->p = 0; in ksh_getopt()
1010 if (argv[go->optind - 1][go->p]) { in ksh_getopt()
1011 if (ksh_isdigit(argv[go->optind - 1][go->p])) { in ksh_getopt()
1012 go->optarg = argv[go->optind - 1] + go->p; in ksh_getopt()
1013 go->p = 0; in ksh_getopt()
1015 go->optarg = NULL; in ksh_getopt()
1017 if (argv[go->optind] && ksh_isdigit(argv[go->optind][0])) { in ksh_getopt()
1018 go->optarg = argv[go->optind++]; in ksh_getopt()
1019 go->p = 0; in ksh_getopt()
1021 go->optarg = NULL; in ksh_getopt()