[PATCH] Fix signatures for getenv/getopt

Khem Raj <[email protected]>
Newsgroups gmane.comp.gnu.make.bugs
Message-ID <[email protected]>
GCC-15 complains about missing parameters, this gets found
out when using non-glibc ( e.g. musl ) C library

Fixes
lib/fnmatch.c:124:14: error: conflicting types for 'getenv'; have 'char *(void)'
|   124 | extern char *getenv ();
|       |              ^~~~~~

src/getopt.c: Define parameters of getenv() and getopt().
src/getopt.h: Ditto.
---
 src/getopt.c | 2 +-
 src/getopt.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/getopt.c b/src/getopt.c
index 0c774894..085d3b9b 100644
--- a/src/getopt.c
+++ b/src/getopt.c
@@ -202,7 +202,7 @@ static char *posixly_correct;
    whose names are inconsistent.  */
 
 #ifndef getenv
-extern char *getenv ();
+extern char *getenv (const char *);
 #endif
 
 static char *
diff --git a/src/getopt.h b/src/getopt.h
index cc8ee8dc..a31c91bb 100644
--- a/src/getopt.h
+++ b/src/getopt.h
@@ -102,7 +102,7 @@ struct option
    errors, only prototype getopt for the GNU C library.  */
 extern int getopt (int argc, char *const *argv, const char *shortopts);
 #else /* not __GNU_LIBRARY__ */
-extern int getopt ();
+extern int getopt (int,  char * const*, const char *);
 #endif /* __GNU_LIBRARY__ */
 extern int getopt_long (int argc, char *const *argv, const char *shortopts,
 		        const struct option *longopts, int *longind);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.