Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit ec93f74b authored by deuce's avatar deuce

Fix GNU builds.

parent cbf85d45
CC = gcc
CXX = g++
CONIO_SRC = ../../../conio
XPDEV_SRC = ../../../xpdev
ODOOR_SRC = ../../../odoors
CFLAGS += -O2
CFLAGS += -g
CFLAGS += -I${ODOOR_SRC} -I${XPDEV_SRC} -I${CONIO_SRC}
# Needed for struct alignment!
CFLAGS += -fshort-enums
LDFLAGS += -L${ODOOR_SRC}
SRC_ROOT := ../../..
include ${SRC_ROOT}/build/Common.gmake
all : ny2008 aedit nyibbs nyedit medit
ODOORS_SRC := $(SRC_ROOT)/odoors
CFLAGS += $(CIOLIB-MT_CFLAGS) $(XPDEV-MT_CFLAGS)
CFLAGS += -I$(ODOORS_SRC)
LDFLAGS += $(CIOLIB-MT_LDFLAGS) $(XPDEV-MT_LDFLAGS) -L${ODOORS_SRC}/libs-`uname`
CPPFLAGS += $(CFLAGS)
filewrap.o:
$(CC) $(CFLAGS) -c ${XPDEV_SRC}/filewrap.c
$(NY2008) : $(OBJS)
$(CXX) $(CPPFLAGS) ${LDFLAGS} $(OBJS) -lODoors -o $(NY2008) $(CIOLIB-MT_LIBS) $(XPDEV-MT_LIBS)
dirwrap.o:
$(CC) $(CFLAGS) -c ${XPDEV_SRC}/dirwrap.c
$(AEDIT) : $(AEDIT_OBJS)
$(CXX) $(CPPFLAGS) ${LDFLAGS} $(AEDIT_OBJS) -o $(AEDIT)
genwrap.o:
$(CC) $(CFLAGS) -c ${XPDEV_SRC}/genwrap.c
$(MEDIT) : $(MEDIT_OBJS)
$(CXX) $(CPPFLAGS) ${LDFLAGS} $(MEDIT_OBJS) -o $(MEDIT)
conio.o: curs_cio.o x_cio.o
$(CC) $(CFLAGS) -c ${CONIO_SRC}/conio.c
$(NYIBBS) : $(NYIBBS_OBJS)
$(CXX) $(CPPFLAGS) ${LDFLAGS} $(NYIBBS_OBJS) -o $(NYIBBS) $(XPDEV-MT_LIBS)
curs_cio.o:
$(CC) $(CFLAGS) -c ${CONIO_SRC}/curs_cio.c
$(NYEDIT) : $(NYEDIT_OBJS)
$(CXX) $(CPPFLAGS) ${LDFLAGS} $(NYEDIT_OBJS) -lODoors -o $(NYEDIT) $(CIOLIB-MT_LIBS) $(XPDEV-MT_LIBS)
x_cio.o:
$(CC) $(CFLAGS) -c ${CONIO_SRC}/x_cio.c
fights.o : fights.cpp fights.h ny2008.h
$(CXX) $(CFLAGS) -c fights.cpp
ibbsny.o : ibbsny.cpp ibbsny.h ny2008.h
$(CXX) $(CFLAGS) -c ibbsny.cpp
igmsup.o : igmsup.cpp ny2008.h
$(CXX) $(CFLAGS) -c igmsup.cpp
second.o : second.cpp ny2008.h
$(CXX) $(CFLAGS) -c second.cpp
chatadd.o : chatadd.cpp ny2008.h
$(CXX) $(CFLAGS) -c chatadd.cpp
ny2008.o : ny2008.cpp
$(CXX) $(CFLAGS) -c ny2008.cpp
ny2008 : ny2008.o ibbsny.o second.o igmsup.o ibbsny.o fights.o dirwrap.o filewrap.o genwrap.o conio.o chatadd.o
$(CXX) $(CFLAGS) ${LDFLAGS} conio.o curs_cio.o x_cio.o ny2008.o chatadd.o dirwrap.o filewrap.o genwrap.o fights.o ibbsny.o igmsup.o second.o -lcurses -lODoors -lm -o ../ny2008
aedit : aedit.cpp
$(CXX) $(CFLAGS) ${LDFLAGS} aedit.cpp -o ../aedit
medit : medit.cpp
$(CXX) $(CFLAGS) ${LDFLAGS} medit.cpp -o ../medit
nyibbs : nyibbs.cpp ibbsny.o filewrap.o genwrap.o dirwrap.o
$(CXX) $(CFLAGS) ${LDFLAGS} nyibbs.cpp ibbsny.o filewrap.o genwrap.o dirwrap.o -o ../nyibbs
nyedit : nyedit.cpp nyedit.h filewrap.o genwrap.o dirwrap.o conio.o curs_cio.o x_cio.o
$(CXX) $(CFLAGS) ${LDFLAGS} nyedit.cpp filewrap.o genwrap.o dirwrap.o conio.o curs_cio.o x_cio.o -lcurses -lODoors -lm -o ../nyedit
clean :
rm -f *.o
rm -f ../ny2008
rm -f ../medit
rm -f ../aedit
rm -f ../nyibbs
rm -f ../nyedit
......@@ -11,7 +11,7 @@
void dump(void);
void
int
main(void) {
FILE *justfile;
enemy erec;
......@@ -21,19 +21,19 @@ main(void) {
INT16 lvl=0;
INT16 cnt;
char nnm[36];
// system("ren "ENEMY_FILENAME" nyenmb.dat");
// system("ren "ENEMY_INDEX" nyenmb.idx");
system("del "ENEMY_FILENAME);
system("del "ENEMY_INDEX);
system("mv "ENEMY_FILENAME" nyenmb.dat");
system("mv "ENEMY_INDEX" nyenmb.idx");
system("rm "ENEMY_FILENAME);
system("rm "ENEMY_INDEX);
eidx.first_enemy[0]=0;
do {
// printf("\nA-Add N-Next level Q-Quit>");
printf("\nA-Add N-Next level Q-Quit>");
scanf("%c",&key);
dump();
if (key=='A' || key=='a') {
// printf("Name of the sucker:");
printf("Name of the sucker:");
cnt=0;
do {
scanf("%c",&key);
......@@ -44,25 +44,25 @@ main(void) {
if (key!='\n' && key!='\r')
dump();
// printf("Hitpoints:");
printf("Hitpoints:");
scanf("%ld",&erec.hitpoints);
dump();
// printf("Strength:");
printf("Strength:");
scanf("%ld",&erec.strength);
dump();
// printf("Defense:");
printf("Defense:");
scanf("%ld",&erec.defense);
dump();
// printf("Arm:");
printf("Arm:");
scanf("%d",&erec.arm);
dump();
justfile=fopen(ENEMY_FILENAME,"a+b");
// printf("Atpos: %d\n\n",ftell(justfile)/sizeof(enemy));
printf("Atpos: %d\n\n",ftell(justfile)/sizeof(enemy));
fwrite(&erec,sizeof(enemy),1,justfile);
fclose(justfile);
......@@ -78,6 +78,7 @@ main(void) {
fwrite(&eidx,sizeof(enemy_idx),1,justfile);
fclose(justfile);
printf("\nDone!");
return 0;
}
void
......
......@@ -63,7 +63,7 @@ INT16 xp_random();
void attack_sequence();
*/
void any_attack_ops(user_rec *user_on, char fight_name[], char en_name[], INT32 en_hitpoints, INT32 en_strength, INT32 en_defense, weapon en_arm) {
void any_attack_ops(user_rec *user_on, const char fight_name[], const char en_name[], INT32 en_hitpoints, INT32 en_strength, INT32 en_defense, weapon en_arm) {
INT32 hit_s; //the attacking stregth
INT32 def_s;
INT32 en_hit_s;
......@@ -4989,7 +4989,7 @@ len_format(char str[]) {
}
void
ny_send_file(char filename[]) {
ny_send_file(const char filename[]) {
char line[124];
FILE *phile;
INT16 cnt;
......@@ -5168,7 +5168,7 @@ ny_get_index(void) {
char
ny_send_menu(menu_t menu,char allowed[],INT16 onscreen) {
ny_send_menu(menu_t menu,const char allowed[],INT16 onscreen) {
char line[124];
FILE *phile;
INT16 cnt;
......
......@@ -11,11 +11,11 @@ void online_fight(INT16 *user_num, user_rec *user_on, INT16 enm_num);
void fgc(INT16 *enm_num, INT16 *user_num);
INT16 event_gen(user_rec *user_on);
INT16 len_format(char str[]);
void ny_send_file(char filename[]);
char ny_send_menu(menu_t menu,char allowed[],INT16 onscreen=0);
void ny_send_file(const char filename[]);
char ny_send_menu(menu_t menu,const char allowed[],INT16 onscreen=0);
void ny_get_index(void);
void ny_line(INT16 line,INT16 before,INT16 after);
void any_attack_ops(user_rec *user_on, char fight_name[], char en_name[], INT32 en_hitpoints, INT32 en_strength, INT32 en_defense, weapon en_arm);
void any_attack_ops(user_rec *user_on, const char fight_name[], const char en_name[], INT32 en_hitpoints, INT32 en_strength, INT32 en_defense, weapon en_arm);
......
......@@ -1298,7 +1298,7 @@ void ConvertStringToAddress(tFidoNode * pNode, const char *pszSource)
#define KEYWORD_IBBS_GN 12
#define KEYWORD_BBS_NAME 13
char *apszKeyWord[NUM_KEYWORDS] = {"SystemAddress",
const char *apszKeyWord[NUM_KEYWORDS] = {"SystemAddress",
"UserName",
"NetmailDir",
"Crash",
......@@ -1313,7 +1313,7 @@ char *apszKeyWord[NUM_KEYWORDS] = {"SystemAddress",
"InterBBSGameNumber",
"SystemName"};
tIBResult IBReadConfig(tIBInfo * pInfo, char *pszConfigFile) {
tIBResult IBReadConfig(tIBInfo * pInfo, const char *pszConfigFile) {
/* Set default values for pInfo settings */
/*
......@@ -1445,7 +1445,7 @@ void ProcessConfigLine(INT16 nKeyword, char *pszParameter, void *pCal
/* Configuration file reader settings */
#define CONFIG_LINE_SIZE 128
#define MAX_TOKEN_CHARS 32
tBool ProcessConfigFile(char *pszFileName, INT16 nKeyWords, char **papszKeyWord,
tBool ProcessConfigFile(const char *pszFileName, INT16 nKeyWords, const char **papszKeyWord,
void (*pfCallBack) (INT16, char *, void *), void *pCallBackData) {
FILE *pfConfigFile;
char szConfigLine[CONFIG_LINE_SIZE + 1];
......
......@@ -39,7 +39,7 @@ tIBResult IBSendAll(tIBInfo *pInfo, char *pBuffer, INT16 nBufferSize);
tIBResult IBSendMail(tIBInfo *pInfo, ibbs_mail_type *ibmail);
tIBResult IBGetMail(tIBInfo *pInfo, ibbs_mail_type *ibmail);
//tIBResult IBGetR(tIBInfo *pInfo, void *pBuffer,INT16 *nBufferLen);
tIBResult IBReadConfig(tIBInfo *pInfo, char *pszConfigFile);
tIBResult IBReadConfig(tIBInfo *pInfo, const char *pszConfigFile);
/******************************************************************************/
......@@ -82,7 +82,7 @@ void DecodeMail(const char *pcSource, ibbs_mail_type *ibmail);
//int DecodeBufferR(const char *pszSource, void *pDestBuffer);
void ConvertAddressToString(char *pszDest, const tFidoNode *pNode);
void ConvertStringToAddress(tFidoNode *pNode, const char *pszSource);
tBool ProcessConfigFile(char *pszFileName, INT16 nKeyWords, char **papszKeyWord,
tBool ProcessConfigFile(const char *pszFileName, INT16 nKeyWords, const char **papszKeyWord,
void (*pfCallBack)(INT16, char *, void *), void *pCallBackData);
void ProcessConfigLine(INT16 nKeyword, char *pszParameter, void *pCallbackData);
......
This diff is collapsed.
......@@ -7,7 +7,7 @@
void dump(void);
void
int
main(void) {
FILE *justfile;
enemy erec;
......
......@@ -14,7 +14,7 @@
// include prototypes for fights
#include "fights.h"
extern unsigned _stklen=20000U;
unsigned _stklen=20000U;
// price arrays
DWORD gun_price[ULTRASOUND_GUN+1] = {
......@@ -63,8 +63,8 @@ INT16 no_rip_m=0;
INT16 rip=FALSE;
char *t_buffer=NULL;
INT16 registered=786;
char *ver="1.01";
char *verinfo="";
const char *ver="1.01";
const char *verinfo="";
INT16 gamedisk,flagdisk=-1;
INT16 *regptr;
char gamedir[MAX_PATH],flagdir[MAX_PATH];
......@@ -166,7 +166,7 @@ time_slice(void) {
}
INT16
copyfile(char *file1,char *file2) {
copyfile(const char *file1,const char *file2) {
FILE *f1,*f2;
char *buffer;
INT32 len1,where,x,y;
......@@ -281,7 +281,7 @@ loadbadwords(void) {
fclose(fp);
}
int
extern "C" int
main(int argc,char *argv[]) {
FILE *justfile,*njustfile;
char key;
......@@ -510,7 +510,7 @@ main(int argc,char *argv[]) {
sscanf(numstr,"%d",&intval);
od_control.od_node=intval;
} else if (strnicmp(argv[cnt],"-C",2)==0) {
strzcpy(od_control.od_config_filename,argv[cnt],2,59);
od_control.od_config_filename=argv[cnt]+2;
od_control.od_config_file = INCLUDE_CONFIG_FILE;
}
} while ((++cnt)<argc);
......@@ -4569,7 +4569,7 @@ DrgPtsCoef(void) {
}
char
callmenu(char allowed[],menu_t menu,INT16 menu_line,char figst) {
callmenu(const char allowed[],menu_t menu,INT16 menu_line,char figst) {
char key;
od_clear_keybuffer();
......@@ -5353,7 +5353,7 @@ AddBestPlayerInIB(char *name,DWORD points) {
INT16
strzcmp(char str1[], char str2[]) {
strzcmp(const char str1[], const char str2[]) {
char temp1[40],
temp2[40];
......
// 0 - Critical Door error (no fossil, etc.)
// 1 - Carrier lost, user off-line
// 2 - Sysop terminated call, user off-line
// 3 - User time used up, user STILL ON-LINE
// 4 - Keyboard inactivity timeout, user off-line
// 10 - User chose to return to BBS
// 11 - User chose to logoff, user off-line
// 12 - Critical RAVote error
#ifndef __unix__
#include <process.h>
#include <dos.h>
#endif
#include <math.h>
#if defined(__WATCOMC__)
#define date dosdate_t
#define getdate(x) _dos_getdate(x)
#else
#include <dirent.h>
#endif
#ifdef __TURBOC__
#include <dir.h>
#endif
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <errno.h>
#include <ctype.h>
/* OpenDoors *MUST* be included first */
#ifndef __BEEN_HERE__
//I never did an OS2 port .. although i started on it
#ifndef __OS2__
#include <OpenDoor.h> // Must be included in all doors
#else
#include <OpenDoor.h> // Must be included in all doors
#endif
#endif
#define __BEEN_HERE__
#if !defined(__unix__) && !defined(_WIN32)
#include <share.h>
#include <conio.h>
#include <io.h>
#else
#include <dirwrap.h>
#include <genwrap.h>
#include <filewrap.h>
#include <conio.h>
#endif
#include <fcntl.h>
#include <sys/stat.h>
#if defined(__TURBOC__) && !defined(_WIN32)
#include <locking.h>
#endif
#ifdef __WATCOMC__
#include <malloc.h>
#endif
#include <limits.h>
#include "filename.h"
#include "ibbsny.h"
#include "structs.h"
#include "const.h"
/*#define NO_MAIL_FLAG 0x0001
#define NY2008_FALG2 0x0002
#define NY2008_FALG3 0x0004
#define NY2008_FALG4 0x0008
#define NY2008_FALG5 0x0010
#define NY2008_FALG6 0x0020*/
int main(int argc,char *argv[]); // Function prototype declarations
char entry_menu(void); // Menu draw...
//char central_park(void);
//char drugs(void);
//char money(void);
//char evil_stuff(void);
//char food(void);
//char guns(void);
//char get_laid(void);
//char healing(void);
//char mail(void);
char callmenu(char allowed[],menu_t menu,INT16 menu_line,char figst);
void DisplayBestIB(void);
void read_IGMs(void);
DWORD get_val(DWORD def,DWORD max);
void EnterStreet(void);
void ListPlayers(void);
void ListPlayersA(void);
void ListPlayersS(sex_type psex);
void DisplayStats(void);
void Maintanance(void);
void drug_ops(void);
void money_ops(void);
void get_laid_ops(void);
void food_ops(void);
void guns_ops(void);
void healing_ops(void);
void newz_ops(void);
void mail_ops(void);
void wrt_sts(void);
void exit_ops(void);
void SortScrFile(INT16 usr, INT16 max);
void ChangeOnlineRanks(void);
void WhosOnline(void);
INT16 askifuser(char handle[25]);
char ny_get_answer(char *string);
void fig_ker(void);
void trim(char *numstr);
void dobadwords(char *s);
void print_drug(drug_type drug);
//void print_drug(drug_type drug,INT16 len);
void print_arm(weapon arm);
void points_raise(DWORD raise);
INT16 CheckForHandle(char handle[25]);
void Die(INT16 diecode); //die of reason 1=drugs 2=hunger 3=std
void ny_kernel(void);
//char rest(void);
void rest_ops(void);
void get_line(char beg[],char line[],char ovr[],INT16 wrap);
void read_mail(void);
void illness(void);
void illness(desease ill, INT16 inf, INT16 rape=FALSE);
void news_post(char line[], char name1[], char name2[], INT16 flag);
void print_disease(desease ill);
INT16 seereg(char bbsname[]);
void get_bbsname(char bbsname[]);
//void cap_names(char name[]);
void change_info(void);
void dump(void);
INT16 strzcmp(char str1[], char str2[]);
void del(char *file);
//void checknodes(void);
void WaitForEnter(void);
INT16 ReadOrAddCurrentUser(void);
void WriteCurrentUser(void);
INT32 randomf(INT32 max);
//FILE *ExculsiveFileOpen(char *pszFileName, char *pszMode);
FILE *ShareFileOpen(char *pszFileName, char *pszMode);
size_t ny_fread(void *ptr, size_t size, size_t n, FILE*stream);
size_t ny_fwrite(const void *ptr, size_t size, size_t n, FILE*stream);
void CustomConfigFunction(char *pszKeyword, char *pszOptions);
void strzcpy(char dest[],const char src[], INT16 beg,INT16 end);
double DrgPtsCoef(void);
void DisplayBest(void);
void AddBestPlayer(void);
void MakeFiles(void);
char *D_Num(INT16 num);
char *D_Num(INT32 num);
char *D_Num(DWORD num);
void heal_wounds(void);
void take_drug(void);
void money_plus(DWORD howmuch);
void money_minus(DWORD howmuch);
void disp_fig_stats(void);
void SortScrFileB(INT16 usr);
void points_loose(DWORD lost);
void CrashRecovery(void);
void IGM(char exenam[]);
void IGM_ops(void);
void CreateDropFile(INT16 all);
void ny_disp_emu(char line[]);
void nyr_disp_emu(char line[]);
void ny_clr_scr();
//void print_gun_prices(void);
void ny_disp_emu(char line[],INT16 min);
void ny_disp_emu_file(FILE *ans_phile,FILE *asc_phile,char line[],INT16 min);
char *ny_un_emu(char line[]);
char *ny_un_emu(char line[],char out[]);
void scr_save(void);
void scr_res(void);
void ch_game_d(void);
void ch_flag_d(void);
//void strim(char s[]);
void forrest_IGM(void);
void call_IGM(char exenamr[]);
void read_fight_IGMs(void);
FILE *ShareFileOpenAR(char *pszFileName, char *pszMode);
void UserStatus(void);
void ny_pers(unsigned char message);
void time_slice(void);
INT16 copyfile(char *file1,char *file2);
INT16 ny_remove(char *pszFileName);
void game_events(void);
void ny_stat_line(INT16 line,INT16 before,INT16 after);
void ny_read_stat_line(INT16 line,char *string, FILE *phile);
void read_ibmail(void);
char *LocationOf(char *address);
INT16 ibbs_bbs_list(void);
void ibbs_bbs_name(INT16 bbs,INT16 sex,INT16 nochoice,char nameI[],INT16 *dbn,INT16 *pn);
//char ibbs_m(void);
void ibbs_ops(void);
void AddBestPlayerIB(void);
void AddBestPlayerInIB(char *name, DWORD points);
/*int findf(char *pathname, struct ffblk *ffblk, INT16 attrib);
INT16 fnext(struct ffblk *ffblk);
INT16 strwcmp(char *format,char *string);*/
/*typedef struct {
INT16 first_enemy[LEVELS],
last_enemy[LEVELS];
} enemy_idx;*/
/*typedef struct {
char sender[25];
char senderI[36];
sex_type sender_sex;
char node_s[NODE_ADDRESS_CHARS + 1];
char node_r[NODE_ADDRESS_CHARS + 1];
char recver[25];
char recverI[36];
INT16 quote_length;
INT16 length;
INT16 flirt;
desease ill;
INT16 inf;
INT16 deleted;
} ibbs_mail_idx_type;*/
// 0 - Critical Door error (no fossil, etc.)
// 1 - Carrier lost, user off-line
// 2 - Sysop terminated call, user off-line
// 3 - User time used up, user STILL ON-LINE
// 4 - Keyboard inactivity timeout, user off-line
// 10 - User chose to return to BBS
// 11 - User chose to logoff, user off-line
// 12 - Critical RAVote error
#ifndef __unix__
#include <process.h>
#include <dos.h>
#endif
#include <math.h>
#if defined(__WATCOMC__)
#define date dosdate_t
#define getdate(x) _dos_getdate(x)
#else
#include <dirent.h>
#endif
#ifdef __TURBOC__
#include <dir.h>
#endif
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <errno.h>
#include <ctype.h>
/* OpenDoors *MUST* be included first */
#ifndef __BEEN_HERE__
//I never did an OS2 port .. although i started on it
#ifndef __OS2__
#include <OpenDoor.h> // Must be included in all doors
#else
#include <OpenDoor.h> // Must be included in all doors
#endif
#endif
#define __BEEN_HERE__
#if !defined(__unix__) && !defined(_WIN32)
#include <share.h>
#include <ciolib.h>
#include <io.h>
#else
#include <dirwrap.h>
#include <genwrap.h>