From 58683d4820ebb8fdd5729a1c914c79ee68455155 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 29 Aug 2015 21:58:47 +0200 Subject: add program_invocation_name and program_invocation_short_name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- include/errno.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/include/errno.h b/include/errno.h index 6a94d76..4ea738d 100644 --- a/include/errno.h +++ b/include/errno.h @@ -41,6 +41,40 @@ volatile int* __errno(void) __GCC_ONLY(__attribute__((__const__))); /* TODO not implemented */ +/** + * This is the name that was used to invoke the program + * running in the current process. This is the value + * of `argv[0]` from the `main` function (where `argv` + * is the second parameter). If `argc` is zero, this + * variable will have the value `NULL`. This is not + * necessarily a proper comman name. For example, + * login shells are usually prefixes with a dash, + * for example "-bash", despite that there is no such + * command. Often, but not always, this will not contain + * directory. + * + * This string may be edited if `program_invocation_short_name` + * or `argv[0]` is edited. + * + * This is a GNU and slibc extension. + */ +#if defined(_GNU_SOURCE) || defined(_SLIBC_SOURCE) +extern char* program_invocation_name; /* TODO not implemented */ +#endif + +/** + * Variant of `program_invocation_name` that is + * guaranteed to not include the directory. + * + * This string may be edited if `program_invocation_name` + * or `argv[0]` is edited. + * + * This is a GNU extension. + */ +#if defined(_GNU_SOURCE) +extern char* program_invocation_short_name; /* TODO not implemented */ +#endif + #endif -- cgit v1.2.3-70-g09d2