Fix build issues due to multiple definitions during linking

Issue is the title, alot of multiple definition errors and some other
misc ones. The changes allow phunix to be built with modern compilers.
This commit is contained in:
Rebekah 2023-05-29 19:28:54 -04:00
parent a4e6c4a7df
commit a6d7953652
Signed by: oneechanhax
GPG Key ID: 183EB7902964DAE5
9 changed files with 93 additions and 27 deletions

View File

@ -204,7 +204,6 @@ void options(int, char **);
OPLIST * opt_next(void);
int bad_opt(void);
int mkpath(char *);
char *chdname;
#if !HAVE_NBTOOL_CONFIG_H
int do_chroot;
#endif

View File

@ -116,6 +116,7 @@ int forcelocal; /* force local operation even if the name
* contains a :
*/
int secure = 1; /* don't extract names that contain .. */
char *chdname;
/*
* PAX - Portable Archive Interchange

View File

@ -101,7 +101,7 @@ public:
~ValueMap() {}
bool hasMD() const { return MDMap; }
bool hasMD() const { return (bool)MDMap; }
MDMapT &MD() {
if (!MDMap)
MDMap.reset(new MDMapT);

View File

@ -72,6 +72,9 @@
int newfs_udf(int argc, char **argv);
static void usage(void) __attribute__((__noreturn__));
/* shared structure between udf_create.c users */
struct udf_create_context context;
struct udf_disclayout layout;
/* queue for temporary storage of sectors to be written out */
struct wrsect {
@ -100,7 +103,6 @@ int wrtrack_skew;
int meta_perc = UDF_META_PERC;
float meta_fract = (float) UDF_META_PERC / 100.0;
/* --------------------------------------------------------------------- */
/*

View File

@ -53,8 +53,8 @@ extern float meta_fract;
/* shared structure between udf_create.c users */
struct udf_create_context context;
struct udf_disclayout layout;
extern struct udf_create_context context;
extern struct udf_disclayout layout;
/* prototypes */
int udf_write_sector(void *sector, uint64_t location);

View File

@ -120,6 +120,8 @@ __RCSID("$NetBSD: make.c,v 1.91 2014/10/18 08:33:30 snj Exp $");
#include "dir.h"
#include "job.h"
FILE *debug_file;
static unsigned int checked = 1;/* Sequence # to detect recursion */
static Lst toBeMade; /* The current fringe of the graph. These
* are nodes which await examination by

View File

@ -440,7 +440,7 @@ extern pid_t myPid;
* There is one bit per module. It is up to the module what debug
* information to print.
*/
FILE *debug_file; /* Output written here - default stdout */
extern FILE *debug_file; /* Output written here - default stdout */
extern int debug;
#define DEBUG_ARCH 0x00001
#define DEBUG_COND 0x00002

View File

@ -46,27 +46,86 @@ __RCSID("$NetBSD: machines.c,v 1.39 2014/02/24 07:23:44 skrll Exp $");
* isn't built with all the architectures defined.
* A lot simpler that conditionally including the definitions themselves.
*/
struct ib_mach
ib_mach_alpha,
ib_mach_amd64,
ib_mach_amiga,
ib_mach_emips,
ib_mach_ews4800mips,
ib_mach_hp300,
ib_mach_hppa,
ib_mach_i386,
ib_mach_landisk,
ib_mach_macppc,
ib_mach_news68k,
ib_mach_newsmips,
ib_mach_next68k,
ib_mach_pmax,
ib_mach_sparc,
ib_mach_sparc64,
ib_mach_sun2,
ib_mach_sun3,
ib_mach_vax,
ib_mach_x68k;
// commented out due to modern c not allowing multiple definitions. This will simply throw not defined errors.
#ifndef __alpha__
struct ib_mach ib_mach_alpha;
#endif
#ifndef __amd64__
struct ib_mach ib_mach_amd64;
#endif
#ifndef __amiga__
struct ib_mach ib_mach_amiga;
#endif
#ifndef __emips__
struct ib_mach ib_mach_emips;
#endif
#ifndef __ews4800mips__
struct ib_mach ib_mach_ews4800mips;
#endif
#ifndef __hp300__
struct ib_mach ib_mach_hp300;
#endif
#ifndef __hppa__
struct ib_mach ib_mach_hppa;
#endif
#if !defined(__i386__) && !defined(__amd64__)
struct ib_mach ib_mach_i386;
#endif
#ifndef __landisk__
struct ib_mach ib_mach_landisk;
#endif
#ifndef __macppc__
struct ib_mach ib_mach_macppc;
#endif
#ifndef __news68k__
struct ib_mach ib_mach_news68k;
#endif
#ifndef __newsmips__
struct ib_mach ib_mach_newsmips;
#endif
#ifndef __next68k__
struct ib_mach ib_mach_next68k;
#endif
#ifndef __pmax__
struct ib_mach ib_mach_pmax;
#endif
#ifndef __sparc__
struct ib_mach ib_mach_sparc;
#endif
#ifndef __sparc64__
struct ib_mach ib_mach_sparc64;
#endif
#ifndef __sun2__
struct ib_mach ib_mach_sun2;
#endif
#ifndef __sun3__
struct ib_mach ib_mach_sun3;
#endif
#ifndef __vax__
struct ib_mach ib_mach_vax;
#endif
#ifndef __x68k__
struct ib_mach ib_mach_x68k;
#endif
struct ib_mach * const machines[] = {
&ib_mach_alpha,

View File

@ -90,6 +90,9 @@ float meta_fract = (float) UDF_META_PERC / 100.0;
int mmc_profile; /* emulated profile */
int req_enable, req_disable;
/* shared structure between udf_create.c users, from sbin/newfs_udf/newfs_udf.h */
struct udf_create_context context;
struct udf_disclayout layout;
/* --------------------------------------------------------------------- */