Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
a7b7ec12
Commit
a7b7ec12
authored
22 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Renamed iniRead* functions to iniGet* (since they read, parse, and malloc).
parent
31feb573
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/sbbs3/js_file.c
+12
-14
12 additions, 14 deletions
src/sbbs3/js_file.c
src/sbbs3/sbbs_ini.c
+82
-82
82 additions, 82 deletions
src/sbbs3/sbbs_ini.c
src/xpdev/ini_file.c
+12
-12
12 additions, 12 deletions
src/xpdev/ini_file.c
src/xpdev/ini_file.h
+13
-13
13 additions, 13 deletions
src/xpdev/ini_file.h
with
119 additions
and
121 deletions
src/sbbs3/js_file.c
+
12
−
14
View file @
a7b7ec12
...
...
@@ -422,20 +422,20 @@ js_iniGetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
switch
(
JSVAL_TAG
(
dflt
))
{
case
JSVAL_STRING
:
*
rval
=
STRING_TO_JSVAL
(
JS_NewStringCopyZ
(
cx
,
ini
Read
String
(
p
->
fp
,
section
,
key
ini
Get
String
(
p
->
fp
,
section
,
key
,
JS_GetStringBytes
(
JS_ValueToString
(
cx
,
dflt
)))));
break
;
case
JSVAL_BOOLEAN
:
*
rval
=
BOOLEAN_TO_JSVAL
(
ini
Read
Bool
(
p
->
fp
,
section
,
key
,
JSVAL_TO_BOOLEAN
(
dflt
)));
ini
Get
Bool
(
p
->
fp
,
section
,
key
,
JSVAL_TO_BOOLEAN
(
dflt
)));
break
;
case
JSVAL_DOUBLE
:
JS_NewNumberValue
(
cx
,
ini
Read
Float
(
p
->
fp
,
section
,
key
,
*
JSVAL_TO_DOUBLE
(
dflt
)),
rval
);
,
ini
Get
Float
(
p
->
fp
,
section
,
key
,
*
JSVAL_TO_DOUBLE
(
dflt
)),
rval
);
break
;
case
JSVAL_OBJECT
:
array
=
JS_NewArrayObject
(
cx
,
0
,
NULL
);
list
=
ini
Read
StringList
(
p
->
fp
,
section
,
key
,
","
,
JS_GetStringBytes
(
JS_ValueToString
(
cx
,
dflt
)));
list
=
ini
Get
StringList
(
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
))
...
...
@@ -447,7 +447,7 @@ js_iniGetValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
default:
if
(
JSVAL_IS_INT
(
dflt
))
{
*
rval
=
INT_TO_JSVAL
(
ini
Read
Integer
(
p
->
fp
,
section
,
key
,
JSVAL_TO_INT
(
dflt
)));
ini
Get
Integer
(
p
->
fp
,
section
,
key
,
JSVAL_TO_INT
(
dflt
)));
break
;
}
break
;
...
...
@@ -474,7 +474,7 @@ js_iniGetSections(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *
array
=
JS_NewArrayObject
(
cx
,
0
,
NULL
);
list
=
ini
Read
SectionList
(
p
->
fp
);
list
=
ini
Get
SectionList
(
p
->
fp
);
for
(
i
=
0
;
list
&&
list
[
i
];
i
++
)
{
val
=
STRING_TO_JSVAL
(
JS_NewStringCopyZ
(
cx
,
list
[
i
]));
if
(
!
JS_SetElement
(
cx
,
array
,
i
,
&
val
))
...
...
@@ -507,7 +507,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
=
ini
Read
KeyList
(
p
->
fp
,
section
);
list
=
ini
Get
KeyList
(
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
))
...
...
@@ -524,11 +524,10 @@ static JSBool
js_iniGetObject
(
JSContext
*
cx
,
JSObject
*
obj
,
uintN
argc
,
jsval
*
argv
,
jsval
*
rval
)
{
char
*
section
;
char
*
val
;
char
**
list
;
jsint
i
;
JSObject
*
object
;
private_t
*
p
;
named_string_t
**
list
;
*
rval
=
JSVAL_NULL
;
...
...
@@ -540,15 +539,14 @@ 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
=
ini
ReadKey
List
(
p
->
fp
,
section
);
list
=
ini
GetNamedString
List
(
p
->
fp
,
section
);
for
(
i
=
0
;
list
&&
list
[
i
];
i
++
)
{
if
((
val
=
iniReadString
(
p
->
fp
,
section
,
list
[
i
],
NULL
))
==
NULL
)
continue
;
JS_DefineProperty
(
cx
,
object
,
list
[
i
],
STRING_TO_JSVAL
(
JS_NewStringCopyZ
(
cx
,
val
))
JS_DefineProperty
(
cx
,
object
,
list
[
i
]
->
name
,
STRING_TO_JSVAL
(
JS_NewStringCopyZ
(
cx
,
list
[
i
]
->
value
))
,
NULL
,
NULL
,
JSPROP_ENUMERATE
);
}
iniFreeStringList
(
list
);
iniFree
Named
StringList
(
list
);
*
rval
=
OBJECT_TO_JSVAL
(
object
);
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/sbbs_ini.c
+
82
−
82
View file @
a7b7ec12
...
...
@@ -162,55 +162,55 @@ void sbbs_read_ini(
section
=
"Global"
;
ctrl_dir
=
ini
Read
String
(
fp
,
section
,
"CtrlDirectory"
,
nulstr
);
ctrl_dir
=
ini
Get
String
(
fp
,
section
,
"CtrlDirectory"
,
nulstr
);
if
(
*
ctrl_dir
)
{
SAFECOPY
(
bbs
->
ctrl_dir
,
ctrl_dir
);
SAFECOPY
(
ftp
->
ctrl_dir
,
ctrl_dir
);
SAFECOPY
(
mail
->
ctrl_dir
,
ctrl_dir
);
SAFECOPY
(
services
->
ctrl_dir
,
ctrl_dir
);
}
temp_dir
=
ini
Read
String
(
fp
,
section
,
"TempDirectory"
,
nulstr
);
temp_dir
=
ini
Get
String
(
fp
,
section
,
"TempDirectory"
,
nulstr
);
if
(
*
temp_dir
)
{
SAFECOPY
(
bbs
->
temp_dir
,
ctrl_dir
);
SAFECOPY
(
ftp
->
temp_dir
,
ctrl_dir
);
}
SAFECOPY
(
host_name
,
ini
Read
String
(
fp
,
section
,
"HostName"
,
nulstr
));
js_max_bytes
=
ini
Read
Integer
(
fp
,
section
,
"JavaScriptMaxBytes"
,
0
);
SAFECOPY
(
host_name
,
ini
Get
String
(
fp
,
section
,
"HostName"
,
nulstr
));
js_max_bytes
=
ini
Get
Integer
(
fp
,
section
,
"JavaScriptMaxBytes"
,
0
);
/***********************************************************************/
section
=
"BBS"
;
*
run_bbs
=
ini
Read
Bool
(
fp
,
section
,
"AutoStart"
,
TRUE
);
=
ini
Get
Bool
(
fp
,
section
,
"AutoStart"
,
TRUE
);
bbs
->
telnet_interface
=
ini
Read
IpAddress
(
fp
,
section
,
"TelnetInterface"
,
INADDR_ANY
);
=
ini
Get
IpAddress
(
fp
,
section
,
"TelnetInterface"
,
INADDR_ANY
);
bbs
->
telnet_port
=
ini
Read
ShortInt
(
fp
,
section
,
"TelnetPort"
,
IPPORT_TELNET
);
=
ini
Get
ShortInt
(
fp
,
section
,
"TelnetPort"
,
IPPORT_TELNET
);
bbs
->
rlogin_interface
=
ini
Read
IpAddress
(
fp
,
section
,
"RLoginInterface"
,
INADDR_ANY
);
=
ini
Get
IpAddress
(
fp
,
section
,
"RLoginInterface"
,
INADDR_ANY
);
bbs
->
rlogin_port
=
ini
Read
ShortInt
(
fp
,
section
,
"RLoginPort"
,
513
);
=
ini
Get
ShortInt
(
fp
,
section
,
"RLoginPort"
,
513
);
bbs
->
first_node
=
ini
Read
ShortInt
(
fp
,
section
,
"FirstNode"
,
1
);
=
ini
Get
ShortInt
(
fp
,
section
,
"FirstNode"
,
1
);
bbs
->
last_node
=
ini
Read
ShortInt
(
fp
,
section
,
"LastNode"
,
4
);
=
ini
Get
ShortInt
(
fp
,
section
,
"LastNode"
,
4
);
bbs
->
outbuf_highwater_mark
=
ini
Read
ShortInt
(
fp
,
section
,
"OutbufHighwaterMark"
,
1024
);
=
ini
Get
ShortInt
(
fp
,
section
,
"OutbufHighwaterMark"
,
1024
);
bbs
->
outbuf_drain_timeout
=
ini
Read
ShortInt
(
fp
,
section
,
"OutbufDrainTimeout"
,
10
);
=
ini
Get
ShortInt
(
fp
,
section
,
"OutbufDrainTimeout"
,
10
);
bbs
->
xtrn_polls_before_yield
=
ini
Read
Integer
(
fp
,
section
,
"ExternalYield"
,
10
);
=
ini
Get
Integer
(
fp
,
section
,
"ExternalYield"
,
10
);
bbs
->
js_max_bytes
=
ini
Read
Integer
(
fp
,
section
,
"JavaScriptMaxBytes"
,
js_max_bytes
);
=
ini
Get
Integer
(
fp
,
section
,
"JavaScriptMaxBytes"
,
js_max_bytes
);
SAFECOPY
(
bbs
->
host_name
,
ini
Read
String
(
fp
,
section
,
"HostName"
,
host_name
));
,
ini
Get
String
(
fp
,
section
,
"HostName"
,
host_name
));
/* Set default terminal type to "stock" termcap closest to "ansi-bbs" */
#if defined(__FreeBSD__)
...
...
@@ -220,9 +220,9 @@ void sbbs_read_ini(
#endif
SAFECOPY
(
bbs
->
xtrn_term_ansi
,
ini
Read
String
(
fp
,
section
,
"ExternalTermANSI"
,
default_term_ansi
));
,
ini
Get
String
(
fp
,
section
,
"ExternalTermANSI"
,
default_term_ansi
));
SAFECOPY
(
bbs
->
xtrn_term_dumb
,
ini
Read
String
(
fp
,
section
,
"ExternalTermDumb"
,
"dumb"
));
,
ini
Get
String
(
fp
,
section
,
"ExternalTermDumb"
,
"dumb"
));
#if defined(__FreeBSD__)
default_dosemu_path
=
"/usr/bin/doscmd"
;
...
...
@@ -231,177 +231,177 @@ void sbbs_read_ini(
#endif
SAFECOPY
(
bbs
->
dosemu_path
,
ini
Read
String
(
fp
,
section
,
"DOSemuPath"
,
default_dosemu_path
));
,
ini
Get
String
(
fp
,
section
,
"DOSemuPath"
,
default_dosemu_path
));
SAFECOPY
(
bbs
->
answer_sound
,
ini
Read
String
(
fp
,
section
,
"AnswerSound"
,
nulstr
));
,
ini
Get
String
(
fp
,
section
,
"AnswerSound"
,
nulstr
));
SAFECOPY
(
bbs
->
hangup_sound
,
ini
Read
String
(
fp
,
section
,
"HangupSound"
,
nulstr
));
,
ini
Get
String
(
fp
,
section
,
"HangupSound"
,
nulstr
));
bbs
->
options
=
ini
Read
BitField
(
fp
,
section
,
"Options"
,
bbs_options
=
ini
Get
BitField
(
fp
,
section
,
"Options"
,
bbs_options
,
BBS_OPT_XTRN_MINIMIZED
|
BBS_OPT_SYSOP_AVAILABLE
);
/***********************************************************************/
section
=
"FTP"
;
*
run_ftp
=
ini
Read
Bool
(
fp
,
section
,
"AutoStart"
,
TRUE
);
=
ini
Get
Bool
(
fp
,
section
,
"AutoStart"
,
TRUE
);
ftp
->
interface_addr
=
ini
Read
IpAddress
(
fp
,
section
,
"Interface"
,
INADDR_ANY
);
=
ini
Get
IpAddress
(
fp
,
section
,
"Interface"
,
INADDR_ANY
);
ftp
->
port
=
ini
Read
ShortInt
(
fp
,
section
,
"Port"
,
ftp
->
port
);
=
ini
Get
ShortInt
(
fp
,
section
,
"Port"
,
ftp
->
port
);
ftp
->
max_clients
=
ini
Read
ShortInt
(
fp
,
section
,
"MaxClients"
,
10
);
=
ini
Get
ShortInt
(
fp
,
section
,
"MaxClients"
,
10
);
ftp
->
max_inactivity
=
ini
Read
ShortInt
(
fp
,
section
,
"MaxInactivity"
,
300
);
/* seconds */
=
ini
Get
ShortInt
(
fp
,
section
,
"MaxInactivity"
,
300
);
/* seconds */
ftp
->
qwk_timeout
=
ini
Read
ShortInt
(
fp
,
section
,
"QwkTimeout"
,
600
);
/* seconds */
=
ini
Get
ShortInt
(
fp
,
section
,
"QwkTimeout"
,
600
);
/* seconds */
ftp
->
js_max_bytes
=
ini
Read
Integer
(
fp
,
section
,
"JavaScriptMaxBytes"
,
js_max_bytes
);
=
ini
Get
Integer
(
fp
,
section
,
"JavaScriptMaxBytes"
,
js_max_bytes
);
SAFECOPY
(
ftp
->
host_name
,
ini
Read
String
(
fp
,
section
,
"HostName"
,
host_name
));
,
ini
Get
String
(
fp
,
section
,
"HostName"
,
host_name
));
SAFECOPY
(
ftp
->
index_file_name
,
ini
Read
String
(
fp
,
section
,
"IndexFileName"
,
"00index"
));
,
ini
Get
String
(
fp
,
section
,
"IndexFileName"
,
"00index"
));
SAFECOPY
(
ftp
->
html_index_file
,
ini
Read
String
(
fp
,
section
,
"HtmlIndexFile"
,
"00index.html"
));
,
ini
Get
String
(
fp
,
section
,
"HtmlIndexFile"
,
"00index.html"
));
SAFECOPY
(
ftp
->
html_index_script
,
ini
Read
String
(
fp
,
section
,
"HtmlIndexScript"
,
"ftp-html.js"
));
,
ini
Get
String
(
fp
,
section
,
"HtmlIndexScript"
,
"ftp-html.js"
));
SAFECOPY
(
ftp
->
answer_sound
,
ini
Read
String
(
fp
,
section
,
"AnswerSound"
,
nulstr
));
,
ini
Get
String
(
fp
,
section
,
"AnswerSound"
,
nulstr
));
SAFECOPY
(
ftp
->
hangup_sound
,
ini
Read
String
(
fp
,
section
,
"HangupSound"
,
nulstr
));
,
ini
Get
String
(
fp
,
section
,
"HangupSound"
,
nulstr
));
SAFECOPY
(
ftp
->
hack_sound
,
ini
Read
String
(
fp
,
section
,
"HackAttemptSound"
,
nulstr
));
,
ini
Get
String
(
fp
,
section
,
"HackAttemptSound"
,
nulstr
));
ftp
->
options
=
ini
Read
BitField
(
fp
,
section
,
"Options"
,
ftp_options
=
ini
Get
BitField
(
fp
,
section
,
"Options"
,
ftp_options
,
FTP_OPT_INDEX_FILE
|
FTP_OPT_HTML_INDEX_FILE
|
FTP_OPT_ALLOW_QWK
);
/***********************************************************************/
section
=
"Mail"
;
*
run_mail
=
ini
Read
Bool
(
fp
,
section
,
"AutoStart"
,
TRUE
);
=
ini
Get
Bool
(
fp
,
section
,
"AutoStart"
,
TRUE
);
mail
->
interface_addr
=
ini
Read
IpAddress
(
fp
,
section
,
"Interface"
,
INADDR_ANY
);
=
ini
Get
IpAddress
(
fp
,
section
,
"Interface"
,
INADDR_ANY
);
mail
->
smtp_port
=
ini
Read
ShortInt
(
fp
,
section
,
"SMTPPort"
,
IPPORT_SMTP
);
=
ini
Get
ShortInt
(
fp
,
section
,
"SMTPPort"
,
IPPORT_SMTP
);
mail
->
pop3_port
=
ini
Read
ShortInt
(
fp
,
section
,
"POP3Port"
,
IPPORT_POP3
);
=
ini
Get
ShortInt
(
fp
,
section
,
"POP3Port"
,
IPPORT_POP3
);
mail
->
relay_port
=
ini
Read
ShortInt
(
fp
,
section
,
"RelayPort"
,
IPPORT_SMTP
);
=
ini
Get
ShortInt
(
fp
,
section
,
"RelayPort"
,
IPPORT_SMTP
);
mail
->
max_clients
=
ini
Read
ShortInt
(
fp
,
section
,
"MaxClients"
,
10
);
=
ini
Get
ShortInt
(
fp
,
section
,
"MaxClients"
,
10
);
mail
->
max_inactivity
=
ini
Read
ShortInt
(
fp
,
section
,
"MaxInactivity"
,
120
);
/* seconds */
=
ini
Get
ShortInt
(
fp
,
section
,
"MaxInactivity"
,
120
);
/* seconds */
mail
->
max_delivery_attempts
=
ini
Read
ShortInt
(
fp
,
section
,
"MaxDeliveryAttempts"
,
50
);
=
ini
Get
ShortInt
(
fp
,
section
,
"MaxDeliveryAttempts"
,
50
);
mail
->
rescan_frequency
=
ini
Read
ShortInt
(
fp
,
section
,
"RescanFrequency"
,
3600
);
/* 60 minutes */
=
ini
Get
ShortInt
(
fp
,
section
,
"RescanFrequency"
,
3600
);
/* 60 minutes */
mail
->
lines_per_yield
=
ini
Read
ShortInt
(
fp
,
section
,
"LinesPerYield"
,
10
);
=
ini
Get
ShortInt
(
fp
,
section
,
"LinesPerYield"
,
10
);
mail
->
max_recipients
=
ini
Read
ShortInt
(
fp
,
section
,
"MaxRecipients"
,
100
);
=
ini
Get
ShortInt
(
fp
,
section
,
"MaxRecipients"
,
100
);
mail
->
max_msg_size
=
ini
Read
Integer
(
fp
,
section
,
"MaxMsgSize"
,
10
*
1024
*
1024
);
/* 10MB */
=
ini
Get
Integer
(
fp
,
section
,
"MaxMsgSize"
,
10
*
1024
*
1024
);
/* 10MB */
SAFECOPY
(
mail
->
host_name
,
ini
Read
String
(
fp
,
section
,
"HostName"
,
host_name
));
,
ini
Get
String
(
fp
,
section
,
"HostName"
,
host_name
));
SAFECOPY
(
mail
->
relay_server
,
ini
Read
String
(
fp
,
section
,
"RelayServer"
,
mail
->
relay_server
));
,
ini
Get
String
(
fp
,
section
,
"RelayServer"
,
mail
->
relay_server
));
SAFECOPY
(
mail
->
dns_server
,
ini
Read
String
(
fp
,
section
,
"DNSServer"
,
mail
->
dns_server
));
,
ini
Get
String
(
fp
,
section
,
"DNSServer"
,
mail
->
dns_server
));
SAFECOPY
(
mail
->
default_user
,
ini
Read
String
(
fp
,
section
,
"DefaultUser"
,
nulstr
));
,
ini
Get
String
(
fp
,
section
,
"DefaultUser"
,
nulstr
));
SAFECOPY
(
mail
->
dnsbl_hdr
,
ini
Read
String
(
fp
,
section
,
"DNSBlacklistHeader"
,
"X-DNSBL"
));
,
ini
Get
String
(
fp
,
section
,
"DNSBlacklistHeader"
,
"X-DNSBL"
));
SAFECOPY
(
mail
->
dnsbl_tag
,
ini
Read
String
(
fp
,
section
,
"DNSBlacklistSubject"
,
"SPAM"
));
,
ini
Get
String
(
fp
,
section
,
"DNSBlacklistSubject"
,
"SPAM"
));
SAFECOPY
(
mail
->
pop3_sound
,
ini
Read
String
(
fp
,
section
,
"POP3Sound"
,
nulstr
));
,
ini
Get
String
(
fp
,
section
,
"POP3Sound"
,
nulstr
));
SAFECOPY
(
mail
->
inbound_sound
,
ini
Read
String
(
fp
,
section
,
"InboundSound"
,
nulstr
));
,
ini
Get
String
(
fp
,
section
,
"InboundSound"
,
nulstr
));
SAFECOPY
(
mail
->
outbound_sound
,
ini
Read
String
(
fp
,
section
,
"OutboundSound"
,
nulstr
));
,
ini
Get
String
(
fp
,
section
,
"OutboundSound"
,
nulstr
));
SAFECOPY
(
mail
->
proc_cfg_file
,
ini
Read
String
(
fp
,
section
,
"ProcessConfigFile"
,
"mailproc.cfg"
));
,
ini
Get
String
(
fp
,
section
,
"ProcessConfigFile"
,
"mailproc.cfg"
));
mail
->
options
=
ini
Read
BitField
(
fp
,
section
,
"Options"
,
mail_options
=
ini
Get
BitField
(
fp
,
section
,
"Options"
,
mail_options
,
MAIL_OPT_ALLOW_POP3
);
/***********************************************************************/
section
=
"Services"
;
*
run_services
=
ini
Read
Bool
(
fp
,
section
,
"AutoStart"
,
TRUE
);
=
ini
Get
Bool
(
fp
,
section
,
"AutoStart"
,
TRUE
);
services
->
interface_addr
=
ini
Read
IpAddress
(
fp
,
section
,
"Interface"
,
INADDR_ANY
);
=
ini
Get
IpAddress
(
fp
,
section
,
"Interface"
,
INADDR_ANY
);
services
->
js_max_bytes
=
ini
Read
Integer
(
fp
,
section
,
"JavaScriptMaxBytes"
,
js_max_bytes
);
=
ini
Get
Integer
(
fp
,
section
,
"JavaScriptMaxBytes"
,
js_max_bytes
);
SAFECOPY
(
services
->
host_name
,
ini
Read
String
(
fp
,
section
,
"HostName"
,
host_name
));
,
ini
Get
String
(
fp
,
section
,
"HostName"
,
host_name
));
SAFECOPY
(
services
->
cfg_file
,
ini
Read
String
(
fp
,
section
,
"ConfigFile"
,
"services.cfg"
));
,
ini
Get
String
(
fp
,
section
,
"ConfigFile"
,
"services.cfg"
));
SAFECOPY
(
services
->
answer_sound
,
ini
Read
String
(
fp
,
section
,
"AnswerSound"
,
nulstr
));
,
ini
Get
String
(
fp
,
section
,
"AnswerSound"
,
nulstr
));
SAFECOPY
(
services
->
hangup_sound
,
ini
Read
String
(
fp
,
section
,
"HangupSound"
,
nulstr
));
,
ini
Get
String
(
fp
,
section
,
"HangupSound"
,
nulstr
));
services
->
options
=
ini
Read
BitField
(
fp
,
section
,
"Options"
,
service_options
=
ini
Get
BitField
(
fp
,
section
,
"Options"
,
service_options
,
BBS_OPT_NO_HOST_LOOKUP
);
/***********************************************************************/
section
=
"Web"
;
*
run_web
=
ini
Read
Bool
(
fp
,
section
,
"AutoStart"
,
FALSE
);
=
ini
Get
Bool
(
fp
,
section
,
"AutoStart"
,
FALSE
);
web
->
interface_addr
=
ini
Read
IpAddress
(
fp
,
section
,
"Interface"
,
INADDR_ANY
);
=
ini
Get
IpAddress
(
fp
,
section
,
"Interface"
,
INADDR_ANY
);
web
->
port
=
ini
Read
ShortInt
(
fp
,
section
,
"Port"
,
IPPORT_HTTP
);
=
ini
Get
ShortInt
(
fp
,
section
,
"Port"
,
IPPORT_HTTP
);
web
->
js_max_bytes
=
ini
Read
Integer
(
fp
,
section
,
"JavaScriptMaxBytes"
,
js_max_bytes
);
=
ini
Get
Integer
(
fp
,
section
,
"JavaScriptMaxBytes"
,
js_max_bytes
);
SAFECOPY
(
web
->
host_name
,
ini
Read
String
(
fp
,
section
,
"HostName"
,
host_name
));
,
ini
Get
String
(
fp
,
section
,
"HostName"
,
host_name
));
SAFECOPY
(
web
->
root_dir
,
ini
Read
String
(
fp
,
section
,
"RootDirectory"
,
"../html"
));
,
ini
Get
String
(
fp
,
section
,
"RootDirectory"
,
"../html"
));
SAFECOPY
(
web
->
error_dir
,
ini
Read
String
(
fp
,
section
,
"ErrorDirectory"
,
"../html/error"
));
,
ini
Get
String
(
fp
,
section
,
"ErrorDirectory"
,
"../html/error"
));
iniFreeStringList
(
web
->
index_file_name
);
web
->
index_file_name
=
ini
Read
StringList
(
fp
,
section
,
"IndexFileNames"
,
","
,
"index.html,index.ssjs"
);
=
ini
Get
StringList
(
fp
,
section
,
"IndexFileNames"
,
","
,
"index.html,index.ssjs"
);
iniFreeStringList
(
web
->
cgi_ext
);
web
->
cgi_ext
=
ini
Read
StringList
(
fp
,
section
,
"CGIExtensions"
,
","
,
".cgi"
);
=
ini
Get
StringList
(
fp
,
section
,
"CGIExtensions"
,
","
,
".cgi"
);
SAFECOPY
(
web
->
ssjs_ext
,
ini
Read
String
(
fp
,
section
,
"JavaScriptExtension"
,
".ssjs"
));
,
ini
Get
String
(
fp
,
section
,
"JavaScriptExtension"
,
".ssjs"
));
web
->
max_inactivity
=
ini
Read
ShortInt
(
fp
,
section
,
"MaxInactivity"
,
120
);
/* seconds */
=
ini
Get
ShortInt
(
fp
,
section
,
"MaxInactivity"
,
120
);
/* seconds */
web
->
max_cgi_inactivity
=
ini
Read
ShortInt
(
fp
,
section
,
"MaxCgiInactivity"
,
120
);
/* seconds */
=
ini
Get
ShortInt
(
fp
,
section
,
"MaxCgiInactivity"
,
120
);
/* seconds */
#ifdef __unix__
...
...
@@ -411,9 +411,9 @@ void sbbs_read_ini(
default_cgi_temp
=
nulstr
;
#endif
SAFECOPY
(
web
->
cgi_temp_dir
,
ini
Read
String
(
fp
,
section
,
"CGITempDirectory"
,
default_cgi_temp
));
,
ini
Get
String
(
fp
,
section
,
"CGITempDirectory"
,
default_cgi_temp
));
web
->
options
=
ini
Read
BitField
(
fp
,
section
,
"Options"
,
web_options
=
ini
Get
BitField
(
fp
,
section
,
"Options"
,
web_options
,
BBS_OPT_NO_HOST_LOOKUP
);
}
This diff is collapsed.
Click to expand it.
src/xpdev/ini_file.c
+
12
−
12
View file @
a7b7ec12
...
...
@@ -122,7 +122,7 @@ static char* get_value(FILE* fp, const char* section, const char* key)
return
(
NULL
);
}
char
*
ini
Read
String
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
const
char
*
deflt
)
char
*
ini
Get
String
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
const
char
*
deflt
)
{
char
*
value
;
...
...
@@ -135,7 +135,7 @@ char* iniReadString(FILE* fp, const char* section, const char* key, const char*
return
(
value
);
}
char
**
ini
Read
StringList
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
char
**
ini
Get
StringList
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
const
char
*
sep
,
const
char
*
deflt
)
{
char
*
value
;
...
...
@@ -203,7 +203,7 @@ void* iniFreeNamedStringList(named_string_t** list)
return
(
NULL
);
}
char
**
ini
Read
SectionList
(
FILE
*
fp
)
char
**
ini
Get
SectionList
(
FILE
*
fp
)
{
char
*
p
;
char
*
tp
;
...
...
@@ -247,7 +247,7 @@ char** iniReadSectionList(FILE* fp)
return
(
lp
);
}
char
**
ini
Read
KeyList
(
FILE
*
fp
,
const
char
*
section
)
char
**
ini
Get
KeyList
(
FILE
*
fp
,
const
char
*
section
)
{
char
*
p
;
char
*
tp
;
...
...
@@ -297,7 +297,7 @@ char** iniReadKeyList(FILE* fp, const char* section)
}
named_string_t
**
ini
Read
NamedStringList
(
FILE
*
fp
,
const
char
*
section
)
ini
Get
NamedStringList
(
FILE
*
fp
,
const
char
*
section
)
{
char
*
p
;
char
*
name
;
...
...
@@ -361,7 +361,7 @@ iniReadNamedStringList(FILE* fp, const char* section)
/* These functions read a single key of the specified type */
long
ini
Read
Integer
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
long
deflt
)
long
ini
Get
Integer
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
long
deflt
)
{
char
*
value
;
...
...
@@ -374,12 +374,12 @@ long iniReadInteger(FILE* fp, const char* section, const char* key, long deflt)
return
(
strtol
(
value
,
NULL
,
0
));
}
ushort
ini
Read
ShortInt
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
ushort
deflt
)
ushort
ini
Get
ShortInt
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
ushort
deflt
)
{
return
((
ushort
)
ini
Read
Integer
(
fp
,
section
,
key
,
deflt
));
return
((
ushort
)
ini
Get
Integer
(
fp
,
section
,
key
,
deflt
));
}
ulong
ini
Read
IpAddress
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
ulong
deflt
)
ulong
ini
Get
IpAddress
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
ulong
deflt
)
{
char
*
value
;
...
...
@@ -395,7 +395,7 @@ ulong iniReadIpAddress(FILE* fp, const char* section, const char* key, ulong def
return
(
ntohl
(
inet_addr
(
value
)));
}
double
ini
Read
Float
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
double
deflt
)
double
ini
Get
Float
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
double
deflt
)
{
char
*
value
;
...
...
@@ -408,7 +408,7 @@ double iniReadFloat(FILE* fp, const char* section, const char* key, double deflt
return
(
atof
(
value
));
}
BOOL
ini
Read
Bool
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
BOOL
deflt
)
BOOL
ini
Get
Bool
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
BOOL
deflt
)
{
char
*
value
;
...
...
@@ -426,7 +426,7 @@ BOOL iniReadBool(FILE* fp, const char* section, const char* key, BOOL deflt)
return
(
strtol
(
value
,
NULL
,
0
));
}
ulong
ini
Read
BitField
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
ulong
ini
Get
BitField
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
ini_bitdesc_t
*
bitdesc
,
ulong
deflt
)
{
int
b
,
i
;
...
...
This diff is collapsed.
Click to expand it.
src/xpdev/ini_file.h
+
13
−
13
View file @
a7b7ec12
...
...
@@ -50,35 +50,35 @@ extern "C" {
#endif
/* Read all section names and return as a string list */
char
**
ini
Read
SectionList
(
FILE
*
fp
);
char
**
ini
Get
SectionList
(
FILE
*
fp
);
/* Read all key names and return as a string list */
char
**
ini
Read
KeyList
(
FILE
*
fp
,
const
char
*
section
);
char
**
ini
Get
KeyList
(
FILE
*
fp
,
const
char
*
section
);
/* Read all key and value pairs and return as a named string list */
named_string_t
**
ini
Read
NamedStringList
(
FILE
*
fp
,
const
char
*
section
);
ini
Get
NamedStringList
(
FILE
*
fp
,
const
char
*
section
);
/* These functions read a single key of the specified type */
char
*
ini
Read
String
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
char
*
ini
Get
String
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
const
char
*
deflt
);
char
**
ini
Read
StringList
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
char
**
ini
Get
StringList
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
const
char
*
sep
,
const
char
*
deflt
);
long
ini
Read
Integer
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
long
ini
Get
Integer
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
long
deflt
);
ushort
ini
Read
ShortInt
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
ushort
ini
Get
ShortInt
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
ushort
deflt
);
ulong
ini
Read
IpAddress
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
ulong
ini
Get
IpAddress
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
ulong
deflt
);
double
ini
Read
Float
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
double
ini
Get
Float
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
double
deflt
);
BOOL
ini
Read
Bool
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
BOOL
ini
Get
Bool
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
BOOL
deflt
);
ulong
ini
Read
BitField
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
ulong
ini
Get
BitField
(
FILE
*
fp
,
const
char
*
section
,
const
char
*
key
,
ini_bitdesc_t
*
bitdesc
,
ulong
deflt
);
/* Free string list returned from ini
Read
*List functions */
/* Free string list returned from ini
Get
*List functions */
void
*
iniFreeStringList
(
char
**
list
);
/* Free named string list returned from ini
Read
NamedStringList */
/* Free named string list returned from ini
Get
NamedStringList */
void
*
iniFreeNamedStringList
(
named_string_t
**
list
);
#if defined(__cplusplus)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment