1184054Slulf/*-
2186743Slulf * Copyright (c) 2007-2009, Ulf Lilleengen <lulf@FreeBSD.org>
3184054Slulf * All rights reserved.
4184054Slulf *
5184054Slulf * Redistribution and use in source and binary forms, with or without
6184054Slulf * modification, are permitted provided that the following conditions
7184054Slulf * are met:
8184054Slulf * 1. Redistributions of source code must retain the above copyright
9184054Slulf *    notice, this list of conditions and the following disclaimer.
10184054Slulf * 2. Redistributions in binary form must reproduce the above copyright
11184054Slulf *    notice, this list of conditions and the following disclaimer in the
12184054Slulf *    documentation and/or other materials provided with the distribution.
13184054Slulf *
14184054Slulf * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15184054Slulf * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16184054Slulf * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17184054Slulf * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18184054Slulf * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19184054Slulf * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20184054Slulf * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21184054Slulf * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22184054Slulf * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23184054Slulf * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24184054Slulf * SUCH DAMAGE.
25184054Slulf *
26184054Slulf * $FreeBSD: releng/10.2/usr.bin/csup/rcsfile.h 216542 2010-12-18 20:43:18Z lulf $
27184054Slulf */
28184054Slulf
29184054Slulf#ifndef _RCSFILE_H_
30184054Slulf#define _RCSFILE_H_
31184054Slulf
32184054Slulf/* RCSFILE fields. */
33184054Slulf#define RCSFILE_HEAD	0
34184054Slulf#define RCSFILE_BRANCH	1
35184054Slulf#define RCSFILE_STRICT	2
36184054Slulf#define RCSFILE_COMMENT	3
37184054Slulf#define RCSFILE_EXPAND	4
38184054Slulf#define RCSFILE_DESC	5
39184054Slulf
40184054Slulfstruct rcsfile;
41184054Slulfstruct delta;
42184054Slulfstruct stream;
43184054Slulf
44184054Slulf/* Fetching, sending and writing an RCS file. */
45216542Slulfstruct rcsfile	*rcsfile_frompath(const char *, const char *, const char *,
46216542Slulf		    const char *, int);
47184054Slulfint		 rcsfile_send_details(struct rcsfile *, struct stream *);
48184054Slulfint		 rcsfile_write(struct rcsfile *, struct stream *);
49184054Slulfvoid		 rcsfile_print(struct rcsfile *);
50184054Slulfvoid		 rcsfile_free(struct rcsfile *);
51184054Slulf
52184054Slulf/* Used for adding and setting rcsfile values. */
53184054Slulfvoid		 rcsfile_addaccess(struct rcsfile *, char *);
54184054Slulfvoid		 rcsfile_addtag(struct rcsfile *, char *, char *);
55184054Slulfvoid		 rcsfile_importtag(struct rcsfile *, char *, char *);
56184054Slulfvoid		 rcsfile_deleterev(struct rcsfile *, char *);
57184054Slulfvoid		 rcsfile_deletetag(struct rcsfile *, char *, char *);
58184054Slulfstruct delta	*rcsfile_getdelta(struct rcsfile *, char *);
59184054Slulfvoid		 rcsfile_setval(struct rcsfile *, int, char *);
60184054Slulf
61184054Slulf/* Functions used for operating on RCS deltas. */
62184054Slulfstruct delta	*rcsfile_addelta(struct rcsfile *, char *, char *, char *,
63184054Slulf		    char *);
64184054Slulfvoid		 rcsfile_importdelta(struct rcsfile *, char *, char *, char *,
65184054Slulf		    char *, char *);
66184054Slulf
67185592Slulfint		 rcsdelta_addlog(struct delta *, char *, int);
68185592Slulfint		 rcsdelta_addtext(struct delta *, char *, int);
69190422Slulfint		 rcsdelta_appendlog(struct delta *, char *, size_t);
70190422Slulfint		 rcsdelta_appendtext(struct delta *, char *, size_t);
71184054Slulfvoid		 rcsdelta_setstate(struct delta *, char *);
72184054Slulfvoid		 rcsdelta_truncatetext(struct delta *, off_t);
73184054Slulfvoid		 rcsdelta_truncatelog(struct delta *, off_t);
74184054Slulf#endif /* !_RCSFILE_H_ */
75