[cvs] bogofilter/src mxcat.c,NONE,1.1.2.1 mxcat.h,NONE,1.1.2.1 Makefile.am,1.90.2.2,1.90.2.3
Fast Bayesian spam filter along lines suggested by Paul Graham
Brought to you by:
m-a
From: <m-...@us...> - 2004-08-27 23:55:13
|
Update of /cvsroot/bogofilter/bogofilter/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25695 Modified Files: Tag: branch-db-txn Makefile.am Added Files: Tag: branch-db-txn mxcat.c mxcat.h Log Message: Add mxcat, a new string helper function. --- NEW FILE: mxcat.c --- /* memory allocating, unlimited strcat * (C) 2004 by Matthias Andree, GNU GPL v2 */ #include "mxcat.h" #include "system.h" #include "xmalloc.h" #include <stdarg.h> #include <string.h> char *mxcat(const char *first, ...) { va_list ap; size_t s; char *t, *r; va_start(ap, first); s = strlen(first); while ((t = va_arg(ap, char *))) { s += strlen(t); } va_end(ap); s++; r = xmalloc(s); va_start(ap, first); strlcpy(r, first, s); while ((t = va_arg(ap, char *))) { strlcat(r, t, s); } va_end(ap); return r; } --- NEW FILE: mxcat.h --- #ifndef MXCAT_H #define MXCAT_H /** mxcat allocates a new buffer and concatenates all strings on the * command line into the new buffer. The variable argument list * MUST be terminated by a NULL. */ char *mxcat(const char *first, ...); #endif Index: Makefile.am =================================================================== RCS file: /cvsroot/bogofilter/bogofilter/src/Makefile.am,v retrieving revision 1.90.2.2 retrieving revision 1.90.2.3 diff -u -d -r1.90.2.2 -r1.90.2.3 --- Makefile.am 15 Jul 2004 00:59:33 -0000 1.90.2.2 +++ Makefile.am 27 Aug 2004 23:55:04 -0000 1.90.2.3 @@ -89,6 +89,7 @@ maint.h maint.c \ mime.h mime.c \ msgcounts.h msgcounts.c \ + mxcat.h mxcat.c \ passthrough.h passthrough.c \ paths.h paths.c \ prob.h prob.c \ |