Add disk_applet executable to the ignore list
[rmail.git] / src / utils / string_utils.c
blobf37bb93f2921f4e6ab0c2adabbf9b5ba56eb4e25
1 /*
2 * string_utils.c
3 */
4 #include <stdio.h>
5 #include <ctype.h>
7 char *substrncpy(char *dest, const char *start, const char *end, size_t n)
9 size_t i;
10 const char *src;
12 if ((!dest) || (!start) || (!end) || (n == 0))
13 return NULL;
15 if (start > end)
16 return NULL;
18 src = start;
19 for (i = 0 ; i < n && src <= end; i++, src++) {
20 dest[i] = *src;
22 for ( ; i < n ; i++) {
23 dest[i] = '\0';
26 return dest;
29 const char *trim_spaces(const char *line)
31 const char *p = line;
33 while (*p != '\0' && isspace(*p)) {
34 if (*p == '\n' || *p == '\r') {
35 break;
37 p++;
39 return p;