xref: /freebsd/tools/build/cross-build/progname.c (revision 744991d495b28ea157a94e139224140687ec19ed)
1*7ec1ec4fSAlex Richardson /*-
2*7ec1ec4fSAlex Richardson  * SPDX-License-Identifier: BSD-2-Clause
3*7ec1ec4fSAlex Richardson  *
4*7ec1ec4fSAlex Richardson  * Copyright 2018-2020 Alex Richardson <arichardson@FreeBSD.org>
5*7ec1ec4fSAlex Richardson  *
6*7ec1ec4fSAlex Richardson  * This software was developed by SRI International and the University of
7*7ec1ec4fSAlex Richardson  * Cambridge Computer Laboratory (Department of Computer Science and
8*7ec1ec4fSAlex Richardson  * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the
9*7ec1ec4fSAlex Richardson  * DARPA SSITH research programme.
10*7ec1ec4fSAlex Richardson  *
11*7ec1ec4fSAlex Richardson  * This software was developed by SRI International and the University of
12*7ec1ec4fSAlex Richardson  * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
13*7ec1ec4fSAlex Richardson  * ("CTSRD"), as part of the DARPA CRASH research programme.
14*7ec1ec4fSAlex Richardson  *
15*7ec1ec4fSAlex Richardson  * Redistribution and use in source and binary forms, with or without
16*7ec1ec4fSAlex Richardson  * modification, are permitted provided that the following conditions
17*7ec1ec4fSAlex Richardson  * are met:
18*7ec1ec4fSAlex Richardson  * 1. Redistributions of source code must retain the above copyright
19*7ec1ec4fSAlex Richardson  *    notice, this list of conditions and the following disclaimer.
20*7ec1ec4fSAlex Richardson  * 2. Redistributions in binary form must reproduce the above copyright
21*7ec1ec4fSAlex Richardson  *    notice, this list of conditions and the following disclaimer in the
22*7ec1ec4fSAlex Richardson  *    documentation and/or other materials provided with the distribution.
23*7ec1ec4fSAlex Richardson  *
24*7ec1ec4fSAlex Richardson  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
25*7ec1ec4fSAlex Richardson  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26*7ec1ec4fSAlex Richardson  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27*7ec1ec4fSAlex Richardson  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
28*7ec1ec4fSAlex Richardson  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29*7ec1ec4fSAlex Richardson  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30*7ec1ec4fSAlex Richardson  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31*7ec1ec4fSAlex Richardson  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32*7ec1ec4fSAlex Richardson  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33*7ec1ec4fSAlex Richardson  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34*7ec1ec4fSAlex Richardson  * SUCH DAMAGE.
35*7ec1ec4fSAlex Richardson  */
36*7ec1ec4fSAlex Richardson #include <sys/cdefs.h>
37*7ec1ec4fSAlex Richardson #include <stdlib.h>
38*7ec1ec4fSAlex Richardson 
39*7ec1ec4fSAlex Richardson extern const char *__progname;
40*7ec1ec4fSAlex Richardson const char *
41*7ec1ec4fSAlex Richardson getprogname(void)
42*7ec1ec4fSAlex Richardson {
43*7ec1ec4fSAlex Richardson 	return (__progname);
44*7ec1ec4fSAlex Richardson }
45*7ec1ec4fSAlex Richardson void
46*7ec1ec4fSAlex Richardson setprogname(const char *progname)
47*7ec1ec4fSAlex Richardson {
48*7ec1ec4fSAlex Richardson 	__progname = progname;
49*7ec1ec4fSAlex Richardson }
50