- if (mflag)
- for (ap = argv; *ap != NULL; ap++) {
- if (*ap == ARGIGNORE)
- continue;
- if ((pw = getpwnam(*ap)) == NULL)
- continue;
- enter_person(pw);
- *ap = ARGIGNORE;
- }
- else while (pw = getpwent())
- for (ap = argv; *ap != NULL; ap++) {
- if (*ap == ARGIGNORE)
- continue;
- if (strcasecmp(pw->pw_name, *ap) && !match(pw, *ap))
- continue;
- enter_person(pw);
- *ap = ARGIGNORE;
- /* don't break, may be listed multiple times */
- }
+ if (mflag) {
+ for (i = 0; i < argc; i++)
+ if (used[i] >= 0 && (pw = getpwnam(argv[i]))) {
+ enter_person(pw);
+ used[i] = 1;
+ }
+ } else while (pw = getpwent())
+ for (i = 0; i < argc; i++)
+ if (used[i] >= 0 &&
+ (!strcasecmp(pw->pw_name, argv[i]) ||
+ match(pw, argv[i]))) {
+ enter_person(pw);
+ used[i] = 1;
+ }