[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemacs-commit] qemacs cutils.c cutils.h
From: |
Charlie Gordon |
Subject: |
[Qemacs-commit] qemacs cutils.c cutils.h |
Date: |
Wed, 14 Oct 2020 19:27:42 -0400 (EDT) |
CVSROOT: /sources/qemacs
Module name: qemacs
Changes by: Charlie Gordon <chqrlie> 20/10/14 19:27:42
Modified files:
. : cutils.c cutils.h
Log message:
add pstrncat
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemacs/cutils.c?cvsroot=qemacs&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/qemacs/cutils.h?cvsroot=qemacs&r1=1.18&r2=1.19
Patches:
Index: cutils.c
===================================================================
RCS file: /sources/qemacs/qemacs/cutils.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- cutils.c 25 Mar 2017 18:15:00 -0000 1.19
+++ cutils.c 14 Oct 2020 23:27:41 -0000 1.20
@@ -135,6 +135,16 @@
return buf;
}
+/* strcat and truncate. */
+char *pstrncat(char *buf, int buf_size, const char *s, int slen)
+{
+ int len = strlen(buf);
+
+ if (len < buf_size)
+ pstrncpy(buf + len, buf_size - len, s, slen);
+ return buf;
+}
+
/* Get the filename portion of a path */
const char *get_basename(const char *filename)
{
Index: cutils.h
===================================================================
RCS file: /sources/qemacs/qemacs/cutils.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- cutils.h 25 Mar 2017 18:15:01 -0000 1.18
+++ cutils.h 14 Oct 2020 23:27:42 -0000 1.19
@@ -31,6 +31,7 @@
#define pstrcpy(buf, sz, str) qe_pstrcpy(buf, sz, str)
#define pstrcat(buf, sz, str) qe_pstrcat(buf, sz, str)
#define pstrncpy(buf, sz, str, n) qe_pstrncpy(buf, sz, str, n)
+#define pstrncat(buf, sz, str, n) qe_pstrncat(buf, sz, str, n)
#undef strncpy
#define strncpy(d,s) do_not_use_strncpy!!(d,s)
@@ -42,6 +43,7 @@
char *pstrcpy(char *buf, int buf_size, const char *str);
char *pstrcat(char *buf, int buf_size, const char *s);
char *pstrncpy(char *buf, int buf_size, const char *s, int len);
+char *pstrncat(char *buf, int buf_size, const char *s, int len);
const char *get_basename(const char *filename);
static inline char *get_basename_nc(char *filename) {
return (char *)get_basename(filename);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemacs-commit] qemacs cutils.c cutils.h,
Charlie Gordon <=