Skip to content

Commit 985f2c4

Browse files
Remove prototypes for getenv. Use stdlib.h. (#122)
This also removes some casts to `char *` that were present but not needed, since `getenv()` is defined to return `char *`.
1 parent 530aa4c commit 985f2c4

File tree

8 files changed

+13
-14
lines changed

8 files changed

+13
-14
lines changed

src/initkbd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <errno.h>
1414
#include <stdio.h>
15+
#include <stdlib.h>
1516
#include <string.h>
1617
#include <sys/types.h>
1718
#ifndef DOS
@@ -383,8 +384,6 @@ void seteventmask(struct inputmask *eventmask)
383384
}
384385
#endif /* SUNDISPLAY */
385386

386-
char *getenv(); /* ---- external entry points --------*/
387-
388387
#define MIN_KEYTYPE 3
389388
#define KB_AS3000J (7 + MIN_KEYTYPE)
390389
#define KB_RS6000 (8 + MIN_KEYTYPE) /* TODO: Can we remove this? */

src/ldeether.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ char *devices[] = {"le0", "le1", "le2", "le3", "le4", "ie0", "ie1", "i
6363
#include <nlist.h>
6464
#include <fcntl.h>
6565
#include <malloc.h>
66+
#include <stdlib.h>
6667

6768
#endif /* NOETHER */
6869

@@ -103,7 +104,7 @@ int main(int argc, char *argv[]) {
103104
/* Use DLPI to connect to the ethernet. This code is stolen
104105
from NFSWATCH4.3
105106
*/
106-
char *etherdev = (char *)getenv("LDEETHERDEV");
107+
char *etherdev = getenv("LDEETHERDEV");
107108
ether_fd = setup_dlpi_dev(etherdev);
108109
if (ether_fd >= 0) { /* Open an ether interface */
109110
ether_intf_type = dlpi_devtype(ether_fd);

src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <errno.h>
2121
#include <setjmp.h>
2222
#include <stdio.h>
23+
#include <stdlib.h>
2324
#include <string.h>
2425
#include <sys/types.h>
2526
#include <time.h>
@@ -248,7 +249,6 @@ char keystring[128] = {""};
248249
#define FALSE 0
249250
#define TRUE !FALSE
250251

251-
char *getenv();
252252
int Lisp_Xinitialized = FALSE;
253253
char sysout_name[MAXPATHLEN]; /* Set by read_Xoption, in the X version. */
254254
int sysout_size = 0; /* ditto */

src/timer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ unsigned long tick_count = 0; /* approx 18 ticks per sec */
4444
#endif /* DOS */
4545
#include <sys/types.h>
4646
#include <stdio.h>
47+
#include <stdlib.h>
4748
#include <signal.h>
4849
#include <unistd.h>
4950
#include <fcntl.h>
@@ -102,7 +103,6 @@ extern DspInterface currentdsp;
102103
*/
103104

104105
int TIMEOUT_TIME; /* For file system timeout */
105-
char *getenv();
106106

107107
#ifdef XWINDOW
108108
#define FALSE 0

src/unixcomm.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Unix Interface Communications
3131
#include <setjmp.h> /* JRB - timeout.h needs setjmp.h */
3232
#include <signal.h>
3333
#include <stdio.h>
34+
#include <stdlib.h>
3435
#include <string.h>
3536
#include <sys/file.h>
3637
#include <sys/ioctl.h>
@@ -258,7 +259,7 @@ void close_unix_descriptors(void) /* Get ready to shut Maiko down */
258259
/************************************************************************/
259260

260261
int FindUnixPipes(void) {
261-
char *envtmp, *getenv(const char *);
262+
char *envtmp;
262263
register int i;
263264
struct unixjob cleareduj;
264265

src/uutils.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include <signal.h>
2222
#include <stdio.h>
23+
#include <stdlib.h>
2324
#include <string.h>
2425
#include <time.h>
2526
#include <unistd.h>
@@ -220,8 +221,6 @@ LispPTR unix_username(LispPTR *args) {
220221
* The only usage seems to be checking "ARCH" == "dos" and for the existance
221222
* of *any* result from the call, which indicates it's an emulated system.
222223
*/
223-
char *getenv(const char *);
224-
225224
LispPTR unix_getparm(LispPTR *args) {
226225
char envname[20], result[128], *envvalue;
227226
if (lisp_string_to_c_string(args[0], envname, sizeof envname)) return NIL;

src/xmkicon.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ Pixmap make_Xicon(DspInterface dsp)
4343
{
4444
unsigned int width, height;
4545
int value, x_hot, y_hot;
46-
char *getenv();
4746

4847
#ifdef TRACE
4948
printf("In make_Xicon().\n");

src/xrdopt.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,12 @@ void read_Xoption(int *argc, char *argv[])
205205
if (*argc == 2) /* There was probably a sysoutarg */
206206
{
207207
(void)strcpy(sysout_name, argv[1]);
208-
} else if ((envname = (char *)getenv("LDESRCESYSOUT")) != NULL) {
208+
} else if ((envname = getenv("LDESRCESYSOUT")) != NULL) {
209209
strcpy(sysout_name, envname);
210-
} else if ((envname = (char *)getenv("LDESOURCESYSOUT")) != NULL)
210+
} else if ((envname = getenv("LDESOURCESYSOUT")) != NULL)
211211
strcpy(sysout_name, envname);
212212
else {
213-
envname = (char *)getenv("HOME");
213+
envname = getenv("HOME");
214214
(void)strcat(sysout_name, envname);
215215
(void)strcat(sysout_name, "/lisp.virtualmem");
216216

@@ -231,7 +231,7 @@ void read_Xoption(int *argc, char *argv[])
231231
fprintf(stderr, "or provide a -display argument.\n");
232232
print_Xusage(argv[0]);
233233
} else {
234-
envname = (char *)getenv("DISPLAY");
234+
envname = getenv("DISPLAY");
235235
(void)strcpy(Display_Name, envname);
236236
}
237237
if ((xdisplay = XOpenDisplay(Display_Name)) != NULL) {
@@ -252,7 +252,7 @@ void read_Xoption(int *argc, char *argv[])
252252
exit(-1);
253253
}
254254

255-
envname = (char *)getenv("HOME");
255+
envname = getenv("HOME");
256256
(void)strcat(tmp, envname);
257257
(void)strcat(tmp, "/.Xdefaults");
258258
if (access(tmp, R_OK) != 0) {

0 commit comments

Comments
 (0)