|
|
1.1 ! root 1: /* scfgsave.c */ ! 2: ! 3: /* Synchronet configuration file save routines */ ! 4: ! 5: /* $Id: scfgsave.c,v 1.48 2006/08/23 22:34:32 rswindell Exp $ */ ! 6: ! 7: /**************************************************************************** ! 8: * @format.tab-size 4 (Plain Text/Source Code File Header) * ! 9: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * ! 10: * * ! 11: * Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html * ! 12: * * ! 13: * This program is free software; you can redistribute it and/or * ! 14: * modify it under the terms of the GNU General Public License * ! 15: * as published by the Free Software Foundation; either version 2 * ! 16: * of the License, or (at your option) any later version. * ! 17: * See the GNU General Public License for more details: gpl.txt or * ! 18: * http://www.fsf.org/copyleft/gpl.html * ! 19: * * ! 20: * Anonymous FTP access to the most recent released source is available at * ! 21: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net * ! 22: * * ! 23: * Anonymous CVS access to the development source and modification history * ! 24: * is available at cvs.synchro.net:/cvsroot/sbbs, example: * ! 25: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login * ! 26: * (just hit return, no password is necessary) * ! 27: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src * ! 28: * * ! 29: * For Synchronet coding style and modification guidelines, see * ! 30: * http://www.synchro.net/source.html * ! 31: * * ! 32: * You are encouraged to submit any modifications (preferably in Unix diff * ! 33: * format) via e-mail to [email protected] * ! 34: * * ! 35: * Note: If this box doesn't appear square, then you need to fix your tabs. * ! 36: ****************************************************************************/ ! 37: ! 38: #include "sbbs.h" ! 39: ! 40: BOOL no_msghdr=FALSE,all_msghdr=FALSE; ! 41: ! 42: static char nulbuf[256]={0}; ! 43: static int pslen; ! 44: #define put_int(var,stream) fwrite(&var,1,sizeof(var),stream) ! 45: #define put_str(var,stream) { pslen=strlen(var); \ ! 46: fwrite(var,1,pslen > sizeof(var) \ ! 47: ? sizeof(var) : pslen ,stream); \ ! 48: fwrite(nulbuf,1,pslen > sizeof(var) \ ! 49: ? 0 : sizeof(var)-pslen,stream); } ! 50: ! 51: /****************************************************************************/ ! 52: /****************************************************************************/ ! 53: BOOL DLLCALL save_cfg(scfg_t* cfg, int backup_level) ! 54: { ! 55: int i; ! 56: ! 57: if(cfg->prepped) ! 58: return(FALSE); ! 59: ! 60: for(i=0;i<cfg->sys_nodes;i++) { ! 61: if(cfg->node_path[i][0]==0) ! 62: sprintf(cfg->node_path[i],"../node%d",i+1); ! 63: cfg->node_num=i+1; ! 64: if(!write_node_cfg(cfg,backup_level)) ! 65: return(FALSE); ! 66: } ! 67: if(!write_main_cfg(cfg,backup_level)) ! 68: return(FALSE); ! 69: if(!write_msgs_cfg(cfg,backup_level)) ! 70: return(FALSE); ! 71: if(!write_file_cfg(cfg,backup_level)) ! 72: return(FALSE); ! 73: if(!write_chat_cfg(cfg,backup_level)) ! 74: return(FALSE); ! 75: if(!write_xtrn_cfg(cfg,backup_level)) ! 76: return(FALSE); ! 77: ! 78: return(TRUE); ! 79: } ! 80: ! 81: BOOL DLLCALL fcopy(char* src, char* dest) ! 82: { ! 83: int ch; ! 84: ulong count=0; ! 85: FILE* in; ! 86: FILE* out; ! 87: BOOL success=TRUE; ! 88: ! 89: if((in=fopen(src,"rb"))==NULL) ! 90: return(FALSE); ! 91: if((out=fopen(dest,"wb"))==NULL) { ! 92: fclose(in); ! 93: return(FALSE); ! 94: } ! 95: ! 96: while(!feof(in)) { ! 97: if((ch=fgetc(in))==EOF) ! 98: break; ! 99: if(fputc(ch,out)==EOF) { ! 100: success=FALSE; ! 101: break; ! 102: } ! 103: if(((count++)%(32*1024))==0) ! 104: YIELD(); ! 105: } ! 106: ! 107: fclose(in); ! 108: fclose(out); ! 109: ! 110: return(success); ! 111: } ! 112: ! 113: BOOL DLLCALL fcompare(char* fn1, char* fn2) ! 114: { ! 115: FILE* fp1; ! 116: FILE* fp2; ! 117: BOOL success=TRUE; ! 118: ! 119: if(flength(fn1) != flength(fn2)) ! 120: return(FALSE); ! 121: if((fp1=fopen(fn1,"rb"))==NULL) ! 122: return(FALSE); ! 123: if((fp2=fopen(fn2,"rb"))==NULL) { ! 124: fclose(fp1); ! 125: return(FALSE); ! 126: } ! 127: ! 128: while(!feof(fp1) && success) { ! 129: if(fgetc(fp1) != fgetc(fp2)) ! 130: success=FALSE; ! 131: } ! 132: ! 133: fclose(fp1); ! 134: fclose(fp2); ! 135: ! 136: return(success); ! 137: } ! 138: ! 139: ! 140: /****************************************************************************/ ! 141: /****************************************************************************/ ! 142: BOOL DLLCALL backup(char *fname, int backup_level, BOOL ren) ! 143: { ! 144: char oldname[MAX_PATH+1]; ! 145: char newname[MAX_PATH+1]; ! 146: char* ext; ! 147: int i; ! 148: int len; ! 149: ! 150: if((ext=strrchr(fname,'.'))==NULL) ! 151: ext=""; ! 152: ! 153: len=strlen(fname)-strlen(ext); ! 154: ! 155: for(i=backup_level;i;i--) { ! 156: safe_snprintf(newname,sizeof(newname),"%.*s.%d%s",len,fname,i-1,ext); ! 157: if(i==backup_level) ! 158: if(fexist(newname) && remove(newname)!=0) ! 159: return(FALSE); ! 160: if(i==1) { ! 161: if(ren == TRUE) { ! 162: if(rename(fname,newname)!=0) ! 163: return(FALSE); ! 164: } else ! 165: if(!fcopy(fname,newname)) ! 166: return(FALSE); ! 167: continue; ! 168: } ! 169: safe_snprintf(oldname,sizeof(oldname),"%.*s.%d%s",len,fname,i-2,ext); ! 170: if(fexist(oldname) && rename(oldname,newname)!=0) ! 171: return(FALSE); ! 172: } ! 173: ! 174: return(TRUE); ! 175: } ! 176: ! 177: /****************************************************************************/ ! 178: /****************************************************************************/ ! 179: BOOL DLLCALL write_node_cfg(scfg_t* cfg, int backup_level) ! 180: { ! 181: char str[MAX_PATH+1]; ! 182: int i,file; ! 183: ushort n; ! 184: FILE *stream; ! 185: ! 186: if(cfg->prepped) ! 187: return(FALSE); ! 188: ! 189: if(cfg->node_num<1 || cfg->node_num>MAX_NODES) ! 190: return(FALSE); ! 191: ! 192: SAFECOPY(str,cfg->node_path[cfg->node_num-1]); ! 193: prep_dir(cfg->ctrl_dir,str,sizeof(str)); ! 194: md(str); ! 195: strcat(str,"node.cnf"); ! 196: backup(str, backup_level, TRUE); ! 197: ! 198: if((file=nopen(str,O_WRONLY|O_CREAT|O_TRUNC))==-1 ! 199: || (stream=fdopen(file,"wb"))==NULL) { ! 200: return(FALSE); ! 201: } ! 202: setvbuf(stream,NULL,_IOFBF,2048); ! 203: ! 204: put_int(cfg->node_num,stream); ! 205: put_str(cfg->node_name,stream); ! 206: put_str(cfg->node_phone,stream); ! 207: put_str(cfg->node_comspec,stream); /* Was node_logon */ ! 208: put_int(cfg->node_misc,stream); ! 209: put_int(cfg->node_ivt,stream); ! 210: put_int(cfg->node_swap,stream); ! 211: #if 0 ! 212: if(cfg->node_swapdir[0]) { ! 213: backslash(cfg->node_swapdir); ! 214: md(cfg->node_swapdir); /* make sure it's a valid directory */ ! 215: } ! 216: #endif ! 217: put_str(cfg->node_swapdir,stream); ! 218: put_int(cfg->node_valuser,stream); ! 219: put_int(cfg->node_minbps,stream); ! 220: put_str(cfg->node_arstr,stream); ! 221: put_int(cfg->node_dollars_per_call,stream); ! 222: put_str(cfg->node_editor,stream); ! 223: put_str(cfg->node_viewer,stream); ! 224: put_str(cfg->node_daily,stream); ! 225: put_int(cfg->node_scrnlen,stream); ! 226: put_int(cfg->node_scrnblank,stream); ! 227: backslash(cfg->ctrl_dir); ! 228: put_str(cfg->ctrl_dir,stream); ! 229: backslash(cfg->text_dir); ! 230: put_str(cfg->text_dir,stream); ! 231: backslash(cfg->temp_dir); ! 232: put_str(cfg->temp_dir,stream); ! 233: for(i=0;i<10;i++) ! 234: put_str(cfg->wfc_cmd[i],stream); ! 235: for(i=0;i<12;i++) ! 236: put_str(cfg->wfc_scmd[i],stream); ! 237: put_str(cfg->mdm_hang,stream); ! 238: put_int(cfg->node_sem_check,stream); ! 239: put_int(cfg->node_stat_check,stream); ! 240: put_str(cfg->scfg_cmd,stream); ! 241: put_int(cfg->sec_warn,stream); ! 242: put_int(cfg->sec_hangup,stream); ! 243: n=0; ! 244: for(i=0;i<188;i++) /* unused init to NULL */ ! 245: fwrite(&n,1,2,stream); ! 246: n=0xffff; /* unused init to 0xff */ ! 247: for(i=0;i<256;i++) ! 248: fwrite(&n,1,2,stream); ! 249: put_int(cfg->com_port,stream); ! 250: put_int(cfg->com_irq,stream); ! 251: put_int(cfg->com_base,stream); ! 252: put_int(cfg->com_rate,stream); ! 253: put_int(cfg->mdm_misc,stream); ! 254: put_str(cfg->mdm_init,stream); ! 255: put_str(cfg->mdm_spec,stream); ! 256: put_str(cfg->mdm_term,stream); ! 257: put_str(cfg->mdm_dial,stream); ! 258: put_str(cfg->mdm_offh,stream); ! 259: put_str(cfg->mdm_answ,stream); ! 260: put_int(cfg->mdm_reinit,stream); ! 261: put_int(cfg->mdm_ansdelay,stream); ! 262: put_int(cfg->mdm_rings,stream); ! 263: put_int(cfg->mdm_results,stream); ! 264: for(i=0;i<cfg->mdm_results;i++) { ! 265: put_int(cfg->mdm_result[i].code,stream); ! 266: put_int(cfg->mdm_result[i].rate,stream); ! 267: put_int(cfg->mdm_result[i].cps,stream); ! 268: put_str(cfg->mdm_result[i].str,stream); ! 269: } ! 270: fclose(stream); ! 271: ! 272: return(TRUE); ! 273: } ! 274: ! 275: /****************************************************************************/ ! 276: /****************************************************************************/ ! 277: BOOL DLLCALL write_main_cfg(scfg_t* cfg, int backup_level) ! 278: { ! 279: char str[MAX_PATH+1],c=0; ! 280: int file; ! 281: ushort i,j,n; ! 282: FILE *stream; ! 283: ! 284: if(cfg->prepped) ! 285: return(FALSE); ! 286: ! 287: SAFEPRINTF(str,"%smain.cnf",cfg->ctrl_dir); ! 288: backup(str, backup_level, TRUE); ! 289: ! 290: if((file=nopen(str,O_WRONLY|O_CREAT|O_TRUNC))==-1 ! 291: || (stream=fdopen(file,"wb"))==NULL) { ! 292: return(FALSE); ! 293: } ! 294: setvbuf(stream,NULL,_IOFBF,2048); ! 295: ! 296: put_str(cfg->sys_name,stream); ! 297: put_str(cfg->sys_id,stream); ! 298: put_str(cfg->sys_location,stream); ! 299: put_str(cfg->sys_phonefmt,stream); ! 300: put_str(cfg->sys_op,stream); ! 301: put_str(cfg->sys_guru,stream); ! 302: put_str(cfg->sys_pass,stream); ! 303: put_int(cfg->sys_nodes,stream); ! 304: for(i=0;i<cfg->sys_nodes;i++) ! 305: put_str(cfg->node_path[i],stream); ! 306: backslash(cfg->data_dir); ! 307: put_str(cfg->data_dir,stream); ! 308: ! 309: backslash(cfg->exec_dir); ! 310: put_str(cfg->exec_dir,stream); ! 311: put_str(cfg->sys_logon,stream); ! 312: put_str(cfg->sys_logout,stream); ! 313: put_str(cfg->sys_daily,stream); ! 314: put_int(cfg->sys_timezone,stream); ! 315: put_int(cfg->sys_misc,stream); ! 316: put_int(cfg->sys_lastnode,stream); ! 317: put_int(cfg->sys_autonode,stream); ! 318: put_int(cfg->uq,stream); ! 319: put_int(cfg->sys_pwdays,stream); ! 320: put_int(cfg->sys_deldays,stream); ! 321: put_int(cfg->sys_exp_warn,stream); ! 322: put_int(cfg->sys_autodel,stream); ! 323: put_int(cfg->sys_def_stat,stream); ! 324: put_str(cfg->sys_chat_arstr,stream); ! 325: put_int(cfg->cdt_min_value,stream); ! 326: put_int(cfg->max_minutes,stream); ! 327: put_int(cfg->cdt_per_dollar,stream); ! 328: put_str(cfg->new_pass,stream); ! 329: put_str(cfg->new_magic,stream); ! 330: put_str(cfg->new_sif,stream); ! 331: put_str(cfg->new_sof,stream); ! 332: ! 333: put_int(cfg->new_level,stream); ! 334: put_int(cfg->new_flags1,stream); ! 335: put_int(cfg->new_flags2,stream); ! 336: put_int(cfg->new_flags3,stream); ! 337: put_int(cfg->new_flags4,stream); ! 338: put_int(cfg->new_exempt,stream); ! 339: put_int(cfg->new_rest,stream); ! 340: put_int(cfg->new_cdt,stream); ! 341: put_int(cfg->new_min,stream); ! 342: put_str(cfg->new_xedit,stream); ! 343: put_int(cfg->new_expire,stream); ! 344: if(cfg->new_shell>=cfg->total_shells) ! 345: cfg->new_shell=0; ! 346: put_int(cfg->new_shell,stream); ! 347: put_int(cfg->new_misc,stream); ! 348: put_int(cfg->new_prot,stream); ! 349: put_int(cfg->new_install,stream); ! 350: n=0; ! 351: for(i=0;i<7;i++) ! 352: put_int(n,stream); ! 353: ! 354: put_int(cfg->expired_level,stream); ! 355: put_int(cfg->expired_flags1,stream); ! 356: put_int(cfg->expired_flags2,stream); ! 357: put_int(cfg->expired_flags3,stream); ! 358: put_int(cfg->expired_flags4,stream); ! 359: put_int(cfg->expired_exempt,stream); ! 360: put_int(cfg->expired_rest,stream); ! 361: ! 362: put_str(cfg->logon_mod,stream); ! 363: put_str(cfg->logoff_mod,stream); ! 364: put_str(cfg->newuser_mod,stream); ! 365: put_str(cfg->login_mod,stream); ! 366: put_str(cfg->logout_mod,stream); ! 367: put_str(cfg->sync_mod,stream); ! 368: put_str(cfg->expire_mod,stream); ! 369: put_int(cfg->ctrlkey_passthru,stream); ! 370: put_str(cfg->mods_dir,stream); ! 371: put_str(cfg->logs_dir,stream); ! 372: ! 373: put_int(c,stream); ! 374: n=0; ! 375: for(i=0;i<158;i++) ! 376: put_int(n,stream); ! 377: n=0xffff; ! 378: for(i=0;i<254;i++) ! 379: put_int(n,stream); ! 380: ! 381: put_int(cfg->user_backup_level,stream); ! 382: put_int(cfg->mail_backup_level,stream); ! 383: ! 384: n=0; ! 385: for(i=0;i<10;i++) { ! 386: put_int(cfg->val_level[i],stream); ! 387: put_int(cfg->val_expire[i],stream); ! 388: put_int(cfg->val_flags1[i],stream); ! 389: put_int(cfg->val_flags2[i],stream); ! 390: put_int(cfg->val_flags3[i],stream); ! 391: put_int(cfg->val_flags4[i],stream); ! 392: put_int(cfg->val_cdt[i],stream); ! 393: put_int(cfg->val_exempt[i],stream); ! 394: put_int(cfg->val_rest[i],stream); ! 395: for(j=0;j<8;j++) ! 396: put_int(n,stream); } ! 397: ! 398: c=0; ! 399: for(i=0;i<100 && !feof(stream);i++) { ! 400: put_int(cfg->level_timeperday[i],stream); ! 401: put_int(cfg->level_timepercall[i],stream); ! 402: put_int(cfg->level_callsperday[i],stream); ! 403: put_int(cfg->level_freecdtperday[i],stream); ! 404: put_int(cfg->level_linespermsg[i],stream); ! 405: put_int(cfg->level_postsperday[i],stream); ! 406: put_int(cfg->level_emailperday[i],stream); ! 407: put_int(cfg->level_misc[i],stream); ! 408: put_int(cfg->level_expireto[i],stream); ! 409: put_int(c,stream); ! 410: for(j=0;j<5;j++) ! 411: put_int(n,stream); } ! 412: ! 413: /* Command Shells */ ! 414: ! 415: put_int(cfg->total_shells,stream); ! 416: for(i=0;i<cfg->total_shells;i++) { ! 417: put_str(cfg->shell[i]->name,stream); ! 418: put_str(cfg->shell[i]->code,stream); ! 419: put_str(cfg->shell[i]->arstr,stream); ! 420: put_int(cfg->shell[i]->misc,stream); ! 421: n=0; ! 422: for(j=0;j<8;j++) ! 423: put_int(n,stream); ! 424: } ! 425: ! 426: fclose(stream); ! 427: ! 428: return(TRUE); ! 429: } ! 430: ! 431: /****************************************************************************/ ! 432: /****************************************************************************/ ! 433: BOOL DLLCALL write_msgs_cfg(scfg_t* cfg, int backup_level) ! 434: { ! 435: char str[MAX_PATH+1],c; ! 436: char dir[LEN_DIR+1]=""; ! 437: int i,j,k,file; ! 438: ushort n; ! 439: long l; ! 440: FILE *stream; ! 441: smb_t smb; ! 442: ! 443: if(cfg->prepped) ! 444: return(FALSE); ! 445: ! 446: SAFEPRINTF(str,"%smsgs.cnf",cfg->ctrl_dir); ! 447: backup(str, backup_level, TRUE); ! 448: ! 449: if((file=nopen(str,O_WRONLY|O_CREAT|O_TRUNC))==-1 ! 450: || (stream=fdopen(file,"wb"))==NULL) { ! 451: return(FALSE); ! 452: } ! 453: setvbuf(stream,NULL,_IOFBF,2048); ! 454: ! 455: put_int(cfg->max_qwkmsgs,stream); ! 456: put_int(cfg->mail_maxcrcs,stream); ! 457: put_int(cfg->mail_maxage,stream); ! 458: put_str(cfg->preqwk_arstr,stream); ! 459: put_int(cfg->smb_retry_time,stream); ! 460: n=0; ! 461: for(i=0;i<235;i++) ! 462: put_int(n,stream); ! 463: n=0xffff; ! 464: for(i=0;i<256;i++) ! 465: put_int(n,stream); ! 466: ! 467: /* Message Groups */ ! 468: ! 469: put_int(cfg->total_grps,stream); ! 470: for(i=0;i<cfg->total_grps;i++) { ! 471: put_str(cfg->grp[i]->lname,stream); ! 472: put_str(cfg->grp[i]->sname,stream); ! 473: put_str(cfg->grp[i]->arstr,stream); ! 474: put_str(cfg->grp[i]->code_prefix,stream); ! 475: c=0; ! 476: put_int(c,stream); ! 477: n=0; ! 478: for(j=0;j<27;j++) ! 479: put_int(n,stream); ! 480: n=0xffff; ! 481: for(j=0;j<16;j++) ! 482: put_int(n,stream); ! 483: } ! 484: ! 485: /* Message Sub-boards */ ! 486: ! 487: backslash(cfg->echomail_dir); ! 488: ! 489: str[0]=0; ! 490: for(i=n=0;i<cfg->total_subs;i++) ! 491: if(cfg->sub[i]->grp<cfg->total_grps) /* total VALID sub-boards */ ! 492: n++; ! 493: put_int(n,stream); ! 494: for(i=0;i<cfg->total_subs;i++) { ! 495: if(cfg->sub[i]->grp>=cfg->total_grps) /* skip bogus group numbers */ ! 496: continue; ! 497: put_int(cfg->sub[i]->grp,stream); ! 498: put_str(cfg->sub[i]->lname,stream); ! 499: put_str(cfg->sub[i]->sname,stream); ! 500: put_str(cfg->sub[i]->qwkname,stream); ! 501: put_str(cfg->sub[i]->code_suffix,stream); ! 502: #if 1 ! 503: if(cfg->sub[i]->data_dir[0]) { ! 504: backslash(cfg->sub[i]->data_dir); ! 505: md(cfg->sub[i]->data_dir); ! 506: } ! 507: #endif ! 508: put_str(cfg->sub[i]->data_dir,stream); ! 509: put_str(cfg->sub[i]->arstr,stream); ! 510: put_str(cfg->sub[i]->read_arstr,stream); ! 511: put_str(cfg->sub[i]->post_arstr,stream); ! 512: put_str(cfg->sub[i]->op_arstr,stream); ! 513: l=(cfg->sub[i]->misc&(~SUB_HDRMOD)); /* Don't write mod bit */ ! 514: put_int(l,stream); ! 515: put_str(cfg->sub[i]->tagline,stream); ! 516: put_str(cfg->sub[i]->origline,stream); ! 517: put_str(cfg->sub[i]->post_sem,stream); ! 518: put_str(cfg->sub[i]->newsgroup,stream); ! 519: put_int(cfg->sub[i]->faddr,stream); ! 520: put_int(cfg->sub[i]->maxmsgs,stream); ! 521: put_int(cfg->sub[i]->maxcrcs,stream); ! 522: put_int(cfg->sub[i]->maxage,stream); ! 523: put_int(cfg->sub[i]->ptridx,stream); ! 524: put_str(cfg->sub[i]->mod_arstr,stream); ! 525: put_int(cfg->sub[i]->qwkconf,stream); ! 526: c=0; ! 527: put_int(c,stream); ! 528: n=0; ! 529: for(k=0;k<26;k++) ! 530: put_int(n,stream); ! 531: ! 532: if(all_msghdr || (cfg->sub[i]->misc&SUB_HDRMOD && !no_msghdr)) { ! 533: if(!cfg->sub[i]->data_dir[0]) ! 534: SAFEPRINTF(smb.file,"%ssubs",cfg->data_dir); ! 535: else ! 536: SAFECOPY(smb.file,cfg->sub[i]->data_dir); ! 537: prep_dir(cfg->ctrl_dir,smb.file,sizeof(smb.file)); ! 538: SAFEPRINTF2(str,"%s%s" ! 539: ,cfg->grp[cfg->sub[i]->grp]->code_prefix ! 540: ,cfg->sub[i]->code_suffix); ! 541: strlwr(str); ! 542: strcat(smb.file,str); ! 543: if(smb_open(&smb)!=0) { ! 544: /* errormsg(WHERE,ERR_OPEN,smb.file,x); */ ! 545: continue; ! 546: } ! 547: if(!filelength(fileno(smb.shd_fp))) { ! 548: smb.status.max_crcs=cfg->sub[i]->maxcrcs; ! 549: smb.status.max_msgs=cfg->sub[i]->maxmsgs; ! 550: smb.status.max_age=cfg->sub[i]->maxage; ! 551: smb.status.attr=cfg->sub[i]->misc&SUB_HYPER ? SMB_HYPERALLOC :0; ! 552: if(smb_create(&smb)!=0) ! 553: /* errormsg(WHERE,ERR_CREATE,smb.file,x) */; ! 554: smb_close(&smb); ! 555: continue; ! 556: } ! 557: if(smb_locksmbhdr(&smb)!=0) { ! 558: smb_close(&smb); ! 559: /* errormsg(WHERE,ERR_LOCK,smb.file,x) */; ! 560: continue; ! 561: } ! 562: if(smb_getstatus(&smb)!=0) { ! 563: smb_close(&smb); ! 564: /* errormsg(WHERE,ERR_READ,smb.file,x) */; ! 565: continue; ! 566: } ! 567: if((!(cfg->sub[i]->misc&SUB_HYPER) || smb.status.attr&SMB_HYPERALLOC) ! 568: && smb.status.max_msgs==cfg->sub[i]->maxmsgs ! 569: && smb.status.max_crcs==cfg->sub[i]->maxcrcs ! 570: && smb.status.max_age==cfg->sub[i]->maxage) { /* No change */ ! 571: smb_close(&smb); ! 572: continue; ! 573: } ! 574: smb.status.max_msgs=cfg->sub[i]->maxmsgs; ! 575: smb.status.max_crcs=cfg->sub[i]->maxcrcs; ! 576: smb.status.max_age=cfg->sub[i]->maxage; ! 577: if(cfg->sub[i]->misc&SUB_HYPER) ! 578: smb.status.attr|=SMB_HYPERALLOC; ! 579: if(smb_putstatus(&smb)!=0) { ! 580: smb_close(&smb); ! 581: /* errormsg(WHERE,ERR_WRITE,smb.file,x); */ ! 582: continue; ! 583: } ! 584: smb_close(&smb); ! 585: } ! 586: } ! 587: ! 588: /* FidoNet */ ! 589: ! 590: put_int(cfg->total_faddrs,stream); ! 591: for(i=0;i<cfg->total_faddrs;i++) { ! 592: put_int(cfg->faddr[i].zone,stream); ! 593: put_int(cfg->faddr[i].net,stream); ! 594: put_int(cfg->faddr[i].node,stream); ! 595: put_int(cfg->faddr[i].point,stream); } ! 596: ! 597: put_str(cfg->origline,stream); ! 598: put_str(cfg->netmail_sem,stream); ! 599: put_str(cfg->echomail_sem,stream); ! 600: backslash(cfg->netmail_dir); ! 601: put_str(cfg->netmail_dir,stream); ! 602: put_str(cfg->echomail_dir,stream); ! 603: backslash(cfg->fidofile_dir); ! 604: put_str(cfg->fidofile_dir,stream); ! 605: put_int(cfg->netmail_misc,stream); ! 606: put_int(cfg->netmail_cost,stream); ! 607: put_int(cfg->dflt_faddr,stream); ! 608: n=0; ! 609: for(i=0;i<28;i++) ! 610: put_int(n,stream); ! 611: ! 612: /* QWKnet Config */ ! 613: ! 614: put_str(cfg->qnet_tagline,stream); ! 615: ! 616: put_int(cfg->total_qhubs,stream); ! 617: for(i=0;i<cfg->total_qhubs;i++) { ! 618: put_str(cfg->qhub[i]->id,stream); ! 619: put_int(cfg->qhub[i]->time,stream); ! 620: put_int(cfg->qhub[i]->freq,stream); ! 621: put_int(cfg->qhub[i]->days,stream); ! 622: put_int(cfg->qhub[i]->node,stream); ! 623: put_str(cfg->qhub[i]->call,stream); ! 624: put_str(cfg->qhub[i]->pack,stream); ! 625: put_str(cfg->qhub[i]->unpack,stream); ! 626: put_int(cfg->qhub[i]->subs,stream); ! 627: for(j=0;j<cfg->qhub[i]->subs;j++) { ! 628: put_int(cfg->qhub[i]->conf[j],stream); ! 629: put_int(cfg->qhub[i]->sub[j],stream); ! 630: put_int(cfg->qhub[i]->mode[j],stream); } ! 631: n=0; ! 632: for(j=0;j<32;j++) ! 633: put_int(n,stream); } ! 634: n=0; ! 635: for(i=0;i<32;i++) ! 636: put_int(n,stream); ! 637: ! 638: /* PostLink Config */ ! 639: ! 640: memset(str,0,11); ! 641: fwrite(str,11,1,stream); /* unused, used to be site name */ ! 642: put_int(cfg->sys_psnum,stream); ! 643: ! 644: put_int(cfg->total_phubs,stream); ! 645: for(i=0;i<cfg->total_phubs;i++) { ! 646: put_str(cfg->phub[i]->name,stream); ! 647: put_int(cfg->phub[i]->time,stream); ! 648: put_int(cfg->phub[i]->freq,stream); ! 649: put_int(cfg->phub[i]->days,stream); ! 650: put_int(cfg->phub[i]->node,stream); ! 651: put_str(cfg->phub[i]->call,stream); ! 652: n=0; ! 653: for(j=0;j<32;j++) ! 654: put_int(n,stream); } ! 655: ! 656: put_str(cfg->sys_psname,stream); ! 657: n=0; ! 658: for(i=0;i<32;i++) ! 659: put_int(n,stream); ! 660: ! 661: put_str(cfg->sys_inetaddr,stream); /* Internet address */ ! 662: put_str(cfg->inetmail_sem,stream); ! 663: put_int(cfg->inetmail_misc,stream); ! 664: put_int(cfg->inetmail_cost,stream); ! 665: put_str(cfg->smtpmail_sem,stream); ! 666: ! 667: fclose(stream); ! 668: ! 669: /* MUST BE AT END */ ! 670: ! 671: if(!no_msghdr) { ! 672: strcpy(dir,cfg->data_dir); ! 673: prep_dir(cfg->ctrl_dir,dir,sizeof(dir)); ! 674: SAFEPRINTF(smb.file,"%smail",dir); ! 675: if(smb_open(&smb)!=0) { ! 676: return(FALSE); ! 677: } ! 678: if(!filelength(fileno(smb.shd_fp))) { ! 679: smb.status.max_msgs=0; ! 680: smb.status.max_crcs=cfg->mail_maxcrcs; ! 681: smb.status.max_age=cfg->mail_maxage; ! 682: smb.status.attr=SMB_EMAIL; ! 683: i=smb_create(&smb); ! 684: smb_close(&smb); ! 685: return(i==0); ! 686: } ! 687: if(smb_locksmbhdr(&smb)!=0) { ! 688: smb_close(&smb); ! 689: /* errormsg disabled. Why? ToDo */ ! 690: /* errormsg(WHERE,ERR_LOCK,smb.file,x); */ ! 691: return(FALSE); ! 692: } ! 693: if(smb_getstatus(&smb)!=0) { ! 694: smb_close(&smb); ! 695: /* errormsg disabled. Why? ToDo */ ! 696: /* errormsg(WHERE,ERR_READ,smb.file,x); */ ! 697: return(FALSE); ! 698: } ! 699: smb.status.max_msgs=0; ! 700: smb.status.max_crcs=cfg->mail_maxcrcs; ! 701: smb.status.max_age=cfg->mail_maxage; ! 702: if(smb_putstatus(&smb)!=0) { ! 703: smb_close(&smb); ! 704: /* errormsg disabled. Why? ToDo */ ! 705: /* errormsg(WHERE,ERR_WRITE,smb.file,x); */ ! 706: return(FALSE); ! 707: } ! 708: smb_close(&smb); ! 709: } ! 710: ! 711: return(TRUE); ! 712: } ! 713: ! 714: ! 715: /****************************************************************************/ ! 716: /****************************************************************************/ ! 717: BOOL DLLCALL write_file_cfg(scfg_t* cfg, int backup_level) ! 718: { ! 719: char str[MAX_PATH+1],cmd[LEN_CMD+1],c; ! 720: char path[MAX_PATH+1]; ! 721: int i,j,k,file; ! 722: ushort n; ! 723: long l=0; ! 724: FILE *stream; ! 725: ! 726: if(cfg->prepped) ! 727: return(FALSE); ! 728: ! 729: SAFEPRINTF(str,"%sfile.cnf",cfg->ctrl_dir); ! 730: backup(str, backup_level, TRUE); ! 731: ! 732: if((file=nopen(str,O_WRONLY|O_CREAT|O_TRUNC))==-1 ! 733: || (stream=fdopen(file,"wb"))==NULL) { ! 734: return(FALSE); ! 735: } ! 736: setvbuf(stream,NULL,_IOFBF,2048); ! 737: ! 738: put_int(cfg->min_dspace,stream); ! 739: put_int(cfg->max_batup,stream); ! 740: put_int(cfg->max_batdn,stream); ! 741: put_int(cfg->max_userxfer,stream); ! 742: put_int(l,stream); /* unused */ ! 743: put_int(cfg->cdt_up_pct,stream); ! 744: put_int(cfg->cdt_dn_pct,stream); ! 745: put_int(l,stream); /* unused */ ! 746: put_str(cmd,stream); ! 747: put_int(cfg->leech_pct,stream); ! 748: put_int(cfg->leech_sec,stream); ! 749: put_int(cfg->file_misc,stream); ! 750: n=0; ! 751: for(i=0;i<30;i++) ! 752: put_int(n,stream); ! 753: ! 754: /* Extractable File Types */ ! 755: ! 756: put_int(cfg->total_fextrs,stream); ! 757: for(i=0;i<cfg->total_fextrs;i++) { ! 758: put_str(cfg->fextr[i]->ext,stream); ! 759: put_str(cfg->fextr[i]->cmd,stream); ! 760: put_str(cfg->fextr[i]->arstr,stream); ! 761: n=0; ! 762: for(j=0;j<8;j++) ! 763: put_int(n,stream); } ! 764: ! 765: /* Compressable File Types */ ! 766: ! 767: put_int(cfg->total_fcomps,stream); ! 768: for(i=0;i<cfg->total_fcomps;i++) { ! 769: put_str(cfg->fcomp[i]->ext,stream); ! 770: put_str(cfg->fcomp[i]->cmd,stream); ! 771: put_str(cfg->fcomp[i]->arstr,stream); ! 772: n=0; ! 773: for(j=0;j<8;j++) ! 774: put_int(n,stream); } ! 775: ! 776: /* Viewable File Types */ ! 777: ! 778: put_int(cfg->total_fviews,stream); ! 779: for(i=0;i<cfg->total_fviews;i++) { ! 780: put_str(cfg->fview[i]->ext,stream); ! 781: put_str(cfg->fview[i]->cmd,stream); ! 782: put_str(cfg->fview[i]->arstr,stream); ! 783: n=0; ! 784: for(j=0;j<8;j++) ! 785: put_int(n,stream); } ! 786: ! 787: /* Testable File Types */ ! 788: ! 789: put_int(cfg->total_ftests,stream); ! 790: for(i=0;i<cfg->total_ftests;i++) { ! 791: put_str(cfg->ftest[i]->ext,stream); ! 792: put_str(cfg->ftest[i]->cmd,stream); ! 793: put_str(cfg->ftest[i]->workstr,stream); ! 794: put_str(cfg->ftest[i]->arstr,stream); ! 795: n=0; ! 796: for(j=0;j<8;j++) ! 797: put_int(n,stream); } ! 798: ! 799: /* Download Events */ ! 800: ! 801: put_int(cfg->total_dlevents,stream); ! 802: for(i=0;i<cfg->total_dlevents;i++) { ! 803: put_str(cfg->dlevent[i]->ext,stream); ! 804: put_str(cfg->dlevent[i]->cmd,stream); ! 805: put_str(cfg->dlevent[i]->workstr,stream); ! 806: put_str(cfg->dlevent[i]->arstr,stream); ! 807: n=0; ! 808: for(j=0;j<8;j++) ! 809: put_int(n,stream); } ! 810: ! 811: /* File Transfer Protocols */ ! 812: ! 813: put_int(cfg->total_prots,stream); ! 814: for(i=0;i<cfg->total_prots;i++) { ! 815: put_int(cfg->prot[i]->mnemonic,stream); ! 816: put_str(cfg->prot[i]->name,stream); ! 817: put_str(cfg->prot[i]->ulcmd,stream); ! 818: put_str(cfg->prot[i]->dlcmd,stream); ! 819: put_str(cfg->prot[i]->batulcmd,stream); ! 820: put_str(cfg->prot[i]->batdlcmd,stream); ! 821: put_str(cfg->prot[i]->blindcmd,stream); ! 822: put_str(cfg->prot[i]->bicmd,stream); ! 823: put_int(cfg->prot[i]->misc,stream); ! 824: put_str(cfg->prot[i]->arstr,stream); ! 825: n=0; ! 826: for(j=0;j<8;j++) ! 827: put_int(n,stream); } ! 828: ! 829: /* Alternate File Paths */ ! 830: ! 831: put_int(cfg->altpaths,stream); ! 832: for(i=0;i<cfg->altpaths;i++) { ! 833: backslash(cfg->altpath[i]); ! 834: fwrite(cfg->altpath[i],LEN_DIR+1,1,stream); ! 835: n=0; ! 836: for(j=0;j<8;j++) ! 837: put_int(n,stream); } ! 838: ! 839: /* File Libraries */ ! 840: ! 841: put_int(cfg->total_libs,stream); ! 842: for(i=0;i<cfg->total_libs;i++) { ! 843: put_str(cfg->lib[i]->lname,stream); ! 844: put_str(cfg->lib[i]->sname,stream); ! 845: put_str(cfg->lib[i]->arstr,stream); ! 846: put_str(cfg->lib[i]->parent_path,stream); ! 847: put_str(cfg->lib[i]->code_prefix,stream); ! 848: ! 849: c=0; ! 850: put_int(c,stream); ! 851: n=0x0000; ! 852: for(j=0;j<3;j++) ! 853: put_int(n,stream); ! 854: ! 855: n=0xffff; ! 856: for(j=0;j<16;j++) ! 857: put_int(n,stream); ! 858: } ! 859: ! 860: /* File Directories */ ! 861: ! 862: put_int(cfg->total_dirs,stream); ! 863: for(j=0;j<cfg->total_libs;j++) ! 864: for(i=0;i<cfg->total_dirs;i++) ! 865: if(cfg->dir[i]->lib==j) { ! 866: put_int(cfg->dir[i]->lib,stream); ! 867: put_str(cfg->dir[i]->lname,stream); ! 868: put_str(cfg->dir[i]->sname,stream); ! 869: put_str(cfg->dir[i]->code_suffix,stream); ! 870: #if 1 ! 871: if(cfg->dir[i]->data_dir[0]) { ! 872: backslash(cfg->dir[i]->data_dir); ! 873: md(cfg->dir[i]->data_dir); ! 874: } ! 875: #endif ! 876: put_str(cfg->dir[i]->data_dir,stream); ! 877: put_str(cfg->dir[i]->arstr,stream); ! 878: put_str(cfg->dir[i]->ul_arstr,stream); ! 879: put_str(cfg->dir[i]->dl_arstr,stream); ! 880: put_str(cfg->dir[i]->op_arstr,stream); ! 881: backslash(cfg->dir[i]->path); ! 882: put_str(cfg->dir[i]->path,stream); ! 883: #if 1 ! 884: if(cfg->dir[i]->misc&DIR_FCHK) { ! 885: SAFECOPY(path,cfg->dir[i]->path); ! 886: if(!path[0]) { /* no file storage path specified */ ! 887: SAFEPRINTF2(str,"%s%s" ! 888: ,cfg->lib[cfg->dir[i]->lib]->code_prefix ! 889: ,cfg->dir[i]->code_suffix); ! 890: strlwr(str); ! 891: safe_snprintf(path,sizeof(path),"%sdirs/%s/" ! 892: ,cfg->data_dir ! 893: ,str); ! 894: } ! 895: else if(cfg->lib[cfg->dir[i]->lib]->parent_path[0]) { ! 896: SAFECOPY(path,cfg->lib[cfg->dir[i]->lib]->parent_path); ! 897: prep_dir(cfg->ctrl_dir,path,sizeof(path)); ! 898: md(path); ! 899: backslash(path); ! 900: strcat(path,cfg->dir[i]->path); ! 901: } ! 902: else ! 903: prep_dir(cfg->ctrl_dir, path,sizeof(path)); ! 904: md(path); ! 905: } ! 906: #endif ! 907: ! 908: put_str(cfg->dir[i]->upload_sem,stream); ! 909: put_int(cfg->dir[i]->maxfiles,stream); ! 910: put_str(cfg->dir[i]->exts,stream); ! 911: put_int(cfg->dir[i]->misc,stream); ! 912: put_int(cfg->dir[i]->seqdev,stream); ! 913: put_int(cfg->dir[i]->sort,stream); ! 914: put_str(cfg->dir[i]->ex_arstr,stream); ! 915: put_int(cfg->dir[i]->maxage,stream); ! 916: put_int(cfg->dir[i]->up_pct,stream); ! 917: put_int(cfg->dir[i]->dn_pct,stream); ! 918: c=0; ! 919: put_int(c,stream); ! 920: n=0; ! 921: for(k=0;k<8;k++) ! 922: put_int(n,stream); ! 923: n=0xffff; ! 924: for(k=0;k<16;k++) ! 925: put_int(n,stream); ! 926: } ! 927: ! 928: /* Text File Sections */ ! 929: ! 930: put_int(cfg->total_txtsecs,stream); ! 931: for(i=0;i<cfg->total_txtsecs;i++) { ! 932: #if 1 ! 933: SAFECOPY(str,cfg->txtsec[i]->code); ! 934: strlwr(str); ! 935: safe_snprintf(path,sizeof(path),"%stext/%s",cfg->data_dir,str); ! 936: md(path); ! 937: #endif ! 938: put_str(cfg->txtsec[i]->name,stream); ! 939: put_str(cfg->txtsec[i]->code,stream); ! 940: put_str(cfg->txtsec[i]->arstr,stream); ! 941: n=0; ! 942: for(j=0;j<8;j++) ! 943: put_int(n,stream); ! 944: } ! 945: ! 946: fclose(stream); ! 947: ! 948: return(TRUE); ! 949: } ! 950: ! 951: ! 952: ! 953: /****************************************************************************/ ! 954: /****************************************************************************/ ! 955: BOOL DLLCALL write_chat_cfg(scfg_t* cfg, int backup_level) ! 956: { ! 957: char str[MAX_PATH+1]; ! 958: int i,j,file; ! 959: ushort n; ! 960: FILE *stream; ! 961: ! 962: if(cfg->prepped) ! 963: return(FALSE); ! 964: ! 965: sprintf(str,"%schat.cnf",cfg->ctrl_dir); ! 966: backup(str, backup_level, TRUE); ! 967: ! 968: if((file=nopen(str,O_WRONLY|O_CREAT|O_TRUNC))==-1 ! 969: || (stream=fdopen(file,"wb"))==NULL) { ! 970: return(FALSE); ! 971: } ! 972: setvbuf(stream,NULL,_IOFBF,2048); ! 973: ! 974: put_int(cfg->total_gurus,stream); ! 975: for(i=0;i<cfg->total_gurus;i++) { ! 976: put_str(cfg->guru[i]->name,stream); ! 977: put_str(cfg->guru[i]->code,stream); ! 978: put_str(cfg->guru[i]->arstr,stream); ! 979: n=0; ! 980: for(j=0;j<8;j++) ! 981: put_int(n,stream); ! 982: } ! 983: ! 984: put_int(cfg->total_actsets,stream); ! 985: for(i=0;i<cfg->total_actsets;i++) ! 986: put_str(cfg->actset[i]->name,stream); ! 987: ! 988: put_int(cfg->total_chatacts,stream); ! 989: for(i=0;i<cfg->total_chatacts;i++) { ! 990: put_int(cfg->chatact[i]->actset,stream); ! 991: put_str(cfg->chatact[i]->cmd,stream); ! 992: put_str(cfg->chatact[i]->out,stream); ! 993: n=0; ! 994: for(j=0;j<8;j++) ! 995: put_int(n,stream); ! 996: } ! 997: ! 998: put_int(cfg->total_chans,stream); ! 999: for(i=0;i<cfg->total_chans;i++) { ! 1000: put_int(cfg->chan[i]->actset,stream); ! 1001: put_str(cfg->chan[i]->name,stream); ! 1002: put_str(cfg->chan[i]->code,stream); ! 1003: put_str(cfg->chan[i]->arstr,stream); ! 1004: put_int(cfg->chan[i]->cost,stream); ! 1005: put_int(cfg->chan[i]->guru,stream); ! 1006: put_int(cfg->chan[i]->misc,stream); ! 1007: n=0; ! 1008: for(j=0;j<8;j++) ! 1009: put_int(n,stream); ! 1010: } ! 1011: ! 1012: put_int(cfg->total_pages,stream); ! 1013: for(i=0;i<cfg->total_pages;i++) { ! 1014: put_str(cfg->page[i]->cmd,stream); ! 1015: put_str(cfg->page[i]->arstr,stream); ! 1016: put_int(cfg->page[i]->misc,stream); ! 1017: n=0; ! 1018: for(j=0;j<8;j++) ! 1019: put_int(n,stream); ! 1020: } ! 1021: ! 1022: fclose(stream); ! 1023: ! 1024: return(TRUE); ! 1025: } ! 1026: ! 1027: ! 1028: /****************************************************************************/ ! 1029: /****************************************************************************/ ! 1030: BOOL DLLCALL write_xtrn_cfg(scfg_t* cfg, int backup_level) ! 1031: { ! 1032: uchar str[MAX_PATH+1],c; ! 1033: int i,j,sec,file; ! 1034: ushort n; ! 1035: FILE *stream; ! 1036: ! 1037: if(cfg->prepped) ! 1038: return(FALSE); ! 1039: ! 1040: sprintf(str,"%sxtrn.cnf",cfg->ctrl_dir); ! 1041: backup(str, backup_level, TRUE); ! 1042: ! 1043: if((file=nopen(str,O_WRONLY|O_CREAT|O_TRUNC))==-1 ! 1044: || (stream=fdopen(file,"wb"))==NULL) { ! 1045: return(FALSE); ! 1046: } ! 1047: setvbuf(stream,NULL,_IOFBF,2048); ! 1048: ! 1049: put_int(cfg->total_swaps,stream); ! 1050: for(i=0;i<cfg->total_swaps;i++) ! 1051: put_str(cfg->swap[i]->cmd,stream); ! 1052: ! 1053: put_int(cfg->total_xedits,stream); ! 1054: for(i=0;i<cfg->total_xedits;i++) { ! 1055: put_str(cfg->xedit[i]->name,stream); ! 1056: put_str(cfg->xedit[i]->code,stream); ! 1057: put_str(cfg->xedit[i]->lcmd,stream); ! 1058: put_str(cfg->xedit[i]->rcmd,stream); ! 1059: put_int(cfg->xedit[i]->misc,stream); ! 1060: put_str(cfg->xedit[i]->arstr,stream); ! 1061: put_int(cfg->xedit[i]->type,stream); ! 1062: c=0; ! 1063: put_int(c,stream); ! 1064: n=0; ! 1065: for(j=0;j<7;j++) ! 1066: put_int(n,stream); ! 1067: } ! 1068: ! 1069: put_int(cfg->total_xtrnsecs,stream); ! 1070: for(i=0;i<cfg->total_xtrnsecs;i++) { ! 1071: put_str(cfg->xtrnsec[i]->name,stream); ! 1072: put_str(cfg->xtrnsec[i]->code,stream); ! 1073: put_str(cfg->xtrnsec[i]->arstr,stream); ! 1074: n=0; ! 1075: for(j=0;j<8;j++) ! 1076: put_int(n,stream); ! 1077: } ! 1078: ! 1079: put_int(cfg->total_xtrns,stream); ! 1080: for(sec=0;sec<cfg->total_xtrnsecs;sec++) ! 1081: for(i=0;i<cfg->total_xtrns;i++) { ! 1082: if(cfg->xtrn[i]->sec!=sec) ! 1083: continue; ! 1084: put_int(cfg->xtrn[i]->sec,stream); ! 1085: put_str(cfg->xtrn[i]->name,stream); ! 1086: put_str(cfg->xtrn[i]->code,stream); ! 1087: put_str(cfg->xtrn[i]->arstr,stream); ! 1088: put_str(cfg->xtrn[i]->run_arstr,stream); ! 1089: put_int(cfg->xtrn[i]->type,stream); ! 1090: put_int(cfg->xtrn[i]->misc,stream); ! 1091: put_int(cfg->xtrn[i]->event,stream); ! 1092: put_int(cfg->xtrn[i]->cost,stream); ! 1093: put_str(cfg->xtrn[i]->cmd,stream); ! 1094: put_str(cfg->xtrn[i]->clean,stream); ! 1095: put_str(cfg->xtrn[i]->path,stream); ! 1096: put_int(cfg->xtrn[i]->textra,stream); ! 1097: put_int(cfg->xtrn[i]->maxtime,stream); ! 1098: n=0; ! 1099: for(j=0;j<7;j++) ! 1100: put_int(n,stream); ! 1101: } ! 1102: ! 1103: put_int(cfg->total_events,stream); ! 1104: for(i=0;i<cfg->total_events;i++) { ! 1105: put_str(cfg->event[i]->code,stream); ! 1106: put_str(cfg->event[i]->cmd,stream); ! 1107: put_int(cfg->event[i]->days,stream); ! 1108: put_int(cfg->event[i]->time,stream); ! 1109: put_int(cfg->event[i]->node,stream); ! 1110: put_int(cfg->event[i]->misc,stream); ! 1111: put_str(cfg->event[i]->dir,stream); ! 1112: put_int(cfg->event[i]->freq,stream); ! 1113: put_int(cfg->event[i]->mdays,stream); ! 1114: n=0; ! 1115: for(j=0;j<5;j++) ! 1116: put_int(n,stream); ! 1117: } ! 1118: ! 1119: put_int(cfg->total_natvpgms,stream); ! 1120: for(i=0;i<cfg->total_natvpgms;i++) ! 1121: put_str(cfg->natvpgm[i]->name,stream); ! 1122: for(i=0;i<cfg->total_natvpgms;i++) ! 1123: put_int(cfg->natvpgm[i]->misc,stream); ! 1124: ! 1125: put_int(cfg->total_hotkeys,stream); ! 1126: for(i=0;i<cfg->total_hotkeys;i++) { ! 1127: put_int(cfg->hotkey[i]->key,stream); ! 1128: put_str(cfg->hotkey[i]->cmd,stream); ! 1129: n=0; ! 1130: for(j=0;j<8;j++) ! 1131: put_int(n,stream); ! 1132: } ! 1133: ! 1134: fclose(stream); ! 1135: ! 1136: return(TRUE); ! 1137: } ! 1138: ! 1139: void DLLCALL refresh_cfg(scfg_t* cfg) ! 1140: { ! 1141: char str[MAX_PATH+1]; ! 1142: int i; ! 1143: int file; ! 1144: node_t node; ! 1145: ! 1146: for(i=0;i<cfg->sys_nodes;i++) { ! 1147: if(getnodedat(cfg,i+1,&node,&file)!=0) ! 1148: continue; ! 1149: node.misc|=NODE_RRUN; ! 1150: if(putnodedat(cfg,i+1,&node,file)) ! 1151: break; ! 1152: } ! 1153: ! 1154: SAFEPRINTF(str,"%srecycle",cfg->ctrl_dir); ftouch(str); ! 1155: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.