xref: /freebsd/usr.bin/m4/stdd.h (revision bdcbfde31e8e9b343f113a1956384bdf30d1ed62)
1a841e1ebSBaptiste Daroussin /*	$OpenBSD: stdd.h,v 1.6 2010/09/07 19:58:09 marco Exp $	*/
2acc9d408SJuli Mallett /*	$NetBSD: stdd.h,v 1.2 1995/09/28 05:37:50 tls Exp $	*/
3acc9d408SJuli Mallett 
49b50d902SRodney W. Grimes /*-
5*8a16b7a1SPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
6*8a16b7a1SPedro F. Giffuni  *
79b50d902SRodney W. Grimes  * Copyright (c) 1991, 1993
89b50d902SRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
99b50d902SRodney W. Grimes  *
109b50d902SRodney W. Grimes  * This code is derived from software contributed to Berkeley by
119b50d902SRodney W. Grimes  * Ozan Yigit at York University.
129b50d902SRodney W. Grimes  *
139b50d902SRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
149b50d902SRodney W. Grimes  * modification, are permitted provided that the following conditions
159b50d902SRodney W. Grimes  * are met:
169b50d902SRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
179b50d902SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
189b50d902SRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
199b50d902SRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
209b50d902SRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
21a841e1ebSBaptiste Daroussin  * 3. Neither the name of the University nor the names of its contributors
229b50d902SRodney W. Grimes  *    may be used to endorse or promote products derived from this software
239b50d902SRodney W. Grimes  *    without specific prior written permission.
249b50d902SRodney W. Grimes  *
259b50d902SRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
269b50d902SRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
279b50d902SRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
289b50d902SRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
299b50d902SRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
309b50d902SRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
319b50d902SRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
329b50d902SRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
339b50d902SRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
349b50d902SRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
359b50d902SRodney W. Grimes  * SUCH DAMAGE.
369b50d902SRodney W. Grimes  */
379b50d902SRodney W. Grimes 
389b50d902SRodney W. Grimes /*
399b50d902SRodney W. Grimes  * standard defines
409b50d902SRodney W. Grimes  */
419b50d902SRodney W. Grimes 
429b50d902SRodney W. Grimes #define max(a,b) ((a) > (b)? (a): (b))
439b50d902SRodney W. Grimes #define min(a,b) ((a) < (b)? (a): (b))
449b50d902SRodney W. Grimes 
459b50d902SRodney W. Grimes #define iswhite(c) ((c) == ' ' || (c) == '\t')
469b50d902SRodney W. Grimes 
479b50d902SRodney W. Grimes /*
489b50d902SRodney W. Grimes  * STREQ is an optimised strcmp(a,b)==0
499b50d902SRodney W. Grimes  * STREQN is an optimised strncmp(a,b,n)==0; assumes n > 0
509b50d902SRodney W. Grimes  */
519b50d902SRodney W. Grimes #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
529b50d902SRodney W. Grimes #define STREQN(a, b, n) ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)
539b50d902SRodney W. Grimes 
549b50d902SRodney W. Grimes #define YES 1
559b50d902SRodney W. Grimes #define NO 0
56