From 9af69f9d45849ecdd455ff5e173849bc4a279da7 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Sat, 27 Jul 2002 00:47:37 +0000
Subject: [PATCH] Moved update_uldate() from upload.cpp to filedat.c (dll
 exported now).

---
 src/sbbs3/filedat.c  | 47 ++++++++++++++++++++++++++++++++++++++++++
 src/sbbs3/sbbs.h     |  2 +-
 src/sbbs3/upload.cpp | 49 --------------------------------------------
 3 files changed, 48 insertions(+), 50 deletions(-)

diff --git a/src/sbbs3/filedat.c b/src/sbbs3/filedat.c
index 70fc690e67..2525f3512b 100644
--- a/src/sbbs3/filedat.c
+++ b/src/sbbs3/filedat.c
@@ -655,3 +655,50 @@ void DLLCALL putextdesc(scfg_t* cfg, uint dirnum, ulong datoffset, char *ext)
 	write(file,ext,F_EXBSIZE);
 	close(file);
 }
+
+/****************************************************************************/
+/* Update the upload date for the file 'f'                                  */
+/****************************************************************************/
+int DLLCALL update_uldate(scfg_t* cfg, file_t* f)
+{
+	char str[256],fname[13];
+	int i,file;
+	long l,length;
+
+	/*******************/
+	/* Update IXB File */
+	/*******************/
+	sprintf(str,"%s%s.ixb",cfg->dir[f->dir]->data_dir,cfg->dir[f->dir]->code);
+	if((file=nopen(str,O_RDWR))==-1)
+		return(errno); 
+	length=filelength(file);
+	if(length%F_IXBSIZE) {
+		close(file);
+		return(-1); 
+	}
+	strcpy(fname,f->name);
+	for(i=8;i<12;i++)   /* Turn FILENAME.EXT into FILENAMEEXT */
+		fname[i]=fname[i+1];
+	for(l=0;l<length;l+=F_IXBSIZE) {
+		read(file,str,F_IXBSIZE);      /* Look for the filename in the IXB file */
+		str[11]=0;
+		if(!strcmp(fname,str)) break; }
+	if(l>=length) {
+		close(file);
+		return(-2); 
+	}
+	lseek(file,l+14,SEEK_SET);
+	write(file,&f->dateuled,4);
+	close(file);
+
+	/*******************************************/
+	/* Update last upload date/time stamp file */
+	/*******************************************/
+	sprintf(str,"%s%s.dab",cfg->dir[f->dir]->data_dir,cfg->dir[f->dir]->code);
+	if((file=nopen(str,O_WRONLY|O_CREAT))==-1)
+		return(errno);
+
+	write(file,&f->dateuled,4);
+	close(file); 
+	return(0);
+}
diff --git a/src/sbbs3/sbbs.h b/src/sbbs3/sbbs.h
index 345c8e3d8f..23e5fffbab 100644
--- a/src/sbbs3/sbbs.h
+++ b/src/sbbs3/sbbs.h
@@ -567,7 +567,6 @@ public:
 	char	sbbsfilename[128],sbbsfiledesc[128]; /* env vars */
 	bool	upload(uint dirnum);
     char	upload_lastdesc[LEN_FDESC+1];
-	void	update_uldate(file_t* f);
 	bool	bulkupload(uint dirnum);
 
 	/* download.cpp */
@@ -771,6 +770,7 @@ extern "C" {
 
 	DLLEXPORT ulong		DLLCALL	getposts(scfg_t* cfg, uint subnum);
 	DLLEXPORT long		DLLCALL getfiles(scfg_t* cfg, uint dirnum);
+	DLLEXPORT int		DLLCALL update_uldate(scfg_t* cfg, file_t* f);
 
 	/* str_util.c */
 	DLLEXPORT void		DLLCALL truncsp(char *str);		/* Truncates white spaces off end of str */
diff --git a/src/sbbs3/upload.cpp b/src/sbbs3/upload.cpp
index 081aa2f0f2..60793ab078 100644
--- a/src/sbbs3/upload.cpp
+++ b/src/sbbs3/upload.cpp
@@ -216,55 +216,6 @@ bool sbbs_t::uploadfile(file_t *f)
 	return(true);
 }
 
-
-/****************************************************************************/
-/* Update the upload date for the file 'f'                                  */
-/****************************************************************************/
-void sbbs_t::update_uldate(file_t* f)
-{
-	char str[256],fname[13];
-	int i,file;
-	long l,length;
-
-	/*******************/
-	/* Update IXB File */
-	/*******************/
-	sprintf(str,"%s%s.ixb",cfg.dir[f->dir]->data_dir,cfg.dir[f->dir]->code);
-	if((file=nopen(str,O_RDWR))==-1) {
-		errormsg(WHERE,ERR_OPEN,str,O_RDWR);
-		return; }
-	length=filelength(file);
-	if(length%F_IXBSIZE) {
-		close(file);
-		errormsg(WHERE,ERR_LEN,str,length);
-		return; }
-	strcpy(fname,f->name);
-	for(i=8;i<12;i++)   /* Turn FILENAME.EXT into FILENAMEEXT */
-		fname[i]=fname[i+1];
-	for(l=0;l<length;l+=F_IXBSIZE) {
-		read(file,str,F_IXBSIZE);      /* Look for the filename in the IXB file */
-		str[11]=0;
-		if(!strcmp(fname,str)) break; }
-	if(l>=length) {
-		close(file);
-		errormsg(WHERE,ERR_CHK,f->name,length);
-		return; }
-	lseek(file,l+14,SEEK_SET);
-	write(file,&f->dateuled,4);
-	close(file);
-
-	/*******************************************/
-	/* Update last upload date/time stamp file */
-	/*******************************************/
-	sprintf(str,"%s%s.dab",cfg.dir[f->dir]->data_dir,cfg.dir[f->dir]->code);
-	if((file=nopen(str,O_WRONLY|O_CREAT))==-1)
-		errormsg(WHERE,ERR_OPEN,str,O_WRONLY|O_CREAT);
-	else {
-		write(file,&f->dateuled,4);
-		close(file); 
-	}
-}
-
 /****************************************************************************/
 /* Uploads files                                                            */
 /****************************************************************************/
-- 
GitLab