Commit f204efa8 authored by Rob Swindell's avatar Rob Swindell 💬

A little more ctype (isdigit isalnum) cleanup

A couple of stragglers here, the isalnum() call caught by an MSVC exception.
parent d6a2af22
......@@ -27,7 +27,6 @@
#include <stdio.h>
#include <stdlib.h> /* malloc */
#include <string.h>
#include <ctype.h> /* isdigit */
#include <sys/types.h>
#include <sys/stat.h> /* must come after sys/types.h */
......
/* Synchronet message base (SMB) library routines returning strings */
/* $Id: smbstr.c,v 1.38 2020/05/25 19:17:06 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,25 +13,12 @@
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.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 <ctype.h> /* is*() */
#include <string.h> /* strcpy, strcat, memset, strchr */
#include <genwrap.h> /* stricmp */
#include "smblib.h"
......@@ -428,7 +413,7 @@ enum smb_net_type SMBCALL smb_get_net_type_by_addr(const char* addr)
}
if(at == NULL && IS_DIGIT(*p) && *tp == '\0' && IS_DIGIT(last))
return NET_FIDO;
if(slash == NULL && (isalnum(*p) || p == colon))
if(slash == NULL && (IS_ALPHANUMERIC(*p) || p == colon))
return NET_INTERNET;
return NET_UNKNOWN;
......
/* Functions to create and parse .ini files */
/* $Id: ini_file.c,v 1.175 2020/08/08 23:26:38 rswindell Exp $ */
// vi: tabstop=4
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
......@@ -16,28 +13,15 @@
* See the GNU Lesser General Public License for more details: lgpl.txt or *
* http://www.fsf.org/copyleft/lesser.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 "ini_file.h"
#include <stdlib.h> /* strtol */
#include <string.h> /* strlen */
#include <ctype.h> /* isdigit */
#include <math.h> /* fmod */
#include "xpdatetime.h" /* isoDateTime_t */
#include "datewrap.h" /* ctime_r */
......
......@@ -19,7 +19,6 @@
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
#include <ctype.h> /* isdigit */
#include <stdlib.h> /* alloca/free on FreeBSD */
#include <string.h> /* bzero (for FD_ZERO) on FreeBSD */
#include <errno.h> /* ENOMEM */
......@@ -144,7 +143,7 @@ int getSocketOptionByName(const char* name, int* level)
return(socket_options[i].value);
}
}
if(!isdigit(*name)) /* unknown option name */
if(!IS_DIGIT(*name)) /* unknown option name */
return(-1);
return(strtol(name,NULL,0));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment