Hi,
Is the TODO file generally up-to-date? Now that I have my copyright
assignment done, maybe I can find some stuff to hack on.
Specifically, are these items still true?
> generally use gnulib for portability more than we use today:
> - getaddrinfo/getnameinfo with IDN support to simplify IDN complexity
> - more system header files replacements
> - ruserok/wtmp stuff
>
> Mingw/cygwin support?
I think it would be nice to use more gnulib stuff. Less dealing with
preprocessor conditionals and the sort. I know gnulib has some
<sys/socket.h> stuff and inet_ntop/inet_ptoa but I haven't looked into
that area much.
Also, I have attached two patches that modernize stuff to match
current gnulib. First, with the 'environ' module there is no need for
'extern char **environ'. It is handled in unistd.h by gnulib [1].
Second, now that the 'stdbool' module emulates C23, there is no need
to include stdbool.h. If the compiler doesn't support bool stuff as a
keyword the header is included in config.h.
[1] https://www.gnu.org/software/gnulib/manual/html_node/environ.html
Collin
From 079eb20eb805a1411e082364762eb7973c402098 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Thu, 2 May 2024 04:21:40 -0700
Subject: [PATCH 1/2] maint: Remove redundant 'environ' declarations.
* src/rexecd.c: Remove 'extern char **environ' and instead rely on the
gnulib declaration in unistd.h.
* src/rshd.c: Likewise.
* src/uucpd.c: Likewise.
* telnet/commands.c: Likewise.
* telnetd/pty.c: Likewise.
* tests/addrpeek.c: Likewise.
---
src/rexecd.c | 1 -
src/rshd.c | 1 -
src/uucpd.c | 2 --
telnet/commands.c | 2 +-
telnetd/pty.c | 1 -
tests/addrpeek.c | 7 -------
6 files changed, 1 insertion(+), 13 deletions(-)
diff --git a/src/rexecd.c b/src/rexecd.c
index e9ed092d..f927e990 100644
--- a/src/rexecd.c
+++ b/src/rexecd.c
@@ -216,7 +216,6 @@ char *envinit[] = { homedir, shell, path, username,
logname, remotehost, NULL
};
#endif
-extern char **environ;
char *getstr (const char *);
diff --git a/src/rshd.c b/src/rshd.c
index b5a8472a..c3ba028b 100644
--- a/src/rshd.c
+++ b/src/rshd.c
@@ -417,7 +417,6 @@ char rhost[128 + sizeof ("RHOST=")] = "RHOST=";
#ifndef WITH_PAM
char *envinit[] = { homedir, shell, path, logname, username, rhost, NULL };
#endif
-extern char **environ;
void
doit (int sockfd, struct sockaddr *fromp, socklen_t fromlen)
diff --git a/src/uucpd.c b/src/uucpd.c
index aad85f22..1dd89cf7 100644
--- a/src/uucpd.c
+++ b/src/uucpd.c
@@ -103,8 +103,6 @@ char *nenv[] = {
NULL,
};
-extern char **environ;
-
static struct argp_option argp_options[] = {
#define GRP 10
{"uucico", 'u', "LOCATION", 0,
diff --git a/telnet/commands.c b/telnet/commands.c
index d5a3481d..1288fdbd 100644
--- a/telnet/commands.c
+++ b/telnet/commands.c
@@ -58,6 +58,7 @@
#include <netinet/in.h>
#include <fcntl.h>
+#include <unistd.h>
#include <signal.h>
#include <netdb.h>
@@ -1886,7 +1887,6 @@ env_find (const char *var)
void
env_init (void)
{
- extern char **environ;
register char **epp, *cp;
register struct env_lst *ep;
#ifndef strchr
diff --git a/telnetd/pty.c b/telnetd/pty.c
index 91018175..18b9d759 100644
--- a/telnetd/pty.c
+++ b/telnetd/pty.c
@@ -83,7 +83,6 @@ startslave (char *host, int autologin, char *autoname)
return master;
}
-extern char **environ;
/*
* scrub_env()
*
diff --git a/tests/addrpeek.c b/tests/addrpeek.c
index 9533e9e7..7102ad98 100644
--- a/tests/addrpeek.c
+++ b/tests/addrpeek.c
@@ -56,13 +56,6 @@
# define SEPARATOR "\n"
#endif
-/* TODO Develop some reliable test for the existence of ENVIRON.
- * It is detectable using HAVE_DECL_ENVIRON for GNU/Linux and
- * GNU/kFreeBSD. It is present, but not detectable for OpenBSD
- * and FreeBSD.
- */
-extern char **environ;
-
static void
write_address (int fd)
{
--
2.44.0
From d233a8f63836576837cb1540a87547531d92a1a7 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Thu, 2 May 2024 04:37:07 -0700
Subject: [PATCH 2/2] maint: Remove redundant stdbool.h includes.
* ping/ping.c: Don't include stdbool.h since gnulib includes it in
config.h if the C23 keyword is not supported.
* ping/ping_common.h: Likewise.
* src/inetd.c: Likewise.
* src/traceroute.c: Likewise.
---
ping/ping.c | 1 -
ping/ping_common.h | 2 --
src/inetd.c | 1 -
src/traceroute.c | 1 -
4 files changed, 5 deletions(-)
diff --git a/ping/ping.c b/ping/ping.c
index f9014c7e..48d49ff1 100644
--- a/ping/ping.c
+++ b/ping/ping.c
@@ -35,7 +35,6 @@
#include <netdb.h>
#include <unistd.h>
#include <stdlib.h>
-#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
diff --git a/ping/ping_common.h b/ping/ping_common.h
index 46f7b4b2..3db07607 100644
--- a/ping/ping_common.h
+++ b/ping/ping_common.h
@@ -24,8 +24,6 @@
#include <error.h>
#include <progname.h>
-#include <stdbool.h>
-
#define MAXWAIT 10 /* Max seconds to wait for response. */
#define MAXPATTERN 16 /* Maximal length of pattern. */
diff --git a/src/inetd.c b/src/inetd.c
index 2d2bd52d..8dbf9d78 100644
--- a/src/inetd.c
+++ b/src/inetd.c
@@ -119,7 +119,6 @@
#include <netdb.h>
#include <pwd.h>
#include <signal.h>
-#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/src/traceroute.c b/src/traceroute.c
index 3ea4f3b6..ea759025 100644
--- a/src/traceroute.c
+++ b/src/traceroute.c
@@ -38,7 +38,6 @@
#include <netdb.h>
#include <unistd.h>
#include <stdlib.h>
-#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
--
2.44.0