Skip to content
Snippets Groups Projects
Commit 41b9d304 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Use smb_atofaddr() for atofaddr() and move where used

A bit of redundant code cleanup, no expected functional change.
parent 48627415
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1071 passed
/* Synchronet FidoNet-related routines */
/* $Id: fido.cpp,v 1.82 2020/07/15 06:12:56 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -15,21 +13,9 @@
* See the GNU General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
......@@ -94,39 +80,3 @@ bool sbbs_t::lookup_netuser(char *into)
fclose(stream);
return(false);
}
/****************************************************************************/
/* Returns the FidoNet address kept in str as ASCII. */
/****************************************************************************/
faddr_t atofaddr(scfg_t* cfg, char *str)
{
char *p;
faddr_t addr;
addr.zone=addr.net=addr.node=addr.point=0;
if((p=strchr(str,':'))!=NULL) {
addr.zone=atoi(str);
addr.net=atoi(p+1);
}
else {
if(cfg->total_faddrs)
addr.zone=cfg->faddr[0].zone;
else
addr.zone=1;
addr.net=atoi(str);
}
if(!addr.zone) /* no such thing as zone 0 */
addr.zone=1;
if((p=strchr(str,'/'))!=NULL)
addr.node=atoi(p+1);
else {
if(cfg->total_faddrs)
addr.net=cfg->faddr[0].net;
else
addr.net=1;
addr.node=atoi(str);
}
if((p=strchr(str,'.'))!=NULL)
addr.point=atoi(p+1);
return(addr);
}
/* netmail.cpp */
/* Synchronet network mail-related functions */
/* $Id: netmail.cpp,v 1.69 2020/05/01 00:10:07 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -17,30 +13,25 @@
* See the GNU General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
#include "sbbs.h"
#include "qwk.h"
faddr_t atofaddr(scfg_t* cfg, char *str);
void pt_zone_kludge(fmsghdr_t hdr,int fido);
/****************************************************************************/
/* Returns the FidoNet address (struct) parsed from str (in ASCII text). */
/****************************************************************************/
static faddr_t atofaddr(scfg_t* cfg, const char *str)
{
return smb_atofaddr(&cfg->faddr[0], str);
}
/****************************************************************************/
/* Send FidoNet/QWK/Internet NetMail from BBS */
/****************************************************************************/
......@@ -1443,7 +1434,7 @@ extern "C" BOOL is_supported_netmail_addr(scfg_t* cfg, const char* addr)
return FALSE;
if(cfg->total_faddrs < 1)
return FALSE;
faddr = atofaddr(cfg, (char*)p);
faddr = atofaddr(cfg, p);
for(int i = 0; i < cfg->total_faddrs; i++)
if(memcmp(&cfg->faddr[i], &faddr, sizeof(faddr)) == 0)
return FALSE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment