From 96ed59de5cf1f3cc88f2af6f47ec604e85f13d15 Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Mon, 23 Aug 2004 23:35:23 +0000 Subject: [PATCH] Renamed iniGet* functions to iniRead*, since they actually perform file I/O (using FILE*) and I want to use iniGet for future str_list_t iniGet functions. --- src/sbbs3/js_file.c | 22 ++-- src/sbbs3/mailsrvr.c | 20 ++-- src/sbbs3/sbbs_ini.c | 230 ++++++++++++++++++++--------------------- src/sbbs3/sbbscon.c | 10 +- src/sbbs3/services.c | 32 +++--- src/syncterm/bbslist.c | 20 ++-- src/xpdev/ini_file.c | 24 ++--- src/xpdev/ini_file.h | 26 ++--- 8 files changed, 192 insertions(+), 192 deletions(-) diff --git a/src/sbbs3/js_file.c b/src/sbbs3/js_file.c index 74943233ea..6bfb49949e 100644 --- a/src/sbbs3/js_file.c +++ b/src/sbbs3/js_file.c @@ -470,27 +470,27 @@ js_iniGetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva key=JS_GetStringBytes(JS_ValueToString(cx, argv[1])); if(dflt==JSVAL_VOID) { /* unspecified default value */ - *rval=get_value(cx,iniGetString(p->fp,section,key,NULL,buf)); + *rval=get_value(cx,iniReadString(p->fp,section,key,NULL,buf)); return(JS_TRUE); } switch(JSVAL_TAG(dflt)) { case JSVAL_STRING: *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, - iniGetString(p->fp,section,key + iniReadString(p->fp,section,key ,JS_GetStringBytes(JS_ValueToString(cx,dflt)),buf))); break; case JSVAL_BOOLEAN: *rval = BOOLEAN_TO_JSVAL( - iniGetBool(p->fp,section,key,JSVAL_TO_BOOLEAN(dflt))); + iniReadBool(p->fp,section,key,JSVAL_TO_BOOLEAN(dflt))); break; case JSVAL_DOUBLE: JS_NewNumberValue(cx - ,iniGetFloat(p->fp,section,key,*JSVAL_TO_DOUBLE(dflt)),rval); + ,iniReadFloat(p->fp,section,key,*JSVAL_TO_DOUBLE(dflt)),rval); break; case JSVAL_OBJECT: array = JS_NewArrayObject(cx, 0, NULL); - list=iniGetStringList(p->fp,section,key,",",JS_GetStringBytes(JS_ValueToString(cx,dflt))); + list=iniReadStringList(p->fp,section,key,",",JS_GetStringBytes(JS_ValueToString(cx,dflt))); for(i=0;list && list[i];i++) { val=STRING_TO_JSVAL(JS_NewStringCopyZ(cx,list[i])); if(!JS_SetElement(cx, array, i, &val)) @@ -502,7 +502,7 @@ js_iniGetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva default: if(JSVAL_IS_NUMBER(dflt)) { JS_ValueToInt32(cx,dflt,&i); - JS_NewNumberValue(cx,iniGetInteger(p->fp,section,key,i),rval); + JS_NewNumberValue(cx,iniReadInteger(p->fp,section,key,i),rval); break; } break; @@ -594,7 +594,7 @@ js_iniGetSections(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval * array = JS_NewArrayObject(cx, 0, NULL); - list = iniGetSectionList(p->fp,prefix); + list = iniReadSectionList(p->fp,prefix); for(i=0;list && list[i];i++) { val=STRING_TO_JSVAL(JS_NewStringCopyZ(cx,list[i])); if(!JS_SetElement(cx, array, i, &val)) @@ -628,7 +628,7 @@ js_iniGetKeys(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval section=JS_GetStringBytes(JS_ValueToString(cx, argv[0])); array = JS_NewArrayObject(cx, 0, NULL); - list = iniGetKeyList(p->fp,section); + list = iniReadKeyList(p->fp,section); for(i=0;list && list[i];i++) { val=STRING_TO_JSVAL(JS_NewStringCopyZ(cx,list[i])); if(!JS_SetElement(cx, array, i, &val)) @@ -661,7 +661,7 @@ js_iniGetObject(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rv section=JS_GetStringBytes(JS_ValueToString(cx, argv[0])); object = JS_NewObject(cx, NULL, NULL, obj); - list = iniGetNamedStringList(p->fp,section); + list = iniReadNamedStringList(p->fp,section); for(i=0;list && list[i];i++) { JS_DefineProperty(cx, object, list[i]->name ,get_value(cx,list[i]->value) @@ -743,7 +743,7 @@ js_iniGetAllObjects(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval array = JS_NewArrayObject(cx, 0, NULL); - sec_list = iniGetSectionList(p->fp,prefix); + sec_list = iniReadSectionList(p->fp,prefix); for(i=0;sec_list && sec_list[i];i++) { object = JS_NewObject(cx, NULL, NULL, obj); @@ -754,7 +754,7 @@ js_iniGetAllObjects(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval ,STRING_TO_JSVAL(JS_NewStringCopyZ(cx,sec_name)) ,NULL,NULL,JSPROP_ENUMERATE); - key_list = iniGetNamedStringList(p->fp,sec_list[i]); + key_list = iniReadNamedStringList(p->fp,sec_list[i]); for(k=0;key_list && key_list[k];k++) JS_DefineProperty(cx, object, key_list[k]->name ,get_value(cx,key_list[k]->value) diff --git a/src/sbbs3/mailsrvr.c b/src/sbbs3/mailsrvr.c index 57c0ff1ba1..0fa04845fb 100644 --- a/src/sbbs3/mailsrvr.c +++ b/src/sbbs3/mailsrvr.c @@ -2071,16 +2071,16 @@ static void smtp_thread(void* arg) telegram_buf[length+strlen(str)]=0; /* Need ASCIIZ */ /* Send telegram to users */ - sec_list=iniGetSectionList(rcptlst,NULL); /* Each section is a recipient */ + sec_list=iniReadSectionList(rcptlst,NULL); /* Each section is a recipient */ for(rcpt_count=0; sec_list!=NULL && sec_list[rcpt_count]!=NULL && rcpt_count<startup->max_recipients; rcpt_count++) { section=sec_list[rcpt_count]; - SAFECOPY(rcpt_name,iniGetString(rcptlst,section ,smb_hfieldtype(RECIPIENT),"unknown",value)); - usernum=iniGetInteger(rcptlst,section ,smb_hfieldtype(RECIPIENTEXT),0); - SAFECOPY(rcpt_addr,iniGetString(rcptlst,section ,smb_hfieldtype(RECIPIENTNETADDR),str,value)); + SAFECOPY(rcpt_name,iniReadString(rcptlst,section ,smb_hfieldtype(RECIPIENT),"unknown",value)); + usernum=iniReadInteger(rcptlst,section ,smb_hfieldtype(RECIPIENTEXT),0); + SAFECOPY(rcpt_addr,iniReadString(rcptlst,section ,smb_hfieldtype(RECIPIENTNETADDR),str,value)); if((i=putsmsg(&scfg,usernum,telegram_buf))==0) lprintf(LOG_INFO,"%04d SMTP Created telegram (%ld/%u bytes) from %s to %s <%s>" @@ -2390,7 +2390,7 @@ static void smtp_thread(void* arg) continue; } - sec_list=iniGetSectionList(rcptlst,NULL); /* Each section is a recipient */ + sec_list=iniReadSectionList(rcptlst,NULL); /* Each section is a recipient */ for(rcpt_count=0; sec_list!=NULL && sec_list[rcpt_count]!=NULL && rcpt_count<startup->max_recipients; rcpt_count++) { @@ -2403,12 +2403,12 @@ static void smtp_thread(void* arg) section=sec_list[rcpt_count]; - SAFECOPY(rcpt_name,iniGetString(rcptlst,section ,smb_hfieldtype(RECIPIENT),"unknown",value)); - usernum=iniGetInteger(rcptlst,section ,smb_hfieldtype(RECIPIENTEXT),0); - agent=iniGetShortInt(rcptlst,section ,smb_hfieldtype(RECIPIENTAGENT),AGENT_PERSON); - nettype=iniGetShortInt(rcptlst,section ,smb_hfieldtype(RECIPIENTNETTYPE),NET_NONE); + SAFECOPY(rcpt_name,iniReadString(rcptlst,section ,smb_hfieldtype(RECIPIENT),"unknown",value)); + usernum=iniReadInteger(rcptlst,section ,smb_hfieldtype(RECIPIENTEXT),0); + agent=iniReadShortInt(rcptlst,section ,smb_hfieldtype(RECIPIENTAGENT),AGENT_PERSON); + nettype=iniReadShortInt(rcptlst,section ,smb_hfieldtype(RECIPIENTNETTYPE),NET_NONE); sprintf(str,"#%u",usernum); - SAFECOPY(rcpt_addr,iniGetString(rcptlst,section ,smb_hfieldtype(RECIPIENTNETADDR),str,value)); + SAFECOPY(rcpt_addr,iniReadString(rcptlst,section ,smb_hfieldtype(RECIPIENTNETADDR),str,value)); snprintf(hdrfield,sizeof(hdrfield), "Received: from %s (%s [%s])\r\n" diff --git a/src/sbbs3/sbbs_ini.c b/src/sbbs3/sbbs_ini.c index e581675283..e8961a82ce 100644 --- a/src/sbbs3/sbbs_ini.c +++ b/src/sbbs3/sbbs_ini.c @@ -78,28 +78,28 @@ static void read_ini_globals(FILE* fp, global_startup_t* global) const char* section = "Global"; char value[INI_MAX_VALUE_LEN]; - if(*iniGetString(fp,section,"CtrlDirectory",nulstr,value)) { + if(*iniReadString(fp,section,"CtrlDirectory",nulstr,value)) { SAFECOPY(global->ctrl_dir,value); backslash(global->ctrl_dir); } - if(*iniGetString(fp,section,"TempDirectory",nulstr,value)) { + if(*iniReadString(fp,section,"TempDirectory",nulstr,value)) { SAFECOPY(global->temp_dir,value); backslash(global->temp_dir); } - if(*iniGetString(fp,section,strHostName,nulstr,value)) + if(*iniReadString(fp,section,strHostName,nulstr,value)) SAFECOPY(global->host_name,value); - global->sem_chk_freq=iniGetShortInt(fp,section,strSemFileCheckFrequency,0); - global->interface_addr=iniGetIpAddress(fp,section,strInterface,INADDR_ANY); - global->log_mask=iniGetBitField(fp,section,strLogMask,log_mask_bits,DEFAULT_LOG_MASK); + global->sem_chk_freq=iniReadShortInt(fp,section,strSemFileCheckFrequency,0); + global->interface_addr=iniReadIpAddress(fp,section,strInterface,INADDR_ANY); + global->log_mask=iniReadBitField(fp,section,strLogMask,log_mask_bits,DEFAULT_LOG_MASK); - global->js.max_bytes = iniGetInteger(fp,section,strJavaScriptMaxBytes ,JAVASCRIPT_MAX_BYTES); - global->js.cx_stack = iniGetInteger(fp,section,strJavaScriptContextStack ,JAVASCRIPT_CONTEXT_STACK); - global->js.branch_limit = iniGetInteger(fp,section,strJavaScriptBranchLimit ,JAVASCRIPT_BRANCH_LIMIT); - global->js.gc_interval = iniGetInteger(fp,section,strJavaScriptGcInterval ,JAVASCRIPT_GC_INTERVAL); - global->js.yield_interval = iniGetInteger(fp,section,strJavaScriptYieldInterval ,JAVASCRIPT_YIELD_INTERVAL); + global->js.max_bytes = iniReadInteger(fp,section,strJavaScriptMaxBytes ,JAVASCRIPT_MAX_BYTES); + global->js.cx_stack = iniReadInteger(fp,section,strJavaScriptContextStack ,JAVASCRIPT_CONTEXT_STACK); + global->js.branch_limit = iniReadInteger(fp,section,strJavaScriptBranchLimit ,JAVASCRIPT_BRANCH_LIMIT); + global->js.gc_interval = iniReadInteger(fp,section,strJavaScriptGcInterval ,JAVASCRIPT_GC_INTERVAL); + global->js.yield_interval = iniReadInteger(fp,section,strJavaScriptYieldInterval ,JAVASCRIPT_YIELD_INTERVAL); } @@ -149,48 +149,48 @@ void sbbs_read_ini( section = "BBS"; if(run_bbs!=NULL) - *run_bbs=iniGetBool(fp,section,"AutoStart",TRUE); + *run_bbs=iniReadBool(fp,section,"AutoStart",TRUE); bbs->telnet_interface - =iniGetIpAddress(fp,section,"TelnetInterface",global->interface_addr); + =iniReadIpAddress(fp,section,"TelnetInterface",global->interface_addr); bbs->telnet_port - =iniGetShortInt(fp,section,"TelnetPort",IPPORT_TELNET); + =iniReadShortInt(fp,section,"TelnetPort",IPPORT_TELNET); bbs->rlogin_interface - =iniGetIpAddress(fp,section,"RLoginInterface",global->interface_addr); + =iniReadIpAddress(fp,section,"RLoginInterface",global->interface_addr); bbs->rlogin_port - =iniGetShortInt(fp,section,"RLoginPort",513); + =iniReadShortInt(fp,section,"RLoginPort",513); bbs->first_node - =iniGetShortInt(fp,section,"FirstNode",1); + =iniReadShortInt(fp,section,"FirstNode",1); bbs->last_node - =iniGetShortInt(fp,section,"LastNode",4); + =iniReadShortInt(fp,section,"LastNode",4); bbs->outbuf_highwater_mark - =iniGetShortInt(fp,section,"OutbufHighwaterMark",1024); + =iniReadShortInt(fp,section,"OutbufHighwaterMark",1024); bbs->outbuf_drain_timeout - =iniGetShortInt(fp,section,"OutbufDrainTimeout",10); + =iniReadShortInt(fp,section,"OutbufDrainTimeout",10); bbs->sem_chk_freq - =iniGetShortInt(fp,section,strSemFileCheckFrequency,global->sem_chk_freq); + =iniReadShortInt(fp,section,strSemFileCheckFrequency,global->sem_chk_freq); bbs->xtrn_polls_before_yield - =iniGetInteger(fp,section,"ExternalYield",10); + =iniReadInteger(fp,section,"ExternalYield",10); /* JavaScript operating parameters */ bbs->js_max_bytes - =iniGetInteger(fp,section,strJavaScriptMaxBytes ,global->js.max_bytes); + =iniReadInteger(fp,section,strJavaScriptMaxBytes ,global->js.max_bytes); bbs->js_cx_stack - =iniGetInteger(fp,section,strJavaScriptContextStack ,global->js.cx_stack); + =iniReadInteger(fp,section,strJavaScriptContextStack ,global->js.cx_stack); bbs->js_branch_limit - =iniGetInteger(fp,section,strJavaScriptBranchLimit ,global->js.branch_limit); + =iniReadInteger(fp,section,strJavaScriptBranchLimit ,global->js.branch_limit); bbs->js_gc_interval - =iniGetInteger(fp,section,strJavaScriptGcInterval ,global->js.gc_interval); + =iniReadInteger(fp,section,strJavaScriptGcInterval ,global->js.gc_interval); bbs->js_yield_interval - =iniGetInteger(fp,section,strJavaScriptYieldInterval,global->js.yield_interval); + =iniReadInteger(fp,section,strJavaScriptYieldInterval,global->js.yield_interval); SAFECOPY(bbs->host_name - ,iniGetString(fp,section,strHostName,global->host_name,value)); + ,iniReadString(fp,section,strHostName,global->host_name,value)); /* Set default terminal type to "stock" termcap closest to "ansi-bbs" */ #if defined(__FreeBSD__) @@ -200,9 +200,9 @@ void sbbs_read_ini( #endif SAFECOPY(bbs->xtrn_term_ansi - ,iniGetString(fp,section,"ExternalTermANSI",default_term_ansi,value)); + ,iniReadString(fp,section,"ExternalTermANSI",default_term_ansi,value)); SAFECOPY(bbs->xtrn_term_dumb - ,iniGetString(fp,section,"ExternalTermDumb","dumb",value)); + ,iniReadString(fp,section,"ExternalTermDumb","dumb",value)); #if defined(__FreeBSD__) default_dosemu_path="/usr/bin/doscmd"; @@ -211,17 +211,17 @@ void sbbs_read_ini( #endif SAFECOPY(bbs->dosemu_path - ,iniGetString(fp,section,"DOSemuPath",default_dosemu_path,value)); + ,iniReadString(fp,section,"DOSemuPath",default_dosemu_path,value)); SAFECOPY(bbs->answer_sound - ,iniGetString(fp,section,"AnswerSound",nulstr,value)); + ,iniReadString(fp,section,"AnswerSound",nulstr,value)); SAFECOPY(bbs->hangup_sound - ,iniGetString(fp,section,"HangupSound",nulstr,value)); + ,iniReadString(fp,section,"HangupSound",nulstr,value)); bbs->log_mask - =iniGetBitField(fp,section,strLogMask,log_mask_bits,global->log_mask); + =iniReadBitField(fp,section,strLogMask,log_mask_bits,global->log_mask); bbs->options - =iniGetBitField(fp,section,strOptions,bbs_options + =iniReadBitField(fp,section,strOptions,bbs_options ,BBS_OPT_XTRN_MINIMIZED|BBS_OPT_SYSOP_AVAILABLE); } @@ -231,48 +231,48 @@ void sbbs_read_ini( section = "FTP"; if(run_ftp!=NULL) - *run_ftp=iniGetBool(fp,section,"AutoStart",TRUE); + *run_ftp=iniReadBool(fp,section,"AutoStart",TRUE); ftp->interface_addr - =iniGetIpAddress(fp,section,strInterface,global->interface_addr); + =iniReadIpAddress(fp,section,strInterface,global->interface_addr); ftp->port - =iniGetShortInt(fp,section,"Port",IPPORT_FTP); + =iniReadShortInt(fp,section,"Port",IPPORT_FTP); ftp->max_clients - =iniGetShortInt(fp,section,"MaxClients",10); + =iniReadShortInt(fp,section,"MaxClients",10); ftp->max_inactivity - =iniGetShortInt(fp,section,"MaxInactivity",300); /* seconds */ + =iniReadShortInt(fp,section,"MaxInactivity",300); /* seconds */ ftp->qwk_timeout - =iniGetShortInt(fp,section,"QwkTimeout",600); /* seconds */ + =iniReadShortInt(fp,section,"QwkTimeout",600); /* seconds */ ftp->sem_chk_freq - =iniGetShortInt(fp,section,strSemFileCheckFrequency,global->sem_chk_freq); + =iniReadShortInt(fp,section,strSemFileCheckFrequency,global->sem_chk_freq); /* JavaScript Operating Parameters */ ftp->js_max_bytes - =iniGetInteger(fp,section,strJavaScriptMaxBytes ,global->js.max_bytes); + =iniReadInteger(fp,section,strJavaScriptMaxBytes ,global->js.max_bytes); ftp->js_cx_stack - =iniGetInteger(fp,section,strJavaScriptContextStack ,global->js.cx_stack); + =iniReadInteger(fp,section,strJavaScriptContextStack ,global->js.cx_stack); SAFECOPY(ftp->host_name - ,iniGetString(fp,section,strHostName,global->host_name,value)); + ,iniReadString(fp,section,strHostName,global->host_name,value)); SAFECOPY(ftp->index_file_name - ,iniGetString(fp,section,"IndexFileName","00index",value)); + ,iniReadString(fp,section,"IndexFileName","00index",value)); SAFECOPY(ftp->html_index_file - ,iniGetString(fp,section,"HtmlIndexFile","00index.html",value)); + ,iniReadString(fp,section,"HtmlIndexFile","00index.html",value)); SAFECOPY(ftp->html_index_script - ,iniGetString(fp,section,"HtmlIndexScript","ftp-html.js",value)); + ,iniReadString(fp,section,"HtmlIndexScript","ftp-html.js",value)); SAFECOPY(ftp->answer_sound - ,iniGetString(fp,section,"AnswerSound",nulstr,value)); + ,iniReadString(fp,section,"AnswerSound",nulstr,value)); SAFECOPY(ftp->hangup_sound - ,iniGetString(fp,section,"HangupSound",nulstr,value)); + ,iniReadString(fp,section,"HangupSound",nulstr,value)); SAFECOPY(ftp->hack_sound - ,iniGetString(fp,section,"HackAttemptSound",nulstr,value)); + ,iniReadString(fp,section,"HackAttemptSound",nulstr,value)); ftp->log_mask - =iniGetBitField(fp,section,strLogMask,log_mask_bits,global->log_mask); + =iniReadBitField(fp,section,strLogMask,log_mask_bits,global->log_mask); ftp->options - =iniGetBitField(fp,section,strOptions,ftp_options + =iniReadBitField(fp,section,strOptions,ftp_options ,FTP_OPT_INDEX_FILE|FTP_OPT_HTML_INDEX_FILE|FTP_OPT_ALLOW_QWK); } @@ -282,74 +282,74 @@ void sbbs_read_ini( section = "Mail"; if(run_mail!=NULL) - *run_mail=iniGetBool(fp,section,"AutoStart",TRUE); + *run_mail=iniReadBool(fp,section,"AutoStart",TRUE); mail->interface_addr - =iniGetIpAddress(fp,section,strInterface,global->interface_addr); + =iniReadIpAddress(fp,section,strInterface,global->interface_addr); mail->smtp_port - =iniGetShortInt(fp,section,"SMTPPort",IPPORT_SMTP); + =iniReadShortInt(fp,section,"SMTPPort",IPPORT_SMTP); mail->pop3_port - =iniGetShortInt(fp,section,"POP3Port",IPPORT_POP3); + =iniReadShortInt(fp,section,"POP3Port",IPPORT_POP3); mail->relay_port - =iniGetShortInt(fp,section,"RelayPort",IPPORT_SMTP); + =iniReadShortInt(fp,section,"RelayPort",IPPORT_SMTP); mail->max_clients - =iniGetShortInt(fp,section,"MaxClients",10); + =iniReadShortInt(fp,section,"MaxClients",10); mail->max_inactivity - =iniGetShortInt(fp,section,"MaxInactivity",120); /* seconds */ + =iniReadShortInt(fp,section,"MaxInactivity",120); /* seconds */ mail->max_delivery_attempts - =iniGetShortInt(fp,section,"MaxDeliveryAttempts",50); + =iniReadShortInt(fp,section,"MaxDeliveryAttempts",50); mail->rescan_frequency - =iniGetShortInt(fp,section,"RescanFrequency",3600); /* 60 minutes */ + =iniReadShortInt(fp,section,"RescanFrequency",3600); /* 60 minutes */ mail->sem_chk_freq - =iniGetShortInt(fp,section,strSemFileCheckFrequency,global->sem_chk_freq); + =iniReadShortInt(fp,section,strSemFileCheckFrequency,global->sem_chk_freq); mail->lines_per_yield - =iniGetShortInt(fp,section,"LinesPerYield",10); + =iniReadShortInt(fp,section,"LinesPerYield",10); mail->max_recipients - =iniGetShortInt(fp,section,"MaxRecipients",100); + =iniReadShortInt(fp,section,"MaxRecipients",100); mail->max_msg_size - =iniGetInteger(fp,section,"MaxMsgSize",DEFAULT_MAX_MSG_SIZE); + =iniReadInteger(fp,section,"MaxMsgSize",DEFAULT_MAX_MSG_SIZE); SAFECOPY(mail->host_name - ,iniGetString(fp,section,strHostName,global->host_name,value)); + ,iniReadString(fp,section,strHostName,global->host_name,value)); SAFECOPY(mail->relay_server - ,iniGetString(fp,section,"RelayServer",mail->relay_server,value)); + ,iniReadString(fp,section,"RelayServer",mail->relay_server,value)); SAFECOPY(mail->relay_user - ,iniGetString(fp,section,"RelayUsername",mail->relay_user,value)); + ,iniReadString(fp,section,"RelayUsername",mail->relay_user,value)); SAFECOPY(mail->relay_pass - ,iniGetString(fp,section,"RelayPassword",mail->relay_pass,value)); + ,iniReadString(fp,section,"RelayPassword",mail->relay_pass,value)); SAFECOPY(mail->dns_server - ,iniGetString(fp,section,"DNSServer",mail->dns_server,value)); + ,iniReadString(fp,section,"DNSServer",mail->dns_server,value)); SAFECOPY(mail->default_user - ,iniGetString(fp,section,"DefaultUser",nulstr,value)); + ,iniReadString(fp,section,"DefaultUser",nulstr,value)); SAFECOPY(mail->dnsbl_hdr - ,iniGetString(fp,section,"DNSBlacklistHeader","X-DNSBL",value)); + ,iniReadString(fp,section,"DNSBlacklistHeader","X-DNSBL",value)); SAFECOPY(mail->dnsbl_tag - ,iniGetString(fp,section,"DNSBlacklistSubject","SPAM",value)); + ,iniReadString(fp,section,"DNSBlacklistSubject","SPAM",value)); SAFECOPY(mail->pop3_sound - ,iniGetString(fp,section,"POP3Sound",nulstr,value)); + ,iniReadString(fp,section,"POP3Sound",nulstr,value)); SAFECOPY(mail->inbound_sound - ,iniGetString(fp,section,"InboundSound",nulstr,value)); + ,iniReadString(fp,section,"InboundSound",nulstr,value)); SAFECOPY(mail->outbound_sound - ,iniGetString(fp,section,"OutboundSound",nulstr,value)); + ,iniReadString(fp,section,"OutboundSound",nulstr,value)); SAFECOPY(mail->proc_cfg_file - ,iniGetString(fp,section,"ProcessConfigFile","mailproc.cfg",value)); + ,iniReadString(fp,section,"ProcessConfigFile","mailproc.cfg",value)); /* JavaScript Operating Parameters */ mail->js_max_bytes - =iniGetInteger(fp,section,strJavaScriptMaxBytes ,global->js.max_bytes); + =iniReadInteger(fp,section,strJavaScriptMaxBytes ,global->js.max_bytes); mail->js_cx_stack - =iniGetInteger(fp,section,strJavaScriptContextStack ,global->js.cx_stack); + =iniReadInteger(fp,section,strJavaScriptContextStack ,global->js.cx_stack); mail->log_mask - =iniGetBitField(fp,section,strLogMask,log_mask_bits,global->log_mask); + =iniReadBitField(fp,section,strLogMask,log_mask_bits,global->log_mask); mail->options - =iniGetBitField(fp,section,strOptions,mail_options + =iniReadBitField(fp,section,strOptions,mail_options ,MAIL_OPT_ALLOW_POP3); } @@ -359,44 +359,44 @@ void sbbs_read_ini( section = "Services"; if(run_services!=NULL) - *run_services=iniGetBool(fp,section,"AutoStart",TRUE); + *run_services=iniReadBool(fp,section,"AutoStart",TRUE); services->interface_addr - =iniGetIpAddress(fp,section,strInterface,global->interface_addr); + =iniReadIpAddress(fp,section,strInterface,global->interface_addr); services->sem_chk_freq - =iniGetShortInt(fp,section,strSemFileCheckFrequency,global->sem_chk_freq); + =iniReadShortInt(fp,section,strSemFileCheckFrequency,global->sem_chk_freq); /* Configurable JavaScript default parameters */ services->js_max_bytes - =iniGetInteger(fp,section,strJavaScriptMaxBytes ,global->js.max_bytes); + =iniReadInteger(fp,section,strJavaScriptMaxBytes ,global->js.max_bytes); services->js_cx_stack - =iniGetInteger(fp,section,strJavaScriptContextStack ,global->js.cx_stack); + =iniReadInteger(fp,section,strJavaScriptContextStack ,global->js.cx_stack); services->js_branch_limit - =iniGetInteger(fp,section,strJavaScriptBranchLimit ,global->js.branch_limit); + =iniReadInteger(fp,section,strJavaScriptBranchLimit ,global->js.branch_limit); services->js_gc_interval - =iniGetInteger(fp,section,strJavaScriptGcInterval ,global->js.gc_interval); + =iniReadInteger(fp,section,strJavaScriptGcInterval ,global->js.gc_interval); services->js_yield_interval - =iniGetInteger(fp,section,strJavaScriptYieldInterval,global->js.yield_interval); + =iniReadInteger(fp,section,strJavaScriptYieldInterval,global->js.yield_interval); SAFECOPY(services->host_name - ,iniGetString(fp,section,strHostName,global->host_name,value)); + ,iniReadString(fp,section,strHostName,global->host_name,value)); SAFECOPY(services->ini_file - ,iniGetString(fp,section,"iniFile","services.ini",value)); + ,iniReadString(fp,section,"iniFile","services.ini",value)); SAFECOPY(services->cfg_file - ,iniGetString(fp,section,"ConfigFile","services.cfg",value)); + ,iniReadString(fp,section,"ConfigFile","services.cfg",value)); SAFECOPY(services->answer_sound - ,iniGetString(fp,section,"AnswerSound",nulstr,value)); + ,iniReadString(fp,section,"AnswerSound",nulstr,value)); SAFECOPY(services->hangup_sound - ,iniGetString(fp,section,"HangupSound",nulstr,value)); + ,iniReadString(fp,section,"HangupSound",nulstr,value)); services->log_mask - =iniGetBitField(fp,section,strLogMask,log_mask_bits,global->log_mask); + =iniReadBitField(fp,section,strLogMask,log_mask_bits,global->log_mask); services->options - =iniGetBitField(fp,section,strOptions,service_options + =iniReadBitField(fp,section,strOptions,service_options ,BBS_OPT_NO_HOST_LOOKUP); } @@ -406,54 +406,54 @@ void sbbs_read_ini( section = "Web"; if(run_web!=NULL) - *run_web=iniGetBool(fp,section,"AutoStart",FALSE); + *run_web=iniReadBool(fp,section,"AutoStart",FALSE); web->interface_addr - =iniGetIpAddress(fp,section,strInterface,global->interface_addr); + =iniReadIpAddress(fp,section,strInterface,global->interface_addr); web->port - =iniGetShortInt(fp,section,"Port",IPPORT_HTTP); + =iniReadShortInt(fp,section,"Port",IPPORT_HTTP); web->sem_chk_freq - =iniGetShortInt(fp,section,strSemFileCheckFrequency,global->sem_chk_freq); + =iniReadShortInt(fp,section,strSemFileCheckFrequency,global->sem_chk_freq); /* JavaScript Operating Parameters */ web->js_max_bytes - =iniGetInteger(fp,section,strJavaScriptMaxBytes ,global->js.max_bytes); + =iniReadInteger(fp,section,strJavaScriptMaxBytes ,global->js.max_bytes); web->js_cx_stack - =iniGetInteger(fp,section,strJavaScriptContextStack ,global->js.cx_stack); + =iniReadInteger(fp,section,strJavaScriptContextStack ,global->js.cx_stack); SAFECOPY(web->host_name - ,iniGetString(fp,section,strHostName,global->host_name,value)); + ,iniReadString(fp,section,strHostName,global->host_name,value)); SAFECOPY(web->root_dir - ,iniGetString(fp,section,"RootDirectory",WEB_DEFAULT_ROOT_DIR,value)); + ,iniReadString(fp,section,"RootDirectory",WEB_DEFAULT_ROOT_DIR,value)); SAFECOPY(web->error_dir - ,iniGetString(fp,section,"ErrorDirectory",WEB_DEFAULT_ERROR_DIR,value)); + ,iniReadString(fp,section,"ErrorDirectory",WEB_DEFAULT_ERROR_DIR,value)); SAFECOPY(web->cgi_dir - ,iniGetString(fp,section,"CGIDirectory",WEB_DEFAULT_CGI_DIR,value)); + ,iniReadString(fp,section,"CGIDirectory",WEB_DEFAULT_CGI_DIR,value)); iniFreeStringList(web->index_file_name); web->index_file_name - =iniGetStringList(fp,section,"IndexFileNames", "," ,"index.html,index.ssjs"); + =iniReadStringList(fp,section,"IndexFileNames", "," ,"index.html,index.ssjs"); iniFreeStringList(web->cgi_ext); web->cgi_ext - =iniGetStringList(fp,section,"CGIExtensions", "," ,".cgi"); + =iniReadStringList(fp,section,"CGIExtensions", "," ,".cgi"); SAFECOPY(web->ssjs_ext - ,iniGetString(fp,section,"JavaScriptExtension",".ssjs",value)); + ,iniReadString(fp,section,"JavaScriptExtension",".ssjs",value)); web->max_inactivity - =iniGetShortInt(fp,section,"MaxInactivity",120); /* seconds */ + =iniReadShortInt(fp,section,"MaxInactivity",120); /* seconds */ web->max_cgi_inactivity - =iniGetShortInt(fp,section,"MaxCgiInactivity",120); /* seconds */ + =iniReadShortInt(fp,section,"MaxCgiInactivity",120); /* seconds */ default_cgi_temp = _PATH_TMP; SAFECOPY(web->cgi_temp_dir - ,iniGetString(fp,section,"CGITempDirectory",default_cgi_temp,value)); + ,iniReadString(fp,section,"CGITempDirectory",default_cgi_temp,value)); web->log_mask - =iniGetBitField(fp,section,strLogMask,log_mask_bits,global->log_mask); + =iniReadBitField(fp,section,strLogMask,log_mask_bits,global->log_mask); web->options - =iniGetBitField(fp,section,strOptions,web_options + =iniReadBitField(fp,section,strOptions,web_options ,BBS_OPT_NO_HOST_LOOKUP); } } diff --git a/src/sbbs3/sbbscon.c b/src/sbbs3/sbbscon.c index 0dca4133a4..21133e2341 100644 --- a/src/sbbs3/sbbscon.c +++ b/src/sbbs3/sbbscon.c @@ -762,11 +762,11 @@ static void read_startup_ini(void) #if defined(__unix__) { char value[INI_MAX_VALUE_LEN]; - SAFECOPY(new_uid_name,iniGetString(fp,"UNIX","User","",value)); - SAFECOPY(new_gid_name,iniGetString(fp,"UNIX","Group","",value)); - is_daemon=iniGetBool(fp,"UNIX","Daemonize",FALSE); - SAFECOPY(daemon_type,iniGetString(fp,"UNIX","LogFacility","U",value)); - umask(iniGetInteger(fp,"UNIX","umask",077)); + SAFECOPY(new_uid_name,iniReadString(fp,"UNIX","User","",value)); + SAFECOPY(new_gid_name,iniReadString(fp,"UNIX","Group","",value)); + is_daemon=iniReadBool(fp,"UNIX","Daemonize",FALSE); + SAFECOPY(daemon_type,iniReadString(fp,"UNIX","LogFacility","U",value)); + umask(iniReadInteger(fp,"UNIX","umask",077)); } #endif /* close .ini file here */ diff --git a/src/sbbs3/services.c b/src/sbbs3/services.c index 1b208698a9..d903d1e83e 100644 --- a/src/sbbs3/services.c +++ b/src/sbbs3/services.c @@ -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 2003 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2004 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 * @@ -1506,24 +1506,24 @@ static service_t* read_services_ini(service_t* service, char* services_ini, DWOR return(service); lprintf(LOG_INFO,"Reading %s",services_ini); - sec_list = iniGetSectionList(fp,""); + sec_list = iniReadSectionList(fp,""); for(i=0; sec_list!=NULL && sec_list[i]!=NULL; i++) { memset(&serv,0,sizeof(service_t)); - SAFECOPY(serv.protocol,iniGetString(fp,sec_list[i],"Protocol",sec_list[i],prot)); + SAFECOPY(serv.protocol,iniReadString(fp,sec_list[i],"Protocol",sec_list[i],prot)); serv.socket=INVALID_SOCKET; - serv.interface_addr=iniGetIpAddress(fp,sec_list[i],"Interface",startup->interface_addr); - serv.port=iniGetShortInt(fp,sec_list[i],"Port",0); - serv.max_clients=iniGetInteger(fp,sec_list[i],"MaxClients",0); - serv.listen_backlog=iniGetInteger(fp,sec_list[i],"ListenBacklog",DEFAULT_LISTEN_BACKLOG); - serv.options=iniGetBitField(fp,sec_list[i],"Options",service_options,0); - SAFECOPY(serv.cmd,iniGetString(fp,sec_list[i],"Command","",cmd)); + serv.interface_addr=iniReadIpAddress(fp,sec_list[i],"Interface",startup->interface_addr); + serv.port=iniReadShortInt(fp,sec_list[i],"Port",0); + serv.max_clients=iniReadInteger(fp,sec_list[i],"MaxClients",0); + serv.listen_backlog=iniReadInteger(fp,sec_list[i],"ListenBacklog",DEFAULT_LISTEN_BACKLOG); + serv.options=iniReadBitField(fp,sec_list[i],"Options",service_options,0); + SAFECOPY(serv.cmd,iniReadString(fp,sec_list[i],"Command","",cmd)); /* JavaScript operating parameters */ - serv.js_max_bytes=iniGetInteger(fp,sec_list[i] ,strJavaScriptMaxBytes ,startup->js_max_bytes); - serv.js_cx_stack=iniGetInteger(fp,sec_list[i] ,strJavaScriptContextStack ,startup->js_cx_stack); - serv.js_branch_limit=iniGetInteger(fp,sec_list[i] ,strJavaScriptBranchLimit ,startup->js_branch_limit); - serv.js_gc_interval=iniGetInteger(fp,sec_list[i] ,strJavaScriptGcInterval ,startup->js_gc_interval); - serv.js_yield_interval=iniGetInteger(fp,sec_list[i] ,strJavaScriptYieldInterval ,startup->js_yield_interval); + serv.js_max_bytes=iniReadInteger(fp,sec_list[i] ,strJavaScriptMaxBytes ,startup->js_max_bytes); + serv.js_cx_stack=iniReadInteger(fp,sec_list[i] ,strJavaScriptContextStack ,startup->js_cx_stack); + serv.js_branch_limit=iniReadInteger(fp,sec_list[i] ,strJavaScriptBranchLimit ,startup->js_branch_limit); + serv.js_gc_interval=iniReadInteger(fp,sec_list[i] ,strJavaScriptGcInterval ,startup->js_gc_interval); + serv.js_yield_interval=iniReadInteger(fp,sec_list[i] ,strJavaScriptYieldInterval ,startup->js_yield_interval); for(j=0;j<*services;j++) if(service[j].interface_addr==serv.interface_addr && service[j].port==serv.port @@ -1534,11 +1534,11 @@ static service_t* read_services_ini(service_t* service, char* services_ini, DWOR continue; } - if(stricmp(iniGetString(fp,sec_list[i],"Host",startup->host_name,host), startup->host_name)!=0) { + if(stricmp(iniReadString(fp,sec_list[i],"Host",startup->host_name,host), startup->host_name)!=0) { lprintf(LOG_NOTICE,"Ignoring service (%s) for host: %s", sec_list[i], host); continue; } - if(stricmp(iniGetString(fp,sec_list[i],"NotHost","",host), startup->host_name)==0) { + if(stricmp(iniReadString(fp,sec_list[i],"NotHost","",host), startup->host_name)==0) { lprintf(LOG_NOTICE,"Ignoring service (%s) not for host: %s", sec_list[i], host); continue; } diff --git a/src/syncterm/bbslist.c b/src/syncterm/bbslist.c index f793ef6d50..72b8ab1ac5 100644 --- a/src/syncterm/bbslist.c +++ b/src/syncterm/bbslist.c @@ -42,20 +42,20 @@ void read_list(char *listpath, struct bbslist **list, int *i, int type) str_list_t bbses; if((listfile=fopen(listpath,"r"))!=NULL) { - bbses=iniGetSectionList(listfile,NULL); + bbses=iniReadSectionList(listfile,NULL); while((bbsname=strListPop(&bbses))!=NULL) { if((list[*i]=(struct bbslist *)malloc(sizeof(struct bbslist)))==NULL) break; strcpy(list[*i]->name,bbsname); - iniGetString(listfile,bbsname,"Address","",list[*i]->addr); - list[*i]->port=iniGetShortInt(listfile,bbsname,"Port",513); - list[*i]->added=iniGetInteger(listfile,bbsname,"Added",0); - list[*i]->connected=iniGetInteger(listfile,bbsname,"LastConnected",0); - list[*i]->calls=iniGetInteger(listfile,bbsname,"TotalCalls",0); - iniGetString(listfile,bbsname,"UserName","",list[*i]->user); - iniGetString(listfile,bbsname,"Password","",list[*i]->password); - list[*i]->dumb=iniGetBool(listfile,bbsname,"BeDumb",0); - list[*i]->reversed=iniGetBool(listfile,bbsname,"Reversed",0); + iniReadString(listfile,bbsname,"Address","",list[*i]->addr); + list[*i]->port=iniReadShortInt(listfile,bbsname,"Port",513); + list[*i]->added=iniReadInteger(listfile,bbsname,"Added",0); + list[*i]->connected=iniReadInteger(listfile,bbsname,"LastConnected",0); + list[*i]->calls=iniReadInteger(listfile,bbsname,"TotalCalls",0); + iniReadString(listfile,bbsname,"UserName","",list[*i]->user); + iniReadString(listfile,bbsname,"Password","",list[*i]->password); + list[*i]->dumb=iniReadBool(listfile,bbsname,"BeDumb",0); + list[*i]->reversed=iniReadBool(listfile,bbsname,"Reversed",0); list[*i]->type=type; list[*i]->id=*i; (*i)++; diff --git a/src/xpdev/ini_file.c b/src/xpdev/ini_file.c index 810e746bb1..ca408106dc 100644 --- a/src/xpdev/ini_file.c +++ b/src/xpdev/ini_file.c @@ -469,7 +469,7 @@ char* iniSetStringList(str_list_t* list, const char* section, const char* key return iniSetString(list, section, key, value, style); } -char* iniGetString(FILE* fp, const char* section, const char* key, const char* deflt, char* value) +char* iniReadString(FILE* fp, const char* section, const char* key, const char* deflt, char* value) { if(get_value(fp,section,key,value)==NULL || *value==0 /* blank */) { if(deflt==NULL) @@ -480,7 +480,7 @@ char* iniGetString(FILE* fp, const char* section, const char* key, const char* d return(value); } -str_list_t iniGetStringList(FILE* fp, const char* section, const char* key +str_list_t iniReadStringList(FILE* fp, const char* section, const char* key ,const char* sep, const char* deflt) { char* value; @@ -536,7 +536,7 @@ void* iniFreeNamedStringList(named_string_t** list) return(NULL); } -str_list_t iniGetSectionList(FILE* fp, const char* prefix) +str_list_t iniReadSectionList(FILE* fp, const char* prefix) { char* p; char str[INI_MAX_LINE_LEN]; @@ -566,7 +566,7 @@ str_list_t iniGetSectionList(FILE* fp, const char* prefix) return(lp); } -str_list_t iniGetKeyList(FILE* fp, const char* section) +str_list_t iniReadKeyList(FILE* fp, const char* section) { char* p; char* vp; @@ -600,7 +600,7 @@ str_list_t iniGetKeyList(FILE* fp, const char* section) } named_string_t** -iniGetNamedStringList(FILE* fp, const char* section) +iniReadNamedStringList(FILE* fp, const char* section) { char* name; char* value; @@ -650,7 +650,7 @@ iniGetNamedStringList(FILE* fp, const char* section) /* These functions read a single key of the specified type */ -long iniGetInteger(FILE* fp, const char* section, const char* key, long deflt) +long iniReadInteger(FILE* fp, const char* section, const char* key, long deflt) { char* value; char buf[INI_MAX_VALUE_LEN]; @@ -664,13 +664,13 @@ long iniGetInteger(FILE* fp, const char* section, const char* key, long deflt) return(strtol(value,NULL,0)); } -ushort iniGetShortInt(FILE* fp, const char* section, const char* key, ushort deflt) +ushort iniReadShortInt(FILE* fp, const char* section, const char* key, ushort deflt) { - return((ushort)iniGetInteger(fp, section, key, deflt)); + return((ushort)iniReadInteger(fp, section, key, deflt)); } #if !defined(NO_SOCKET_SUPPORT) -ulong iniGetIpAddress(FILE* fp, const char* section, const char* key, ulong deflt) +ulong iniReadIpAddress(FILE* fp, const char* section, const char* key, ulong deflt) { char buf[INI_MAX_VALUE_LEN]; char* value; @@ -688,7 +688,7 @@ ulong iniGetIpAddress(FILE* fp, const char* section, const char* key, ulong defl } #endif -double iniGetFloat(FILE* fp, const char* section, const char* key, double deflt) +double iniReadFloat(FILE* fp, const char* section, const char* key, double deflt) { char buf[INI_MAX_VALUE_LEN]; char* value; @@ -702,7 +702,7 @@ double iniGetFloat(FILE* fp, const char* section, const char* key, double deflt) return(atof(value)); } -BOOL iniGetBool(FILE* fp, const char* section, const char* key, BOOL deflt) +BOOL iniReadBool(FILE* fp, const char* section, const char* key, BOOL deflt) { char buf[INI_MAX_VALUE_LEN]; char* value; @@ -721,7 +721,7 @@ BOOL iniGetBool(FILE* fp, const char* section, const char* key, BOOL deflt) return(strtol(value,NULL,0)); } -ulong iniGetBitField(FILE* fp, const char* section, const char* key, +ulong iniReadBitField(FILE* fp, const char* section, const char* key, ini_bitdesc_t* bitdesc, ulong deflt) { int i; diff --git a/src/xpdev/ini_file.h b/src/xpdev/ini_file.h index b3317b8821..fadd514e5f 100644 --- a/src/xpdev/ini_file.h +++ b/src/xpdev/ini_file.h @@ -63,35 +63,35 @@ extern "C" { /* Read all section names and return as an allocated string list */ /* Optionally (if prefix!=NULL), returns a subset of section names */ -str_list_t iniGetSectionList (FILE*, const char* prefix); +str_list_t iniReadSectionList(FILE*, const char* prefix); /* Read all key names and return as an allocated string list */ -str_list_t iniGetKeyList (FILE*, const char* section); +str_list_t iniReadKeyList(FILE*, const char* section); /* Read all key and value pairs and return as a named string list */ named_string_t** - iniGetNamedStringList (FILE*, const char* section); + iniReadNamedStringList (FILE*, const char* section); /* These functions read a single key of the specified type */ -char* iniGetString (FILE*, const char* section, const char* key, +char* iniReadString(FILE*, const char* section, const char* key, const char* deflt, char* value); -str_list_t iniGetStringList(FILE*, const char* section, const char* key +str_list_t iniReadStringList(FILE*, const char* section, const char* key ,const char* sep, const char* deflt); -long iniGetInteger (FILE*, const char* section, const char* key, +long iniReadInteger(FILE*, const char* section, const char* key, long deflt); -ushort iniGetShortInt (FILE*, const char* section, const char* key, +ushort iniReadShortInt(FILE*, const char* section, const char* key, ushort deflt); -ulong iniGetIpAddress(FILE*, const char* section, const char* key, +ulong iniReadIpAddress(FILE*, const char* section, const char* key, ulong deflt); -double iniGetFloat (FILE*, const char* section, const char* key, +double iniReadFloat(FILE*, const char* section, const char* key, double deflt); -BOOL iniGetBool (FILE*, const char* section, const char* key, +BOOL iniReadBool(FILE*, const char* section, const char* key, BOOL deflt); -ulong iniGetBitField (FILE*, const char* section, const char* key, +ulong iniReadBitField(FILE*, const char* section, const char* key, ini_bitdesc_t* bitdesc, ulong deflt); -/* Free string list returned from iniGet*List functions */ +/* Free string list returned from iniRead*List functions */ void* iniFreeStringList(str_list_t list); -/* Free named string list returned from iniGetNamedStringList */ +/* Free named string list returned from iniReadNamedStringList */ void* iniFreeNamedStringList(named_string_t** list); -- GitLab