aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-08-29 21:58:47 +0200
committerMattias Andrée <maandree@operamail.com>2015-08-29 22:01:06 +0200
commit58683d4820ebb8fdd5729a1c914c79ee68455155 (patch)
tree6f21766c5cd5959f524a28d5dab36cf80c5da246
parentadd errno.h (diff)
downloadslibc-58683d4820ebb8fdd5729a1c914c79ee68455155.tar.gz
slibc-58683d4820ebb8fdd5729a1c914c79ee68455155.tar.bz2
slibc-58683d4820ebb8fdd5729a1c914c79ee68455155.tar.xz
add program_invocation_name and program_invocation_short_name
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--include/errno.h34
1 files changed, 34 insertions, 0 deletions
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