1/*
2 * Copyright 2006, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *		Axel Dörfler, axeld@pinc-software.de
7 */
8
9
10#include <stdlib.h>
11#include <string.h>
12
13
14extern const char *__progname;
15
16const char *_getprogname(void);
17
18
19const char *
20_getprogname(void)
21{
22	return __progname;
23}
24
25
26void
27setprogname(const char *programName)
28{
29	const char *slash = strrchr(programName, '/');
30	if (slash != NULL)
31		__progname = slash + 1;
32	else
33		__progname = programName;
34}
35
36#pragma weak getprogname=_getprogname
37