diff --git a/src/sbbs3/execfunc.cpp b/src/sbbs3/execfunc.cpp index a80c265a20631dd2606e239c0518e895bb384c74..94b7e262c7ff81b14d987f2adbb3597ccc60c854 100644 --- a/src/sbbs3/execfunc.cpp +++ b/src/sbbs3/execfunc.cpp @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -274,7 +274,7 @@ int sbbs_t::exec_function(csi_t *csi) if(!noyes(text[DeleteErrorLogQ])) remove(str); } else - bputs(text[NoErrorLogExists]); + bprintf(text[FileDoesNotExist],str); for(i=1;i<=cfg.sys_nodes;i++) { getnodedat(i,&node,0); if(node.errors) diff --git a/src/sbbs3/listfile.cpp b/src/sbbs3/listfile.cpp index b40cbd45b178a9e3f208fbf8cc41914745ffd63e..2caf8758c8c7f1a67e3fba48ba82425691731cd6 100644 --- a/src/sbbs3/listfile.cpp +++ b/src/sbbs3/listfile.cpp @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -1067,7 +1067,7 @@ int sbbs_t::listfileinfo(uint dirnum, char *filespec, long mode) case 'F': /* delete file only */ sprintf(str,"%s%s",dirpath,fname); if(!fexistcase(str)) - bputs(text[FileNotThere]); + bprintf(text[FileDoesNotExist],str); else { if(!noyes(text[AreYouSureQ])) { if(remove(str)) diff --git a/src/sbbs3/text.h b/src/sbbs3/text.h index 6f355dc7687f63198fa0ca2c160182128cfa1fab..b55b884fd627ff4101955d1a000242c15bb732c6 100644 --- a/src/sbbs3/text.h +++ b/src/sbbs3/text.h @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -202,7 +202,7 @@ enum { ,Unused156 ,ErrorLogHdr ,DeleteErrorLogQ - ,NoErrorLogExists + ,DirectoryDoesNotExist ,ClearErrCounter ,InvalidNode ,SendingTelegramToUser @@ -286,7 +286,7 @@ enum { ,CloseFileRecordQ ,SysopRemoveFilePrompt ,UserRemoveFilePrompt - ,FileNotThere + ,FileDoesNotExist ,CouldntRemoveFile ,DeleteFileQ ,AddToOfflineDirQ diff --git a/src/sbbs3/tmp_xfer.cpp b/src/sbbs3/tmp_xfer.cpp index 4e8b21a072b7ae250e4c1bae6641cc4d3139b84c..a1996b193d0a614f7ee587ac38ade33989cdcf1a 100644 --- a/src/sbbs3/tmp_xfer.cpp +++ b/src/sbbs3/tmp_xfer.cpp @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2007 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -105,6 +105,12 @@ void sbbs_t::temp_xfer() logch(ch,0); switch(ch) { case 'A': /* add to temp file */ + if(!isdir(cfg.temp_dir)) { + bprintf(text[DirectoryDoesNotExist], cfg.temp_dir); + SAFEPRINTF(str,"Temp directory does not exist: %s", cfg.temp_dir); + errorlog(str); + break; + } /* free disk space */ space=getfreediskspace(cfg.temp_dir,1024); if(space<(ulong)cfg.min_dspace) { @@ -283,6 +289,13 @@ void sbbs_t::extract(uint dirnum) if(!strcmp(cfg.dir[dirnum]->code,"TEMP")) intmp=1; + if(!isdir(cfg.temp_dir)) { + bprintf(text[DirectoryDoesNotExist], cfg.temp_dir); + SAFEPRINTF(str,"Temp directory does not exist: %s", cfg.temp_dir); + errorlog(str); + return; + } + /* get free disk space */ space=getfreediskspace(cfg.temp_dir,1024); if(space<(ulong)cfg.min_dspace) { @@ -367,8 +380,9 @@ void sbbs_t::extract(uint dirnum) SAFECOPY(temp_uler,f.uler); SAFECOPY(temp_file,f.name); } /* padded filename */ if(!fexistcase(path)) { - bputs(text[FileNotThere]); /* not on disk */ - return; } + bprintf(text[FileDoesNotExist],path); /* not on disk */ + return; + } done=0; while(online && !done) { mnemonics(text[ExtractFilesPrompt]); diff --git a/src/sbbs3/upload.cpp b/src/sbbs3/upload.cpp index 4ff7f6b48c8887b263c0aa57dd49806d189e63fe..b3fae9781ba698df814cc0eb32b7d5b1ca81b636 100644 --- a/src/sbbs3/upload.cpp +++ b/src/sbbs3/upload.cpp @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -283,6 +283,12 @@ bool sbbs_t::upload(uint dirnum) else strcpy(path,cfg.dir[dirnum]->path); + if(!isdir(path)) { + bprintf(text[DirectoryDoesNotExist], path); + SAFEPRINTF(str,"File directory does not exist: %s", path); + errorlog(str); + return(false); + } /* get free disk space */ space=getfreediskspace(path,1024); diff --git a/src/sbbs3/viewfile.cpp b/src/sbbs3/viewfile.cpp index 084030c6bc33fcd936d15891ac241b26fb31e73e..052321b3d3d481d61ed7892b7667e7feacfe9d87 100644 --- a/src/sbbs3/viewfile.cpp +++ b/src/sbbs3/viewfile.cpp @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2000 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License * @@ -110,28 +110,31 @@ void sbbs_t::viewfiles(uint dirnum, char *fspec) /****************************************************************************/ void sbbs_t::viewfilecontents(file_t* f) { - char str[128],cmd[128]; - char tmp[512]; + char cmd[128]; + char path[MAX_PATH+1]; + char* ext; int i; - if(f->size<=0L) { - bputs(text[FileNotThere]); - return; } + getfilepath(&cfg, f, path); - sprintf(str,"%s%s",f->altpath > 0 && f->altpath<=cfg.altpaths - ? cfg.altpath[f->altpath-1] : cfg.dir[f->dir]->path - ,unpadfname(f->name,tmp)); - strcpy(tmp,f->name); - truncsp(tmp); - for(i=0;i<cfg.total_fviews;i++) { - if(!stricmp(tmp+9,cfg.fview[i]->ext) - && chk_ar(cfg.fview[i]->ar,&useron)) { - strcpy(cmd,cfg.fview[i]->cmd); - break; } } - if(i==cfg.total_fviews) - bprintf(text[NonviewableFile],tmp+9); + if(f->size<=0L) { + bprintf(text[FileDoesNotExist],path); + return; + } + if((ext=getfext(path))!=NULL) { + ext++; + for(i=0;i<cfg.total_fviews;i++) { + if(!stricmp(ext,cfg.fview[i]->ext) + && chk_ar(cfg.fview[i]->ar,&useron)) { + strcpy(cmd,cfg.fview[i]->cmd); + break; + } + } + } + if(ext==NULL || i==cfg.total_fviews) + bprintf(text[NonviewableFile],ext); else - if((i=external(cmdstr(cmd,str,str,NULL) + if((i=external(cmdstr(cmd,path,path,NULL) ,EX_OUTL|EX_OUTR|EX_INR))!=0) - errormsg(WHERE,ERR_EXEC,cmdstr(cmd,str,str,NULL),i); + errormsg(WHERE,ERR_EXEC,cmdstr(cmd,path,path,NULL),i); }