1*3e40e9d7Sriastradh /* $NetBSD: utils.h,v 1.3 2014/01/22 06:15:22 riastradh Exp $ */ 2d99bda47Sriastradh 3d99bda47Sriastradh /*- 4d99bda47Sriastradh * Copyright (c) 2014 The NetBSD Foundation, Inc. 5d99bda47Sriastradh * All rights reserved. 6d99bda47Sriastradh * 7d99bda47Sriastradh * This code is derived from software contributed to The NetBSD Foundation 8d99bda47Sriastradh * by Taylor R. Campbell. 9d99bda47Sriastradh * 10d99bda47Sriastradh * Redistribution and use in source and binary forms, with or without 11d99bda47Sriastradh * modification, are permitted provided that the following conditions 12d99bda47Sriastradh * are met: 13d99bda47Sriastradh * 1. Redistributions of source code must retain the above copyright 14d99bda47Sriastradh * notice, this list of conditions and the following disclaimer. 15d99bda47Sriastradh * 2. Redistributions in binary form must reproduce the above copyright 16d99bda47Sriastradh * notice, this list of conditions and the following disclaimer in the 17d99bda47Sriastradh * documentation and/or other materials provided with the distribution. 18d99bda47Sriastradh * 19d99bda47Sriastradh * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20d99bda47Sriastradh * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21d99bda47Sriastradh * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22d99bda47Sriastradh * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23d99bda47Sriastradh * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24d99bda47Sriastradh * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25d99bda47Sriastradh * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26d99bda47Sriastradh * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27d99bda47Sriastradh * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28d99bda47Sriastradh * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29d99bda47Sriastradh * POSSIBILITY OF SUCH DAMAGE. 30d99bda47Sriastradh */ 31d99bda47Sriastradh 32d99bda47Sriastradh #ifndef VNDCOMPRESS_UTILS_H 33d99bda47Sriastradh #define VNDCOMPRESS_UTILS_H 34d99bda47Sriastradh 35d99bda47Sriastradh #include <sys/types.h> 36d99bda47Sriastradh #include <sys/cdefs.h> 37d99bda47Sriastradh 38d99bda47Sriastradh /* XXX Seems to be missing from <stdio.h>... */ 39d99bda47Sriastradh int snprintf_ss(char *restrict, size_t, const char *restrict, ...) 40d99bda47Sriastradh __printflike(3, 4); 41d99bda47Sriastradh int vsnprintf_ss(char *restrict, size_t, const char *restrict, va_list) 42d99bda47Sriastradh __printflike(3, 0); 43d99bda47Sriastradh 44d99bda47Sriastradh ssize_t read_block(int, void *, size_t); 45*3e40e9d7Sriastradh ssize_t pread_block(int, void *, size_t, off_t); 46d99bda47Sriastradh void err_ss(int, const char *) __dead; 47d99bda47Sriastradh void errx_ss(int, const char *, ...) __printflike(2, 3) __dead; 48d99bda47Sriastradh void warn_ss(const char *); 49d99bda47Sriastradh void warnx_ss(const char *, ...) __printflike(1, 2); 50d99bda47Sriastradh void vwarnx_ss(const char *, va_list) __printflike(1, 0); 516e96c4eaSriastradh void block_signals(sigset_t *); 526e96c4eaSriastradh void restore_sigmask(const sigset_t *); 53d99bda47Sriastradh 54d99bda47Sriastradh #endif /* VNDCOMPRESS_UTILS_H */ 55