1*6541b77cSguenther /* $OpenBSD: rcsutil.h,v 1.16 2023/08/11 05:02:21 guenther Exp $ */ 29349b09eSxsa /* 39349b09eSxsa * Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org> 49349b09eSxsa * All rights reserved. 59349b09eSxsa * 69349b09eSxsa * Redistribution and use in source and binary forms, with or without 79349b09eSxsa * modification, are permitted provided that the following conditions 89349b09eSxsa * are met: 99349b09eSxsa * 109349b09eSxsa * 1. Redistributions of source code must retain the above copyright 119349b09eSxsa * notice, this list of conditions and the following disclaimer. 129349b09eSxsa * 2. The name of the author may not be used to endorse or promote products 139349b09eSxsa * derived from this software without specific prior written permission. 149349b09eSxsa * 159349b09eSxsa * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 169349b09eSxsa * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 179349b09eSxsa * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 189349b09eSxsa * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 199349b09eSxsa * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 209349b09eSxsa * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 219349b09eSxsa * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 229349b09eSxsa * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 239349b09eSxsa * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 249349b09eSxsa * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 259349b09eSxsa */ 269349b09eSxsa 279349b09eSxsa #ifndef RCSUTIL_H 289349b09eSxsa #define RCSUTIL_H 299349b09eSxsa 309349b09eSxsa #include "rcs.h" 319349b09eSxsa 32714c2363Sxsa struct rcs_line { 3314b185ffSniallo u_char *l_line; 34714c2363Sxsa int l_lineno; 3514b185ffSniallo size_t l_len; 36714c2363Sxsa TAILQ_ENTRY(rcs_line) l_list; 37714c2363Sxsa }; 38714c2363Sxsa 397a9e6d11Sray TAILQ_HEAD(tqh, rcs_line); 40714c2363Sxsa 41714c2363Sxsa struct rcs_lines { 42714c2363Sxsa int l_nblines; 437a9e6d11Sray struct tqh l_lines; 44714c2363Sxsa }; 45714c2363Sxsa 46714c2363Sxsa struct rcs_argvector { 47714c2363Sxsa char *str; 48714c2363Sxsa char **argv; 49714c2363Sxsa }; 50714c2363Sxsa 519349b09eSxsa /* rcsutil.c */ 529349b09eSxsa int rcs_getopt(int, char **, const char *); 53*6541b77cSguenther void rcs_set_mtime(RCSFILE *, struct timespec); 54bc8d37c3Sjoris int rcs_choosefile(const char *, char *, size_t); 55*6541b77cSguenther struct timespec rcs_get_mtime(RCSFILE *); 569349b09eSxsa RCSNUM *rcs_getrevnum(const char *, RCSFILE *); 5700f4e67cSmillert char *rcs_prompt(const char *, int); 586e2f6b91Sray u_int rcs_rev_select(RCSFILE *, const char *); 5900f4e67cSmillert int rcs_set_description(RCSFILE *, const char *, int); 609349b09eSxsa void rcs_setrevstr(char **, char *); 619349b09eSxsa void rcs_setrevstr2(char **, char **, char *); 62c2ac0f30Sxsa BUF *rcs_patchfile(u_char *, size_t, u_char *, size_t, 63714c2363Sxsa int (*p)(struct rcs_lines *,struct rcs_lines *)); 64c2ac0f30Sxsa struct rcs_lines *rcs_splitlines(u_char *, size_t); 65714c2363Sxsa void rcs_freelines(struct rcs_lines *); 669642f3ecSmillert int rcs_yesno(int); 676e2f6b91Sray struct rcs_argvector *rcs_strsplit(const char *, const char *); 68714c2363Sxsa void rcs_argv_destroy(struct rcs_argvector *); 69168f4dcaSotto void rcs_strip_suffix(char *); 709349b09eSxsa 719349b09eSxsa #endif /* RCSUTIL_H */ 72