1*e0b8e63eSJohn Marino /* $NetBSD: utils.h,v 1.1.1.2 2008/05/18 14:31:39 aymeric Exp $ */ 2*e0b8e63eSJohn Marino 3*e0b8e63eSJohn Marino /*- 4*e0b8e63eSJohn Marino * Copyright (c) 1992, 1993, 1994 Henry Spencer. 5*e0b8e63eSJohn Marino * Copyright (c) 1992, 1993, 1994 6*e0b8e63eSJohn Marino * The Regents of the University of California. All rights reserved. 7*e0b8e63eSJohn Marino * 8*e0b8e63eSJohn Marino * This code is derived from software contributed to Berkeley by 9*e0b8e63eSJohn Marino * Henry Spencer of the University of Toronto. 10*e0b8e63eSJohn Marino * 11*e0b8e63eSJohn Marino * Redistribution and use in source and binary forms, with or without 12*e0b8e63eSJohn Marino * modification, are permitted provided that the following conditions 13*e0b8e63eSJohn Marino * are met: 14*e0b8e63eSJohn Marino * 1. Redistributions of source code must retain the above copyright 15*e0b8e63eSJohn Marino * notice, this list of conditions and the following disclaimer. 16*e0b8e63eSJohn Marino * 2. Redistributions in binary form must reproduce the above copyright 17*e0b8e63eSJohn Marino * notice, this list of conditions and the following disclaimer in the 18*e0b8e63eSJohn Marino * documentation and/or other materials provided with the distribution. 19*e0b8e63eSJohn Marino * 3. Neither the name of the University nor the names of its contributors 20*e0b8e63eSJohn Marino * may be used to endorse or promote products derived from this software 21*e0b8e63eSJohn Marino * without specific prior written permission. 22*e0b8e63eSJohn Marino * 23*e0b8e63eSJohn Marino * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24*e0b8e63eSJohn Marino * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25*e0b8e63eSJohn Marino * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26*e0b8e63eSJohn Marino * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27*e0b8e63eSJohn Marino * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28*e0b8e63eSJohn Marino * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29*e0b8e63eSJohn Marino * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30*e0b8e63eSJohn Marino * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31*e0b8e63eSJohn Marino * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32*e0b8e63eSJohn Marino * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33*e0b8e63eSJohn Marino * SUCH DAMAGE. 34*e0b8e63eSJohn Marino * 35*e0b8e63eSJohn Marino * @(#)utils.h 8.2 (Berkeley) 3/16/94 36*e0b8e63eSJohn Marino */ 37*e0b8e63eSJohn Marino 38*e0b8e63eSJohn Marino /* utility definitions */ 39*e0b8e63eSJohn Marino #define DUPMAX _POSIX2_RE_DUP_MAX /* xxx is this right? */ 40*e0b8e63eSJohn Marino #define INFINITY (DUPMAX + 1) 41*e0b8e63eSJohn Marino #define NC (CHAR_MAX - CHAR_MIN + 1) 42*e0b8e63eSJohn Marino typedef unsigned char uch; 43*e0b8e63eSJohn Marino 44*e0b8e63eSJohn Marino /* switch off assertions (if not already off) if no REDEBUG */ 45*e0b8e63eSJohn Marino #ifndef REDEBUG 46*e0b8e63eSJohn Marino #ifndef NDEBUG 47*e0b8e63eSJohn Marino #define NDEBUG /* no assertions please */ 48*e0b8e63eSJohn Marino #endif 49*e0b8e63eSJohn Marino #endif 50*e0b8e63eSJohn Marino #include <assert.h> 51*e0b8e63eSJohn Marino 52*e0b8e63eSJohn Marino /* for old systems with bcopy() but no memmove() */ 53*e0b8e63eSJohn Marino #ifdef USEBCOPY 54*e0b8e63eSJohn Marino #define memmove(d, s, c) bcopy(s, d, c) 55*e0b8e63eSJohn Marino #endif 56