#include <stdio.h>Include dependency graph for sys.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Defines | |
| #define | __attribute__(A) |
| #define | __P(x) x |
| #define | _DIAGASSERT(x) |
| #define | __BEGIN_DECLS |
| #define | __END_DECLS |
| #define | public |
| #define | private static |
| #define | protected |
| #define | strlcat libedit_strlcat |
| #define | strlcpy libedit_strlcpy |
| #define | fgetln libedit_fgetln |
| #define | REGEX |
Typedefs | |
| typedef unsigned int | u_int32_t |
| typedef void * | ptr_t |
| typedef void * | ioctl_t |
Functions | |
| size_t | strlcat (char *dst, const char *src, size_t size) |
| size_t | strlcpy (char *dst, const char *src, size_t size) |
| char * | fgetln (FILE *fp, size_t *len) |
| #define fgetln libedit_fgetln |
| #define strlcat libedit_strlcat |
| #define strlcpy libedit_strlcpy |
| char* fgetln | ( | FILE * | fp, | |
| size_t * | len | |||
| ) |
Definition at line 48 of file fgetln.c.
References buf, errno, free, malloc, NULL, realloc, and strchr().
00049 { 00050 static char *buf = NULL; 00051 static size_t bufsiz = 0; 00052 char *ptr; 00053 00054 00055 if (buf == NULL) { 00056 bufsiz = BUFSIZ; 00057 if ((buf = malloc(bufsiz)) == NULL) 00058 return NULL; 00059 } 00060 00061 if (fgets(buf, bufsiz, fp) == NULL) 00062 return NULL; 00063 *len = 0; 00064 00065 while ((ptr = strchr(&buf[*len], '\n')) == NULL) { 00066 size_t nbufsiz = bufsiz + BUFSIZ; 00067 char *nbuf = realloc(buf, nbufsiz); 00068 00069 if (nbuf == NULL) { 00070 int oerrno = errno; 00071 free(buf); 00072 errno = oerrno; 00073 buf = NULL; 00074 return NULL; 00075 } else 00076 buf = nbuf; 00077 00078 *len = bufsiz; 00079 if (fgets(&buf[bufsiz], BUFSIZ, fp) == NULL) 00080 return buf; 00081 00082 bufsiz = nbufsiz; 00083 } 00084 00085 *len = (ptr - buf) + 1; 00086 return buf; 00087 }
Here is the call graph for this function:

Definition at line 47 of file strlcat.c.
00051 { 00052 register char *d = dst; 00053 register const char *s = src; 00054 register size_t n = siz; 00055 size_t dlen; 00056 00057 /* Find the end of dst and adjust bytes left but don't go past end */ 00058 while (n-- != 0 && *d != '\0') 00059 d++; 00060 dlen = d - dst; 00061 n = siz - dlen; 00062 00063 if (n == 0) 00064 return(dlen + strlen(s)); 00065 while (*s != '\0') { 00066 if (n != 1) { 00067 *d++ = *s; 00068 n--; 00069 } 00070 s++; 00071 } 00072 *d = '\0'; 00073 00074 return(dlen + (s - src)); /* count does not include NUL */ 00075 }
Here is the call graph for this function:

Definition at line 49 of file strlcpy.c.
References _DIAGASSERT, n, and NULL.
00053 { 00054 register char *d = dst; 00055 register const char *s = src; 00056 register size_t n = siz; 00057 00058 /* Copy as many bytes as will fit */ 00059 if (n != 0 && --n != 0) { 00060 do { 00061 if ((*d++ = *s++) == 0) 00062 break; 00063 } while (--n != 0); 00064 } 00065 00066 /* Not enough room in dst, add NUL and traverse rest of src */ 00067 if (n == 0) { 00068 if (siz != 0) 00069 *d = '\0'; /* NUL-terminate dst */ 00070 while (*s++) 00071 ; 00072 } 00073 00074 return(s - src - 1); /* count does not include NUL */ 00075 }
1.4.7

