pw_group.c (176474) | pw_group.c (242349) |
---|---|
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 176474 2008-02-23 01:25:22Z scf $"; | 29 "$FreeBSD: head/usr.sbin/pw/pw_group.c 242349 2012-10-30 08:00:53Z bapt $"; |
30#endif /* not lint */ 31 32#include <ctype.h> 33#include <err.h> 34#include <termios.h> 35#include <stdbool.h> 36#include <unistd.h> | 30#endif /* not lint */ 31 32#include <ctype.h> 33#include <err.h> 34#include <termios.h> 35#include <stdbool.h> 36#include <unistd.h> |
37#include <grp.h> 38#include <libutil.h> |
|
37 38#include "pw.h" 39#include "bitmap.h" 40 41 42static struct passwd *lookup_pwent(const char *user); 43static void delete_members(char ***members, int *grmembers, int *i, 44 struct carg *arg, struct group *grp); --- 353 unchanged lines hidden (view full) --- 398 return gid; 399} 400 401 402static int 403print_group(struct group * grp, int pretty) 404{ 405 if (!pretty) { | 39 40#include "pw.h" 41#include "bitmap.h" 42 43 44static struct passwd *lookup_pwent(const char *user); 45static void delete_members(char ***members, int *grmembers, int *i, 46 struct carg *arg, struct group *grp); --- 353 unchanged lines hidden (view full) --- 400 return gid; 401} 402 403 404static int 405print_group(struct group * grp, int pretty) 406{ 407 if (!pretty) { |
406 int buflen = 0; | |
407 char *buf = NULL; 408 | 408 char *buf = NULL; 409 |
409 fmtgrent(&buf, &buflen, grp); | 410 buf = gr_make(grp); |
410 fputs(buf, stdout); 411 free(buf); 412 } else { 413 int i; 414 415 printf("Group Name: %-15s #%lu\n" 416 " Members: ", 417 grp->gr_name, (long) grp->gr_gid); 418 for (i = 0; grp->gr_mem[i]; i++) 419 printf("%s%s", i ? "," : "", grp->gr_mem[i]); 420 fputs("\n\n", stdout); 421 } 422 return EXIT_SUCCESS; 423} | 411 fputs(buf, stdout); 412 free(buf); 413 } else { 414 int i; 415 416 printf("Group Name: %-15s #%lu\n" 417 " Members: ", 418 grp->gr_name, (long) grp->gr_gid); 419 for (i = 0; grp->gr_mem[i]; i++) 420 printf("%s%s", i ? "," : "", grp->gr_mem[i]); 421 fputs("\n\n", stdout); 422 } 423 return EXIT_SUCCESS; 424} |