1e3cfc8crgrimes/*-
2872b698pfg * SPDX-License-Identifier: BSD-3-Clause
3872b698pfg *
4e3cfc8crgrimes * Copyright (c) 1991, 1993
5e3cfc8crgrimes *	The Regents of the University of California.  All rights reserved.
6e3cfc8crgrimes *
7e3cfc8crgrimes * This code is derived from software contributed to Berkeley by
8e3cfc8crgrimes * Kenneth Almquist.
9e3cfc8crgrimes *
10e3cfc8crgrimes * Redistribution and use in source and binary forms, with or without
11e3cfc8crgrimes * modification, are permitted provided that the following conditions
12e3cfc8crgrimes * are met:
13e3cfc8crgrimes * 1. Redistributions of source code must retain the above copyright
14e3cfc8crgrimes *    notice, this list of conditions and the following disclaimer.
15e3cfc8crgrimes * 2. Redistributions in binary form must reproduce the above copyright
16e3cfc8crgrimes *    notice, this list of conditions and the following disclaimer in the
17e3cfc8crgrimes *    documentation and/or other materials provided with the distribution.
187e6cabdimp * 3. Neither the name of the University nor the names of its contributors
19e3cfc8crgrimes *    may be used to endorse or promote products derived from this software
20e3cfc8crgrimes *    without specific prior written permission.
21e3cfc8crgrimes *
22e3cfc8crgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23e3cfc8crgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24e3cfc8crgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25e3cfc8crgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26e3cfc8crgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27e3cfc8crgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28e3cfc8crgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29e3cfc8crgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30e3cfc8crgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31e3cfc8crgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32e3cfc8crgrimes * SUCH DAMAGE.
33e3cfc8crgrimes *
345195be9peter *	@(#)bltin.h	8.2 (Berkeley) 5/4/95
3566312e4peter * $FreeBSD$
36e3cfc8crgrimes */
37e3cfc8crgrimes
38e3cfc8crgrimes/*
39e3cfc8crgrimes * This file is included by programs which are optionally built into the
40e3cfc8crgrimes * shell.  If SHELL is defined, we try to map the standard UNIX library
41e3cfc8crgrimes * routines to ash routines using defines.
42e3cfc8crgrimes */
43e3cfc8crgrimes
44e3cfc8crgrimes#include "../shell.h"
45e3cfc8crgrimes#include "../mystring.h"
46e3cfc8crgrimes#ifdef SHELL
47bbd4d38jilles#include "../error.h"
48e3cfc8crgrimes#include "../output.h"
4916addb8jilles#include "builtins.h"
50ae2aabcjilles#define FILE struct output
51ea83bbajoerg#undef stdout
52e3cfc8crgrimes#define stdout out1
53ea83bbajoerg#undef stderr
54e3cfc8crgrimes#define stderr out2
55e3cfc8crgrimes#define printf out1fmt
56ea83bbajoerg#undef putc
57e3cfc8crgrimes#define putc(c, file)	outc(c, file)
58ea83bbajoerg#undef putchar
59e3cfc8crgrimes#define putchar(c)	out1c(c)
60e3cfc8crgrimes#define fprintf outfmt
61e3cfc8crgrimes#define fputs outstr
62808b93djilles#define fwrite(ptr, size, nmemb, file) outbin(ptr, (size) * (nmemb), file)
63e3cfc8crgrimes#define fflush flushout
64e3cfc8crgrimes#define INITARGS(argv)
65eb00352jilles#define warnx warning
66ae2aabcjilles#define warn(fmt, ...) warning(fmt ": %s", __VA_ARGS__, strerror(errno))
67ccc4611jilles#define errx(exitstatus, ...) error(__VA_ARGS__)
68c58aca0steve
69e3cfc8crgrimes#else
70e3cfc8crgrimes#undef NULL
71e3cfc8crgrimes#include <stdio.h>
72e3cfc8crgrimes#undef main
73e3cfc8crgrimes#define INITARGS(argv)	if ((commandname = argv[0]) == NULL) {fputs("Argc is zero\n", stderr); exit(2);} else
74e3cfc8crgrimes#endif
75e3cfc8crgrimes
76ae2aabcjilles#include <unistd.h>
77ae2aabcjilles
78e3cfc8crgrimespointer stalloc(int);
7994dae0ajillesint killjob(const char *, int);
80e3cfc8crgrimes
81e3cfc8crgrimesextern char *commandname;
82