lister.c (156230) | lister.c (156701) |
---|---|
1/*- 2 * Copyright (c) 2003-2006, Maxime Henrion <mux@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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 * | 1/*- 2 * Copyright (c) 2003-2006, Maxime Henrion <mux@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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 * $FreeBSD: vendor/csup/dist/contrib/csup/lister.c 156230 2006-03-03 04:11:29Z mux $ | 26 * $FreeBSD: vendor/csup/dist/contrib/csup/lister.c 156701 2006-03-14 03:51:13Z mux $ |
27 */ 28 29#include <assert.h> 30#include <errno.h> 31#include <limits.h> 32#include <stdio.h> 33#include <stdlib.h> 34#include <string.h> --- 105 unchanged lines hidden (view full) --- 140/* List a single collection based on the status file. */ 141static int 142lister_coll(struct lister *l, struct coll *coll, struct status *st) 143{ 144 struct stream *wr; 145 struct attrstack *as; 146 struct statusrec *sr; 147 struct fattr *fa; | 27 */ 28 29#include <assert.h> 30#include <errno.h> 31#include <limits.h> 32#include <stdio.h> 33#include <stdlib.h> 34#include <string.h> --- 105 unchanged lines hidden (view full) --- 140/* List a single collection based on the status file. */ 141static int 142lister_coll(struct lister *l, struct coll *coll, struct status *st) 143{ 144 struct stream *wr; 145 struct attrstack *as; 146 struct statusrec *sr; 147 struct fattr *fa; |
148 size_t i; |
|
148 int depth, error, ret, prunedepth; 149 150 wr = l->wr; 151 depth = 0; 152 prunedepth = INT_MAX; 153 as = attrstack_new(); 154 while ((ret = status_get(st, NULL, 0, 0, &sr)) == 1) { 155 switch (sr->sr_type) { --- 42 unchanged lines hidden (view full) --- 198 assert(status_eof(st)); 199 assert(depth == 0); 200 error = proto_printf(wr, ".\n"); 201 attrstack_free(as); 202 if (error) 203 return (LISTER_ERR_WRITE); 204 return (0); 205bad: | 149 int depth, error, ret, prunedepth; 150 151 wr = l->wr; 152 depth = 0; 153 prunedepth = INT_MAX; 154 as = attrstack_new(); 155 while ((ret = status_get(st, NULL, 0, 0, &sr)) == 1) { 156 switch (sr->sr_type) { --- 42 unchanged lines hidden (view full) --- 199 assert(status_eof(st)); 200 assert(depth == 0); 201 error = proto_printf(wr, ".\n"); 202 attrstack_free(as); 203 if (error) 204 return (LISTER_ERR_WRITE); 205 return (0); 206bad: |
206 while (depth-- > 0) { | 207 for (i = 0; i < attrstack_size(as); i++) { |
207 fa = attrstack_pop(as); 208 fattr_free(fa); 209 } 210 attrstack_free(as); 211 return (error); 212} 213 214/* Handle a directory up entry found in the status file. */ --- 224 unchanged lines hidden --- | 208 fa = attrstack_pop(as); 209 fattr_free(fa); 210 } 211 attrstack_free(as); 212 return (error); 213} 214 215/* Handle a directory up entry found in the status file. */ --- 224 unchanged lines hidden --- |