From 69796e34d74f1bdbf54cb677152bc71426f8a81f Mon Sep 17 00:00:00 2001 From: Nick Briggs Date: Tue, 27 Mar 2018 10:39:23 -0700 Subject: [PATCH] More linux related fixups for string.h. Fix some type warnings. modified: ../src/dsk.c modified: ../src/fvar.c modified: ../src/ldsout.c modified: ../src/main.c modified: ../src/timer.c --- src/dsk.c | 2 +- src/fvar.c | 2 +- src/ldsout.c | 4 ++++ src/main.c | 5 ++++- src/timer.c | 6 +++++- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/dsk.c b/src/dsk.c index 13645b8..00ae347 100644 --- a/src/dsk.c +++ b/src/dsk.c @@ -15,7 +15,7 @@ static char *id = "$Id: dsk.c,v 1.4 2001/12/24 01:09:01 sybalsky Exp $ Copyright #include "version.h" -#if defined(MACOSX) || defined(FREEBSD) +#if defined(MACOSX) || defined(FREEBSD) || defined(LINUX) #include #endif diff --git a/src/fvar.c b/src/fvar.c index 6161680..2dc6e11 100644 --- a/src/fvar.c +++ b/src/fvar.c @@ -415,7 +415,7 @@ LispPTR N_OP_fvar_(register LispPTR tos, register int n) { : (swapx((int)(x) + NEWATOM_VALUE_OFFSET))) #endif /* BIGVM */ -#define STK_HI_RET(x) ((int)(x) << 16) | 1 | ((unsigned int)(x) >> 16) +#define STK_HI_RET(x) ((unsigned int)(x) << 16) | 1 | ((unsigned int)(x) >> 16) #endif /* BIGATOMS */ diff --git a/src/ldsout.c b/src/ldsout.c index e7bd175..6e9ec54 100644 --- a/src/ldsout.c +++ b/src/ldsout.c @@ -59,11 +59,15 @@ extern int errno; int Storage_expanded; /* T or NIL */ /* RISCOS, OSF1 and MACOSX don't have valloc, and malloc works OK there. */ +#if defined(LINUX) +/* has valloc() */ +#else #if defined(SYSVONLY) || defined(OSF1) || defined(MACOSX) #define valloc malloc #else char *valloc(); #endif /* SYSVONLY || OSF1 || MACOSX */ +#endif /* not LINUX */ /************************************************************************/ /* */ diff --git a/src/main.c b/src/main.c index b7bb412..92f9097 100644 --- a/src/main.c +++ b/src/main.c @@ -38,6 +38,9 @@ static char *id = "$Id: main.c,v 1.4 2001/12/26 22:17:03 sybalsky Exp $ Copyrigh #include #include #endif /* DOS */ +#ifdef LINUX +#include +#endif #ifndef NOETHER #ifndef USE_DLPI @@ -796,7 +799,7 @@ void print_info_lines() { #elif (RELEASE == 351) printf("Emulator for Medley release 3.51\n"); #endif /* RELEASE */ -#if defined(MACOSX) || defined(FREEBSD) +#if defined(MACOSX) || defined(FREEBSD) || defined(LINUX) printf("Creation date: %s", ctime((const time_t *)&MDate)); #else printf("Creation date: %s", ctime(&MDate)); diff --git a/src/timer.c b/src/timer.c index eff9ed9..f2b29dd 100644 --- a/src/timer.c +++ b/src/timer.c @@ -77,6 +77,10 @@ extern int ether_fd; #endif #ifdef LINUX +#include +#include +#define _BSD_SOURCE +#include #include #endif @@ -421,7 +425,7 @@ LispPTR N_OP_rclk(LispPTR tos) struct timeval timev; gettimeofday(&timev, NULL); - usec = (timev.tv_sec * 1000000) + timev.tv_usec; + usec = (timev.tv_sec * 1000000UL) + timev.tv_usec; #endif /* USETIMEFN */ *((unsigned int *)(Addr68k_from_LADDR(tos))) = usec; return (tos);