Skip to content

Commit

Permalink
Merge pull request #1785 from ccoffing/portable-build-fixes
Browse files Browse the repository at this point in the history
Portable build fixes
  • Loading branch information
ghaerr authored Jan 9, 2024
2 parents b423cce + 729ea23 commit 5fe82e3
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 20 deletions.
1 change: 0 additions & 1 deletion elkscmd/ash/error.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ struct jmploc *handler;
int exception;
volatile int suppressint;
volatile int intpending;
char *commandname;


/*
Expand Down
1 change: 1 addition & 0 deletions elkscmd/ash/var.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct var vps2;
struct var vpse;
struct var vvers;
struct var vterm;
struct localvar *localvars;

const struct varinit varinit[] = {
#if ATTY
Expand Down
2 changes: 1 addition & 1 deletion elkscmd/ash/var.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ struct localvar {
};


struct localvar *localvars;
extern struct localvar *localvars;

#if ATTY
extern struct var vatty;
Expand Down
12 changes: 2 additions & 10 deletions elkscmd/disk_utils/mkfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@
#include <linuxmt/fs.h>
#include <linuxmt/minix_fs.h>

/* Check for gcc removed from here. */

#ifndef __linux__
#define volatile
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif

Expand Down Expand Up @@ -152,12 +149,7 @@ unsigned char test_bit(unsigned int nr, void * add)
#define mark_zone(x) (setbit(zone_map,(x)-FIRSTZONE+1))
#define unmark_zone(x) (clrbit(zone_map,(x)-FIRSTZONE+1))

/*
* Volatile to let gcc know that this doesn't return. When trying
* to compile this under minix, volatile gives a warning, as
* exit() isn't defined as volatile under minix.
*/
volatile void fatal_error(const char * fmt_string,int status)
void fatal_error(const char * fmt_string,int status)
{
printf(fmt_string);
exit(status);
Expand Down
1 change: 1 addition & 0 deletions elkscmd/file_utils/l.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* by commas
*/

#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion elkscmd/sys_utils/chmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ int do_chmem(char *filename, int changeheap, int changestack,
int
main(int argc, char **argv)
{
int ch, err;
int ch, err = 0;
int changeheap = 0, changestack = 0;
unsigned long heap = 0, stack = 0;

Expand Down
1 change: 0 additions & 1 deletion elkscmd/xvi/xvi.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
/* #include <sgtty.h> tjp*/
#include <ctype.h>
#include <stdio.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <signal.h>
#include <setjmp.h>
Expand Down
8 changes: 4 additions & 4 deletions libc/malloc/__mini_malloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
void *
__mini_malloc(size_t size)
{
register mem *ptr;
register unsigned int sz;
mem *ptr;
size_t sz;

/* First time round this _might_ be odd, But we won't do that! */
sz = (unsigned int)sbrk(0);
sz = (size_t)sbrk(0);
if(sz & (sizeof(mem) - 1))
sbrk(4 - (sz & (sizeof(mem) - 1)));

Expand All @@ -29,7 +29,7 @@ __mini_malloc(size_t size)
size /= sizeof(mem);

ptr = (mem *) sbrk(size * sizeof(mem));
if((int)ptr == -1)
if((intptr_t)ptr == -1)
return 0;

m_size(ptr) = size;
Expand Down
4 changes: 2 additions & 2 deletions libc/termcap/tgetent.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ int li, co;
int
tgetent(char *bp, const char *name)
{
register char *termcap_name;
char *termcap_name, *term_name;
register int fd;
struct termcap_buffer buf;
register char *bp1;
Expand Down Expand Up @@ -320,7 +320,7 @@ tgetent(char *bp, const char *name)
it is the entry itself, but only if
the name the caller requested matches the TERM variable. */

if (termcap_name && !filep && !strcmp (name, getenv ("TERM")))
if (termcap_name && !filep && (term_name = getenv("TERM")) && !strcmp (name, term_name))
{
indirect = termcap_tgetst1 (termcap_find_capability (termcap_name, "tc"), (char **) 0);
if (!indirect)
Expand Down

0 comments on commit 5fe82e3

Please sign in to comment.