Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Macros | Functions
strlcpy.h File Reference

Go to the source code of this file.

Macros

#define EXPRT
 

Functions

size_t EXPRT strlcpy (char *dst, const char *src, size_t size)
 
size_t EXPRT strlcat (char *dst, const char *src, size_t size)
 

Macro Definition Documentation

#define EXPRT

Definition at line 42 of file strlcpy.h.

Function Documentation

size_t EXPRT strlcpy ( char *  dst,
const char *  src,
size_t  size 
)

Definition at line 39 of file strlcpy.cc.

40 {
41  char *d = dst;
42  const char *s = src;
43  size_t n = size;
44 
45  /* Copy as many bytes as will fit */
46  if (n != 0 && --n != 0) {
47  do {
48  if ((*d++ = *s++) == 0)
49  break;
50  } while (--n != 0);
51  }
52 
53  /* Not enough room in dst, add NUL and traverse rest of src */
54  if (n == 0) {
55  if (size != 0)
56  *d = '\0'; /* NUL-terminate dst */
57  while (*s++);
58  }
59 
60  return (s - src - 1); /* count does not include NUL */
61 }
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:45
alias put_queue eval echo n
Definition: qlib.csh:19
size_t EXPRT strlcat ( char *  dst,
const char *  src,
size_t  size 
)

Definition at line 72 of file strlcpy.cc.

73 {
74  char *d = dst;
75  const char *s = src;
76  size_t n = size;
77  size_t dlen;
78 
79  /* Find the end of dst and adjust bytes left but don't go past end */
80  while (n-- != 0 && *d != '\0')
81  d++;
82  dlen = d - dst;
83  n = size - dlen;
84 
85  if (n == 0)
86  return (dlen + strlen(s));
87  while (*s != '\0') {
88  if (n != 1) {
89  *d++ = *s;
90  n--;
91  }
92  s++;
93  }
94  *d = '\0';
95 
96  return (dlen + (s - src)); /* count does not include NUL */
97 }
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:45
alias put_queue eval echo n
Definition: qlib.csh:19