]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - common.h
Lots of str[n]cat, str[n]cpy, and [v]sprintf have been replaced by strlcat, strlcpy...
[xonotic/darkplaces.git] / common.h
index f3e7be34fc414a6332f2bef1e6ef72cbef7f97cb..5e3a0bd0884e4d374e2c409b22eef30aff9c5307 100644 (file)
--- a/common.h
+++ b/common.h
@@ -138,8 +138,6 @@ float MSG_ReadDPCoord (void);
 
 #define MSG_ReadVector(v) {(v)[0] = MSG_ReadCoord();(v)[1] = MSG_ReadCoord();(v)[2] = MSG_ReadCoord();}
 
-extern int dpprotocol;
-
 //============================================================================
 
 extern char com_token[1024];
@@ -171,6 +169,7 @@ extern      struct cvar_s   registered;
 #define GAME_GOODVSBAD2 6
 #define GAME_TEU 7
 #define GAME_BATTLEMECH 8
+#define GAME_ZYMOTIC 9
 
 extern int gamemode;
 extern char *gamename;
@@ -194,5 +193,28 @@ void freedirectory(stringlist_t *list);
 
 char *SearchInfostring(const char *infostring, const char *key);
 
+
+// strlcat and strlcpy, from OpenBSD
+// Most (all?) BSDs already have them
+#if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__)
+
+/*
+ * Appends src to string dst of size siz (unlike strncat, siz is the
+ * full size of dst, not space left).  At most siz-1 characters
+ * will be copied.  Always NUL terminates (unless siz <= strlen(dst)).
+ * Returns strlen(src) + MIN(siz, strlen(initial dst)).
+ * If retval >= siz, truncation occurred.
+ */
+size_t strlcat(char *dst, const char *src, size_t siz);
+
+/*
+ * Copy src to string dst of size siz.  At most siz-1 characters
+ * will be copied.  Always NUL terminates (unless siz == 0).
+ * Returns strlen(src); if retval >= siz, truncation occurred.
+ */
+size_t strlcpy(char *dst, const char *src, size_t siz);
+
+#endif  // #if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__)
+
 #endif