Index: head/usr.bin/units/units.c =================================================================== --- head/usr.bin/units/units.c +++ head/usr.bin/units/units.c @@ -802,10 +802,10 @@ if (!readfile) readunits(NULL); - if (cap_enter() < 0 && errno != ENOSYS) - err(1, "unable to enter capability mode"); - if (optind == argc - 2) { + if (cap_enter() < 0 && errno != ENOSYS) + err(1, "unable to enter capability mode"); + havestr = argv[optind]; wantstr = argv[optind + 1]; initializeunit(&have); @@ -815,8 +815,7 @@ addunit(&want, wantstr, 0, 1); completereduce(&want); showanswer(&have, &want); - } - else { + } else { inhistory = history_init(); el = el_init(argv[0], stdin, stdout, stderr); el_set(el, EL_PROMPT, &prompt); @@ -828,6 +827,9 @@ if (inhistory == 0) err(1, "Could not initialize history"); + if (cap_enter() < 0 && errno != ENOSYS) + err(1, "unable to enter capability mode"); + if (!quiet) printf("%d units, %d prefixes\n", unitcount, prefixcount);