stdd.h revision 259262
152284Sobrien/*	$OpenBSD: stdd.h,v 1.6 2010/09/07 19:58:09 marco Exp $	*/
252284Sobrien/*	$NetBSD: stdd.h,v 1.2 1995/09/28 05:37:50 tls Exp $	*/
352284Sobrien
452284Sobrien/*-
5117395Skan * Copyright (c) 1991, 1993
652284Sobrien *	The Regents of the University of California.  All rights reserved.
752284Sobrien *
852284Sobrien * This code is derived from software contributed to Berkeley by
952284Sobrien * Ozan Yigit at York University.
1052284Sobrien *
1152284Sobrien * Redistribution and use in source and binary forms, with or without
1252284Sobrien * modification, are permitted provided that the following conditions
1352284Sobrien * are met:
1452284Sobrien * 1. Redistributions of source code must retain the above copyright
1552284Sobrien *    notice, this list of conditions and the following disclaimer.
1652284Sobrien * 2. Redistributions in binary form must reproduce the above copyright
1752284Sobrien *    notice, this list of conditions and the following disclaimer in the
1852284Sobrien *    documentation and/or other materials provided with the distribution.
1952284Sobrien * 3. Neither the name of the University nor the names of its contributors
2052284Sobrien *    may be used to endorse or promote products derived from this software
2152284Sobrien *    without specific prior written permission.
2252284Sobrien *
2390075Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2452284Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2552284Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2652284Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2752284Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2852284Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2952284Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3090075Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3190075Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3252284Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33117395Skan * SUCH DAMAGE.
34117395Skan *
35117395Skan *	@(#)stdd.h	8.1 (Berkeley) 6/6/93
36117395Skan * $FreeBSD: stable/9/usr.bin/m4/stdd.h 259262 2013-12-12 15:04:59Z tijl $
37117395Skan */
38117395Skan
39117395Skan/*
40117395Skan * standard defines
41117395Skan */
42117395Skan
43117395Skan#define max(a,b) ((a) > (b)? (a): (b))
44117395Skan#define min(a,b) ((a) < (b)? (a): (b))
45117395Skan
4652284Sobrien#define iswhite(c) ((c) == ' ' || (c) == '\t')
4752284Sobrien
48117395Skan/*
4952284Sobrien * STREQ is an optimised strcmp(a,b)==0
5052284Sobrien * STREQN is an optimised strncmp(a,b,n)==0; assumes n > 0
5152284Sobrien */
5252284Sobrien#define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
5352284Sobrien#define STREQN(a, b, n) ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)
5452284Sobrien
5552284Sobrien#define YES 1
5690075Sobrien#define NO 0
5752284Sobrien