xref: /dragonfly/usr.bin/patch/util.h (revision caaec4e3)
1 /*
2  * $OpenBSD: util.h,v 1.15 2005/06/20 07:14:06 otto Exp $
3  */
4 
5 /*
6  * patch - a program to apply diffs to original files
7  *
8  * Copyright 1986, Larry Wall
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following condition is met:
12  * 1. Redistributions of source code must retain the above copyright notice,
13  * this condition and the following disclaimer.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
16  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
19  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  * -C option added in 1998, original code by Marc Espie, based on FreeBSD
28  * behaviour
29  */
30 
31 char		*fetchname(const char *, bool *, int);
32 char		*checked_in(char *);
33 int		backup_file(const char *);
34 int		move_file(const char *, const char *);
35 int		copy_file(const char *, const char *);
36 void		say(const char *, ...)
37 		    __attribute__((__format__(__printf__, 1, 2)));
38 void		fatal(const char *, ...)
39 		    __attribute__((__format__(__printf__, 1, 2)))
40 		    __attribute__((noreturn));
41 void		pfatal(const char *, ...)
42 		    __attribute__((__format__(__printf__, 1, 2)))
43 		    __attribute__((noreturn));
44 void		ask(const char *, ...)
45 		    __attribute__((__format__(__printf__, 1, 2)));
46 char		*savestr(const char *);
47 void		set_signals(int);
48 void		ignore_signals(void);
49 void		makedirs(const char *, bool);
50 void		version(void) __attribute__((noreturn));
51 void		my_exit(int) __attribute__((noreturn));
52 
53 /* in mkpath.c */
54 extern int mkpath(char *);
55