summaryrefslogtreecommitdiff
path: root/src/qcommon
diff options
context:
space:
mode:
authorChristopher Schwarz <lakitu7@gmail.com>2009-10-10 19:18:21 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:16:46 +0000
commit19ec3ab02940f56b4e927ff0e67ebcbab718ceb4 (patch)
treea110ba9ce795b59c0c1571dfadcb8f3efd698cac /src/qcommon
parenta327db46a2d939633b6836de28251ae7d4dbbec5 (diff)
* (bug 3998) linewrap cp, parse newlines in cp and motd
Diffstat (limited to 'src/qcommon')
-rw-r--r--src/qcommon/q_shared.c7
-rw-r--r--src/qcommon/q_shared.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/src/qcommon/q_shared.c b/src/qcommon/q_shared.c
index 5b74badd..6da13ad0 100644
--- a/src/qcommon/q_shared.c
+++ b/src/qcommon/q_shared.c
@@ -935,6 +935,13 @@ int Q_CountChar(const char *string, char tocount)
return count;
}
+void Q_ParseNewlines( char *dest, const char *src, int destsize )
+{
+ for( ; *src && destsize > 1; src++, destsize-- )
+ *dest++ = ( ( *src == '\\' && *( ++src ) == 'n' ) ? '\n' : *src );
+ *dest++ = '\0';
+}
+
void QDECL Com_sprintf( char *dest, int size, const char *fmt, ...) {
int len;
va_list argptr;
diff --git a/src/qcommon/q_shared.h b/src/qcommon/q_shared.h
index 5aaf0878..34f3e471 100644
--- a/src/qcommon/q_shared.h
+++ b/src/qcommon/q_shared.h
@@ -791,6 +791,8 @@ void Q_strcat( char *dest, int size, const char *src );
int Q_PrintStrlen( const char *string );
// removes color sequences from string
char *Q_CleanStr( char *string );
+// parse "\n" into '\n'
+void Q_ParseNewlines( char *dest, const char *src, int destsize );
// Count the number of char tocount encountered in string
int Q_CountChar(const char *string, char tocount);