Deleted Added
sdiff udiff text old ( 248102 ) new ( 273791 )
full compact
1/*-
2 * Copyright (c) 2008 Sean C. Farley <scf@FreeBSD.org>
3 * 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

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

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/lib/libutil/gr_util.c 248102 2013-03-09 13:30:06Z db $");
29
30#include <sys/param.h>
31#include <sys/errno.h>
32#include <sys/stat.h>
33
34#include <ctype.h>
35#include <err.h>
36#include <fcntl.h>

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

165gr_copy(int ffd, int tfd, const struct group *gr, struct group *old_gr)
166{
167 char buf[8192], *end, *line, *p, *q, *r, t;
168 struct group *fgr;
169 const struct group *sgr;
170 size_t len;
171 int eof, readlen;
172
173 sgr = gr;
174 if (gr == NULL) {
175 line = NULL;
176 if (old_gr == NULL)
177 return (-1);
178 sgr = old_gr;
179 } else if ((line = gr_make(gr)) == NULL)
180 return (-1);
181
182 eof = 0;
183 len = 0;
184 p = q = end = buf;
185 for (;;) {
186 /* find the end of the current line */
187 for (p = q; q < end && *q != '\0'; ++q)
188 if (*q == '\n')
189 break;

--- 442 unchanged lines hidden ---