NeoMutt  2024-04-16-36-g75b6fb
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
string2.h File Reference

String manipulation functions. More...

#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
+ Include dependency graph for string2.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define STR_COMMAND   8192
 Enough space for a long command line.
 
#define NONULL(x)   ((x) ? (x) : "")
 
#define S_ERR   127
 
#define S_BKG   126
 
#define SKIPWS(ch)
 
#define terminate_string(str, strlen, buflen)    (str)[MIN((strlen), (buflen))] = '\0'
 
#define terminate_buffer(str, strlen)    terminate_string(str, strlen, sizeof(str) - 1)
 

Functions

void mutt_str_adjust (char **ptr)
 Shrink-to-fit a string.
 
int mutt_str_asprintf (char **strp, const char *fmt,...) __attribute__((__format__(__printf__
 
int int mutt_str_coll (const char *a, const char *b)
 Collate two strings (compare using locale), safely.
 
const char * mutt_str_find_word (const char *src)
 Find the end of a word (non-space)
 
const char * mutt_str_getenv (const char *name)
 Get an environment variable.
 
void mutt_str_hyphenate (char *buf, size_t buflen, const char *str)
 Hyphenate a snake-case string.
 
bool mutt_str_is_ascii (const char *str, size_t len)
 Is a string ASCII (7-bit)?
 
size_t mutt_str_len (const char *a)
 Calculate the length of a string, safely.
 
char * mutt_str_lower (char *str)
 Convert all characters in the string to lowercase.
 
size_t mutt_str_lws_len (const char *s, size_t n)
 Measure the linear-white-space at the beginning of a string.
 
void mutt_str_remove_trailing_ws (char *s)
 Trim trailing whitespace from a string.
 
char * mutt_str_replace (char **p, const char *s)
 Replace one string with another.
 
char * mutt_str_sep (char **stringp, const char *delim)
 Find first occurrence of any of delim characters in *stringp.
 
char * mutt_str_skip_email_wsp (const char *s)
 Skip over whitespace as defined by RFC5322.
 
char * mutt_str_skip_whitespace (const char *p)
 Find the first non-whitespace character in a string.
 
const char * mutt_str_sysexit (int e)
 Return a string matching an error code.
 
char * mutt_str_upper (char *str)
 Convert all characters in the string to uppercase.
 
int mutt_str_cmp (const char *a, const char *b)
 Compare two strings, safely.
 
size_t mutt_str_copy (char *dest, const char *src, size_t dsize)
 Copy a string into a buffer (guaranteeing NUL-termination)
 
char * mutt_str_dup (const char *str)
 Copy a string, safely.
 
bool mutt_str_equal (const char *a, const char *b)
 Compare two strings.
 
size_t mutt_str_startswith (const char *str, const char *prefix)
 Check whether a string starts with a prefix.
 
char * mutt_strn_copy (char *dest, const char *src, size_t len, size_t dsize)
 Copy a sub-string into a buffer.
 
char * mutt_strn_dup (const char *begin, size_t l)
 Duplicate a sub-string.
 
bool mutt_strn_equal (const char *a, const char *b, size_t num)
 Check for equality of two strings (to a maximum), safely.
 
int mutt_istr_cmp (const char *a, const char *b)
 Compare two strings ignoring case, safely.
 
bool mutt_istr_equal (const char *a, const char *b)
 Compare two strings, ignoring case.
 
const char * mutt_istr_find (const char *haystack, const char *needle)
 Find first occurrence of string (ignoring case)
 
int mutt_istr_remall (char *str, const char *target)
 Remove all occurrences of substring, ignoring case.
 
size_t mutt_istr_startswith (const char *str, const char *prefix)
 Check whether a string starts with a prefix, ignoring case.
 
int mutt_istrn_cmp (const char *a, const char *b, size_t num)
 Compare two strings ignoring case (to a maximum), safely.
 
bool mutt_istrn_equal (const char *a, const char *b, size_t num)
 Check for equality of two strings ignoring case (to a maximum), safely.
 
const char * mutt_istrn_rfind (const char *haystack, size_t haystack_length, const char *needle)
 Find last instance of a substring, ignoring case.
 
static bool mutt_str_is_email_wsp (char c)
 Is this a whitespace character (for an email header)
 

Detailed Description

String manipulation functions.

Authors
  • Richard Russon
  • Pietro Cerutti

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file string2.h.

Macro Definition Documentation

◆ STR_COMMAND

#define STR_COMMAND   8192

Enough space for a long command line.

Definition at line 35 of file string2.h.

◆ NONULL

#define NONULL (   x)    ((x) ? (x) : "")

Definition at line 37 of file string2.h.

◆ S_ERR

#define S_ERR   127

Definition at line 40 of file string2.h.

◆ S_BKG

#define S_BKG   126

Definition at line 41 of file string2.h.

◆ SKIPWS

#define SKIPWS (   ch)
Value:
while (*(ch) && isspace((unsigned char) *(ch))) \
ch++;

Definition at line 45 of file string2.h.

◆ terminate_string

#define terminate_string (   str,
  strlen,
  buflen 
)     (str)[MIN((strlen), (buflen))] = '\0'

Definition at line 49 of file string2.h.

◆ terminate_buffer

#define terminate_buffer (   str,
  strlen 
)     terminate_string(str, strlen, sizeof(str) - 1)

Definition at line 52 of file string2.h.

Function Documentation

◆ mutt_str_adjust()

void mutt_str_adjust ( char **  ptr)

Shrink-to-fit a string.

Parameters
[out]ptrString to alter

Take a string which is allocated on the heap, find its length and reallocate the memory to be exactly the right size.

This function alters the pointer of the caller.

Definition at line 293 of file string.c.

294{
295 if (!ptr || !*ptr)
296 return;
297 mutt_mem_realloc(ptr, strlen(*ptr) + 1);
298}
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:114
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_str_asprintf()

int mutt_str_asprintf ( char **  strp,
const char *  fmt,
  ... 
)

◆ mutt_str_coll()

int int mutt_str_coll ( const char *  a,
const char *  b 
)

Collate two strings (compare using locale), safely.

Parameters
aFirst string to compare
bSecond string to compare
Return values
<0a precedes b
0a and b are identical
>0b precedes a

Definition at line 503 of file string.c.

504{
505 return strcoll(NONULL(a), NONULL(b));
506}
#define NONULL(x)
Definition: string2.h:37
+ Here is the caller graph for this function:

◆ mutt_str_find_word()

const char * mutt_str_find_word ( const char *  src)

Find the end of a word (non-space)

Parameters
srcString to search
Return values
ptrEnd of the word

Skip to the end of the current word. Skip past any whitespace characters.

Note
If there aren't any more words, this will return a pointer to the final NUL character.

Definition at line 700 of file string.c.

701{
702 if (!src)
703 return NULL;
704
705 while (*src && strchr(" \t\n", *src))
706 src++;
707 while (*src && !strchr(" \t\n", *src))
708 src++;
709 return src;
710}
+ Here is the caller graph for this function:

◆ mutt_str_getenv()

const char * mutt_str_getenv ( const char *  name)

Get an environment variable.

Parameters
nameEnvironment variable to get
Return values
ptrValue of variable
NULLVariable isn't set, or is empty
Warning
The caller must not free the returned pointer.

Definition at line 720 of file string.c.

721{
722 if (!name)
723 return NULL;
724
725 const char *val = getenv(name);
726 if (val && (val[0] != '\0'))
727 return val;
728
729 return NULL;
730}
+ Here is the caller graph for this function:

◆ mutt_str_hyphenate()

void mutt_str_hyphenate ( char *  buf,
size_t  buflen,
const char *  str 
)

Hyphenate a snake-case string.

Parameters
bufBuffer for the result
buflenLength of the buffer
strString to convert

Replace underscores (_) with hyphens -`).

Definition at line 843 of file string.c.

844{
845 if (!buf || (buflen == 0) || !str)
846 return;
847
848 mutt_str_copy(buf, str, buflen);
849 for (; *buf != '\0'; buf++)
850 {
851 if (*buf == '_')
852 *buf = '-';
853 }
854}
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition: string.c:575
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_str_is_ascii()

bool mutt_str_is_ascii ( const char *  str,
size_t  len 
)

Is a string ASCII (7-bit)?

Parameters
strString to examine
lenLength of string to examine
Return values
trueThere are no 8-bit chars

Definition at line 677 of file string.c.

678{
679 if (!str)
680 return true;
681
682 for (; (*str != '\0') && (len > 0); str++, len--)
683 if ((*str & 0x80) != 0)
684 return false;
685
686 return true;
687}
+ Here is the caller graph for this function:

◆ mutt_str_len()

size_t mutt_str_len ( const char *  a)

Calculate the length of a string, safely.

Parameters
aString to measure
Return values
numLength in bytes

Definition at line 490 of file string.c.

491{
492 return a ? strlen(a) : 0;
493}

◆ mutt_str_lower()

char * mutt_str_lower ( char *  str)

Convert all characters in the string to lowercase.

Parameters
strString to lowercase
Return values
ptrLowercase string

The string is transformed in place.

Definition at line 307 of file string.c.

308{
309 if (!str)
310 return NULL;
311
312 char *p = str;
313
314 while (*p)
315 {
316 *p = tolower((unsigned char) *p);
317 p++;
318 }
319
320 return str;
321}
+ Here is the caller graph for this function:

◆ mutt_str_lws_len()

size_t mutt_str_lws_len ( const char *  s,
size_t  n 
)

Measure the linear-white-space at the beginning of a string.

Parameters
sString to check
nMaximum number of characters to check
Return values
numCount of whitespace characters

Count the number of whitespace characters at the beginning of a string. They can be <space>, <tab>, <cr> or <lf>.

Definition at line 622 of file string.c.

623{
624 if (!s)
625 return 0;
626
627 const char *p = s;
628 size_t len = n;
629
630 if (n == 0)
631 return 0;
632
633 for (; p < (s + n); p++)
634 {
635 if (!strchr(" \t\r\n", *p))
636 {
637 len = p - s;
638 break;
639 }
640 }
641
642 if ((len != 0) && strchr("\r\n", *(p - 1))) /* LWS doesn't end with CRLF */
643 len = 0;
644 return len;
645}
+ Here is the caller graph for this function:

◆ mutt_str_remove_trailing_ws()

void mutt_str_remove_trailing_ws ( char *  s)

Trim trailing whitespace from a string.

Parameters
sString to trim

The string is modified in place.

Definition at line 559 of file string.c.

560{
561 if (!s)
562 return;
563
564 for (char *p = s + mutt_str_len(s) - 1; (p >= s) && isspace(*p); p--)
565 *p = '\0';
566}
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:490
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_str_replace()

char * mutt_str_replace ( char **  p,
const char *  s 
)

Replace one string with another.

Parameters
[out]pString to replace
[in]sNew string
Return values
ptrReplaced string

This function free()s the original string, strdup()s the new string and overwrites the pointer to the first string.

This function alters the pointer of the caller.

Note
Free *p afterwards to handle the case that *p and s reference the same memory

Definition at line 274 of file string.c.

275{
276 if (!p)
277 return NULL;
278 const char *tmp = *p;
279 *p = mutt_str_dup(s);
280 FREE(&tmp);
281 return *p;
282}
#define FREE(x)
Definition: memory.h:45
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:253
+ Here is the call graph for this function:

◆ mutt_str_sep()

char * mutt_str_sep ( char **  stringp,
const char *  delim 
)

Find first occurrence of any of delim characters in *stringp.

Parameters
stringpPointer to string to search for delim, updated with position of after delim if found else NULL
delimString with characters to search for in *stringp
Return values
ptrInput value of *stringp

Definition at line 186 of file string.c.

187{
188 if (!stringp || !*stringp || !delim)
189 return NULL;
190 return strsep(stringp, delim);
191}
static char * strsep(char **stringp, const char *delim)
Extract a token from a string.
Definition: string.c:82
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_str_skip_email_wsp()

char * mutt_str_skip_email_wsp ( const char *  s)

Skip over whitespace as defined by RFC5322.

Parameters
sString to search
Return values
ptr
  • First non-whitespace character
  • Terminating NUL character, if the string was entirely whitespace

This is used primarily for parsing header fields.

Definition at line 602 of file string.c.

603{
604 if (!s)
605 return NULL;
606
607 for (; mutt_str_is_email_wsp(*s); s++)
608 ; // Do nothing
609
610 return (char *) s;
611}
static bool mutt_str_is_email_wsp(char c)
Is this a whitespace character (for an email header)
Definition: string2.h:103
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_str_skip_whitespace()

char * mutt_str_skip_whitespace ( const char *  p)

Find the first non-whitespace character in a string.

Parameters
pString to search
Return values
ptr
  • First non-whitespace character
  • Terminating NUL character, if the string was entirely whitespace

Definition at line 545 of file string.c.

546{
547 if (!p)
548 return NULL;
549 SKIPWS(p);
550 return (char *) p;
551}
#define SKIPWS(ch)
Definition: string2.h:45
+ Here is the caller graph for this function:

◆ mutt_str_sysexit()

const char * mutt_str_sysexit ( int  err_num)

Return a string matching an error code.

Parameters
err_numError code, e.g. EX_NOPERM
Return values
ptrstring representing the error code

Definition at line 169 of file string.c.

170{
171 for (size_t i = 0; i < mutt_array_size(SysExits); i++)
172 {
173 if (err_num == SysExits[i].err_num)
174 return SysExits[i].err_str;
175 }
176
177 return NULL;
178}
#define mutt_array_size(x)
Definition: memory.h:38
Lookup table of error messages.
Definition: string.c:109
const char * err_str
Human-readable string for error.
Definition: string.c:111
+ Here is the caller graph for this function:

◆ mutt_str_upper()

char * mutt_str_upper ( char *  str)

Convert all characters in the string to uppercase.

Parameters
strString to uppercase
Return values
ptrUppercase string

The string is transformed in place.

Definition at line 330 of file string.c.

331{
332 if (!str)
333 return NULL;
334
335 char *p = str;
336
337 while (*p)
338 {
339 *p = toupper((unsigned char) *p);
340 p++;
341 }
342
343 return str;
344}
+ Here is the caller graph for this function:

◆ mutt_str_cmp()

int mutt_str_cmp ( const char *  a,
const char *  b 
)

Compare two strings, safely.

Parameters
aFirst string to compare
bSecond string to compare
Return values
-1a precedes b
0a and b are identical
1b precedes a

Definition at line 393 of file string.c.

394{
395 return strcmp(NONULL(a), NONULL(b));
396}
+ Here is the caller graph for this function:

◆ mutt_str_copy()

size_t mutt_str_copy ( char *  dest,
const char *  src,
size_t  dsize 
)

Copy a string into a buffer (guaranteeing NUL-termination)

Parameters
destBuffer for the result
srcString to copy
dsizeDestination buffer size
Return values
numDestination string length

Definition at line 575 of file string.c.

576{
577 if (!dest || (dsize == 0))
578 return 0;
579 if (!src)
580 {
581 dest[0] = '\0';
582 return 0;
583 }
584
585 char *dest0 = dest;
586 while ((--dsize > 0) && (*src != '\0'))
587 *dest++ = *src++;
588
589 *dest = '\0';
590 return dest - dest0;
591}

◆ mutt_str_dup()

char * mutt_str_dup ( const char *  str)

Copy a string, safely.

Parameters
strString to copy
Return values
ptrCopy of the string
NULLstr was NULL or empty

Definition at line 253 of file string.c.

254{
255 if (!str || (*str == '\0'))
256 return NULL;
257
258 return strdup(str);
259}

◆ mutt_str_equal()

bool mutt_str_equal ( const char *  a,
const char *  b 
)

Compare two strings.

Parameters
aFirst string
bSecond string
Return values
trueThe strings are equal
falseThe strings are not equal

Definition at line 654 of file string.c.

655{
656 return (a == b) || (mutt_str_cmp(a, b) == 0);
657}
int mutt_str_cmp(const char *a, const char *b)
Compare two strings, safely.
Definition: string.c:393
+ Here is the call graph for this function:

◆ mutt_str_startswith()

size_t mutt_str_startswith ( const char *  str,
const char *  prefix 
)

Check whether a string starts with a prefix.

Parameters
strString to check
prefixPrefix to match
Return values
numLength of prefix if str starts with prefix
0str does not start with prefix

Definition at line 230 of file string.c.

231{
232 return startswith(str, prefix, true);
233}
static size_t startswith(const char *str, const char *prefix, bool match_case)
Check whether a string starts with a prefix.
Definition: string.c:201
+ Here is the call graph for this function:

◆ mutt_strn_copy()

char * mutt_strn_copy ( char *  dest,
const char *  src,
size_t  len,
size_t  dsize 
)

Copy a sub-string into a buffer.

Parameters
destBuffer for the result
srcStart of the string to copy
lenLength of the string to copy
dsizeDestination buffer size
Return values
ptrDestination buffer

Definition at line 354 of file string.c.

355{
356 if (!src || !dest || (len == 0) || (dsize == 0))
357 return dest;
358
359 if (len > (dsize - 1))
360 len = dsize - 1;
361 memcpy(dest, src, len);
362 dest[len] = '\0';
363 return dest;
364}
+ Here is the caller graph for this function:

◆ mutt_strn_dup()

char * mutt_strn_dup ( const char *  begin,
size_t  len 
)

Duplicate a sub-string.

Parameters
beginStart of the string to copy
lenLength of string to copy
Return values
ptrNew string

The caller must free the returned string.

Definition at line 374 of file string.c.

375{
376 if (!begin)
377 return NULL;
378
379 char *p = mutt_mem_malloc(len + 1);
380 memcpy(p, begin, len);
381 p[len] = '\0';
382 return p;
383}
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
Definition: memory.c:90
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_strn_equal()

bool mutt_strn_equal ( const char *  a,
const char *  b,
size_t  num 
)

Check for equality of two strings (to a maximum), safely.

Parameters
aFirst string to compare
bSecond string to compare
numMaximum number of bytes to compare
Return values
trueFirst num chars of both strings are equal
falseFirst num chars of both strings not equal

Definition at line 419 of file string.c.

420{
421 return strncmp(NONULL(a), NONULL(b), num) == 0;
422}
+ Here is the caller graph for this function:

◆ mutt_istr_cmp()

int mutt_istr_cmp ( const char *  a,
const char *  b 
)

Compare two strings ignoring case, safely.

Parameters
aFirst string to compare
bSecond string to compare
Return values
-1a precedes b
0a and b are identical
1b precedes a

Definition at line 406 of file string.c.

407{
408 return strcasecmp(NONULL(a), NONULL(b));
409}
+ Here is the caller graph for this function:

◆ mutt_istr_equal()

bool mutt_istr_equal ( const char *  a,
const char *  b 
)

Compare two strings, ignoring case.

Parameters
aFirst string
bSecond string
Return values
trueThe strings are equal
falseThe strings are not equal

Definition at line 666 of file string.c.

667{
668 return (a == b) || (mutt_istr_cmp(a, b) == 0);
669}
int mutt_istr_cmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
Definition: string.c:406
+ Here is the call graph for this function:

◆ mutt_istr_find()

const char * mutt_istr_find ( const char *  haystack,
const char *  needle 
)

Find first occurrence of string (ignoring case)

Parameters
haystackString to search through
needleString to find
Return values
ptrFirst match of the search string
NULLNo match, or an error

Definition at line 515 of file string.c.

516{
517 if (!haystack)
518 return NULL;
519 if (!needle)
520 return haystack;
521
522 const char *p = NULL, *q = NULL;
523
524 while (*(p = haystack))
525 {
526 for (q = needle;
527 *p && *q && (tolower((unsigned char) *p) == tolower((unsigned char) *q));
528 p++, q++)
529 {
530 }
531 if ((*q == '\0'))
532 return haystack;
533 haystack++;
534 }
535 return NULL;
536}
+ Here is the caller graph for this function:

◆ mutt_istr_remall()

int mutt_istr_remall ( char *  str,
const char *  target 
)

Remove all occurrences of substring, ignoring case.

Parameters
strString containing the substring
targetTarget substring for removal
Return values
0String contained substring and substring was removed successfully
1String did not contain substring

Definition at line 739 of file string.c.

740{
741 int rc = 1;
742 if (!str || !target)
743 return rc;
744
745 // Look through an ensure all instances of the substring are gone.
746 while ((str = (char *) strcasestr(str, target)))
747 {
748 size_t target_len = mutt_str_len(target);
749 memmove(str, str + target_len, 1 + strlen(str + target_len));
750 rc = 0; // If we got here, then a substring existed and has been removed.
751 }
752
753 return rc;
754}
static char * strcasestr(const char *haystack, const char *needle)
Find the first occurrence of needle in haystack, ignoring case.
Definition: string.c:56
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_istr_startswith()

size_t mutt_istr_startswith ( const char *  str,
const char *  prefix 
)

Check whether a string starts with a prefix, ignoring case.

Parameters
strString to check
prefixPrefix to match
Return values
numLength of prefix if str starts with prefix
0str does not start with prefix

Definition at line 242 of file string.c.

243{
244 return startswith(str, prefix, false);
245}
+ Here is the call graph for this function:

◆ mutt_istrn_cmp()

int mutt_istrn_cmp ( const char *  a,
const char *  b,
size_t  num 
)

Compare two strings ignoring case (to a maximum), safely.

Parameters
aFirst string to compare
bSecond string to compare
numMaximum number of bytes to compare
Return values
-1a precedes b
0a and b are identical
1b precedes a

Definition at line 433 of file string.c.

434{
435 return strncasecmp(NONULL(a), NONULL(b), num);
436}
+ Here is the caller graph for this function:

◆ mutt_istrn_equal()

bool mutt_istrn_equal ( const char *  a,
const char *  b,
size_t  num 
)

Check for equality of two strings ignoring case (to a maximum), safely.

Parameters
aFirst string to compare
bSecond string to compare
numMaximum number of bytes to compare
Return values
-1a precedes b
trueFirst num chars of both strings are equal, ignoring case
falseFirst num chars of both strings not equal, ignoring case

Definition at line 447 of file string.c.

448{
449 return strncasecmp(NONULL(a), NONULL(b), num) == 0;
450}
+ Here is the caller graph for this function:

◆ mutt_istrn_rfind()

const char * mutt_istrn_rfind ( const char *  haystack,
size_t  haystack_length,
const char *  needle 
)

Find last instance of a substring, ignoring case.

Parameters
haystackString to search through
haystack_lengthLength of the string
needleString to find
Return values
NULLString not found
ptrLocation of string

Return the last instance of needle in the haystack, or NULL. Like strcasestr(), only backwards, and for a limited haystack length.

Definition at line 463 of file string.c.

464{
465 if (!haystack || (haystack_length == 0) || !needle)
466 return NULL;
467
468 int needle_length = strlen(needle);
469 const char *haystack_end = haystack + haystack_length - needle_length;
470
471 for (const char *p = haystack_end; p >= haystack; --p)
472 {
473 for (size_t i = 0; i < needle_length; i++)
474 {
475 if ((tolower((unsigned char) p[i]) != tolower((unsigned char) needle[i])))
476 goto next;
477 }
478 return p;
479
480 next:;
481 }
482 return NULL;
483}
+ Here is the caller graph for this function:

◆ mutt_str_is_email_wsp()

static bool mutt_str_is_email_wsp ( char  c)
inlinestatic

Is this a whitespace character (for an email header)

Parameters
cCharacter to test
Return values
trueIt is whitespace

Definition at line 103 of file string2.h.

104{
105 return (c == ' ') || (c == '\t') || (c == '\r') || (c == '\n');
106}
+ Here is the caller graph for this function: