From ae442c0fd1f28211583ccc9867ddd7f88db7494e Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Tue, 22 Dec 2020 23:36:39 +0700 Subject: [PATCH] Remove prototypes for getenv. Use stdlib.h. This also removes some casts to `char *` that were present but not needed, since `getenv()` is defined to return `char *`. --- src/initkbd.c | 3 +-- src/ldeether.c | 3 ++- src/main.c | 2 +- src/timer.c | 2 +- src/unixcomm.c | 3 ++- src/uutils.c | 3 +-- src/xmkicon.c | 1 - src/xrdopt.c | 10 +++++----- 8 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/initkbd.c b/src/initkbd.c index 891f64a1..517af784 100644 --- a/src/initkbd.c +++ b/src/initkbd.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #ifndef DOS @@ -383,8 +384,6 @@ void seteventmask(struct inputmask *eventmask) } #endif /* SUNDISPLAY */ -char *getenv(); /* ---- external entry points --------*/ - #define MIN_KEYTYPE 3 #define KB_AS3000J (7 + MIN_KEYTYPE) #define KB_RS6000 (8 + MIN_KEYTYPE) /* TODO: Can we remove this? */ diff --git a/src/ldeether.c b/src/ldeether.c index d9c694fd..67d7fe85 100644 --- a/src/ldeether.c +++ b/src/ldeether.c @@ -63,6 +63,7 @@ char *devices[] = {"le0", "le1", "le2", "le3", "le4", "ie0", "ie1", "i #include #include #include +#include #endif /* NOETHER */ @@ -103,7 +104,7 @@ int main(int argc, char *argv[]) { /* Use DLPI to connect to the ethernet. This code is stolen from NFSWATCH4.3 */ - char *etherdev = (char *)getenv("LDEETHERDEV"); + char *etherdev = getenv("LDEETHERDEV"); ether_fd = setup_dlpi_dev(etherdev); if (ether_fd >= 0) { /* Open an ether interface */ ether_intf_type = dlpi_devtype(ether_fd); diff --git a/src/main.c b/src/main.c index c51d2c38..1fef340a 100644 --- a/src/main.c +++ b/src/main.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -248,7 +249,6 @@ char keystring[128] = {""}; #define FALSE 0 #define TRUE !FALSE -char *getenv(); int Lisp_Xinitialized = FALSE; char sysout_name[MAXPATHLEN]; /* Set by read_Xoption, in the X version. */ int sysout_size = 0; /* ditto */ diff --git a/src/timer.c b/src/timer.c index 3b238557..3ac5867a 100644 --- a/src/timer.c +++ b/src/timer.c @@ -44,6 +44,7 @@ unsigned long tick_count = 0; /* approx 18 ticks per sec */ #endif /* DOS */ #include #include +#include #include #include #include @@ -102,7 +103,6 @@ extern DspInterface currentdsp; */ int TIMEOUT_TIME; /* For file system timeout */ -char *getenv(); #ifdef XWINDOW #define FALSE 0 diff --git a/src/unixcomm.c b/src/unixcomm.c index 336e547c..08f58b5e 100644 --- a/src/unixcomm.c +++ b/src/unixcomm.c @@ -31,6 +31,7 @@ Unix Interface Communications #include /* JRB - timeout.h needs setjmp.h */ #include #include +#include #include #include #include @@ -258,7 +259,7 @@ void close_unix_descriptors(void) /* Get ready to shut Maiko down */ /************************************************************************/ int FindUnixPipes(void) { - char *envtmp, *getenv(const char *); + char *envtmp; register int i; struct unixjob cleareduj; diff --git a/src/uutils.c b/src/uutils.c index 04e82bca..be7afa53 100644 --- a/src/uutils.c +++ b/src/uutils.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -220,8 +221,6 @@ LispPTR unix_username(LispPTR *args) { * The only usage seems to be checking "ARCH" == "dos" and for the existance * of *any* result from the call, which indicates it's an emulated system. */ -char *getenv(const char *); - LispPTR unix_getparm(LispPTR *args) { char envname[20], result[128], *envvalue; if (lisp_string_to_c_string(args[0], envname, sizeof envname)) return NIL; diff --git a/src/xmkicon.c b/src/xmkicon.c index 0207b0ac..2888c35d 100644 --- a/src/xmkicon.c +++ b/src/xmkicon.c @@ -43,7 +43,6 @@ Pixmap make_Xicon(DspInterface dsp) { unsigned int width, height; int value, x_hot, y_hot; - char *getenv(); #ifdef TRACE printf("In make_Xicon().\n"); diff --git a/src/xrdopt.c b/src/xrdopt.c index a7599388..2fd73b95 100644 --- a/src/xrdopt.c +++ b/src/xrdopt.c @@ -205,12 +205,12 @@ void read_Xoption(int *argc, char *argv[]) if (*argc == 2) /* There was probably a sysoutarg */ { (void)strcpy(sysout_name, argv[1]); - } else if ((envname = (char *)getenv("LDESRCESYSOUT")) != NULL) { + } else if ((envname = getenv("LDESRCESYSOUT")) != NULL) { strcpy(sysout_name, envname); - } else if ((envname = (char *)getenv("LDESOURCESYSOUT")) != NULL) + } else if ((envname = getenv("LDESOURCESYSOUT")) != NULL) strcpy(sysout_name, envname); else { - envname = (char *)getenv("HOME"); + envname = getenv("HOME"); (void)strcat(sysout_name, envname); (void)strcat(sysout_name, "/lisp.virtualmem"); @@ -231,7 +231,7 @@ void read_Xoption(int *argc, char *argv[]) fprintf(stderr, "or provide a -display argument.\n"); print_Xusage(argv[0]); } else { - envname = (char *)getenv("DISPLAY"); + envname = getenv("DISPLAY"); (void)strcpy(Display_Name, envname); } if ((xdisplay = XOpenDisplay(Display_Name)) != NULL) { @@ -252,7 +252,7 @@ void read_Xoption(int *argc, char *argv[]) exit(-1); } - envname = (char *)getenv("HOME"); + envname = getenv("HOME"); (void)strcat(tmp, envname); (void)strcat(tmp, "/.Xdefaults"); if (access(tmp, R_OK) != 0) {