Lines Matching refs:opt

138 #define IS_TARGET_DRIVER(opt)	((opt).target[0] == TARGET_DRIVER[0])
162 int opt;
167 #define _X(n,a,o,m) { .name = n a, .opt = o, .help = m, },
187 if (isprint(tbl[i].opt))
188 n = printf("-%c | --%s", tbl[i].opt, tbl[i].name);
248 } opt = {
320 opt.brief = true;
325 opt.debug = strtous(optarg, NULL, 0);
327 opt.debug++;
328 opt.debug &= DEBUG_MASK;
332 opt.opt_fname = estrdup(optarg);
337 get_bootnum(&opt, optarg);
339 opt.active = false;
345 get_bootnum(&opt, optarg);
347 opt.active = true;
353 get_bootnum(&opt, optarg);
359 get_bootnum(&opt, optarg);
363 opt.prefix_bootorder = false;
368 opt.prefix_bootorder = true;
377 opt.device = estrdup(optarg);
381 opt.reconnect = false;
385 opt.reconnect = true;
394 opt.label = estrdup(optarg);
398 opt.loader = estrdup(optarg);
406 opt.b_flag = true;
407 opt.bootnum = strtous(optarg, NULL, 16);
416 opt.bootorder = estrdup(optarg);
421 opt.partnum = strtous(optarg, NULL, 0);
425 if (opt.regexp != NULL)
426 free(opt.regexp);
427 opt.regexp = estrdup(optarg);
431 if (opt.target != NULL)
434 opt.target = TARGET_DRIVER;
442 opt.timeout = strtous(optarg, NULL, 0);
447 opt.quiet = true;
448 opt.verbose = 0;
456 opt.verbose++;
457 opt.brief = false;
462 opt.mbr_sig_write = MBR_SIG_WRITE_FORCE;
463 opt.mbr_sig = (uint32_t)estrtou(optarg, 0,
467 opt.mbr_sig_write = MBR_SIG_WRITE_MAYBE;
469 opt.mbr_sig = (uint32_t)random();
475 if (opt.csus != NULL) {
479 opt.csus = estrdup(optarg);
484 if (opt.csus != NULL) {
488 opt.csus = estrdup(optarg);
492 if (opt.target != NULL)
495 opt.target = TARGET_SYSPREP;
504 if (opt.target == NULL)
505 opt.target = TARGET_BOOT;
516 if (opt.quiet)
517 opt.verbose = 0;
521 if (opt.regexp != NULL) {/* override any previous setting */
523 opt.regexp);
524 free(opt.regexp);
529 return show_gpt(fname, opt.verbose);
533 if (!opt.b_flag)
537 if (opt.mbr_sig_write) {
542 return mbr_sig_write(opt.device, opt.mbr_sig,
543 IS_MBR_SIG_FORCE(opt), opt.verbose);
553 case act_del_bootorder_dups: return del_bootorder_dups(efi_fd, opt.target);
554 case act_del_bootorder: return del_bootorder(efi_fd, opt.target);
557 case act_del_variable: return del_variable(efi_fd, opt.target, opt.bootnum);
559 case act_set_active: return set_active(efi_fd, opt.target, opt.bootnum, opt.active);
560 case act_set_bootnext: return set_bootnext(efi_fd, opt.bootnum);
561 case act_set_bootorder: return set_bootorder(efi_fd, opt.target, opt.bootorder);
562 case act_set_timeout: return set_timeout(efi_fd, opt.timeout);
564 case act_remove_bootorder: return remove_bootorder(efi_fd, opt.target, opt.csus, 0);
565 case act_prefix_bootorder: return prefix_bootorder(efi_fd, opt.target, opt.csus, 0);
578 easprintf(&opt.regexp, "^%s[0-9,A-F]{4}$", opt.target);
583 if (opt.regexp != NULL)
586 if (opt.b_flag) {
587 easprintf(&opt.regexp, "^%s%04X$",
588 opt.target, opt.bootnum);
590 easprintf(&opt.regexp, "^%s", opt.target);
595 var_hdl = get_variables(efi_fd, opt.regexp, &var_array, &var_cnt);
597 free(opt.regexp);
598 opt.regexp = NULL;
610 if (opt.device == NULL) {
611 opt.device = DEFAULT_DEVICE;
612 if (opt.device == NULL)
616 if (opt.reconnect && IS_TARGET_DRIVER(opt))
623 opt.target);
624 easprintf(&v.name, "%s%04X", opt.target, bootnum);
626 if (!opt.quiet)
641 v.ev.data = make_bootvar_data(opt.device, opt.partnum,
642 attrib, opt.label, opt.loader, opt.opt_fname,
645 if (!opt.quiet) {
650 opt.debug &= (uint)~DEBUG_BRIEF_BIT;
651 opt.debug |= DEBUG_VERBOSE_BIT;
652 show_variable(&v, opt.debug, 0);
669 if (opt.prefix_bootorder)
670 rv = prefix_bootorder(efi_fd, opt.target, NULL,
677 if (opt.mbr_sig_write) {
678 assert(opt.device != NULL);
679 mbr_sig_write(opt.device, opt.mbr_sig,
680 IS_MBR_SIG_FORCE(opt), opt.verbose);
687 uint flags = opt.debug;
689 if (opt.verbose)
692 if (opt.brief)
699 if (opt.brief)