1 /* @(#)util.h	1.15 18/02/28 2011-2018 J. Schilling */
2 /*
3  *	Copyright (c) 1986 Larry Wall
4  *	Copyright (c) 2011-2018 J. Schilling
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following condition is met:
8  *
9  * 1. Redistributions of source code must retain the above copyright notice,
10  * this condition and the following disclaimer.
11  *
12  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
13  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
14  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
15  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
16  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
18  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
19  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22  * SUCH DAMAGE.
23  */
24 
25 /*
26  * Definitions for date+time
27  */
28 typedef struct dtime {
29 	Llong	dt_sec;		/* Seconds since Jan 1 1970 GMT		*/
30 	int	dt_nsec;	/* Nanoseconds (must be positive)	*/
31 	int	dt_zone;	/* Timezone (seconds east to GMT)	*/
32 } dtime_t;
33 
34 #define	DT_NO_ZONE	1	/* Impossible timezone - no zone found	*/
35 #define	DT_MIN_ZONE	(-89940) /* Minimum zone (-24:59)		*/
36 #define	DT_MAX_ZONE	93540	/* Minimum zone (+25:59)		*/
37 
38 EXT dtime_t	file_times[2];
39 
40 extern	int	move_file __PR((char *from, char *to));
41 extern	void	removedirs __PR((char *path));
42 extern	void	copy_file __PR((char *from, char *to));
43 extern	char	*savestr __PR((register char *s));
44 /*PRINTFLIKE1*/
45 extern	void	say	__PR((const char *fmt, ...)) __printflike__(1, 2);
46 /*PRINTFLIKE1*/
47 extern	void	fatal	__PR((const char *fmt, ...)) __printflike__(1, 2);
48 /*PRINTFLIKE1*/
49 extern	void	pfatal	__PR((const char *fmt, ...)) __printflike__(1, 2);
50 /*PRINTFLIKE1*/
51 extern	void	ask	__PR((const char *fmt, ...)) __printflike__(1, 2);
52 extern	void	set_signals __PR((int reset));
53 extern	void	ignore_signals __PR((void));
54 #ifndef	_SCHILY_SCHILY_H
55 extern	int	makedirs __PR((register char *filename, mode_t mode,
56 						bool striplast));
57 #endif
58 extern	char	*fetchname __PR((char *at, int strip_leading,
59 						int assume_exists,
60 						dtime_t *dtp));
61 extern	int	settime	__PR((char *name, int idx, int failed));
62 extern	int	pspawn	__PR((char *av[]));
63