-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);
128, 128, 0
};
-
-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)
{
int i = 0;
do {
dest[i] = src[i];
- if (dest[i] == 0) return(dest);
+ if (dest[i] == 0) return i;
++i;
} while (i<n);
dest[n - 1] = 0;
- return dest;
+ return -i;
}