Update kris/util.c strlcpy
This commit is contained in:
parent
14e430ac5b
commit
2b85380411
1
kris/Makefile
Symbolic link
1
kris/Makefile
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../Makefile
|
1
kris/config.mk
Symbolic link
1
kris/config.mk
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../config.mk
|
10
kris/sic.c
10
kris/sic.c
@ -28,14 +28,6 @@ static char channel[256];
|
|||||||
static time_t trespond;
|
static time_t trespond;
|
||||||
static FILE *srv;
|
static FILE *srv;
|
||||||
|
|
||||||
#define va_buf(buf, fmt) {\
|
|
||||||
va_list ap; \
|
|
||||||
\
|
|
||||||
va_start(ap, fmt); \
|
|
||||||
vsnprintf(buf, sizeof buf, fmt, ap); \
|
|
||||||
va_end(ap); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "util.c"
|
#include "util.c"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -167,7 +159,7 @@ main(int argc, char *argv[]) {
|
|||||||
if(++i < argc) password = argv[i];
|
if(++i < argc) password = argv[i];
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
eprint("sic-"VERSION", ? 2005-2007 Anselm R. Garbe, Nico Golde\n");
|
eprint("sic-"VERSION", ©2005-2009 Kris Maglione, Anselm R. Garbe, Nico Golde\n");
|
||||||
default:
|
default:
|
||||||
eprint("usage: sic [-h host] [-p port] [-n nick] [-k keyword] [-v]\n");
|
eprint("usage: sic [-h host] [-p port] [-n nick] [-k keyword] [-v]\n");
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,13 @@
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
|
#define va_buf(buf, fmt) {\
|
||||||
|
va_list ap; \
|
||||||
|
va_start(ap, fmt); \
|
||||||
|
vsnprintf(buf, sizeof buf, fmt, ap); \
|
||||||
|
va_end(ap); \
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
eprint(const char *fmt, ...) {
|
eprint(const char *fmt, ...) {
|
||||||
|
|
||||||
@ -34,7 +41,7 @@ dial(char *host, int port) {
|
|||||||
#define strlcpy _strlcpy
|
#define strlcpy _strlcpy
|
||||||
static void
|
static void
|
||||||
strlcpy(char *to, const char *from, int l) {
|
strlcpy(char *to, const char *from, int l) {
|
||||||
strncpy(to, from, l-1);
|
memccpy(to, from, '\0', l);
|
||||||
to[l-1] = '\0';
|
to[l-1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user