diff --git a/src/sbbs3/nopen.c b/src/sbbs3/nopen.c index 6977e68e89a37084e4acb486f78db68f8651a4bc..3d758ca5021bc5d30b9ca825b4f9e294d67c8a9a 100644 --- a/src/sbbs3/nopen.c +++ b/src/sbbs3/nopen.c @@ -43,7 +43,7 @@ /* number of times if the attempted file is already open or denying access */ /* for some other reason. All files are opened in BINARY mode. */ /****************************************************************************/ -int nopen(char *str, int access) +int nopen(const char* str, int access) { int file,share,count=0; @@ -64,7 +64,7 @@ int nopen(char *str, int access) /* This function performs an nopen, but returns a file stream with a buffer */ /* allocated. */ /****************************************************************************/ -FILE* fnopen(int *fd, char *str, int access) +FILE* fnopen(int* fd, const char* str, int access) { char mode[128]; int file; @@ -100,3 +100,15 @@ FILE* fnopen(int *fd, char *str, int access) setvbuf(stream,NULL,_IOFBF,FNOPEN_BUF_SIZE); return(stream); } + +BOOL ftouch(const char* fname) +{ + int file; + + file=nopen(fname,O_WRONLY|O_CREAT); + if(file<0) + return(FALSE); + close(file); + + return(TRUE); +} diff --git a/src/sbbs3/sbbs.h b/src/sbbs3/sbbs.h index b70a85375ab205813bd93365178cbc307ca7f95a..94aaf8ae70d15c5ba753b3c20808de2ec5c9af8f 100644 --- a/src/sbbs3/sbbs.h +++ b/src/sbbs3/sbbs.h @@ -937,8 +937,9 @@ int pstrcmp(char **str1, char **str2); /* Compares pointers to pointers */ int strsame(char *str1, char *str2); /* Compares number of same chars */ /* nopen.c */ -int nopen(char *str, int access); -FILE * fnopen(int *file, char *str, int access); +int nopen(const char* str, int access); +FILE * fnopen(int* file, const char* str, int access); +BOOL ftouch(const char* fname); /* load_cfg.c */ BOOL md(char *path);