summaryrefslogtreecommitdiff
path: root/source/q_shared.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/q_shared.c')
-rw-r--r--source/q_shared.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/source/q_shared.c b/source/q_shared.c
index 6b4a61b..150c95e 100644
--- a/source/q_shared.c
+++ b/source/q_shared.c
@@ -873,6 +873,16 @@ qboolean COM_IsNumeric( const char *string ) {
}
+qboolean COM_HasSpaces( const char *string ) {
+ while( *string ) {
+ if( *string <= 32 ) {
+ return qtrue;
+ }
+ string++;
+ }
+ return qfalse;
+}
+
/* Parses hexadecimal number until it encounters
* illegible symbol or end of string.
* Does not check for overflow.
@@ -1858,6 +1868,32 @@ int Q_strcat( char *dest, int destsize, const char *src ) {
/*
===============
+Q_concat
+===============
+*/
+int Q_concat( char *buffer, int size, ... ) {
+ va_list argptr;
+ const char *s;
+ int len, total = 0;
+
+ va_start( argptr, size );
+ while( ( s = va_arg( argptr, const char * ) ) != NULL ) {
+ len = strlen( s );
+ if( total + len >= size ) {
+ break;
+ }
+ memcpy( buffer + total, s, len );
+ total += len;
+ }
+ va_end( argptr );
+
+ buffer[total] = 0;
+ return total;
+}
+
+
+/*
+===============
Q_vsnprintf
Safe implementation of vsnprintf supposed to