Deleted Added
full compact
pw_group.c (56000) pw_group.c (61957)
1/*-
2 * Copyright (C) 1996
3 * David L. Nugent. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#ifndef lint
28static const char rcsid[] =
1/*-
2 * Copyright (C) 1996
3 * David L. Nugent. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#ifndef lint
28static const char rcsid[] =
29 "$FreeBSD: head/usr.sbin/pw/pw_group.c 56000 2000-01-15 00:20:22Z davidn $";
29 "$FreeBSD: head/usr.sbin/pw/pw_group.c 61957 2000-06-22 16:48:41Z ache $";
30#endif /* not lint */
31
32#include <ctype.h>
33#include <err.h>
34#include <termios.h>
35#include <unistd.h>
36
37#include "pw.h"

--- 45 unchanged lines hidden (view full) ---

83 print_group(grp, pretty);
84 ENDGRENT();
85 return EXIT_SUCCESS;
86 }
87 if (a_gid == NULL) {
88 if (a_name == NULL)
89 errx(EX_DATAERR, "group name or id required");
90
30#endif /* not lint */
31
32#include <ctype.h>
33#include <err.h>
34#include <termios.h>
35#include <unistd.h>
36
37#include "pw.h"

--- 45 unchanged lines hidden (view full) ---

83 print_group(grp, pretty);
84 ENDGRENT();
85 return EXIT_SUCCESS;
86 }
87 if (a_gid == NULL) {
88 if (a_name == NULL)
89 errx(EX_DATAERR, "group name or id required");
90
91 if (mode != M_ADD && grp == NULL && isdigit(*a_name->val)) {
91 if (mode != M_ADD && grp == NULL && isdigit((unsigned char)*a_name->val)) {
92 (a_gid = a_name)->ch = 'g';
93 a_name = NULL;
94 }
95 }
96 grp = (a_name != NULL) ? GETGRNAM(a_name->val) : GETGRGID((gid_t) atoi(a_gid->val));
97
98 if (mode == M_UPDATE || mode == M_DELETE || mode == M_PRINT) {
99 if (a_name == NULL && grp == NULL) /* Try harder */

--- 115 unchanged lines hidden (view full) ---

215 members[i++] = grp->gr_mem[k];
216 }
217 k++;
218 }
219 }
220 for (p = strtok(arg->val, ", \t"); p != NULL; p = strtok(NULL, ", \t")) {
221 int j;
222 if ((pwd = GETPWNAM(p)) == NULL) {
92 (a_gid = a_name)->ch = 'g';
93 a_name = NULL;
94 }
95 }
96 grp = (a_name != NULL) ? GETGRNAM(a_name->val) : GETGRGID((gid_t) atoi(a_gid->val));
97
98 if (mode == M_UPDATE || mode == M_DELETE || mode == M_PRINT) {
99 if (a_name == NULL && grp == NULL) /* Try harder */

--- 115 unchanged lines hidden (view full) ---

215 members[i++] = grp->gr_mem[k];
216 }
217 k++;
218 }
219 }
220 for (p = strtok(arg->val, ", \t"); p != NULL; p = strtok(NULL, ", \t")) {
221 int j;
222 if ((pwd = GETPWNAM(p)) == NULL) {
223 if (!isdigit(*p) || (pwd = getpwuid((uid_t) atoi(p))) == NULL)
223 if (!isdigit((unsigned char)*p) || (pwd = getpwuid((uid_t) atoi(p))) == NULL)
224 errx(EX_NOUSER, "user `%s' does not exist", p);
225 }
226 /*
227 * Check for duplicates
228 */
229 for (j = 0; j < i && strcmp(members[j], pwd->pw_name)!=0; j++)
230 ;
231 if (j == i && extendarray(&members, &grmembers, i + 2) != -1)

--- 121 unchanged lines hidden ---
224 errx(EX_NOUSER, "user `%s' does not exist", p);
225 }
226 /*
227 * Check for duplicates
228 */
229 for (j = 0; j < i && strcmp(members[j], pwd->pw_name)!=0; j++)
230 ;
231 if (j == i && extendarray(&members, &grmembers, i + 2) != -1)

--- 121 unchanged lines hidden ---