Commits (2)
......@@ -258,7 +258,7 @@ BOOL sbbs_t::start_batch_download()
file_t f = {{}};
BOOL result = FALSE;
if(batch_file_get(&cfg, ini, filenames[0], &f)) {
result = sendfile(&f, /* prot: */' ', /* autohang: */true);
result = sendfile(&f, useron.prot, /* autohang: */true);
if(result == TRUE)
batch_file_remove(&cfg, useron.number, XFER_BATCH_DOWNLOAD, f.name);
}
......
......@@ -736,6 +736,15 @@ char* iniSetHexInt(str_list_t* list, const char* section, const char* key, uint
return iniSetString(list, section, key, str, style);
}
char* iniSetHexInt64(str_list_t* list, const char* section, const char* key, uint64_t value
,ini_style_t* style)
{
char str[INI_MAX_VALUE_LEN];
SAFEPRINTF(str,"0x%" PRIx64, value);
return iniSetString(list, section, key, str, style);
}
char* iniSetFloat(str_list_t* list, const char* section, const char* key, double value
,ini_style_t* style)
{
......@@ -1646,6 +1655,22 @@ static ulong parseULongInteger(const char* value)
return(strtoul(value,NULL,0));
}
static int64_t parseInt64(const char* value)
{
if(isTrue(value))
return TRUE;
return strtoll(value,NULL,0);
}
static uint64_t parseUInt64(const char* value)
{
if(isTrue(value))
return TRUE;
return strtoull(value,NULL,0);
}
static BOOL parseBool(const char* value)
{
return(INT_TO_BOOL(parseInteger(value)));
......@@ -1792,6 +1817,58 @@ ulong iniGetULongInt(str_list_t list, const char* section, const char* key, ulon
return(parseULongInteger(vp));
}
int64_t iniReadInt64(FILE* fp, const char* section, const char* key, int64_t deflt)
{
char* value;
char buf[INI_MAX_VALUE_LEN];
if((value=read_value(fp,section,key,buf, /* literals_supported: */FALSE))==NULL)
return deflt;
if(*value==0) /* blank value */
return deflt;
return parseInt64(value);
}
uint64_t iniReadUInt64(FILE* fp, const char* section, const char* key, uint64_t deflt)
{
char* value;
char buf[INI_MAX_VALUE_LEN];
if((value=read_value(fp,section,key,buf, /* literals_supported: */FALSE))==NULL)
return deflt;
if(*value==0) /* blank value */
return deflt;
return parseUInt64(value);
}
int64_t iniGetInt64(str_list_t list, const char* section, const char* key, int64_t deflt)
{
char* vp=NULL;
get_value(list, section, key, NULL, &vp, /* literals_supported: */FALSE);
if(vp==NULL || *vp==0) /* blank value or missing key */
return deflt;
return parseInt64(vp);
}
uint64_t iniGetUInt64(str_list_t list, const char* section, const char* key, uint64_t deflt)
{
char* vp=NULL;
get_value(list, section, key, NULL, &vp, /* literals_supported: */FALSE);
if(vp==NULL || *vp==0) /* blank value or missing key */
return deflt;
return parseUInt64(vp);
}
int64_t iniReadBytes(FILE* fp, const char* section, const char* key, uint unit, int64_t deflt)
{
char* value;
......
......@@ -89,6 +89,10 @@ DLLEXPORT long iniReadLongInt(FILE*, const char* section, const char* key
,long deflt);
DLLEXPORT ulong iniReadULongInt(FILE*, const char* section, const char* key
,ulong deflt);
DLLEXPORT int64_t iniReadInt64(FILE*, const char* section, const char* key
,int64_t deflt);
DLLEXPORT uint64_t iniReadUInt64(FILE*, const char* section, const char* key
,uint64_t deflt);
DLLEXPORT int64_t iniReadBytes(FILE*, const char* section, const char* key
,uint unit, int64_t deflt);
DLLEXPORT double iniReadDuration(FILE*, const char* section, const char* key
......@@ -164,6 +168,10 @@ DLLEXPORT long iniGetLongInt(str_list_t, const char* section, const char* key
,long deflt);
DLLEXPORT ulong iniGetULongInt(str_list_t, const char* section, const char* key
,ulong deflt);
DLLEXPORT int64_t iniGetInt64(str_list_t, const char* section, const char* key
,int64_t deflt);
DLLEXPORT uint64_t iniGetUInt64(str_list_t, const char* section, const char* key
,uint64_t deflt);
DLLEXPORT int64_t iniGetBytes(str_list_t, const char* section, const char* key
,uint unit, int64_t deflt);
DLLEXPORT double iniGetDuration(str_list_t, const char* section, const char* key
......@@ -237,6 +245,8 @@ DLLEXPORT char* iniSetDuration(str_list_t*, const char* section, const char* k
,ini_style_t*);
DLLEXPORT char* iniSetHexInt(str_list_t*, const char* section, const char* key, uint value
,ini_style_t*);
DLLEXPORT char* iniSetHexInt64(str_list_t*, const char* section, const char* key, uint64_t value
,ini_style_t*);
DLLEXPORT char* iniSetFloat(str_list_t*, const char* section, const char* key, double value
,ini_style_t*);
DLLEXPORT char* iniSetBool(str_list_t*, const char* section, const char* key, BOOL value
......