1 /* strutil.h
2 
3    Originally written by Don Robert Maszle
4 
5    Copyright (c) 1992-2017 Free Software Foundation, Inc.
6 
7    This file is part of GNU MCSim.
8 
9    GNU MCSim is free software; you can redistribute it and/or
10    modify it under the terms of the GNU General Public License
11    as published by the Free Software Foundation; either version 3
12    of the License, or (at your option) any later version.
13 
14    GNU MCSim is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with GNU MCSim; if not, see <http://www.gnu.org/licenses/>
21 
22    Alternate string routines header file.  Routines for when NULL
23    pointer dereferencing is a no-no.
24 
25    These handle NULL string pointer cases in a reasonable manner and
26    ultimately call the standard library routines.
27 */
28 
29 #define  MyStrcpy(szDest, szSource) \
30   ((szDest) && (szSource) ? strcpy((szDest), (szSource)) : NULL)
31 
32 #define  MyStrlen(sz) \
33   ((sz) ? strlen((sz)) : (int) 0)
34 
35 #define  MyStrchr(sz, iChar) \
36   ((sz) ? strchr((sz), (iChar)) : NULL)
37 
38 #define  MyStrtok(sz, szToken) \
39   ((sz) && (szToken) ? strtok((sz), (szToken)) : NULL)
40 
41 /* ----------------------------------------------------------------------------
42    Prototypes */
43 
44 int MyStrcmp(const char* sz1, const char* sz2);
45 
46 /* End */
47 
48