Blame


1 d947271f 2019-02-08 stsp /* $OpenBSD: rcsutil.h,v 1.15 2016/07/04 01:39:12 millert Exp $ */
2 d947271f 2019-02-08 stsp /*
3 d947271f 2019-02-08 stsp * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
4 d947271f 2019-02-08 stsp * All rights reserved.
5 d947271f 2019-02-08 stsp *
6 d947271f 2019-02-08 stsp * Redistribution and use in source and binary forms, with or without
7 d947271f 2019-02-08 stsp * modification, are permitted provided that the following conditions
8 d947271f 2019-02-08 stsp * are met:
9 d947271f 2019-02-08 stsp *
10 d947271f 2019-02-08 stsp * 1. Redistributions of source code must retain the above copyright
11 d947271f 2019-02-08 stsp * notice, this list of conditions and the following disclaimer.
12 d947271f 2019-02-08 stsp * 2. The name of the author may not be used to endorse or promote products
13 d947271f 2019-02-08 stsp * derived from this software without specific prior written permission.
14 d947271f 2019-02-08 stsp *
15 d947271f 2019-02-08 stsp * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
16 d947271f 2019-02-08 stsp * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
17 d947271f 2019-02-08 stsp * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
18 d947271f 2019-02-08 stsp * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 d947271f 2019-02-08 stsp * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 d947271f 2019-02-08 stsp * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
21 d947271f 2019-02-08 stsp * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
22 d947271f 2019-02-08 stsp * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
23 d947271f 2019-02-08 stsp * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
24 d947271f 2019-02-08 stsp * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 d947271f 2019-02-08 stsp */
26 d947271f 2019-02-08 stsp
27 d947271f 2019-02-08 stsp #ifndef RCSUTIL_H
28 d947271f 2019-02-08 stsp #define RCSUTIL_H
29 d947271f 2019-02-08 stsp
30 d947271f 2019-02-08 stsp #include "rcs.h"
31 d947271f 2019-02-08 stsp
32 d947271f 2019-02-08 stsp struct rcs_line {
33 d947271f 2019-02-08 stsp u_char *l_line;
34 d947271f 2019-02-08 stsp int l_lineno;
35 d947271f 2019-02-08 stsp size_t l_len;
36 d947271f 2019-02-08 stsp TAILQ_ENTRY(rcs_line) l_list;
37 d947271f 2019-02-08 stsp };
38 d947271f 2019-02-08 stsp
39 d947271f 2019-02-08 stsp TAILQ_HEAD(tqh, rcs_line);
40 d947271f 2019-02-08 stsp
41 d947271f 2019-02-08 stsp struct rcs_lines {
42 d947271f 2019-02-08 stsp int l_nblines;
43 d947271f 2019-02-08 stsp struct tqh l_lines;
44 d947271f 2019-02-08 stsp };
45 d947271f 2019-02-08 stsp
46 d947271f 2019-02-08 stsp struct rcs_argvector {
47 d947271f 2019-02-08 stsp char *str;
48 d947271f 2019-02-08 stsp char **argv;
49 d947271f 2019-02-08 stsp };
50 d947271f 2019-02-08 stsp
51 d947271f 2019-02-08 stsp /* rcsutil.c */
52 d947271f 2019-02-08 stsp int rcs_getopt(int, char **, const char *);
53 d947271f 2019-02-08 stsp void rcs_set_mtime(RCSFILE *, time_t);
54 d947271f 2019-02-08 stsp int rcs_choosefile(const char *, char *, size_t);
55 d947271f 2019-02-08 stsp time_t rcs_get_mtime(RCSFILE *);
56 d947271f 2019-02-08 stsp RCSNUM *rcs_getrevnum(const char *, RCSFILE *);
57 d947271f 2019-02-08 stsp char *rcs_prompt(const char *, int);
58 d947271f 2019-02-08 stsp u_int rcs_rev_select(RCSFILE *, const char *);
59 d947271f 2019-02-08 stsp int rcs_set_description(RCSFILE *, const char *, int);
60 d947271f 2019-02-08 stsp void rcs_setrevstr(char **, char *);
61 d947271f 2019-02-08 stsp void rcs_setrevstr2(char **, char **, char *);
62 d947271f 2019-02-08 stsp BUF *rcs_patchfile(u_char *, size_t, u_char *, size_t,
63 d947271f 2019-02-08 stsp int (*p)(struct rcs_lines *,struct rcs_lines *));
64 d947271f 2019-02-08 stsp struct rcs_lines *rcs_splitlines(u_char *, size_t);
65 d947271f 2019-02-08 stsp void rcs_freelines(struct rcs_lines *);
66 d947271f 2019-02-08 stsp int rcs_yesno(int);
67 d947271f 2019-02-08 stsp struct rcs_argvector *rcs_strsplit(const char *, const char *);
68 d947271f 2019-02-08 stsp void rcs_argv_destroy(struct rcs_argvector *);
69 d947271f 2019-02-08 stsp void rcs_strip_suffix(char *);
70 d947271f 2019-02-08 stsp
71 d947271f 2019-02-08 stsp #endif /* RCSUTIL_H */