diff options
author | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2013-05-31 20:59:25 +0000 |
---|---|---|
committer | Antoine Jacoutot <ajacoutot@cvs.openbsd.org> | 2013-05-31 20:59:25 +0000 |
commit | 32f7fca8e67c4496a1076a3262e907ab4f66be1c (patch) | |
tree | 8178ef66fd7f41cbfa14f42a2347c4bb39ca31f7 /lib/libc/gen/getprogname.c | |
parent | cb993534d12b98cd1ba9d48fa00de63bfb6ffc7e (diff) |
Add getprogname() and setprogname() to ease slackers^porters' work.
Man page adapted from FreeBSD and NetBSD.
Bump libc minor now (there will be more upcoming changes).
input from tedu@
get it in deraadt@
Diffstat (limited to 'lib/libc/gen/getprogname.c')
-rw-r--r-- | lib/libc/gen/getprogname.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/libc/gen/getprogname.c b/lib/libc/gen/getprogname.c new file mode 100644 index 00000000000..a6d51037a09 --- /dev/null +++ b/lib/libc/gen/getprogname.c @@ -0,0 +1,26 @@ +/* $OpenBSD: getprogname.c,v 1.1 2013/05/31 20:59:23 ajacoutot Exp $ */ +/* + * Copyright (c) 2013 Antoine Jacoutot <ajacoutot@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <stdlib.h> + +extern const char *__progname; + +const char * +getprogname(void) +{ + return (__progname); +} |