Import Cardgame 0.1.15 upstream source snapshot
Original author: Pierre Sarrazin. Public-domain library and demo. Source: http://sarrazip.com/dev/cardgame-0.1.15.tar.gz Archive SHA-256: ca706dddd96fec63b829f8958c2e47485b0e1166129d45fda0b6369404c1bb54
This commit is contained in:
commit
d3a54e24ee
39 files changed
+2603
No files matched your search
@@ -0,0 +1,22 @@
|
||||
#include "cardgame.h"
|
||||
|
||||
|
||||
void
|
||||
concat(char *out, unsigned max, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, max);
|
||||
for (char *src; src = va_arg(ap, char *); ) // for each string passed as an argument
|
||||
{
|
||||
word len = strlen(src);
|
||||
if (len > max - 1)
|
||||
len = max - 1;
|
||||
max -= len;
|
||||
while (len--) // while that string is not finished
|
||||
*out++ = *src++;
|
||||
if (max <= 1)
|
||||
break;
|
||||
}
|
||||
va_end(ap);
|
||||
*out = '\0';
|
||||
}
|
||||
Reference in new issue
Block a user