xref: /netbsd-src/usr.bin/m4/stdd.h (revision 89aaa1bb64ba8db54daf131749fe578e804d9382)
1*89aaa1bbSagc /*	$NetBSD: stdd.h,v 1.4 2003/08/07 11:14:34 agc Exp $	*/
28ddb7345Stls 
3a7c89f0fSglass /*-
4a7c89f0fSglass  * Copyright (c) 1991, 1993
5a7c89f0fSglass  *	The Regents of the University of California.  All rights reserved.
6a7c89f0fSglass  *
7a7c89f0fSglass  * This code is derived from software contributed to Berkeley by
8a7c89f0fSglass  * Ozan Yigit at York University.
9a7c89f0fSglass  *
10a7c89f0fSglass  * Redistribution and use in source and binary forms, with or without
11a7c89f0fSglass  * modification, are permitted provided that the following conditions
12a7c89f0fSglass  * are met:
13a7c89f0fSglass  * 1. Redistributions of source code must retain the above copyright
14a7c89f0fSglass  *    notice, this list of conditions and the following disclaimer.
15a7c89f0fSglass  * 2. Redistributions in binary form must reproduce the above copyright
16a7c89f0fSglass  *    notice, this list of conditions and the following disclaimer in the
17a7c89f0fSglass  *    documentation and/or other materials provided with the distribution.
18*89aaa1bbSagc  * 3. Neither the name of the University nor the names of its contributors
19a7c89f0fSglass  *    may be used to endorse or promote products derived from this software
20a7c89f0fSglass  *    without specific prior written permission.
21a7c89f0fSglass  *
22a7c89f0fSglass  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23a7c89f0fSglass  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24a7c89f0fSglass  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25a7c89f0fSglass  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26a7c89f0fSglass  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27a7c89f0fSglass  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28a7c89f0fSglass  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29a7c89f0fSglass  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30a7c89f0fSglass  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31a7c89f0fSglass  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32a7c89f0fSglass  * SUCH DAMAGE.
33a7c89f0fSglass  *
34a7c89f0fSglass  *	@(#)stdd.h	8.1 (Berkeley) 6/6/93
35a7c89f0fSglass  */
36a7c89f0fSglass 
37a7c89f0fSglass /*
38a7c89f0fSglass  * standard defines
39a7c89f0fSglass  */
40a7c89f0fSglass 
41a7c89f0fSglass #define max(a,b) ((a) > (b)? (a): (b))
42a7c89f0fSglass #define min(a,b) ((a) < (b)? (a): (b))
43a7c89f0fSglass 
44a7c89f0fSglass #define iswhite(c) ((c) == ' ' || (c) == '\t')
45a7c89f0fSglass 
46a7c89f0fSglass /*
47a7c89f0fSglass  * STREQ is an optimised strcmp(a,b)==0
48a7c89f0fSglass  * STREQN is an optimised strncmp(a,b,n)==0; assumes n > 0
49a7c89f0fSglass  */
50a7c89f0fSglass #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
51a7c89f0fSglass #define STREQN(a, b, n) ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)
52a7c89f0fSglass 
53a7c89f0fSglass #define YES 1
54a7c89f0fSglass #define NO 0
55