Lines Matching refs:go
360 Getopt go; in parse_args() local
382 ksh_getopt_reset(&go, GF_ERROR|GF_PLUSOPT); in parse_args()
383 while ((optc = ksh_getopt(argv, &go, opts)) != -1) { in parse_args()
384 set = tobool(!(go.info & GI_PLUS)); in parse_args()
390 array = go.optarg; in parse_args()
396 if (go.optarg == NULL) { in parse_args()
407 i = option(go.optarg); in parse_args()
430 bi_errorf("%s: %s", go.optarg, "bad option"); in parse_args()
443 chvt(&go); in parse_args()
469 if (!(go.info & GI_MINUSMINUS) && argv[go.optind] && in parse_args()
470 (argv[go.optind][0] == '-' || argv[go.optind][0] == '+') && in parse_args()
471 argv[go.optind][1] == '\0') { in parse_args()
473 if (argv[go.optind][0] == '-') { in parse_args()
478 go.optind++; in parse_args()
482 *setargsp = !arrayset && ((go.info & GI_MINUSMINUS) || in parse_args()
483 argv[go.optind]); in parse_args()
497 for (i = go.optind; argv[i]; i++) in parse_args()
499 qsort(&argv[go.optind], i - go.optind, sizeof(void *), in parse_args()
503 go.optind += set_array(array, tobool(arrayset > 0), in parse_args()
504 argv + go.optind); in parse_args()
506 return (go.optind); in parse_args()
955 ksh_getopt_reset(Getopt *go, int flags) in ksh_getopt_reset() argument
957 go->optind = 1; in ksh_getopt_reset()
958 go->optarg = NULL; in ksh_getopt_reset()
959 go->p = 0; in ksh_getopt_reset()
960 go->flags = flags; in ksh_getopt_reset()
961 go->info = 0; in ksh_getopt_reset()
962 go->buf[1] = '\0'; in ksh_getopt_reset()
992 ksh_getopt(const char **argv, Getopt *go, const char *optionsp) in ksh_getopt() argument
997 if (go->p == 0 || (c = argv[go->optind - 1][go->p]) == '\0') { in ksh_getopt()
998 const char *arg = argv[go->optind], flag = arg ? *arg : '\0'; in ksh_getopt()
1000 go->p = 1; in ksh_getopt()
1002 go->optind++; in ksh_getopt()
1003 go->p = 0; in ksh_getopt()
1004 go->info |= GI_MINUSMINUS; in ksh_getopt()
1010 (!(go->flags & GF_PLUSOPT) || flag != '+')) || in ksh_getopt()
1012 go->p = 0; in ksh_getopt()
1015 go->optind++; in ksh_getopt()
1016 go->info &= ~(GI_MINUS|GI_PLUS); in ksh_getopt()
1017 go->info |= flag == '-' ? GI_MINUS : GI_PLUS; in ksh_getopt()
1019 go->p++; in ksh_getopt()
1023 go->buf[0] = c; in ksh_getopt()
1024 go->optarg = go->buf; in ksh_getopt()
1027 (go->flags & GF_NONAME) ? "" : argv[0], in ksh_getopt()
1028 (go->flags & GF_NONAME) ? "" : ": ", c, in ksh_getopt()
1030 if (go->flags & GF_ERROR) in ksh_getopt()
1042 if (argv[go->optind - 1][go->p]) in ksh_getopt()
1043 go->optarg = argv[go->optind - 1] + go->p; in ksh_getopt()
1044 else if (argv[go->optind]) in ksh_getopt()
1045 go->optarg = argv[go->optind++]; in ksh_getopt()
1047 go->optarg = NULL; in ksh_getopt()
1050 go->buf[0] = c; in ksh_getopt()
1051 go->optarg = go->buf; in ksh_getopt()
1055 (go->flags & GF_NONAME) ? "" : argv[0], in ksh_getopt()
1056 (go->flags & GF_NONAME) ? "" : ": ", c, in ksh_getopt()
1058 if (go->flags & GF_ERROR) in ksh_getopt()
1062 go->p = 0; in ksh_getopt()
1065 go->optarg = argv[go->optind - 1] + go->p; in ksh_getopt()
1066 go->p = 0; in ksh_getopt()
1073 if (argv[go->optind - 1][go->p]) { in ksh_getopt()
1074 if (ksh_isdigit(argv[go->optind - 1][go->p])) { in ksh_getopt()
1075 go->optarg = argv[go->optind - 1] + go->p; in ksh_getopt()
1076 go->p = 0; in ksh_getopt()
1078 go->optarg = NULL; in ksh_getopt()
1080 if (argv[go->optind] && ksh_isdigit(argv[go->optind][0])) { in ksh_getopt()
1081 go->optarg = argv[go->optind++]; in ksh_getopt()
1082 go->p = 0; in ksh_getopt()
1084 go->optarg = NULL; in ksh_getopt()
1959 chvt(const Getopt *go) in chvt() argument
1961 const char *dv = go->optarg; in chvt()
1983 "can't find tty", go->optarg); in chvt()
2005 if (go->optarg[0] != '!') { in chvt()
2017 if (go->optarg[0] != '-') { in chvt()
2028 rndset((unsigned long)chvt_rndsetup(go, sizeof(Getopt))); in chvt()