shell.h revision 213744
11556Srgrimes/*-
21556Srgrimes * Copyright (c) 1991, 1993
31556Srgrimes *	The Regents of the University of California.  All rights reserved.
41556Srgrimes *
51556Srgrimes * This code is derived from software contributed to Berkeley by
61556Srgrimes * Kenneth Almquist.
71556Srgrimes *
81556Srgrimes * Redistribution and use in source and binary forms, with or without
91556Srgrimes * modification, are permitted provided that the following conditions
101556Srgrimes * are met:
111556Srgrimes * 1. Redistributions of source code must retain the above copyright
121556Srgrimes *    notice, this list of conditions and the following disclaimer.
131556Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
141556Srgrimes *    notice, this list of conditions and the following disclaimer in the
151556Srgrimes *    documentation and/or other materials provided with the distribution.
161556Srgrimes * 4. Neither the name of the University nor the names of its contributors
171556Srgrimes *    may be used to endorse or promote products derived from this software
181556Srgrimes *    without specific prior written permission.
191556Srgrimes *
201556Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
211556Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
221556Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
231556Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
241556Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
251556Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
261556Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
271556Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
281556Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
291556Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
301556Srgrimes * SUCH DAMAGE.
311556Srgrimes *
3217987Speter *	@(#)shell.h	8.2 (Berkeley) 5/4/95
3350471Speter * $FreeBSD: head/bin/sh/shell.h 213744 2010-10-12 19:24:41Z obrien $
341556Srgrimes */
351556Srgrimes
36178625Sstefanf#ifndef SHELL_H_
37178625Sstefanf#define SHELL_H_
38178625Sstefanf
39178625Sstefanf#include <inttypes.h>
40178625Sstefanf
411556Srgrimes/*
421556Srgrimes * The follow should be set to reflect the type of system you have:
431556Srgrimes *	JOBS -> 1 if you have Berkeley job control, 0 otherwise.
441556Srgrimes *	define DEBUG=1 to compile in debugging (set global "debug" to turn on)
451556Srgrimes *	define DEBUG=2 to compile in and turn on debugging.
46213744Sobrien *	define DEBUG=3 to also build all functions as public
471556Srgrimes *
48213744Sobrien * When debugging is on, debugging info will be written to ./trace and
491556Srgrimes * a quit signal will generate a core dump.
501556Srgrimes */
511556Srgrimes
521556Srgrimes
53119746Sschweikh#define	JOBS 1
5417988Speter/* #define DEBUG 1 */
551556Srgrimes
56119578Sschweikh/*
57119578Sschweikh * Type of used arithmetics. SUSv3 requires us to have at least signed long.
58119578Sschweikh */
59178625Sstefanftypedef intmax_t arith_t;
60178625Sstefanf#define	ARITH_FORMAT_STR  "%" PRIdMAX
61178625Sstefanf#define	atoarith_t(arg)  strtoimax(arg, NULL, 0)
62178625Sstefanf#define	strtoarith_t(nptr, endptr, base)  strtoimax(nptr, endptr, base)
63119578Sschweikh
641556Srgrimestypedef void *pointer;
65213744Sobrien#if DEBUG >= 3
66213744Sobrien#define STATIC
67213744Sobrien#else
6819281Sache#define STATIC  static
69213744Sobrien#endif
70119746Sschweikh#define MKINIT  /* empty */
711556Srgrimes
721556Srgrimes#include <sys/cdefs.h>
731556Srgrimes
741556Srgrimesextern char nullstr[1];		/* null string */
751556Srgrimes
761556Srgrimes#ifdef DEBUG
77119746Sschweikh#define TRACE(param)  sh_trace param
781556Srgrimes#else
791556Srgrimes#define TRACE(param)
801556Srgrimes#endif
81178625Sstefanf
82178625Sstefanf#endif /* !SHELL_H_ */
83