Skip to content
Snippets Groups Projects
Commit 2e6d0a27 authored by rswindell's avatar rswindell
Browse files

Bug-fix: don't force timezone to UTC if the "use local timezone" option is

enabled in SCFG->System (the default is enabled).
Added copyright comment header block.
Fixed msvc6 warnings.
parent c006c9c8
No related branches found
No related tags found
No related merge requests found
#line 1 "delfiles.c" /* delfiles.c */
/* Developed 1990-1997 by Rob Swindell; PO Box 501, Yorba Linda, CA 92885 */ /* Program to delete expired files from a Synchronet file database */
/* $Id$ */
/****************************************************************************
* @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 *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* See the GNU General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
#include "sbbs.h" #include "sbbs.h"
...@@ -57,7 +90,7 @@ int main(int argc, char **argv) ...@@ -57,7 +90,7 @@ int main(int argc, char **argv)
{ {
char str[256],fname[MAX_PATH+1],not[MAX_NOTS][9],nots=0,*p; char str[256],fname[MAX_PATH+1],not[MAX_NOTS][9],nots=0,*p;
int i,j,dirnum,libnum,file; int i,j,dirnum,libnum,file;
ulong l,m,n,length; ulong l,m;
long misc=0; long misc=0;
time_t now; time_t now;
file_t workfile; file_t workfile;
...@@ -65,7 +98,6 @@ int main(int argc, char **argv) ...@@ -65,7 +98,6 @@ int main(int argc, char **argv)
glob_t gl; glob_t gl;
uchar *ixbbuf; uchar *ixbbuf;
putenv("TZ=UCT0");
setvbuf(stdout,NULL,_IONBF,0); setvbuf(stdout,NULL,_IONBF,0);
fprintf(stderr,"\nDELFILES Version %s (%s) - Removes files from Synchronet " fprintf(stderr,"\nDELFILES Version %s (%s) - Removes files from Synchronet "
...@@ -73,13 +105,13 @@ fprintf(stderr,"\nDELFILES Version %s (%s) - Removes files from Synchronet " ...@@ -73,13 +105,13 @@ fprintf(stderr,"\nDELFILES Version %s (%s) - Removes files from Synchronet "
if(argc<2) { if(argc<2) {
printf("\n usage: DELFILES <dir_code or * for ALL> [switches]\n"); printf("\n usage: DELFILES <dir_code or * for ALL> [switches]\n");
printf("\nswitches: /LIB name All directories of specified library\n"); printf("\nswitches: -LIB name All directories of specified library\n");
printf(" /NOT code Exclude specific directory\n"); printf(" -NOT code Exclude specific directory\n");
printf(" /OFF Remove files that are offline " printf(" -OFF Remove files that are offline "
"(don't exist on disk)\n"); "(don't exist on disk)\n");
printf(" /NOL Remove files with no link " printf(" -NOL Remove files with no link "
"(don't exist in database)\n"); "(don't exist in database)\n");
printf(" /RPT Report findings only " printf(" -RPT Report findings only "
"(don't delete any files)\n"); "(don't delete any files)\n");
return(0); } return(0); }
...@@ -93,8 +125,6 @@ if(p==NULL) { ...@@ -93,8 +125,6 @@ if(p==NULL) {
#endif #endif
return(1); } return(1); }
putenv("TZ=UCT0");
memset(&cfg, 0, sizeof(cfg)); memset(&cfg, 0, sizeof(cfg));
cfg.size=sizeof(cfg); cfg.size=sizeof(cfg);
SAFECOPY(cfg.ctrl_dir, p); SAFECOPY(cfg.ctrl_dir, p);
...@@ -103,6 +133,9 @@ backslash(cfg.ctrl_dir); ...@@ -103,6 +133,9 @@ backslash(cfg.ctrl_dir);
load_cfg(&cfg, NULL, TRUE, str); load_cfg(&cfg, NULL, TRUE, str);
chdir(cfg.ctrl_dir); chdir(cfg.ctrl_dir);
if(!(cfg.sys_misc&SM_LOCAL_TZ))
putenv("TZ=UTC0");
dirnum=libnum=-1; dirnum=libnum=-1;
if(argv[1][0]=='*') if(argv[1][0]=='*')
misc|=ALL; misc|=ALL;
...@@ -171,7 +204,7 @@ for(i=0;i<cfg.total_dirs;i++) { ...@@ -171,7 +204,7 @@ for(i=0;i<cfg.total_dirs;i++) {
sprintf(str,"%s*.*",tmp); sprintf(str,"%s*.*",tmp);
printf("\nSearching %s for unlinked files\n",str); printf("\nSearching %s for unlinked files\n",str);
if(!glob(str, GLOB_MARK, NULL, &gl)) { if(!glob(str, GLOB_MARK, NULL, &gl)) {
for(j=0; j<gl.gl_pathc; j++) { for(j=0; j<(int)gl.gl_pathc; j++) {
/* emulate _A_NORMAL */ /* emulate _A_NORMAL */
if(isdir(gl.gl_pathv[j])) if(isdir(gl.gl_pathv[j]))
continue; continue;
...@@ -203,7 +236,7 @@ for(i=0;i<cfg.total_dirs;i++) { ...@@ -203,7 +236,7 @@ for(i=0;i<cfg.total_dirs;i++) {
close(file); close(file);
printf("\7ERR_ALLOC %s %lu\n",str,l); printf("\7ERR_ALLOC %s %lu\n",str,l);
continue; } continue; }
if(read(file,ixbbuf,l)!=l) { if(read(file,ixbbuf,l)!=(int)l) {
close(file); close(file);
printf("\7ERR_READ %s %lu\n",str,l); printf("\7ERR_READ %s %lu\n",str,l);
free((char *)ixbbuf); free((char *)ixbbuf);
...@@ -260,4 +293,6 @@ for(i=0;i<cfg.total_dirs;i++) { ...@@ -260,4 +293,6 @@ for(i=0;i<cfg.total_dirs;i++) {
removefiledat(&cfg, &workfile); } } removefiledat(&cfg, &workfile); } }
free((char *)ixbbuf); } free((char *)ixbbuf); }
return(0);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment