summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
be41288)
-> return a long
-> return the number of copied bytes.
-> return negative values if we hit the boundary.
-libcitadel1_1.05-4_i386.deb libs optional
-libcitadel1-dbg_1.05-4_i386.deb libdevel optional
-libcitadel-dev_1.05-4_i386.deb libdevel optional
+libcitadel1_1.06-7_i386.deb libs optional
+libcitadel1-dbg_1.06-7_i386.deb libdevel optional
+libcitadel-dev_1.06-7_i386.deb libdevel optional
-char *safestrncpy(char *dest, const char *src, size_t n);
+int safestrncpy(char *dest, const char *src, size_t n);
int num_tokens (const char *source, char tok);
long extract_token(char *dest, const char *source, int parmnum, char separator, int maxlen);
long grab_token(char **dest, const char *source, int parmnum, char separator);
int num_tokens (const char *source, char tok);
long extract_token(char *dest, const char *source, int parmnum, char separator, int maxlen);
long grab_token(char **dest, const char *source, int parmnum, char separator);
-
-char *safestrncpy(char *dest, const char *src, size_t n)
+/**
+ * \brief copy a string into a buffer of a known size. abort if we exceed the limits
+ * \param dest the targetbuffer
+ * \param src the source string
+ * \param n the size od dest
+ * \returns the number of characters copied if dest is big enough, -n if not.
+ */
+int safestrncpy(char *dest, const char *src, size_t n)
- if (dest[i] == 0) return(dest);
+ if (dest[i] == 0) return i;
++i;
} while (i<n);
dest[n - 1] = 0;
++i;
} while (i<n);
dest[n - 1] = 0;