--- sbbs/src/sbbs3/addfiles.c 2018/04/24 16:41:23 1.1 +++ sbbs/src/sbbs3/addfiles.c 2018/04/24 16:42:54 1.1.1.2 @@ -2,13 +2,13 @@ /* Program to add files to a Synchronet file database */ -/* $Id: addfiles.c,v 1.1 2018/04/24 16:41:23 root Exp $ */ +/* $Id: addfiles.c,v 1.1.1.2 2018/04/24 16:42:54 root Exp $ */ /**************************************************************************** * @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 2009 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 * @@ -66,7 +66,7 @@ char lib[LEN_GSNAME+1]; /****************************************************************************/ /* This is needed by load_cfg.c */ /****************************************************************************/ -int lprintf(int level, char *fmat, ...) +int lprintf(int level, const char *fmat, ...) { va_list argptr; char sbuf[512]; @@ -184,7 +184,7 @@ void updatestats(ulong size) { char str[MAX_PATH+1]; int file; - ulong l; + uint32_t l; sprintf(str,"%sdsts.dab",scfg.ctrl_dir); if((file=nopen(str,O_RDWR|O_BINARY))==-1) { @@ -266,15 +266,15 @@ void addlist(char *inpath, file_t f, uin if(mode&FILE_ID) { for(i=0;iext,f.name+9) && chk_ar(&scfg,scfg.fextr[i]->ar,NULL)) + if(!stricmp(scfg.fextr[i]->ext,f.name+9) && chk_ar(&scfg,scfg.fextr[i]->ar,/* user: */NULL, /* client: */NULL)) break; if(icmd,filepath,"FILE_ID.DIZ",NULL)); if(!fexistcase(tmp)) { sprintf(tmp,"%sDESC.SDI",scfg.temp_dir); - remove(tmp); + removecase(tmp); system(mycmdstr(scfg.fextr[i]->cmd,filepath,"DESC.SDI",NULL)); fexistcase(tmp); } @@ -286,7 +286,7 @@ void addlist(char *inpath, file_t f, uin break; ext[i]=0; if(mode&ASCII_ONLY) - strip_exascii(ext); + strip_exascii(ext, ext); if(!(mode&KEEP_DESC)) { sprintf(tmpext,"%.256s",ext); prep_desc(tmpext); @@ -307,7 +307,7 @@ void addlist(char *inpath, file_t f, uin f.altpath=cur_altpath; prep_desc(f.desc); if(mode&ASCII_ONLY) - strip_exascii(f.desc); + strip_exascii(f.desc, f.desc); if(exist) { putfiledat(&scfg,&f); if(!(mode&NO_NEWDATE)) @@ -469,15 +469,15 @@ void addlist(char *inpath, file_t f, uin if(mode&FILE_ID) { for(i=0;iext,f.name+9) && chk_ar(&scfg,scfg.fextr[i]->ar,NULL)) + if(!stricmp(scfg.fextr[i]->ext,f.name+9) && chk_ar(&scfg,scfg.fextr[i]->ar,/* user: */NULL, /* client: */NULL)) break; if(icmd,filepath,"FILE_ID.DIZ",NULL)); if(!fexistcase(tmp)) { sprintf(tmp,"%sDESC.SDI",scfg.temp_dir); - remove(tmp); + removecase(tmp); system(mycmdstr(scfg.fextr[i]->cmd,filepath,"DESC.SDI",NULL)); fexistcase(tmp); } @@ -489,7 +489,7 @@ void addlist(char *inpath, file_t f, uin break; ext[i]=0; if(mode&ASCII_ONLY) - strip_exascii(ext); + strip_exascii(ext, ext); if(!(mode&KEEP_DESC)) { sprintf(tmpext,"%.256s",ext); prep_desc(tmpext); @@ -512,7 +512,7 @@ void addlist(char *inpath, file_t f, uin f.altpath=cur_altpath; prep_desc(f.desc); if(mode&ASCII_ONLY) - strip_exascii(f.desc); + strip_exascii(f.desc, f.desc); if(exist) { putfiledat(&scfg,&f); if(!(mode&NO_NEWDATE)) @@ -636,22 +636,22 @@ char *usage="\nusage: addfiles code [.al "\n or: addfiles code [.alt_path] [-opts] file " "\"description\"\n" "\navailable opts:" - "\n a import ASCII only (no extended ASCII)" - "\n b synchronize database with file list (use with caution)" - "\n c do not remove extra spaces from file description" - "\n d delete list after import" - "\n e do not import extended descriptions" - "\n f include file date in descriptions" - "\n t include today's date in descriptions" - "\n i include added files in upload statistics" - "\n n do not update information for existing files" - "\n o update upload date only for existing files" - "\n u do not update upload date for existing files" - "\n z check for and import FILE_ID.DIZ and DESC.SDI" - "\n k keep original short description (not DIZ)" - "\n s search directory for files (no file list)" - "\n l specify library (short name) to Auto-ADD" - "\n x specify uploader's user name (may require quotes)" + "\n -a import ASCII only (no extended ASCII)" + "\n -b synchronize database with file list (use with caution)" + "\n -c do not remove extra spaces from file description" + "\n -d delete list after import" + "\n -e do not import extended descriptions" + "\n -f include file date in descriptions" + "\n -t include today's date in descriptions" + "\n -i include added files in upload statistics" + "\n -n do not update information for existing files" + "\n -o update upload date only for existing files" + "\n -u do not update upload date for existing files" + "\n -z check for and import FILE_ID.DIZ and DESC.SDI" + "\n -k keep original short description (not DIZ)" + "\n -s search directory for files (no file list)" + "\n -l specify library (short name) to Auto-ADD" + "\n -x specify uploader's user name (may require quotes)" "\n" "\nAuto-ADD: use - in place of code for Auto-ADD of FILES.BBS" "\n use -filename to Auto-ADD a different filename" @@ -675,7 +675,7 @@ int main(int argc, char **argv) long l; file_t f; - sscanf("$Revision: 1.1 $", "%*s %s", revision); + sscanf("$Revision: 1.1.1.2 $", "%*s %s", revision); fprintf(stderr,"\nADDFILES v%s-%s (rev %s) - Adds Files to Synchronet " "Filebase\n" @@ -711,9 +711,6 @@ int main(int argc, char **argv) SAFECOPY(scfg.temp_dir,"../temp"); prep_dir(scfg.ctrl_dir, scfg.temp_dir, sizeof(scfg.temp_dir)); - if(!(scfg.sys_misc&SM_LOCAL_TZ)) - putenv("TZ=UTC0"); - if(argv[1][0]=='*' || argv[1][0]=='-') { if(argv[1][1]=='?') { printf(usage); @@ -890,19 +887,19 @@ int main(int argc, char **argv) f.altpath=cur_altpath; prep_desc(f.desc); if(mode&ASCII_ONLY) - strip_exascii(f.desc); + strip_exascii(f.desc, f.desc); printf("%s %7lu %s\n",f.name,f.cdt,f.desc); if(mode&FILE_ID) { for(i=0;iext,f.name+9) && chk_ar(&scfg,scfg.fextr[i]->ar,NULL)) + if(!stricmp(scfg.fextr[i]->ext,f.name+9) && chk_ar(&scfg,scfg.fextr[i]->ar,/* user: */NULL, /* client: */NULL)) break; if(icmd,str,"FILE_ID.DIZ",NULL)); if(!fexistcase(tmp)) { sprintf(tmp,"%sDESC.SDI",scfg.temp_dir); - remove(tmp); + removecase(tmp); system(mycmdstr(scfg.fextr[i]->cmd,str,"DESC.SDI",NULL)); fexistcase(tmp); }