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