rcsparse.c (185592) | rcsparse.c (186700) |
---|---|
1/*- 2 * Copyright (c) 2008, Ulf Lilleengen <lulf@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) 2008, Ulf Lilleengen <lulf@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: projects/csup_cvsmode/contrib/csup/rcsparse.c 185592 2008-12-03 22:47:33Z lulf $ | 26 * $FreeBSD: projects/csup_cvsmode/contrib/csup/rcsparse.c 186700 2009-01-02 12:40:58Z lulf $ |
27 */ 28 29#include <assert.h> 30#include <stdio.h> 31#include <stdlib.h> 32 33#include "misc.h" 34#include "queue.h" --- 42 unchanged lines hidden (view full) --- 77 *arglen = len; 78 return (val); 79} 80 81/* 82 * Start up parser, and use the rcsfile hook to add objects. 83 */ 84int | 27 */ 28 29#include <assert.h> 30#include <stdio.h> 31#include <stdlib.h> 32 33#include "misc.h" 34#include "queue.h" --- 42 unchanged lines hidden (view full) --- 77 *arglen = len; 78 return (val); 79} 80 81/* 82 * Start up parser, and use the rcsfile hook to add objects. 83 */ 84int |
85rcsparse_run(struct rcsfile *rf, FILE *infp) | 85rcsparse_run(struct rcsfile *rf, FILE *infp, int ro) |
86{ 87 yyscan_t scanner; 88 char *desc; 89 int error, tok; 90 91 error = 0; 92 rcslex_init(&scanner); 93 rcsset_in(infp, scanner); 94 tok = parse_admin(rf, &scanner); 95 tok = parse_deltas(rf, &scanner, tok); 96 assert(tok == KEYWORD); 97 asserttoken(&scanner, STRING); 98 desc = duptext(&scanner, NULL); 99 rcsfile_setval(rf, RCSFILE_DESC, desc); 100 free(desc); 101 tok = rcslex(scanner); | 86{ 87 yyscan_t scanner; 88 char *desc; 89 int error, tok; 90 91 error = 0; 92 rcslex_init(&scanner); 93 rcsset_in(infp, scanner); 94 tok = parse_admin(rf, &scanner); 95 tok = parse_deltas(rf, &scanner, tok); 96 assert(tok == KEYWORD); 97 asserttoken(&scanner, STRING); 98 desc = duptext(&scanner, NULL); 99 rcsfile_setval(rf, RCSFILE_DESC, desc); 100 free(desc); 101 tok = rcslex(scanner); |
102 error = parse_deltatexts(rf, &scanner, tok); 103 if (error) 104 return (error); | 102 /* Parse deltatexts if we need to edit. */ 103 if (!ro) { 104 error = parse_deltatexts(rf, &scanner, tok); 105 if (error) 106 return (error); 107 } |
105 rcslex_destroy(scanner); 106 return (0); 107} 108 109/* 110 * Parse the admin part of a RCS file. 111 */ 112static int --- 242 unchanged lines hidden --- | 108 rcslex_destroy(scanner); 109 return (0); 110} 111 112/* 113 * Parse the admin part of a RCS file. 114 */ 115static int --- 242 unchanged lines hidden --- |