summaryrefslogtreecommitdiffstats
path: root/pw/pw_group.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2012-10-30 08:00:53 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2012-10-30 08:00:53 +0000
commit530ff00378e7fc235e5ea51067c77398d575141e (patch)
tree3abb99e7579c92aa1f2dcc367f65dac3918dfad9 /pw/pw_group.c
parent6844cbad609c7fe499b4e759a0157ae704c84ccc (diff)
downloadpw-darwin-530ff00378e7fc235e5ea51067c77398d575141e.tar.gz
pw-darwin-530ff00378e7fc235e5ea51067c77398d575141e.zip
Teach pw(8) about how to use pw/gr API to reduce code duplication
MFC after: 2 months
Diffstat (limited to 'pw/pw_group.c')
-rw-r--r--pw/pw_group.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pw/pw_group.c b/pw/pw_group.c
index a8f182c..f4f2116 100644
--- a/pw/pw_group.c
+++ b/pw/pw_group.c
@@ -34,6 +34,8 @@ static const char rcsid[] =
#include <termios.h>
#include <stdbool.h>
#include <unistd.h>
+#include <grp.h>
+#include <libutil.h>
#include "pw.h"
#include "bitmap.h"
@@ -403,10 +405,9 @@ static int
print_group(struct group * grp, int pretty)
{
if (!pretty) {
- int buflen = 0;
char *buf = NULL;
- fmtgrent(&buf, &buflen, grp);
+ buf = gr_make(grp);
fputs(buf, stdout);
free(buf);
} else {