]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/LibC/StdLib/setprogname.c
BaseTools/GenFfs: add FFS file types for MM modules.
[mirror_edk2.git] / StdLib / LibC / StdLib / setprogname.c
CommitLineData
d7ce7006 1/** @file setprogname and getprogname\r
2\r
3 $NetBSD: setprogname.c,v 1.5 2008/04/28 20:24:12 martin Exp $\r
4\r
5 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
6 This program and the accompanying materials\r
7 are licensed and made available under the terms and conditions of the BSD License\r
8 which accompanies this distribution. The full text of the license may be found at\r
9 http://opensource.org/licenses/bsd-license.php\r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14 * Copyright (c) 2001 The NetBSD Foundation, Inc.\r
15 * All rights reserved.\r
16 *\r
17 * This code is derived from software contributed to The NetBSD Foundation\r
18 * by Todd Vierling.\r
19 *\r
20 * Redistribution and use in source and binary forms, with or without\r
21 * modification, are permitted provided that the following conditions\r
22 * are met:\r
23 * 1. Redistributions of source code must retain the above copyright\r
24 * notice, this list of conditions and the following disclaimer.\r
25 * 2. Redistributions in binary form must reproduce the above copyright\r
26 * notice, this list of conditions and the following disclaimer in the\r
27 * documentation and/or other materials provided with the distribution.\r
28 *\r
29 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS\r
30 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\r
31 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
32 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS\r
33 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
34 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
35 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
36 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
37 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
38 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
39 * POSSIBILITY OF SUCH DAMAGE.\r
40 */\r
41#include <LibConfig.h>\r
42\r
5c5e4a12 43#ifdef HAVE_SETPROGNAME\r
d7ce7006 44#include <string.h>\r
45\r
46static const char *__progname = NULL;\r
47\r
48void\r
49setprogname(const char *progname)\r
50{\r
51 __progname = strrchr(progname, '/');\r
52 if (__progname == NULL)\r
53 __progname = progname;\r
54 else\r
55 __progname++;\r
56}\r
57\r
58const char *\r
59getprogname(void)\r
60{\r
61 return __progname;\r
62}\r
63\r
64#endif\r