shell.h revision 213744
1139790Simp/*-
226159Sse * Copyright (c) 1991, 1993
366529Smsmith *	The Regents of the University of California.  All rights reserved.
466529Smsmith *
5138468Sscottl * This code is derived from software contributed to Berkeley by
626159Sse * Kenneth Almquist.
726159Sse *
826159Sse * Redistribution and use in source and binary forms, with or without
926159Sse * modification, are permitted provided that the following conditions
1026159Sse * are met:
1126159Sse * 1. Redistributions of source code must retain the above copyright
1226159Sse *    notice, this list of conditions and the following disclaimer.
1326159Sse * 2. Redistributions in binary form must reproduce the above copyright
1426159Sse *    notice, this list of conditions and the following disclaimer in the
1526159Sse *    documentation and/or other materials provided with the distribution.
1626159Sse * 4. Neither the name of the University nor the names of its contributors
1726159Sse *    may be used to endorse or promote products derived from this software
1826159Sse *    without specific prior written permission.
1926159Sse *
2026159Sse * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2126159Sse * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2226159Sse * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2326159Sse * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2426159Sse * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2526159Sse * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2626159Sse * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2726159Sse * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2826159Sse * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
296104Sse * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30115706Sobrien * SUCH DAMAGE.
31115706Sobrien *
32115706Sobrien *	@(#)shell.h	8.2 (Berkeley) 5/4/95
33152219Simp * $FreeBSD: head/bin/sh/shell.h 213744 2010-10-12 19:24:41Z obrien $
34152219Simp */
35125981Sjhb
366734Sbde#ifndef SHELL_H_
3747307Speter#define SHELL_H_
38111068Speter
39111068Speter#include <inttypes.h>
40138429Sscottl
41138429Sscottl/*
42100435Simp * The follow should be set to reflect the type of system you have:
43100435Simp *	JOBS -> 1 if you have Berkeley job control, 0 otherwise.
4466529Smsmith *	define DEBUG=1 to compile in debugging (set global "debug" to turn on)
4559294Smsmith *	define DEBUG=2 to compile in and turn on debugging.
4659294Smsmith *	define DEBUG=3 to also build all functions as public
47138429Sscottl *
48138429Sscottl * When debugging is on, debugging info will be written to ./trace and
49138429Sscottl * a quit signal will generate a core dump.
50138429Sscottl */
51138429Sscottl
52138429Sscottl
53138429Sscottl#define	JOBS 1
54152219Simp/* #define DEBUG 1 */
55152219Simp
56152219Simp/*
57152219Simp * Type of used arithmetics. SUSv3 requires us to have at least signed long.
58103868Sjhb */
59103868Sjhbtypedef intmax_t arith_t;
60103868Sjhb#define	ARITH_FORMAT_STR  "%" PRIdMAX
61103868Sjhb#define	atoarith_t(arg)  strtoimax(arg, NULL, 0)
6282441Simp#define	strtoarith_t(nptr, endptr, base)  strtoimax(nptr, endptr, base)
63138429Sscottl
64138429Sscottltypedef void *pointer;
65138429Sscottl#if DEBUG >= 3
66138429Sscottl#define STATIC
67138429Sscottl#else
68138429Sscottl#define STATIC  static
69138429Sscottl#endif
70138429Sscottl#define MKINIT  /* empty */
71138429Sscottl
72138429Sscottl#include <sys/cdefs.h>
73138429Sscottl
74138429Sscottlextern char nullstr[1];		/* null string */
75138429Sscottl
76138429Sscottl#ifdef DEBUG
77138429Sscottl#define TRACE(param)  sh_trace param
78138429Sscottl#else
7926159Sse#define TRACE(param)
8026159Sse#endif
81138429Sscottl
826104Sse#endif /* !SHELL_H_ */
8366529Smsmith