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 e9a2e9ff authored by rswindell's avatar rswindell

Changed sbbs_t::fnopen to straight c and moved it from main.cpp to misc.c.

parent 27283cd4
......@@ -58,6 +58,46 @@ int nopen(char *str, int access)
mswait(55);
return(file);
}
/****************************************************************************/
/* This function performs an nopen, but returns a file stream with a buffer */
/* allocated. */
/****************************************************************************/
FILE * fnopen(int *fd, char *str, int access)
{
char mode[128];
int file;
FILE * stream;
if((file=nopen(str,access))==-1)
return(NULL);
if(fd!=NULL)
*fd=file;
if(access&O_APPEND) {
if(access&O_RDONLY)
strcpy(mode,"a+");
else
strcpy(mode,"a");
} else if(access&O_CREAT) {
if(access&O_TRUNC)
strcpy(mode,"w");
else
strcpy(mode,"w+");
} else {
if(access&O_WRONLY || (access&O_RDWR)==O_RDWR)
strcpy(mode,"r+");
else
strcpy(mode,"r");
}
stream=fdopen(file,mode);
if(stream==NULL) {
close(file);
return(NULL);
}
setvbuf(stream,NULL,_IOFBF,FNOPEN_BUF_SIZE);
return(stream);
}
/****************************************************************************/
/* Returns the number of characters in 'str' not counting ctrl-ax codes */
......
......@@ -492,7 +492,6 @@ public:
/* misc.cpp */
int nopen(char *str, int access);
FILE * fnopen(int *file, char *str,int access);
void errormsg(int line, char *file, char action, char *object
,ulong access, char *extinfo=NULL);
int mv(char *src, char *dest, char copy); /* fast file move/copy function */
......@@ -726,6 +725,7 @@ extern "C" {
/* misc.c */
int nopen(char *str, int access);
FILE * fnopen(int *file, char *str, int access);
int bstrlen(char *str);
void strip_ctrl(char *str);
void strip_exascii(char *str);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment