diff options
author | Alejandro Colomar <alx@kernel.org> | 2023-04-03 01:37:43 +0200 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2023-04-03 01:37:44 +0200 |
commit | 185ed498eef2733ec8e39f8bd9e3ed9930eefa53 (patch) | |
tree | 838a26331ecfb2df7599f635e2afcfde18b3b507 | |
parent | 07c34d31e4d9fd02a433ceece8674265872bac23 (diff) |
getopt.3: Remove const from argv
It is unnecessary to let readers believe it's const. Keep it as a
detail in VERSIONS, which will only be found by those who need it. It
is better to believe it's non-const, and rarely will one need to know
that it isn't true.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r-- | man3/getopt.3 | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/man3/getopt.3 b/man3/getopt.3 index b04b52631..45687b06e 100644 --- a/man3/getopt.3 +++ b/man3/getopt.3 @@ -31,7 +31,7 @@ Standard C library .nf .B #include <unistd.h> .PP -.BI "int getopt(int " argc ", char *const " argv [], +.BI "int getopt(int " argc ", char *" argv [], .BI " const char *" optstring ); .PP .BI "extern char *" optarg ; @@ -39,10 +39,10 @@ Standard C library .PP .B #include <getopt.h> .PP -.BI "int getopt_long(int " argc ", char *const " argv [], +.BI "int getopt_long(int " argc ", char *" argv [], .BI " const char *" optstring , .BI " const struct option *" longopts ", int *" longindex ); -.BI "int getopt_long_only(int " argc ", char *const " argv [], +.BI "int getopt_long_only(int " argc ", char *" argv [], .BI " const char *" optstring , .BI " const struct option *" longopts ", int *" longindex ); .fi @@ -349,16 +349,18 @@ T} .ad .sp 1 .SH VERSIONS -.BR getopt () -conforms to POSIX provided the environment variable +POSIX specifies that the +.I argv +array argument should be +.IR const , +but these functions permute its elements +unless the environment variable .B POSIXLY_CORRECT is set. -Otherwise, the elements of \fIargv\fP aren't really -.IR const , -because these functions permute them. -Nevertheless, .I const -is used in the prototype to be compatible with other systems. +is used in the actual prototype to be compatible with other systems; +however, this page doesn't show the qualifier, +to avoid confusing readers. .SH STANDARDS .TP .BR getopt () |